Symbol + Constant output.

Hongyu Wang wwwhhhyyy333@gmail.com
Wed Nov 4 08:08:14 GMT 2020


> Maybe those scan-asm regexp are too strict and should be relaxed a
> bit.

I agree with this, since with -fPIC the code produced would be different,
just use symbol + constant may be too strict.

I think the scan-assembler could be reduced to
/* { dg-final { scan-assembler "(?:movdqu|movups)\[
\\t\]+\[^\n\]*%xmm1,\[^\n\r]*16" } } */

> for the PLUS case i386.c says:
>
>        /* Some assemblers need integer constants to appear first.  */
>
> =====

It seems with pic the format should be opposite to non-pic, if so, the comment
does not need change IMHO.

Uros Bizjak <ubizjak@gmail.com> 于2020年11月2日周一 下午6:21写道:
>
> On Sun, Nov 1, 2020 at 2:04 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
> >
> > Hi Uros,
> >
> > I was looking into the test fails for the new keylocker-* testcases.
> >
> > Many are because of missing “_” (which seems to happen more often than
> > not).  These I can fix trivially.
> >
> > But some are because we have:
> >
> > name+constant(%rip) being emitted on Linux
> >
> > and
> >
> > constant+name(%rip) being emitted on Darwin.
> >
> > ——
> >
> > The reason is that Darwin is always PIC and so outputs
> > (const:DI (plus:DI (symbol_ref:DI ("h2") [flags 0x2] <var_decl
> > 0x7ffff55e3c60 h2>)
> >          (const_int 16 [0x10])))
> >
> > using - gcc/i386.c:output_pic_addr_const
> >
> > Linux outputs the same thing
> >
> > using - gcc/final.c:output_addr_const
> >
> > ====
> >
> > for the PLUS case final.c says:
> >
> >        /* Some assemblers need integer constants to appear last (eg masm).  */
> >
> >
> > for the PLUS case i386.c says:
> >
> >        /* Some assemblers need integer constants to appear first.  */
> >
> > =====
> >
> > So .. I could make a really tedious patch to match the different forms in the
> > keylocker tests for Darwin ..
> >
> > .. but ISTM that maybe one of those comments is wrong / out of date - and the
> > right thing would be to fix that.
>
> I don't know which assemblers are referred to in the comment, but gas
> accepts both forms:
>
>        mov k2+16(%rip), %eax
>        mov 16+k2(%rip), %eax
>
> > Any insight welcome,
>
> Maybe those scan-asm regexp are too strict and should be relaxed a
> bit. Please resolve this issue with the author (CC'd).
>
> Uros.

-- 
Regards,

Hongyu, Wang


More information about the Gcc mailing list