[llvm-branch-commits] [llvm] AMDGPU/GlobalISel: add RegBankLegalize rules for extends and trunc (PR #132383)

Nicolai Hähnle via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 26 09:55:40 PDT 2025


================
@@ -215,8 +205,7 @@ body: |
     ; CHECK: liveins: $sgpr0
     ; CHECK-NEXT: {{  $}}
     ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
-    ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
-    ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s64) = G_ANYEXT [[TRUNC]](s1)
+    ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s64) = G_ANYEXT [[COPY]](s32)
----------------
nhaehnle wrote:

Isn't this a correctness regression? I'm not entirely certain because I remember there was some weirdness around what G_TRUNC means semantically. Can you explain why there is no need for a trunc or bitwise and or something like that in the output?

Note that `anyext_s1_to_s32_vgpr` does leave a G_AND, so either that test shows a code quality issue or this test is incorrect.

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


More information about the llvm-branch-commits mailing list