The definition of one_cmplsi2 insn pattern is not mandatory; the insn
generator recognize the absence of the pattern and instead generates an XOR
with a pseudo whose value is -1 if "XOR reg, reg, imm" is not also provided.
There is an advantage to exposing constant-valued registers early in RTL
passes; they are easier targets for CSE or loop invariant hoisting.
Indeed, the only reason we defined that insn even though it wasn't required
was because some optimizers in the RTL ifcvt pass needed
'(set (reg) (not (reg)))' RTX, however, in recent versions of gcc, the
equivalent optimizations are performed before RTL passes, so there is no
longer any need to explicitly define that insn.
Another concern with removing this insn definition is the impact on complex
insns that have '(not)' as part of them, but also nothing to worry about;
because the RTL insn combiner can correctly recognize an XOR with a register
value of -1 as a one's complement operation even without the definition of
this insn, and apply the result to subsequent combine operations.
gcc/ChangeLog:
* config/xtensa/xtensa.md (one_cmplsi2): Remove.
---
gcc/config/xtensa/xtensa.md | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 374288df708..0bb4db58738 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -669,7 +669,7 @@
})
-;; Negation and one's complement.
+;; Negation.
(define_insn "negsi2"
[(set (match_operand:SI 0 "register_operand" "=a")
@@ -680,27 +680,6 @@
(set_attr "mode" "SI")
(set_attr "length" "3")])
-(define_insn_and_split "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=a")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "#"
- "&& can_create_pseudo_p ()"
- [(set (match_dup 2)
- (const_int -1))
- (set (match_dup 0)
- (xor:SI (match_dup 1)
- (match_dup 2)))]
-{
- operands[2] = gen_reg_rtx (SImode);
-}
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set (attr "length")
- (if_then_else (match_test "TARGET_DENSITY")
- (const_int 5)
- (const_int 6)))])
-
(define_insn "negsf2"
[(set (match_operand:SF 0 "register_operand" "=f")
(neg:SF (match_operand:SF 1 "register_operand" "f")))]
--
2.39.5