aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh/predicates.md
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/sh/predicates.md')
-rw-r--r--gcc/config/sh/predicates.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/config/sh/predicates.md b/gcc/config/sh/predicates.md
index dcbd75b..25949c6 100644
--- a/gcc/config/sh/predicates.md
+++ b/gcc/config/sh/predicates.md
@@ -195,6 +195,34 @@
return 0;
})
+;; Returns true if OP is either a register or constant 0 or constant 1.
+(define_predicate "arith_reg_or_0_or_1_operand"
+ (match_code "subreg,reg,const_int,const_vector")
+{
+ return arith_reg_or_0_operand (op, mode) || satisfies_constraint_M (op);
+})
+
+;; Returns true if OP is a suitable constant for the minimum value of a
+;; clips.b or clips.w insn.
+(define_predicate "clips_min_const_int"
+ (and (match_code "const_int")
+ (ior (match_test "INTVAL (op) == -128")
+ (match_test "INTVAL (op) == -32768"))))
+
+;; Returns true if OP is a suitable constant for the maximum value of a
+;; clips.b or clips.w insn.
+(define_predicate "clips_max_const_int"
+ (and (match_code "const_int")
+ (ior (match_test "INTVAL (op) == 127")
+ (match_test "INTVAL (op) == 32767"))))
+
+;; Returns true if OP is a suitable constant for the maximum value of a
+;; clipu.b or clipu.w insn.
+(define_predicate "clipu_max_const_int"
+ (and (match_code "const_int")
+ (ior (match_test "INTVAL (op) == 255")
+ (match_test "INTVAL (op) == 65535"))))
+
;; Returns 1 if OP is a floating point operator with two operands.
(define_predicate "binary_float_operator"
(and (match_code "plus,minus,mult,div")