[PATCH X86, PR62128] Rotate pattern for AVX2

Uros Bizjak ubizjak@gmail.com
Tue Sep 30 18:08:00 GMT 2014

On Tue, Sep 30, 2014 at 7:06 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Sep 30, 2014 at 6:47 PM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
>> Patch resubmitted from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01400.html
>> The patch fix PR62128 and  "gcc.target/i386/pr52252-atom.c" in
>> core-avx2 make check.
>> The test in pr62128 is exactly TEST 22 from
>> gcc.dg/torture/vshuf-v32qi.c. It will check if the pattern is correct
>> or not.
>> The patch developed similar to define_insn_and_split
>> "*avx_vperm_broadcast_<mode>".
>> The patch passed x86 bootstrap and make check (+2 new passes for
>> -march=core-avx2).
>> Is it ok?

Please try following (totally untested) expander:

--cut here--
(define_expand "avx2_rotate<mode>_perm"
  [(set (match_operand:V_256 0 "register_operand")
    (match_operand:V_256 1 "register_operand")
    (match_parallel 2 "palignr_operand"
      [(match_operand 3 "const_int_operand" "n")])))]
  int shift = INTVAL (operands[3]) * <ssescalarsize>;
  rtx insn;

  rtx op0 = gen_lowpart (V4DImode, operands[0]);
  rtx op1 = gen_lowpart (V4DImode, operands[1]);

  emit_insn (gen_avx2_permv2ti (op0, op1, op1, GEN_INT (33)));

  op0 = gen_lowpart (V2TImode, operands[0]);
  op1 = gen_lowpart (V2TImode, operands[1]);

  if (shift < GET_MODE_SIZE (TImode))
    insn = gen_avx2_palignrv2ti (op0, op0, op1, GEN_INT (shift)));
    insn = gen_avx2_palignrv2ti (op0, op1, op0, GEN_INT (shift - 16)));

  emit_insn (insn);
--cut here--

BTW: Looking at the code above, it looks to me that avx2_permv2ti
should accept V2TImode operands, not V4DImode.


More information about the Gcc-patches mailing list