All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Uros Bizjak <ubizjak@gmail.com>,
	GCC Development <gcc@gcc.gnu.org>, X86 ML <x86@kernel.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	linux-toolchains@vger.kernel.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Will Deacon <will@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: typeof and operands in named address spaces
Date: Wed, 11 Nov 2020 18:40:57 -0600	[thread overview]
Message-ID: <20201112004057.GN2672@gate.crashing.org> (raw)
In-Reply-To: <20201110201108.GQ2611@hirez.programming.kicks-ass.net>

On Tue, Nov 10, 2020 at 09:11:08PM +0100, Peter Zijlstra wrote:
> On Tue, Nov 10, 2020 at 10:42:58AM -0800, Nick Desaulniers wrote:
> > When I think of qualifiers, I think of const and volatile.  I'm not
> > sure why the first post I'm cc'ed on talks about "segment" qualifiers.
> > Maybe it's in reference to a variable attribute that the kernel
> > defines?  Looking at Clang's Qualifier class, I see const, volatile,
> > restrict (ah, right), some Objective-C stuff, and address space
> > (TR18037 is referenced, I haven't looked up what that is) though maybe
> > "segment" pseudo qualifiers the kernel defines expand to address space
> > variable attributes?
> 
> Right, x86 Named Address Space:
> 
>   https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Named-Address-Spaces.html#Named-Address-Spaces
> 
> Also, Google found me this:
> 
>   https://reviews.llvm.org/D64676
> 
> The basic problem seems to be they act exactly like qualifiers in that
> typeof() preserves them, so if you have:

GCC has the four standard type qualifiers (const, volatile, restrict,
and _Atomic), but also the address space things yes.

> > Maybe stripping all qualifiers is fine since you can add them back in
> > if necessary?
> 
> So far that seems sufficient. Although the Devil's advocate in me is
> trying to construct a case where we need to preserve const but strip
> volatile and that's then means we need to detect if the original has
> const or not, because unconditionally adding it will be wrong.

If you want to drop all qualifiers, you only need a way to convert
something to an rvalue (which always has an unqualified type).  So maybe
make syntax for just *that*?  __builtin_unqualified() perhaps?  Which
could be useful in more places than just doing an unqualified_typeof.


Segher

  reply	other threads:[~2020-11-12  1:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFULd4aOca3k-AZ+ocMBqDRpH_kNisBQwfK0F4Jf7znsPxsrBw@mail.gmail.com>
2020-11-09 12:47 ` typeof and operands in named address spaces Peter Zijlstra
2020-11-09 19:38   ` Segher Boessenkool
2020-11-09 19:50     ` Nick Desaulniers
2020-11-10  7:57       ` Peter Zijlstra
2020-11-10 18:42         ` Nick Desaulniers
2020-11-10 20:11           ` Peter Zijlstra
2020-11-12  0:40             ` Segher Boessenkool [this message]
2025-05-29  6:29           ` Uros Bizjak
2020-11-12  0:47         ` Segher Boessenkool
2020-11-10  7:52     ` Peter Zijlstra

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=20201112004057.GN2672@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=borntraeger@de.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mpe@ellerman.id.au \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ubizjak@gmail.com \
    --cc=will@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.