@@ -994,41 +994,8 @@ xtensa_expand_scc (rtx operands[4], machine_mode cmp_mode)
rtx cmp;
rtx one_tmp, zero_tmp;
rtx (*gen_fn) (rtx, rtx, rtx, rtx, rtx);
- enum rtx_code code = GET_CODE (operands[1]);
- if (cmp_mode == SImode && CONST_INT_P (operands[3])
- && (code == EQ || code == NE))
- switch (INTVAL (operands[3]))
- {
- case 0:
- if (TARGET_MINMAX)
- {
- one_tmp = force_reg (SImode, const1_rtx);
- emit_insn (gen_uminsi3 (dest, operands[2], one_tmp));
- if (code == EQ)
- emit_insn (gen_xorsi3 (dest, dest, one_tmp));
- return 1;
- }
- break;
- case -2147483648:
- if (TARGET_ABS)
- {
- emit_insn (gen_abssi2 (dest, operands[2]));
- if (code == EQ)
- emit_insn (gen_lshrsi3 (dest, dest, GEN_INT (31)));
- else
- {
- emit_insn (gen_ashrsi3 (dest, dest, GEN_INT (31)));
- emit_insn (gen_addsi3 (dest, dest, const1_rtx));
- }
- return 1;
- }
- break;
- default:
- break;
- }
-
- if (! (cmp = gen_conditional_move (code, cmp_mode,
+ if (! (cmp = gen_conditional_move (GET_CODE (operands[1]), cmp_mode,
operands[2], operands[3])))
return 0;
@@ -3188,6 +3188,118 @@
(const_int 5)
(const_int 6)))])
+(define_insn_and_split "eq_zero_NSA"
+ [(set (match_operand:SI 0 "register_operand" "=a")
+ (eq:SI (match_operand:SI 1 "register_operand" "r")
+ (const_int 0)))]
+ "TARGET_NSA"
+ "#"
+ "&& 1"
+ [(set (match_dup 0)
+ (clz:SI (match_dup 1)))
+ (set (match_dup 0)
+ (lshiftrt:SI (match_dup 0)
+ (const_int 5)))]
+ ""
+ [(set_attr "type" "move")
+ (set_attr "mode" "SI")
+ (set_attr "length" "6")])
+
+(define_insn_and_split "eqne_zero"
+ [(set (match_operand:SI 0 "register_operand" "=a,&a")
+ (match_operator:SI 2 "boolean_operator"
+ [(match_operand:SI 1 "register_operand" "0,r")
+ (const_int 0)]))
+ (clobber (match_scratch:SI 3 "=&a,X"))]
+ ""
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+ enum rtx_code code = GET_CODE (operands[2]);
+ int same_p = REGNO (operands[0]) == REGNO (operands[1]);
+ emit_move_insn (same_p ? operands[3] : operands[0],
+ code == EQ ? constm1_rtx : const1_rtx);
+ emit_insn (gen_movsicc_internal0 (operands[0], operands[1],
+ same_p ? operands[3] : operands[1],
+ operands[0],
+ gen_rtx_fmt_ee (same_p ? NE : EQ,
+ VOIDmode,
+ operands[1],
+ const0_rtx)));
+ if (code == EQ)
+ emit_insn (gen_addsi3 (operands[0], operands[0], const1_rtx));
+ DONE;
+}
+ [(set_attr "type" "move")
+ (set_attr "mode" "SI")
+ (set (attr "length")
+ (if_then_else (match_test "GET_CODE (operands[2]) == EQ")
+ (if_then_else (match_test "TARGET_DENSITY")
+ (const_int 7)
+ (const_int 9))
+ (if_then_else (match_test "TARGET_DENSITY")
+ (const_int 5)
+ (const_int 6))))])
+
+(define_insn_and_split "*eqne_zero_masked_bits"
+ [(set (match_operand:SI 0 "register_operand" "=a")
+ (match_operator 3 "boolean_operator"
+ [(and:SI (match_operand:SI 1 "register_operand" "r")
+ (match_operand:SI 2 "const_int_operand" "i"))
+ (const_int 0)]))]
+ "IN_RANGE (exact_log2 (INTVAL (operands[2]) + 1), 17, 31)
+ || IN_RANGE (exact_log2 (-INTVAL (operands[2])), 1, 30)"
+ "#"
+ "&& 1"
+ [(const_int 0)]
+{
+ HOST_WIDE_INT mask = INTVAL (operands[2]);
+ int n;
+ enum rtx_code code = GET_CODE (operands[3]);
+ if (IN_RANGE (n = exact_log2 (mask + 1), 17, 31))
+ emit_insn (gen_ashlsi3 (operands[0], operands[1], GEN_INT (32 - n)));
+ else
+ emit_insn (gen_lshrsi3 (operands[0], operands[1],
+ GEN_INT (floor_log2 (-mask))));
+ if (TARGET_NSA && code == EQ)
+ emit_insn (gen_eq_zero_NSA (operands[0], operands[0]));
+ else
+ emit_insn (gen_eqne_zero (operands[0], operands[0],
+ gen_rtx_fmt_ee (code, VOIDmode,
+ operands[0], const0_rtx)));
+ DONE;
+})
+
+(define_insn_and_split "*eqne_INT_MIN"
+ [(set (match_operand:SI 0 "register_operand" "=a")
+ (match_operator:SI 2 "boolean_operator"
+ [(match_operand:SI 1 "register_operand" "r")
+ (const_int -2147483648)]))]
+ "TARGET_ABS"
+ "#"
+ "&& 1"
+ [(const_int 0)]
+{
+ emit_insn (gen_abssi2 (operands[0], operands[1]));
+ if (GET_CODE (operands[2]) == EQ)
+ emit_insn (gen_lshrsi3 (operands[0], operands[0], GEN_INT (31)));
+ else
+ {
+ emit_insn (gen_ashrsi3 (operands[0], operands[0], GEN_INT (31)));
+ emit_insn (gen_addsi3 (operands[0], operands[0], const1_rtx));
+ }
+ DONE;
+}
+ [(set_attr "type" "move")
+ (set_attr "mode" "SI")
+ (set (attr "length")
+ (if_then_else (match_test "GET_CODE (operands[2]) == EQ")
+ (const_int 6)
+ (if_then_else (match_test "TARGET_DENSITY")
+ (const_int 8)
+ (const_int 9))))])
+
(define_peephole2
[(set (match_operand:SI 0 "register_operand")
(match_operand:SI 6 "reload_operand"))