diff mbox

S/390: Add a (not ...) splitter to help combine

Message ID 20140404162232.GA27368@bart
State New
Headers show

Commit Message

Andreas Krebbel April 4, 2014, 4:22 p.m. UTC
Hi,

when combine deals with (xor (x) (const_int -1)) it turns it into a
(not (x)) first.  This seems to be a disadvantage for targets not
providing (not ..) patterns since it prevents intermediate steps from
matching.

If noticed this for the builtin-bswap-8/9 testcases which are fixed
with the attached patch.

Bootstrap and regtest clean on s390x.

Bye,

-Andreas-

2014-04-04  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* config/s390/s390.md: Add a splitter for NOT rtx.
diff mbox

Patch

diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 7d9d1ad..b17c1fa 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -7001,6 +7001,21 @@ 
   ""
   "s390_expand_logical_operator (XOR, <MODE>mode, operands); DONE;")
 
+; Combine replaces (xor (x) (const_int -1)) with (not (x)) when doing
+; simplifications.  So its better to have something matching.
+(define_split
+  [(set (match_operand:INT 0 "nonimmediate_operand" "")
+        (not:INT (match_operand:INT 1 "nonimmediate_operand" "")))]
+  ""
+  [(parallel
+    [(set (match_dup 0) (xor:INT (match_dup 1) (match_dup 2)))
+     (clobber (reg:CC CC_REGNUM))])]
+{
+  operands[2] = constm1_rtx;
+  if (!s390_logical_operator_ok_p (operands))
+    FAIL;
+})
+
 ;
 ; xordi3 instruction pattern(s).
 ;