On Sun, Mar 3, 2019 at 10:18 PM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> On Sun, Mar 3, 2019 at 9:27 AM Uros Bizjak <ubiz...@gmail.com> wrote:
> >
> > On Thu, Feb 28, 2019 at 8:10 PM H.J. Lu <hjl.to...@gmail.com> wrote:
> > >
> > > 32-bit indices in VSIB address are sign-extended to 64 bits.  In x32,
> > > when 32-bit indices are used as addresses, like in
> > >
> > > vgatherdps %ymm7, 0(,%ymm9,1), %ymm6
> > >
> > > 32-bit indices, 0xf7fa3010, is sign-extended to 0xfffffffff7fa3010 which
> > > is invalid address.  Add addr32 prefix to UNSPEC_VSIBADDR instructions
> > > for x32 if there is no base register nor symbol.
> > >
> > > This fixes 175.vpr and 254.gap in SPEC CPU 2000 on x32 with
> > >
> > > -Ofast -funroll-loops -march=haswell
> >
> > 1. Testcases 2 to 9 fail on fedora-29 with:
> >
> > In file included from /usr/include/features.h:452,
> >                  from /usr/include/bits/libc-header-start.h:33,
> >                  from /usr/include/stdlib.h:25,
> >                  from /ssd/uros/gcc-build-fast/gcc/include/mm_malloc.h:27,
> >                  from /ssd/uros/gcc-build-fast/gcc/include/xmmintrin.h:34,
> >                  from /ssd/uros/gcc-build-fast/gcc/include/immintrin.h:29,
> >                  from
> > /home/uros/gcc-svn/trunk/gcc/testsuite/gcc.target/i386/pr89523-2.c:7:
> > /usr/include/gnu/stubs.h:13:11: fatal error: gnu/stubs-x32.h: No such
> > file or directory
>
> I will update tests to remove  "#include immintrin.h"
>
> > 2. Does the patch work with -maddress-mode={short,long}?
>
> Yes.
>
> > 3. The implementation is wrong. You should use operand substitution
> > with VSIB address as operand, not substitution without operand.
>
> How can I add an addr32 prefix with operand substitution?  This is
> very similar to "%^".  My updated patch will use "%^".

Yes, using %^ is what I think would be the optimal solution. Other
than that, in your proposed patch, operand-less %_ scans the entire
current_output_insn to dig to the UNSPEC_VSIBADDR. You can just use
operand substitution, and do e.g. "%X2vgatherpf0..." where 'X'
processes operand 2 (vsib_address_operand) and conditionally outputs
addr32.

BTW: In a new version of the patch, please specify what is changed
from the previous version. Otherwise, review of a new version is more
or less a guesswork what changed.

Uros.

Reply via email to