diff mbox

Fix i386 *_cconly shifts (PR target/46088)

Message ID 20101111235221.GN29412@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 11, 2010, 11:52 p.m. UTC
On Thu, Nov 11, 2010 at 07:51:42AM -0800, Richard Henderson wrote:
> On 11/11/2010 07:35 AM, Jakub Jelinek wrote:
> > -   && ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands)"
> > +   /* Can't use ix86_binary_operator_ok here, as the scratch
> > +      operand might be missing.  */
> > +   && !MEM_P (operands[1])"
> 
> Better to change the predicate on op1 to register_operand,
> and drop the test here inside the extra predicate.
> 
> Ok with that change.

Thanks, this is what I've committed after bootstrap/regtest on x86_64-linux
and i686-linux:

2010-11-12  Jakub Jelinek  <jakub@redhat.com>

	PR target/46088
	* config/i386/i386.md (*ashl<mode>3_cconly,
	*<shiftrt_insn><mode>3_cconly): Don't use ix86_binary_operator_ok,
	change nonimmediate_operand predicate to register_operand.

	* gcc.dg/pr46088.c: New test.



	Jakub
diff mbox

Patch

--- gcc/config/i386/i386.md.jj	2010-11-11 09:38:56.000000000 +0100
+++ gcc/config/i386/i386.md	2010-11-11 12:04:40.000000000 +0100
@@ -9714,7 +9714,7 @@  (define_insn "*ashlsi3_cmp_zext"
 (define_insn "*ashl<mode>3_cconly"
   [(set (reg FLAGS_REG)
 	(compare
-	  (ashift:SWI (match_operand:SWI 1 "nonimmediate_operand" "0")
+	  (ashift:SWI (match_operand:SWI 1 "register_operand" "0")
 		      (match_operand:QI 2 "<shift_immediate_operand>" "<S>"))
 	  (const_int 0)))
    (clobber (match_scratch:SWI 0 "=<r>"))]
@@ -9723,8 +9723,7 @@  (define_insn "*ashl<mode>3_cconly"
     || (operands[2] == const1_rtx
 	&& (TARGET_SHIFT1
 	    || TARGET_DOUBLE_WITH_ADD)))
-   && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands)"
+   && ix86_match_ccmode (insn, CCGOCmode)"
 {
   switch (get_attr_type (insn))
     {
@@ -10081,7 +10080,7 @@  (define_insn "*<shiftrt_insn><mode>3_cco
   [(set (reg FLAGS_REG)
 	(compare
 	  (any_shiftrt:SWI
-	    (match_operand:SWI 1 "nonimmediate_operand" "0")
+	    (match_operand:SWI 1 "register_operand" "0")
 	    (match_operand:QI 2 "<shift_immediate_operand>" "<S>"))
 	  (const_int 0)))
    (clobber (match_scratch:SWI 0 "=<r>"))]
@@ -10089,8 +10088,7 @@  (define_insn "*<shiftrt_insn><mode>3_cco
     || !TARGET_PARTIAL_FLAG_REG_STALL
     || (operands[2] == const1_rtx
 	&& TARGET_SHIFT1))
-   && ix86_match_ccmode (insn, CCGOCmode)
-   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
+   && ix86_match_ccmode (insn, CCGOCmode)"
 {
   if (operands[2] == const1_rtx
       && (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)))
--- gcc/testsuite/gcc.dg/pr46088.c.jj	2010-11-11 12:09:08.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr46088.c	2010-11-11 12:08:49.000000000 +0100
@@ -0,0 +1,12 @@ 
+/* PR target/46088 */
+/* { dg-do compile } */
+/* { dg-options "-Os -fnon-call-exceptions -fpeel-loops" } */
+
+extern void bar (void);
+
+void
+foo (int i)
+{
+  if (i >> 3)
+    bar ();
+}