From b66cf46e4d410cb19a3529efa2ffda289848298d Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 21 Oct 2011 01:27:36 +0000 Subject: [PATCH] spu.md ("vec_permv16qi"): Reduce selector modulo 32 before using the shufb instruction. * config/spu/spu.md ("vec_permv16qi"): Reduce selector modulo 32 before using the shufb instruction. From-SVN: r180283 --- gcc/ChangeLog | 5 +++++ gcc/config/spu/spu.md | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30a25f993dfa..3b5fc23e9063 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-10-20 Ulrich Weigand + + * config/spu/spu.md ("vec_permv16qi"): Reduce selector modulo 32 + before using the shufb instruction. + 2011-10-20 Kirill Yukhin PR target/50766 diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md index 00cfaa4be55e..ca2cad9ba54a 100644 --- a/gcc/config/spu/spu.md +++ b/gcc/config/spu/spu.md @@ -4395,16 +4395,22 @@ selb\t%0,%4,%0,%3" "shufb\t%0,%1,%2,%3" [(set_attr "type" "shuf")]) +; The semantics of vec_permv16qi are nearly identical to those of the SPU +; shufb instruction, except that we need to reduce the selector modulo 32. (define_expand "vec_permv16qi" - [(set (match_operand:V16QI 0 "spu_reg_operand" "") + [(set (match_dup 4) (and:V16QI (match_operand:V16QI 3 "spu_reg_operand" "") + (match_dup 6))) + (set (match_operand:V16QI 0 "spu_reg_operand" "") (unspec:V16QI [(match_operand:V16QI 1 "spu_reg_operand" "") (match_operand:V16QI 2 "spu_reg_operand" "") - (match_operand:V16QI 3 "spu_reg_operand" "")] + (match_dup 5)] UNSPEC_SHUFB))] "" { - operands[3] = gen_lowpart (TImode, operands[3]); + operands[4] = gen_reg_rtx (V16QImode); + operands[5] = gen_lowpart (TImode, operands[4]); + operands[6] = spu_const (V16QImode, 31); }) (define_insn "nop" -- 2.47.2