[llvm] [AArch64] Combine and and lsl into ubfiz (PR #118974)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 08:48:03 PST 2024


================
@@ -8989,6 +8989,15 @@ def : Pat<(shl (i64 (zext GPR32:$Rn)), (i64 imm0_63:$imm)),
                    (i64 (i64shift_a        imm0_63:$imm)),
                    (i64 (i64shift_sext_i32 imm0_63:$imm)))>;
 
+def : Pat<(shl (i64 (and (i64 (anyext GPR32:$Rn)), 0xff)), (i64 imm0_63:$imm)),
----------------
david-arm wrote:

I'm actually quite surprised that the anyext survived all the way through to isel! I was expecting a DAG combine to simply fold `and (i64 (anyext GPR32:$Rn)), 0xff` into something like `and GPR64:$Rn, 0xff`.

https://github.com/llvm/llvm-project/pull/118974


More information about the llvm-commits mailing list