All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: christophe.leroy@c-s.fr, patch-notifications@ellerman.id.au,
	linux-kernel@vger.kernel.org, npiggin@gmail.com,
	clang-built-linux@googlegroups.com, paulus@samba.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto'
Date: Thu, 11 Jun 2020 18:52:56 -0500	[thread overview]
Message-ID: <20200611235256.GL31009@gate.crashing.org> (raw)
In-Reply-To: <20200611224355.71174-1-ndesaulniers@google.com>

On Thu, Jun 11, 2020 at 03:43:55PM -0700, Nick Desaulniers wrote:
> Segher, Cristophe, I suspect Clang is missing support for the %L and %U
> output templates [1].

The arch/powerpc kernel first used the %U output modifier in 0c176fa80fdf
(from 2016), and %L in b8b572e1015f (2008).  include/asm-ppc (and ppc64)
have had %U since 2005 (1da177e4c3f4), and %L as well (0c541b4406a6).

> I've implemented support for some of these before
> in Clang via the documentation at [2], but these seem to be machine
> specific?

Yes, almost all output modifiers are.  Only %l, %a, %n, and part of %c
are generic (and %% and %= and on some targets, %{, %|, %}).

> Can you please point me to documentation/unit tests/source for
> these so that I can figure out what they should be doing, and look into
> implementing them in Clang?

The PowerPC part of
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints
(sorry, no anchor) documents %U.

Traditionally the source code is the documentation for this.  The code
here starts with the comment
      /* Write second word of DImode or DFmode reference.  Works on register
         or non-indexed memory only.  */
(which is very out-of-date itself, it works fine for e.g. TImode as well,
but alas).

Unit tests are completely unsuitable for most compiler things like this.

The source code is gcc/config/rs6000/rs6000.c, easiest is to search for
'L' (with those quotes).  Function print_operand.

HtH,


Segher

WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: patch-notifications@ellerman.id.au, christophe.leroy@c-s.fr,
	benh@kernel.crashing.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com,
	paulus@samba.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto'
Date: Thu, 11 Jun 2020 18:52:56 -0500	[thread overview]
Message-ID: <20200611235256.GL31009@gate.crashing.org> (raw)
In-Reply-To: <20200611224355.71174-1-ndesaulniers@google.com>

On Thu, Jun 11, 2020 at 03:43:55PM -0700, Nick Desaulniers wrote:
> Segher, Cristophe, I suspect Clang is missing support for the %L and %U
> output templates [1].

The arch/powerpc kernel first used the %U output modifier in 0c176fa80fdf
(from 2016), and %L in b8b572e1015f (2008).  include/asm-ppc (and ppc64)
have had %U since 2005 (1da177e4c3f4), and %L as well (0c541b4406a6).

> I've implemented support for some of these before
> in Clang via the documentation at [2], but these seem to be machine
> specific?

Yes, almost all output modifiers are.  Only %l, %a, %n, and part of %c
are generic (and %% and %= and on some targets, %{, %|, %}).

> Can you please point me to documentation/unit tests/source for
> these so that I can figure out what they should be doing, and look into
> implementing them in Clang?

The PowerPC part of
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints
(sorry, no anchor) documents %U.

Traditionally the source code is the documentation for this.  The code
here starts with the comment
      /* Write second word of DImode or DFmode reference.  Works on register
         or non-indexed memory only.  */
(which is very out-of-date itself, it works fine for e.g. TImode as well,
but alas).

Unit tests are completely unsuitable for most compiler things like this.

The source code is gcc/config/rs6000/rs6000.c, easiest is to search for
'L' (with those quotes).  Function print_operand.

HtH,


Segher

  reply	other threads:[~2020-06-11 23:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 17:08 [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' Christophe Leroy
2020-04-17 17:08 ` Christophe Leroy
2020-04-17 17:08 ` [PATCH v4 2/2] powerpc/uaccess: Implement unsafe_copy_to_user() as a simple loop Christophe Leroy
2020-04-17 17:08   ` Christophe Leroy
2020-05-29  4:24   ` Michael Ellerman
2020-05-05 14:27 ` [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' Michael Ellerman
2020-05-05 14:27   ` Michael Ellerman
2020-05-05 15:32   ` Segher Boessenkool
2020-05-05 15:32     ` Segher Boessenkool
2020-05-06  0:58     ` Michael Ellerman
2020-05-06  0:58       ` Michael Ellerman
2020-05-06 17:58       ` Segher Boessenkool
2020-05-06 17:58         ` Segher Boessenkool
2020-05-06 18:10         ` Christophe Leroy
2020-05-06 18:10           ` Christophe Leroy
2020-05-06 22:18           ` Segher Boessenkool
2020-05-06 22:18             ` Segher Boessenkool
2020-05-05 15:40   ` Christophe Leroy
2020-05-05 15:40     ` Christophe Leroy
2020-05-05 15:59     ` Segher Boessenkool
2020-05-05 15:59       ` Segher Boessenkool
2020-05-06  1:36       ` Michael Ellerman
2020-05-06  1:36         ` Michael Ellerman
2020-05-06 18:09         ` Segher Boessenkool
2020-05-06 18:09           ` Segher Boessenkool
2020-05-29  4:24 ` Michael Ellerman
2020-06-11 22:43   ` Nick Desaulniers
2020-06-11 22:43     ` Nick Desaulniers
2020-06-11 23:52     ` Segher Boessenkool [this message]
2020-06-11 23:52       ` Segher Boessenkool
2020-06-12 21:33       ` Nick Desaulniers
2020-06-12 21:33         ` Nick Desaulniers
2020-06-13  1:08         ` Segher Boessenkool
2020-06-13  1:08           ` Segher Boessenkool
2020-06-13  6:46         ` Christophe Leroy
2020-06-13  6:46           ` Christophe Leroy
2020-06-13 10:47         ` Michael Ellerman
2020-06-13 10:47           ` Michael Ellerman

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=20200611235256.GL31009@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ndesaulniers@google.com \
    --cc=npiggin@gmail.com \
    --cc=patch-notifications@ellerman.id.au \
    --cc=paulus@samba.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.