[llvm] [AMDGPU][SDAG] Legalise v2i32 or/xor/and instructions to make use of 64-bit wide instructions (PR #140694)

Janek van Oirschot via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 08:00:17 PDT 2025


================
@@ -18,11 +18,11 @@ define <2 x i32> @test_add2x32(ptr %a_ptr, ptr %b_ptr) {
 ; CHECK-LABEL: test_add2x32:
 ; CHECK:       ; %bb.0:
 ; CHECK-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; CHECK-NEXT:    flat_load_dword v4, v[2:3]
-; CHECK-NEXT:    flat_load_dword v5, v[0:1]
-; CHECK-NEXT:    v_mov_b32_e32 v1, 48
+; CHECK-NEXT:    flat_load_dwordx2 v[4:5], v[0:1]
+; CHECK-NEXT:    flat_load_dwordx2 v[6:7], v[2:3]
 ; CHECK-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
-; CHECK-NEXT:    v_or_b32_e32 v0, v5, v4
+; CHECK-NEXT:    v_or_b32_e32 v1, v5, v7
+; CHECK-NEXT:    v_or_b32_e32 v0, v4, v6
----------------
JanekvO wrote:

Having a bit of a better look into this, something still feels wrong here. From what I understand, 48 is materialized through the propagation of range metadata so this basically undoes the exact thing it's testing. But I have to admit I'm not sure if this is something that should be fixed here or would be more suitable for a follow up, mostly because there's more happening in this test that I don't exactly understand (e.g., v2i16 can be wholly deduced while v2i64 can only deduce one of its elements through the metadata range?)

All in all, I'd at least want to have some visibility on it (i.e., ticket, gh issue)
@LU-JOHN considering you've added the test, any opinions on this test changing?

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


More information about the llvm-commits mailing list