@@ -20031,8 +20031,10 @@ (define_expand "parityhi2"
"! TARGET_POPCNT"
{
rtx scratch = gen_reg_rtx (QImode);
+ rtx tmp = gen_reg_rtx (HImode);
- emit_insn (gen_parityhi2_cmp (operands[1]));
+ emit_move_insn (tmp, operands[1]);
+ emit_insn (gen_parityhi2_cmp (tmp));
ix86_expand_setcc (scratch, ORDERED,
gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx);
new file mode 100644
@@ -0,0 +1,23 @@
+/* PR target/112672 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+typedef unsigned short u16;
+
+u16 g = 254;
+
+static inline u16
+foo (u16 u)
+{
+ u *= g;
+ return u + __builtin_parityl (u);
+}
+
+int
+main (void)
+{
+ u16 x = foo (4);
+ if (x != 4 * 254 + 1)
+ __builtin_abort ();
+ return 0;
+}