From: Ingo Molnar <mingo@kernel.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: Uros Bizjak <uros_bizjak1@t-2.net>,
linux-kernel@vger.kernel.org, "x86@kernel.org" <x86@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: Introduce ASM flags to bitops
Date: Mon, 27 Jul 2015 18:13:39 +0200 [thread overview]
Message-ID: <20150727161339.GC25158@gmail.com> (raw)
In-Reply-To: <CAFULd4ZiyhbAFs_WzE3NLqiLz87DwdAjay65F0X8P44RQ3Y_2Q@mail.gmail.com>
* Uros Bizjak <ubizjak@gmail.com> wrote:
> On Mon, Jul 27, 2015 at 5:54 PM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Uros Bizjak <ubizjak@gmail.com> wrote:
> >
> >> On Mon, Jul 27, 2015 at 5:40 PM, Ingo Molnar <mingo@kernel.org> wrote:
> >> >
> >> > * Uros Bizjak <uros_bizjak1@t-2.net> wrote:
> >> >
> >> >> From: Uros Bizjak <ubizjak@gmail.com>
> >> >>
> >> >> This patch introduces GCC ASM flags to bitops. Instead of e.g.
> >> >>
> >> >> 136d7: 48 0f a3 3d 00 00 00 bt %rdi,0x0(%rip)
> >> >> 136de: 00
> >> >> 136df: 19 ff sbb %edi,%edi
> >> >> 136e1: 85 ff test %edi,%edi
> >> >> 136e3: 0f 95 c0 setne %al
> >> >>
> >> >> following code is generated:
> >> >>
> >> >> 13767: 48 0f a3 3d 00 00 00 bt %rdi,0x0(%rip)
> >> >> 1376e: 00
> >> >> 1376f: 0f 92 c0 setb %al
> >> >>
> >> >> Similar improvement can be seen in following code:
> >> >>
> >> >> 7a6c: 48 0f a3 11 bt %rdx,(%rcx)
> >> >> 7a70: 19 d2 sbb %edx,%edx
> >> >> 7a72: 85 d2 test %edx,%edx
> >> >> 7a74: 74 eb je 7a61
> >> >>
> >> >> which becomes:
> >> >>
> >> >> 7a8c: 48 0f a3 11 bt %rdx,(%rcx)
> >> >> 7a90: 73 ef jae 7a81
> >> >>
> >> >> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> >> >> ---
> >> >> arch/x86/include/asm/bitops.h | 26 ++++++++++++++++++++++++--
> >> >> arch/x86/include/asm/percpu.h | 18 +++++++++++++++++-
> >> >> arch/x86/include/asm/signal.h | 6 ++++++
> >> >> arch/x86/include/asm/sync_bitops.h | 18 ++++++++++++++++++
> >> >> 4 files changed, 65 insertions(+), 3 deletions(-)
> >> >
> >> > Nothing in your patch seems to be setting __GCC_ASM_FLAG_OUTPUTS__, and the patch
> >> > does not seem to be mailed as part of a larger series ...
> >> >
> >> > So how is this supposed to work?
> >>
> >> GCC version 6+ will automatically define __GCC_ASM_FLAG_OUTPUTS__ when
> >> this feature is supported. Please see [1] for RFC GCC patch series and
> >> [2] for final committed patch.
> >>
> >> [1] https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00594.html
> >> [2] https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02087.html
> >
> > Ok, great. This information should be part of the changelog and such, as it's not
> > obvious.
>
> No problem, I'll add this information and send a v2 patch.
>
> > Does the GCC project treat this as an ABI kind of thing, i.e. can the kernel rely
> > on it from now on, without the GCC side semantics of this feature not ever
> > changing and breaking the kernel?
>
> Yes. It was discussed and agreed between GCC and kernel people (HPA)
> on GCC mailing list. Please see [3].
>
> [3] https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00725.html
Ok, great!
One more request: please make it similar to how we handle other, similar compiler
features and introduce an interim macro like:
#ifdef __GCC_ASM_FLAG_OUTPUTS__
# define CC_HAVE_ASM_FLAG_OUTPUTS
#endif
in a suitable spot in include/linux/compiler-gcc.h, and use
CC_HAVE_ASM_FLAG_OUTPUTS in the other places.
this makes it easier to disable/enable this feature centrally, and it might enable
other compilers to introduce a similar feature.
Thanks,
Ingo
prev parent reply other threads:[~2015-07-27 16:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-26 0:07 [PATCH] x86: Introduce ASM flags to bitops Uros Bizjak
2015-07-27 15:40 ` Ingo Molnar
2015-07-27 15:50 ` Uros Bizjak
2015-07-27 15:54 ` Ingo Molnar
2015-07-27 15:59 ` Uros Bizjak
2015-07-27 16:13 ` Ingo Molnar [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=20150727161339.GC25158@gmail.com \
--to=mingo@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ubizjak@gmail.com \
--cc=uros_bizjak1@t-2.net \
--cc=x86@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