Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp459315imu; Mon, 26 Nov 2018 13:21:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xez/HQRKuzu4d3k6gw0Hm5CSWkx7TBGvlhbmmmxNQ1K3LFnwvYPukdGl/cMk4h3dTUMx5o X-Received: by 2002:a17:902:166:: with SMTP id 93-v6mr28923494plb.68.1543267292854; Mon, 26 Nov 2018 13:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543267292; cv=none; d=google.com; s=arc-20160816; b=UQatc1SwGZn8Nw/YJjejnXruBXaje5Dzftaz24UpCIQ1McWG4ojGdMEIHuZRoiYsbl ZgTxPRiinrmirELoW7p0FAcSXdgAhXypx4z7GO1Pw7vwyEMp2LueJfBkg4c9Hke8PiUw vNd3piu19m7AFcA0CVyfh52uga/8Eo7Fi3IW9rUhTVQ3xLlqUruAvellVL8tu7PjKrnT JgZZw+7kj+rd8/Snzp+6wbRR9HlQYN83QcbSG3LMxF/76nKk9cF7su7LK/C01k9u0Yzd RSkl6xwSGX/WZ7FtbHNOL4gh0ynF2McrfEIkbniGA9YKW8qv6EJr61LYma92MFrrHNm7 U0xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=ET/r+ok3bQ8ZUYeeUeTpKiv1kIQw3fQzxI0dUQT7rm0=; b=tbmByTj3g2CwoWA7ig2FDcFC4CtB60xysKr0wCvupadVU+Za2FqqGrFa7hpfA5ouFc ar2RiVJqrT63OrBBSkIa1Lu/jHgjXSu+Sxy4rbjq3UPDfjJj4y1ip6yJUTFcOBrA/jDt bLQE6M7p8igqW7O/SW+ZVIvgkZE9bZqqjVaUz6e9OefMpN01dRtR28F/LLBkoX3V/SKL /hC6AQ8UifzY4bk9aUWj9Q7avIgnVKImQCWYUcRIoUQBpM5uW4GrOePEQ+xkRKo3i43e DNa1URRBWNE0UxN2Bi3+TTE3dNiKXFVA2sZGiObddqU9KAbQ5N0TU++8vEa+0HbkQJOo WU/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QnT5TavK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si1404367ply.126.2018.11.26.13.21.15; Mon, 26 Nov 2018 13:21:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QnT5TavK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726634AbeK0IOF (ORCPT + 99 others); Tue, 27 Nov 2018 03:14:05 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36916 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbeK0IOF (ORCPT ); Tue, 27 Nov 2018 03:14:05 -0500 Received: by mail-pf1-f193.google.com with SMTP id u3-v6so7209507pfm.4 for ; Mon, 26 Nov 2018 13:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ET/r+ok3bQ8ZUYeeUeTpKiv1kIQw3fQzxI0dUQT7rm0=; b=QnT5TavKVQtMLSWitO5rb+LaXPR0IXvDqrkca3ZzR28Elp+eLcEdzYlIFZlZ3em7/6 Xaqvl/STtBiyIgUfI8u5Q+4WRVRoB6hKe1wPtD74yI6nBXfXvzVxwSShLn9XQoEEgoul v5O8RrFFK1aehNr/jUzy7h24FwkQ5pFQW9huOqGz0u7LK4c1SNIsS2/dxRf9G0ghRkcr DG4yMDxX8/KBvJcwkzLI+KuNOMa6bURgrtYemFc8t/kJOUPS+gMfxIaGiNgyhqgsROxS 2uKFJfyxFS94Wu6aHsqxVSJjlQMLE/DnruHUp429LzouSFnL2WDvSEQkR9roKpGTgsPJ 24vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=ET/r+ok3bQ8ZUYeeUeTpKiv1kIQw3fQzxI0dUQT7rm0=; b=tsCdL0MMjwqZYEtPAU92bmlGWSdFYliC6VyFrWoYf61KMaMEsFH4Zf1SdPFCuEEK8Z aPSzCVwtdqtqV+H1gj/d23CKL6JmCMREtVd7Ns7FwJZHfEMU2rwTwdZI1tQ6OuWw+Cav U5FJYnouFD8cUVUJgmKXQuj60u1V8h1R7cxRqLMmQD0mc6AyJM593fwgeVZQwbuJ5YM0 MF4eZMYtqdPPf00Vlo2tb8+w/s3Y8fcw2kWTG9gVRPnI3j3AKPfoLpyMUU+Fuu52K4XC H7Rb2wP1OSzDrAoI4UDS0MknK9DDjBVYk8mEUbxqb/2rOMmovSSqXXpDcb9LmxdxyLSR q6sw== X-Gm-Message-State: AGRZ1gKLg2BKaQqVqpcwjcogOYg47Djvh4tQb4JU7nihxGkMQARG3Ku5 i7vf5hWiRNWZ69vRejNzE/E= X-Received: by 2002:a62:4bc2:: with SMTP id d63-v6mr31225579pfj.170.1543267119110; Mon, 26 Nov 2018 13:18:39 -0800 (PST) Received: from gmail.com (cpe-98-150-136-16.hawaii.res.rr.com. [98.150.136.16]) by smtp.gmail.com with ESMTPSA id v12sm1432560pgg.41.2018.11.26.13.18.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 13:18:38 -0800 (PST) Date: Mon, 26 Nov 2018 11:18:35 -1000 From: Joey Pabalinas To: David CARLIER Cc: joeypabalinas@gmail.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, aryabinin@virtuozzo.com Subject: Re: Re: [PATCH] Little memset_explicit optimisation Message-ID: <20181126211835.wdqiqszz6u65cbe3@gmail.com> Mail-Followup-To: Joey Pabalinas , David CARLIER , linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, aryabinin@virtuozzo.com References: <20181126113724.svbv6np25fzxkhrm@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5p7fgi77jkdtgm5h" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5p7fgi77jkdtgm5h Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 26, 2018 at 07:36:19PM +0000, David CARLIER wrote: > Sorry I m not used yet at all to LKML rules. >=20 > So here a slight difference in assembly generated between the two > versions (amd64) : > ` > .loc 1 7 7 > leaq -12(%rbp), %rax > movq %rax, -8(%rbp) > - .loc 1 11 2 > + .loc 1 9 6 > movq -8(%rbp), %rax > movl $4, %edx > movl $0, %esi > movq %rax, %rdi > call memset@PLT > + movq %rax, -8(%rbp) > .loc 1 13 23 > movq -8(%rbp), %rax > movl (%rax), %eax What is the advantage of having the added `movq %rax, -8(%rbp)` here? The next instruction is `movq -8(%rbp), %rax` and nothing afterwords uses the value stored in `-8(%rbp)`. Also, is this compiled without optimization? Take a looks at the assembly in a small test case with -O1 (making sure to use the target variable so it isn't optimized out) and compare the assembly generated with and without that assignment. --=20 Cheers, Joey Pabalinas --5p7fgi77jkdtgm5h Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEENpTlWU2hUK/KMvHp2rGdfm9DtVIFAlv8YysACgkQ2rGdfm9D tVKATw//Wwix4UmSG5SKowfLzD/VHgJ0WVGXQO7xd1K5npqdp2+jWZmeL7EQxB8U zl4obOxOk83h54YXLxYy3AQhzo/jpBDQAypL039YErjE4G21ERvAs6oltOuKqrOI VMOTM4C57iKhEYw8ZcRoOMmDNZmD8Q6fD6pkf2krfQcZe/v6qdSasaVbJXZ1PrNt 1JhUjLWHnHDWHSqM6erDiYRKjAqF/VsEzRkYDX6O8vpA4ckxJ4xe07cSd5XE4kjN i1JSvV1mwv4Ed18GAkkRuvfKPo5wyLTdrWMYORXc22zUB2WmuGOA1cUm3Qrt6bcM Uz7q316Lk5EFcwTU6EOxSmmVIKm6gcvaOzBxcCuq4ERimyQZ5sxoPYWBquQ7mapC mMqTU8hh06hMTFeSec+AdOld1GTYF7W1gW/edkHXFJIL3KLlKNeC9lS4xx7I1C6z puqKP+JViKUXBOpvFyN6WqNbbXfa1sU0f8F0sLuQYK5UCHnv+M7IvQS6JYWJpgnu qyJMgh6v3ocvwj8sVB0p33MAIaC7paMvu23p8BtxTs0MdNLuAP4fCj+qQ+DmMIQ3 WTF7SLjKJJPPxMm7QBSlqIxbCnkhdj5W0PkSk4qixSp680iRM5p3jT1z2x6Db1Be 10KT10qKsIJjYCxWv7nvZpjplmmA5LnES0gicASfnCI6Za8b5Xs= =0nC3 -----END PGP SIGNATURE----- --5p7fgi77jkdtgm5h--