[llvm] [AMDGPU][SDAG] Legalise v2i32 or/xor/and instructions to make use of 64-bit wide instructions (PR #140694)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 18 13:43:13 PDT 2025
================
@@ -63,9 +63,11 @@ define i64 @shl_metadata_cant_be_narrowed_to_i32(i64 %arg0, ptr %arg1.ptr) {
; CHECK-LABEL: shl_metadata_cant_be_narrowed_to_i32:
; CHECK: ; %bb.0:
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; CHECK-NEXT: flat_load_dword v2, v[2:3]
+; CHECK-NEXT: flat_load_dword v1, v[2:3]
; CHECK-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
-; CHECK-NEXT: v_lshlrev_b64 v[0:1], v2, v[0:1]
+; CHECK-NEXT: v_and_b32_e32 v1, 7, v1
+; CHECK-NEXT: v_lshlrev_b32_e32 v1, v1, v0
+; CHECK-NEXT: v_mov_b32_e32 v0, 0
----------------
LU-JOHN wrote:
The metadata range in this testcase has a Known.getMinValue().getZExtValue() of 0 and thus the reduction of the 64-bit shift to 32-bit should not be done.
The test in llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp line 4112 blocks this transformation in the old version of this code.
https://github.com/llvm/llvm-project/pull/140694
More information about the llvm-commits
mailing list