https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123883
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2026-04-06
Status|UNCONFIRMED |NEW
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Comments on the match patthern:
+(simplify
+ (bit_and (convert? (lshift integer_onep@1 SSA_NAME@0))
+ (convert? (lshift integer_onep SSA_NAME@0)))
+ (lshift (convert @1) (convert @0)))
Something like this
(simplify
(bit_and
(convert? (lshift integer_onep@1 @0)
(convert? (lshift integer_onep@2 @0))
(convert:type (lshift:largertype { largertypeone; } @0))
But with you a few extra checks.
checking both converts are truncating (or a nop) (like in this case of code in
comment #1).
This is to make sure you don't introduce undefined behavior that was not there
before.
I am not sure if that will change the needed riscv pattern though.