aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2011-01-17 10:18:24 -0800
committerRichard Henderson <rth@gcc.gnu.org>2011-01-17 10:18:24 -0800
commit784f69be19ef920218a7b05d6fb2569596864afb (patch)
tree8681175cc31c180190b4eb6e6854f2044b49208b /gcc
parentf033541c61c4d7ca041a52c842d9358841334017 (diff)
downloadgcc-784f69be19ef920218a7b05d6fb2569596864afb.zip
gcc-784f69be19ef920218a7b05d6fb2569596864afb.tar.gz
gcc-784f69be19ef920218a7b05d6fb2569596864afb.tar.bz2
rx: Replace sat builtin with ssaddsi3 pattern.
A standalone __builtin_rx_sat isn't implementable due to needing to keep the flags live before reload. Instead provide a saturating add pattern, which hopefully will be pattern-matched by high-level optimizations. From-SVN: r168928
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rx/rx.c4
-rw-r--r--gcc/config/rx/rx.md41
3 files changed, 37 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4b6aa41..8683ed3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2011-01-17 Richard Henderson <rth@redhat.com>
+ * config/rx/rx.c (RX_BUILTIN_SAT): Remove.
+ (rx_init_builtins): Remove sat builtin.
+ (rx_expand_builtin): Likewise.
+ * config/rx/rx.md (ssaddsi3): New.
+ (*sat): Rename from sat. Represent the CC_REG input.
+
* config/rx/predicates.md (rshift_operator): New.
* config/rx/rx.c (rx_expand_insv): Remove.
* config/rx/rx-protos.h: Update.
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index 8cc46e7..0179b1f 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -1847,7 +1847,6 @@ enum rx_builtin
RX_BUILTIN_REVW,
RX_BUILTIN_RMPA,
RX_BUILTIN_ROUND,
- RX_BUILTIN_SAT,
RX_BUILTIN_SETPSW,
RX_BUILTIN_WAIT,
RX_BUILTIN_max
@@ -1902,7 +1901,6 @@ rx_init_builtins (void)
ADD_RX_BUILTIN1 (RACW, "racw", void, integer);
ADD_RX_BUILTIN1 (ROUND, "round", intSI, float);
ADD_RX_BUILTIN1 (REVW, "revw", intSI, intSI);
- ADD_RX_BUILTIN1 (SAT, "sat", intSI, intSI);
ADD_RX_BUILTIN1 (WAIT, "wait", void, void);
}
@@ -2100,8 +2098,6 @@ rx_expand_builtin (tree exp,
case RX_BUILTIN_ROUND: return rx_expand_builtin_round (op, target);
case RX_BUILTIN_REVW: return rx_expand_int_builtin_1_arg
(op, target, gen_revw, false);
- case RX_BUILTIN_SAT: return rx_expand_int_builtin_1_arg
- (op, target, gen_sat, false);
case RX_BUILTIN_WAIT: emit_insn (gen_wait ()); return NULL_RTX;
default:
diff --git a/gcc/config/rx/rx.md b/gcc/config/rx/rx.md
index 7fa8668..a3db92c 100644
--- a/gcc/config/rx/rx.md
+++ b/gcc/config/rx/rx.md
@@ -1378,6 +1378,37 @@
[(set_attr "length" "3,2,3")]
)
+;; Saturate to 32-bits
+(define_insn_and_split "ssaddsi3"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (ss_plus:SI (match_operand:SI 1 "register_operand" "r")
+ (match_operand:SI 2 "rx_source_operand" "riQ")))
+ (clobber (reg:CC CC_REG))]
+ ""
+ "#"
+ "reload_completed"
+ [(parallel [(set (match_dup 0)
+ (plus:SI (match_dup 1) (match_dup 2)))
+ (set (reg:CC_ZSC CC_REG)
+ (compare:CC_ZSC
+ (plus:SI (match_dup 1) (match_dup 2))
+ (const_int 0)))])
+ (set (match_dup 0)
+ (unspec:SI [(match_dup 0) (reg:CC CC_REG)]
+ UNSPEC_BUILTIN_SAT))]
+ ""
+)
+
+(define_insn "*sat"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec:SI [(match_operand:SI 1 "register_operand" "0")
+ (reg:CC CC_REG)]
+ UNSPEC_BUILTIN_SAT))]
+ "reload_completed"
+ "sat\t%0"
+ [(set_attr "length" "2")]
+)
+
(define_insn "subsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
(minus:SI (match_operand:SI 1 "register_operand" "0,0,0,r,0")
@@ -2068,16 +2099,6 @@
(set_attr "length" "3,5")]
)
-;; Saturate to 32-bits
-(define_insn "sat"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (unspec:SI [(match_operand:SI 1 "register_operand" "0")]
- UNSPEC_BUILTIN_SAT))]
- ""
- "sat\t%0"
- [(set_attr "length" "2")]
-)
-
;;---------- Control Registers ------------------------
;; Clear Processor Status Word