[llvm] [RISCV] Inhibit DAG folding shl through zext.w pattern with zba (PR #91626)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 11:18:27 PDT 2024
================
@@ -2891,8 +2890,7 @@ define i64 @srli_slliw(i64 %1) {
;
; RV64ZBA-LABEL: srli_slliw:
; RV64ZBA: # %bb.0: # %entry
-; RV64ZBA-NEXT: slli a0, a0, 2
-; RV64ZBA-NEXT: srli a0, a0, 4
+; RV64ZBA-NEXT: srli a0, a0, 2
; RV64ZBA-NEXT: slli.uw a0, a0, 4
; RV64ZBA-NEXT: ret
entry:
----------------
dtcxzyw wrote:
The original test case is canonical: https://godbolt.org/z/ee3YPfY4s
```
define ptr @test(ptr %0, i64 %1) {
entry:
%2 = lshr exact i64 %1, 2
%3 = and i64 %2, 4294967295
%4 = getelementptr inbounds i8, ptr %0, i64 600
%5 = getelementptr [80 x i8], ptr %4, i64 %3
ret ptr %5
}
```
https://github.com/llvm/llvm-project/pull/91626
More information about the llvm-commits
mailing list