[PATCH 38/41] i386: Allow MMX vector expanders with TARGET_MMX_WITH_SSE

H.J. Lu hjl.tools@gmail.com
Sun Feb 17 17:28:00 GMT 2019


On Sun, Feb 17, 2019 at 9:22 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Sun, Feb 17, 2019 at 6:15 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> > > > > On Sat, Feb 16, 2019 at 11:46 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > > >
> > > > > >         PR target/89021
> > > > > >         * config/i386/i386.c (ix86_expand_vector_init_duplicate): Set
> > > > > >         mmx_ok to true if TARGET_MMX_WITH_SSE is true.
> > > > > >         (ix86_expand_vector_init_one_nonzero): Likewise.
> > > > > >         (ix86_expand_vector_init_one_var): Likewise.
> > > > > >         (ix86_expand_vector_init_general): Likewise.
> > > > > >         (ix86_expand_vector_init): Likewise.
> > > > > >         (ix86_expand_vector_set): Likewise.
> > > > > >         (ix86_expand_vector_extract): Likewise.
> > > > >
> > > > > Please move this initialization to .md files. We don't support V2SF, so
> > > > >
> > > > > (define_expand "vec_setv2sf"
> > > > >   [(match_operand:V2SF 0 "register_operand")
> > > > >    (match_operand:SF 1 "register_operand")
> > > > >    (match_operand 2 "const_int_operand")]
> > > > >   "TARGET_MMX"
> > > > > {
> > > > >   ix86_expand_vector_set (false, operands[0], operands[1],
> > > > >               INTVAL (operands[2]));
> > > > >   DONE;
> > > > > })
> > > > >
> > > > > should remain false, while in:
> > > > >
> > > > > (define_expand "vec_setv2si"
> > > > >   [(match_operand:V2SI 0 "register_operand")
> > > > >    (match_operand:SI 1 "register_operand")
> > > > >    (match_operand 2 "const_int_operand")]
> > > > >   "TARGET_MMX"
> > > > > {
> > > > >   ix86_expand_vector_set (false, operands[0], operands[1],
> > > > >               INTVAL (operands[2]));
> > > > >   DONE;
> > > > > })
> > > > >
> > > > > we should use TARGET_MMX_WITH_SSE instead of false in the call to
> > > > > ix86_expand_vector_set. The same change for the other MMX modes: V4HI
> > > > > and V8QI.
> > > > >
> > > > > Same for other exported vector initializers: ix86_expand_vector_init
> > > > > and ix86_expand_vector_extract. We support V2SI, V4HI and V8QI, but
> > > > > not V2SF (non-MMX modes are agnostic to mmx_ok argument).
> > > > >
> > > >
> > > > There is limited support for V2SF with MMX.  My goal is to emulate
> > > > all MMX features with SSE so that -msse2 -mno-mmx works for all
> > > > MMX codes which don't use MMX inline asm.  Leaving out V2SF
> > > > emulation creates a hole in my implementation.  Do you have testcases
> > > > to show issues with V2SF emulation?
> > >
> > > No, but V2SF should be avoided from emulation.
> >
> > Then -msse2 -mno-mmx won't work on some MMX codes like:
> >
> > #include <mmintrin.h>
> >
> > float
> > foo (__m64 x)
> > {
> >   return ((__v2sf) x)[0];
> > }
> >
> > Is there any reason why it shouldn't work for -msse2 -mno-mmx?
>
> Does this require 3DNOW insn? If not, it is OK also for V2SF.

V2SF vector manipulation, like init, dup, extract, insert, doesn't
require 3DNOW.  They are tested with -msse2 -mo-mmx in my
tests for MMX intrinsic emulations with SSE.

-- 
H.J.



More information about the Gcc-patches mailing list