Hi,

On Mon, Feb 01, 2021 at 11:24:42PM -0500, Michael Meissner wrote:
> In PR target/98519, the assembler does not like asm memory references that are
> prefixed.  We can't automatically change the instruction to prefixed form with
> a 'p' like we do for normal RTL insns, since this is assembly code.

It is incorrect in general, too, for at least three reasons.

> Instead,
> the patch prevents prefixed memory addresses from being passed by default.
> 
> This patch uses the TARGET_MD_ASM_ADJUST target hook to change the 'm' and 'o'
> constraints to be 'em' and 'eo'.

This does not work correctly, and is a gross misuse of this hook anyway.

Like I said before, just make 'm' (or even general_operand) not allow
prefixed memory in inline asm.

> +       while ((ch = *constraint++) != '\0')

Don't do assignments (or any other surprising side effects) in
conditionals please.  Code should be *readable*, not a puzzle.

0 is written as 0, not as 000 or '\0' or 0x0 or anything else.

> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/pr98519.c
> @@ -0,0 +1,17 @@
> +/* { dg-do compile } */

This is the default.

> +/* { dg-require-effective-target powerpc_prefixed_addr } */

You do not want this line, you want to compile this *always*.  You set
cpu=power10 anyway!  Also, the test should work *without it*!

> +/* { dg-final { scan-assembler-not {\m[@]pcrel\M} } } */

You can just write @ instead of [@].  Putting \m immediately in front of
a non-letter (or \M immediately after) does not do anything, either.


Segher

Reply via email to