This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RFC][x86] Fix PR91154, add SImode smax, allow SImode add in SSE regs


On Mon, Aug 5, 2019 at 3:09 PM Uros Bizjak <ubizjak@gmail.com> wrote:

> > > > > > (define_mode_iterator MAXMIN_IMODE [SI "TARGET_SSE4_1"] [DI "TARGET_AVX512F"])
> > > > > >
> > > > > > and then we need to split DImode for 32bits, too.
> > > > >
> > > > > For now, please add "TARGET_64BIT && TARGET_AVX512F" for DImode
> > > > > condition, I'll provide _doubleword splitter later.
> > > >
> > > > Shouldn't that be TARGET_AVX512VL instead?  Or does the insn use %g0 etc.
> > > > to force use of %zmmN?
> > >
> > > It generates V4SI mode, so - yes, AVX512VL.
> >
> >     case SMAX:
> >     case SMIN:
> >     case UMAX:
> >     case UMIN:
> >       if ((mode == DImode && (!TARGET_64BIT || !TARGET_AVX512VL))
> >           || (mode == SImode && !TARGET_SSE4_1))
> >         return false;
> >
> > so there's no way to use AVX512VL for 32bit?
>
> There is a way, but on 32bit targets, we need to split DImode
> operation to a sequence of SImode operations for unconverted pattern.
> This is of course doable, but somehow more complex than simply
> emitting a DImode compare + DImode cmove, which is what current
> splitter does. So, a follow-up task.

Please find attached the complete .md part that enables SImode for
TARGET_SSE4_1 and DImode for TARGET_AVX512VL for both, 32bit and 64bit
targets. The patterns also allows for memory operand 2, so STV has
chance to create the vector pattern with implicit load. In case STV
fails, the memory operand 2 is loaded to the register first;  operand
2 is used in compare and cmove instruction, so pre-loading of the
operand should be beneficial.

Also note, that splitting should happen rarely. Due to the cost
function, STV should effectively always convert minmax to a vector
insn.

Uros.

Attachment: maxmin-md.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]