summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-07-09 12:38:12 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2022-07-09 12:38:12 +0100
commit3ce205f62dea251482806d3efce992134c5677cd (patch)
tree9876e8b9feea71e21edfcba8d3e1d8b447b9274c
parent3fbb94b3a4ac9fa35f0a3b1b5e69ab0d6924c5bf (diff)
PR target/105930: Split *xordi3_doubleword after reload on x86.
This is a backport of the fix for PR target/105930 from mainline to the gcc12 release branch. 2022-07-09 Roger Sayle <roger@nextmovesoftware.com> Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog PR target/105930 * config/i386/i386.md (*<any_or>di3_doubleword): Split after reload. Use rtx_equal_p to avoid creating memory-to-memory moves, and emit NOTE_INSN_DELETED if operand[2] is zero (i.e. with -O0).
-rw-r--r--gcc/config/i386/i386.md22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 7c9560fc4f0..1c4781d26f7 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -10400,22 +10400,25 @@
"ix86_expand_binary_operator (<CODE>, <MODE>mode, operands); DONE;")
(define_insn_and_split "*<code>di3_doubleword"
- [(set (match_operand:DI 0 "nonimmediate_operand")
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=ro,r")
(any_or:DI
- (match_operand:DI 1 "nonimmediate_operand")
- (match_operand:DI 2 "x86_64_szext_general_operand")))
+ (match_operand:DI 1 "nonimmediate_operand" "0,0")
+ (match_operand:DI 2 "x86_64_szext_general_operand" "re,o")))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT
- && ix86_binary_operator_ok (<CODE>, DImode, operands)
- && ix86_pre_reload_split ()"
+ && ix86_binary_operator_ok (<CODE>, DImode, operands)"
"#"
- "&& 1"
+ "&& reload_completed"
[(const_int 0)]
{
+ /* This insn may disappear completely when operands[2] == const0_rtx
+ and operands[0] == operands[1], which requires a NOTE_INSN_DELETED. */
+ bool emit_insn_deleted_note_p = false;
+
split_double_mode (DImode, &operands[0], 3, &operands[0], &operands[3]);
if (operands[2] == const0_rtx)
- emit_move_insn (operands[0], operands[1]);
+ emit_insn_deleted_note_p = true;
else if (operands[2] == constm1_rtx)
{
if (<CODE> == IOR)
@@ -10427,7 +10430,10 @@
ix86_expand_binary_operator (<CODE>, SImode, &operands[0]);
if (operands[5] == const0_rtx)
- emit_move_insn (operands[3], operands[4]);
+ {
+ if (emit_insn_deleted_note_p)
+ emit_note (NOTE_INSN_DELETED);
+ }
else if (operands[5] == constm1_rtx)
{
if (<CODE> == IOR)