From: Joey Pabalinas <joeypabalinas@gmail.com>
To: David CARLIER <devnexen@gmail.com>
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
Date: Mon, 26 Nov 2018 11:18:35 -1000 [thread overview]
Message-ID: <20181126211835.wdqiqszz6u65cbe3@gmail.com> (raw)
In-Reply-To: <CA+XhMqz9igfiZqRgwvfQ0c=FVyWf=ZUD0xjypEgzO27qwmBNeA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]
On Mon, Nov 26, 2018 at 07:36:19PM +0000, David CARLIER wrote:
> Sorry I m not used yet at all to LKML rules.
>
> 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.
--
Cheers,
Joey Pabalinas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2018-11-26 21:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-24 12:35 David CARLIER
2018-11-26 11:29 ` Andy Shevchenko
2018-11-26 11:37 ` Joey Pabalinas
2018-11-26 19:36 ` David CARLIER
2018-11-26 21:18 ` Joey Pabalinas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181126211835.wdqiqszz6u65cbe3@gmail.com \
--to=joeypabalinas@gmail.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=aryabinin@virtuozzo.com \
--cc=devnexen@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®