Patchwork [rs6000,committed] fix abs_isel patterns

login
register
mail settings
Submitter Nathan Froyd
Date July 20, 2010, 6:38 p.m.
Message ID <20100720183853.GK26037@codesourcery.com>
Download mbox | patch
Permalink /patch/59352/
State New
Headers show

Comments

Nathan Froyd - July 20, 2010, 6:38 p.m.
While debugging other problems, I noticed that my isel patch:

http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01298.html

was causing ICEs when compiling libgcc.  After making the isel patterns
only accept lt/eq/gt comparison codes, the *abs<mode>2_isel splitters
split to RTL that's not recognizable.  (This should have shown up when
compiling libgcc for powerpc-eabispe, but doesn't because the default
processor for that target isn't an isel-capable processor...patch
forthcoming.)

Fixed with the below patch, which reverses the sense of the condition in
the patterns, along with the operands.

Applied as obvious after testing on powerpc-eabispe.

-Nathan

	* config/rs6000/rs6000.md (abs<mode>2_isel, nabs<mode>2_isel):
	Reverse sense of if_then_else condition.

Patch

Index: config/rs6000/rs6000.md
===================================================================
--- config/rs6000/rs6000.md	(revision 162343)
+++ config/rs6000/rs6000.md	(working copy)
@@ -2105,10 +2105,10 @@  (define_insn_and_split "abs<mode>2_isel"
 	(compare:CC (match_dup 1)
 		    (const_int 0)))
    (set (match_dup 0)
-	(if_then_else:GPR (ge (match_dup 3)
+	(if_then_else:GPR (lt (match_dup 3)
 			      (const_int 0))
-			  (match_dup 1)
-			  (match_dup 2)))]
+			  (match_dup 2)
+			  (match_dup 1)))]
   "")
 
 (define_insn_and_split "nabs<mode>2_isel"
@@ -2124,10 +2124,10 @@  (define_insn_and_split "nabs<mode>2_isel
 	(compare:CC (match_dup 1)
 		    (const_int 0)))
    (set (match_dup 0)
-	(if_then_else:GPR (ge (match_dup 3)
+	(if_then_else:GPR (lt (match_dup 3)
 			      (const_int 0))
-			  (match_dup 2)
-			  (match_dup 1)))]
+			  (match_dup 1)
+			  (match_dup 2)))]
   "")
 
 (define_insn_and_split "abssi2_nopower"