Hello!
Attached patch fixes PR 60909, where memory operand was used as a
target RTX of a CMOVE insn, leading to unrecognized insn. Similar
problem was found with rdseed insn, where memory operand was used as
an invalid target of a ZERO_EXTEND insn.
Attached patch fixes both occurences.
2014-04-21 Uros Bizjak <[email protected]>
PR target/60909
* config/i386/i386.c (ix86_expand_builtin)
<case IX86_BUILTIN_RDRAND{16,32,64}_STEP>: Use temporary
register for target RTX.
<case IX86_BUILTIN_RDSEED{16,32,64}_STEP>: Ditto.
Testsuite/ChangeLog:
2014-04-21 Uros Bizjak <[email protected]>
PR target/60909
* gcc.target/i386/pr60909-1.c: New test.
* gcc.target/i386/pr60909-2.c: Ditto.
Patch was committed to mainline and will be committed to other release
branches after 4.9 is released.
Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 209544)
+++ config/i386/i386.c (working copy)
@@ -35400,7 +35400,8 @@ rdrand_step:
else
op2 = gen_rtx_SUBREG (SImode, op0, 0);
- if (target == 0)
+ if (target == 0
+ || !register_operand (target, SImode))
target = gen_reg_rtx (SImode);
pat = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG),
@@ -35442,7 +35443,8 @@ rdseed_step:
const0_rtx);
emit_insn (gen_rtx_SET (VOIDmode, op2, pat));
- if (target == 0)
+ if (target == 0
+ || !register_operand (target, SImode))
target = gen_reg_rtx (SImode);
emit_insn (gen_zero_extendqisi2 (target, op2));
Index: testsuite/gcc.target/i386/pr60909-1.c
===================================================================
--- testsuite/gcc.target/i386/pr60909-1.c (revision 0)
+++ testsuite/gcc.target/i386/pr60909-1.c (working copy)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mrdrnd" } */
+
+extern void bar (int);
+
+void
+foo (unsigned *u)
+{
+ int i = __builtin_ia32_rdrand32_step (u);
+ bar (i);
+}
Index: testsuite/gcc.target/i386/pr60909-2.c
===================================================================
--- testsuite/gcc.target/i386/pr60909-2.c (revision 0)
+++ testsuite/gcc.target/i386/pr60909-2.c (working copy)
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mrdseed" } */
+
+extern void bar (int);
+
+void
+foo (unsigned *u)
+{
+ int i = __builtin_ia32_rdseed_si_step (u);
+ bar (i);
+}