aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1992-07-27 18:58:27 -0700
committerJim Wilson <wilson@gcc.gnu.org>1992-07-27 18:58:27 -0700
commit95edfef236ff9bf3702d97718729a213e843cfd8 (patch)
tree04720bb007cd293c1fb52eb1f2fd2013cbc404a6
parent2abaee930b35ca4bff4ac836e0b59efb90c1ec42 (diff)
downloadgcc-95edfef236ff9bf3702d97718729a213e843cfd8.zip
gcc-95edfef236ff9bf3702d97718729a213e843cfd8.tar.gz
gcc-95edfef236ff9bf3702d97718729a213e843cfd8.tar.bz2
Add DEFINE_SPLITs to optimize logic operation with
certain immediate values. From-SVN: r1694
-rw-r--r--gcc/config/sparc/sparc.md56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index cdbc02b..acb4ee4 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -1993,6 +1993,20 @@
""
"and %1,%2,%0")
+(define_split
+ [(set (match_operand:SI 0 "register_operand" "")
+ (and:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "" "")))]
+ "GET_CODE (operands[2]) == CONST_INT
+ && !SMALL_INT (operands[2])
+ && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
+ [(set (match_dup 0) (match_dup 3))
+ (set (match_dup 0) (and:SI (not:SI (match_dup 0)) (match_dup 1)))]
+ "
+{
+ operands[3] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
+}")
+
(define_insn ""
[(set (match_operand:DI 0 "register_operand" "=r")
(and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
@@ -2053,6 +2067,20 @@
""
"or %1,%2,%0")
+(define_split
+ [(set (match_operand:SI 0 "register_operand" "")
+ (ior:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "" "")))]
+ "GET_CODE (operands[2]) == CONST_INT
+ && !SMALL_INT (operands[2])
+ && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
+ [(set (match_dup 0) (match_dup 3))
+ (set (match_dup 0) (ior:SI (not:SI (match_dup 0)) (match_dup 1)))]
+ "
+{
+ operands[3] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
+}")
+
(define_insn ""
[(set (match_operand:DI 0 "register_operand" "=r")
(ior:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
@@ -2113,6 +2141,34 @@
""
"xor %r1,%2,%0")
+(define_split
+ [(set (match_operand:SI 0 "register_operand" "")
+ (xor:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "" "")))]
+ "GET_CODE (operands[2]) == CONST_INT
+ && !SMALL_INT (operands[2])
+ && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
+ [(set (match_dup 0) (match_dup 3))
+ (set (match_dup 0) (not:SI (xor:SI (match_dup 0) (match_dup 1))))]
+ "
+{
+ operands[3] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
+}")
+
+(define_split
+ [(set (match_operand:SI 0 "register_operand" "")
+ (not:SI (xor:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "" ""))))]
+ "GET_CODE (operands[2]) == CONST_INT
+ && !SMALL_INT (operands[2])
+ && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
+ [(set (match_dup 0) (match_dup 3))
+ (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 1)))]
+ "
+{
+ operands[3] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
+}")
+
;; xnor patterns. Note that (a ^ ~b) == (~a ^ b) == ~(a ^ b).
;; Combine now canonicalizes to the rightmost expression.
(define_insn ""