[Bug target/105991] [12/13 Regression] rldicl+sldi+add generated instead of rldimi
roger at nextmovesoftware dot com
gcc-bugzilla@gcc.gnu.org
Thu Jun 16 07:57:06 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105991
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-06-16
CC| |roger at nextmovesoftware dot com
Keywords| |patch
Status|UNCONFIRMED |NEW
--- Comment #1 from Roger Sayle <roger at nextmovesoftware dot com> ---
The following patch appears to correct this for me on a cross-compiler to
powerpcle64, but it's tricky for me to do a full bootstrap/regression test.
2022-06-16 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR target/105991
* config/rs6000/rs6000.md (plus_xor): New code iterator.
(*rotl<mode>3_insert_3_<code>): New define_insn_and_split.
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index c55ee7e..695ec33 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -4188,6 +4188,23 @@
}
[(set_attr "type" "insert")])
+; Canonicalize the PLUS and XOR forms to IOR for rotl<mode>3_insert_3
+(define_code_iterator plus_xor [plus xor])
+
+(define_insn_and_split "*rotl<mode>3_insert_3_<code>"
+ [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
+ (plus_xor:GPR
+ (and:GPR (match_operand:GPR 3 "gpc_reg_operand" "0")
+ (match_operand:GPR 4 "const_int_operand" "n"))
+ (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
+ (match_operand:SI 2 "const_int_operand" "n"))))]
+ "INTVAL (operands[2]) == exact_log2 (UINTVAL (operands[4]) + 1)"
+ "#"
+ "&& 1"
+ [(set (match_dup 0)
+ (ior:GPR (and:GPR (match_dup 3) (match_dup 4))
+ (ashift:GPR (match_dup 1) (match_dup 2))))])
+
(define_code_iterator plus_ior_xor [plus ior xor])
(define_split
More information about the Gcc-bugs
mailing list