@@ -84,6 +84,11 @@ (define_mode_iterator V_16_32_64
(define_mode_iterator V2FI [V2SF V2SI])
(define_mode_iterator V24FI [V2SF V2SI V4HF V4HI])
+
+(define_mode_iterator V248FI [V2SF V2SI V4HF V4HI V8QI])
+
+(define_mode_iterator V24FI_32 [V2HF V2HI V4QI])
+
;; Mapping from integer vector mode to mnemonic suffix
(define_mode_attr mmxvecsize
[(V8QI "b") (V4QI "b") (V2QI "b")
@@ -3729,6 +3734,70 @@ (define_expand "v<insn>v4qi3"
DONE;
})
+(define_expand "vec_shl_<mode>"
+ [(set (match_operand:V248FI 0 "register_operand")
+ (ashift:V1DI
+ (match_operand:V248FI 1 "nonimmediate_operand")
+ (match_operand:DI 2 "nonmemory_operand")))]
+ "TARGET_MMX_WITH_SSE"
+{
+ rtx op0 = gen_reg_rtx (V1DImode);
+ rtx op1 = force_reg (<MODE>mode, operands[1]);
+
+ emit_insn (gen_mmx_ashlv1di3
+ (op0, gen_lowpart (V1DImode, op1), operands[2]));
+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0));
+ DONE;
+})
+
+(define_expand "vec_shl_<mode>"
+ [(set (match_operand:V24FI_32 0 "register_operand")
+ (ashift:V1SI
+ (match_operand:V24FI_32 1 "nonimmediate_operand")
+ (match_operand:DI 2 "nonmemory_operand")))]
+ "TARGET_SSE2"
+{
+ rtx op0 = gen_reg_rtx (V1SImode);
+ rtx op1 = force_reg (<MODE>mode, operands[1]);
+
+ emit_insn (gen_mmx_ashlv1si3
+ (op0, gen_lowpart (V1SImode, op1), operands[2]));
+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0));
+ DONE;
+})
+
+(define_expand "vec_shr_<mode>"
+ [(set (match_operand:V248FI 0 "register_operand")
+ (lshiftrt:V1DI
+ (match_operand:V248FI 1 "nonimmediate_operand")
+ (match_operand:DI 2 "nonmemory_operand")))]
+ "TARGET_MMX_WITH_SSE"
+{
+ rtx op0 = gen_reg_rtx (V1DImode);
+ rtx op1 = force_reg (<MODE>mode, operands[1]);
+
+ emit_insn (gen_mmx_lshrv1di3
+ (op0, gen_lowpart (V1DImode, op1), operands[2]));
+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0));
+ DONE;
+})
+
+(define_expand "vec_shr_<mode>"
+ [(set (match_operand:V24FI_32 0 "register_operand")
+ (lshiftrt:V1SI
+ (match_operand:V24FI_32 1 "nonimmediate_operand")
+ (match_operand:DI 2 "nonmemory_operand")))]
+ "TARGET_SSE2"
+{
+ rtx op0 = gen_reg_rtx (V1SImode);
+ rtx op1 = force_reg (<MODE>mode, operands[1]);
+
+ emit_insn (gen_mmx_lshrv1si3
+ (op0, gen_lowpart (V1SImode, op1), operands[2]));
+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0));
+ DONE;
+})
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Parallel integral comparisons
@@ -16498,29 +16498,35 @@ (define_split
"operands[3] = XVECEXP (operands[2], 0, 0);")
(define_expand "vec_shl_<mode>"
- [(set (match_dup 3)
+ [(set (match_operand:V_128 0 "register_operand")
(ashift:V1TI
- (match_operand:V_128 1 "register_operand")
- (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
- (set (match_operand:V_128 0 "register_operand") (match_dup 4))]
+ (match_operand:V_128 1 "nonimmediate_operand")
+ (match_operand:SI 2 "const_0_to_255_mul_8_operand")))]
"TARGET_SSE2"
{
- operands[1] = gen_lowpart (V1TImode, operands[1]);
- operands[3] = gen_reg_rtx (V1TImode);
- operands[4] = gen_lowpart (<MODE>mode, operands[3]);
+ rtx op0 = gen_reg_rtx (V1TImode);
+ rtx op1 = force_reg (<MODE>mode, operands[1]);
+
+ emit_insn (gen_sse2_ashlv1ti3
+ (op0, gen_lowpart (V1TImode, op1), operands[2]));
+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0));
+ DONE;
})
(define_expand "vec_shr_<mode>"
- [(set (match_dup 3)
+ [(set (match_operand:V_128 0 "register_operand")
(lshiftrt:V1TI
- (match_operand:V_128 1 "register_operand")
- (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
- (set (match_operand:V_128 0 "register_operand") (match_dup 4))]
+ (match_operand:V_128 1 "nonimmediate_operand")
+ (match_operand:SI 2 "const_0_to_255_mul_8_operand")))]
"TARGET_SSE2"
{
- operands[1] = gen_lowpart (V1TImode, operands[1]);
- operands[3] = gen_reg_rtx (V1TImode);
- operands[4] = gen_lowpart (<MODE>mode, operands[3]);
+ rtx op0 = gen_reg_rtx (V1TImode);
+ rtx op1 = force_reg (<MODE>mode, operands[1]);
+
+ emit_insn (gen_sse2_lshrv1ti3
+ (op0, gen_lowpart (V1TImode, op1), operands[2]));
+ emit_move_insn (operands[0], gen_lowpart (<MODE>mode, op0));
+ DONE;
})
(define_expand "ashlv1ti3"
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+typedef char vect64 __attribute__((vector_size(8)));
+
+void f (vect64 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2, 3, 4, 5, 6, 7, 8);
+}
+
+/* { dg-final { scan-assembler "psrlq" } } */
+
+void g(vect64 *a)
+{
+ *a = __builtin_shufflevector((vect64){0}, *a, 7, 8, 9, 10, 11, 12, 13, 14);
+}
+
+/* { dg-final { scan-assembler "psllq" } } */
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef char vect32 __attribute__((vector_size(4)));
+
+void f (vect32 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect32){0}, 1, 2, 3, 4);
+}
+
+/* { dg-final { scan-assembler "psrld" } } */
+
+void g(vect32 *a)
+{
+ *a = __builtin_shufflevector((vect32){0}, *a, 3, 4, 5, 6);
+}
+
+/* { dg-final { scan-assembler "pslld" } } */
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+typedef short vect64 __attribute__((vector_size(8)));
+
+void f (vect64 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2, 3, 4);
+}
+
+/* { dg-final { scan-assembler "psrlq" } } */
+
+void g(vect64 *a)
+{
+ *a = __builtin_shufflevector((vect64){0}, *a, 3, 4, 5, 6);
+}
+
+/* { dg-final { scan-assembler "psllq" } } */
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef short vect32 __attribute__((vector_size(4)));
+
+void f (vect32 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect32){0}, 1, 2);
+}
+
+/* { dg-final { scan-assembler "psrld" } } */
+
+void g(vect32 *a)
+{
+ *a = __builtin_shufflevector((vect32){0}, *a, 1, 2);
+}
+
+/* { dg-final { scan-assembler "pslld" } } */
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+typedef _Float16 vect64 __attribute__((vector_size(8)));
+
+void f (vect64 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2, 3, 4);
+}
+
+/* { dg-final { scan-assembler "psrlq" } } */
+
+void g(vect64 *a)
+{
+ *a = __builtin_shufflevector((vect64){0}, *a, 3, 4, 5, 6);
+}
+
+/* { dg-final { scan-assembler "psllq" } } */
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef _Float16 vect32 __attribute__((vector_size(4)));
+
+void f (vect32 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect32){0}, 1, 2);
+}
+
+/* { dg-final { scan-assembler "psrld" } } */
+
+void g(vect32 *a)
+{
+ *a = __builtin_shufflevector((vect32){0}, *a, 1, 2);
+}
+
+/* { dg-final { scan-assembler "pslld" } } */
new file mode 100644
@@ -0,0 +1,19 @@
+/* PR target/113871 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2" } */
+
+typedef int vect64 __attribute__((vector_size(8)));
+
+void f (vect64 *a)
+{
+ *a = __builtin_shufflevector(*a, (vect64){0}, 1, 2);
+}
+
+/* { dg-final { scan-assembler "psrlq" } } */
+
+void g(vect64 *a)
+{
+ *a = __builtin_shufflevector((vect64){0}, *a, 1, 2);
+}
+
+/* { dg-final { scan-assembler "psllq" } } */