emit_insn (gen_sse2_pshufd (tmp1, ops[0], GEN_INT (0xb1)));
rtx tmp2 = gen_reg_rtx (V4SImode);
- emit_insn (gen_andv4si3 (tmp2, tmp1, ops[0]));
+ if (GET_CODE (operands[1]) == EQ)
+ emit_insn (gen_andv4si3 (tmp2, tmp1, ops[0]));
+ else
+ emit_insn (gen_iorv4si3 (tmp2, tmp1, ops[0]));
emit_move_insn (operands[0], gen_lowpart (V2DImode, tmp2));
}
emit_insn (gen_sse2_pshufd (tmp1, tmp2, GEN_INT (0x4e)));
rtx tmp3 = gen_reg_rtx (V4SImode);
- emit_insn (gen_andv4si3 (tmp3, tmp2, tmp1));
+ if (GET_CODE (operands[1]) == EQ)
+ emit_insn (gen_andv4si3 (tmp3, tmp2, tmp1));
+ else
+ emit_insn (gen_iorv4si3 (tmp3, tmp2, tmp1));
emit_move_insn (operands[0], gen_lowpart (V1TImode, tmp3));
DONE;
--- /dev/null
+/* PR target/105613 */
+/* { dg-do run { target int128 } } */
+
+typedef unsigned __int128 __attribute__((__vector_size__ (16))) V;
+
+void
+foo (V v, V *r)
+{
+ *r = v != 0;
+}
+
+int
+main ()
+{
+ V r;
+ foo ((V) {5}, &r);
+ if (r[0] != ~(unsigned __int128) 0)
+ __builtin_abort ();
+ foo ((V) {0x500000005ULL}, &r);
+ if (r[0] != ~(unsigned __int128) 0)
+ __builtin_abort ();
+ foo ((V) {0}, &r);
+ if (r[0] != 0)
+ __builtin_abort ();
+ return 0;
+}