[llvm] [NVPTX] Merge consecutive elements while buffering constant vectors with sub-byte datatype. (PR #183628)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 16:41:34 PDT 2026
================
@@ -0,0 +1,28 @@
+; Test to verify that NVPTX backend correctly handles constant global vectors
+; containing sub-byte sized elements.
+
+; RUN: llc < %s -mtriple=nvptx64 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 | %ptxas-verify %}
+
+target triple = "nvptx-nvidia-cuda"
+
+; CHECK: .visible .global .align 1 .b8 test0[1] = {33};
+ at test0 = local_unnamed_addr addrspace(1) constant <2 x i4> <i4 1, i4 2>, align 1
+
+; CHECK: .visible .global .align 1 .b8 test1[2] = {33, 3};
+ at test1 = local_unnamed_addr addrspace(1) constant <3 x i4> <i4 1, i4 2, i4 3>, align 1
+
+; CHECK: .visible .global .align 1 .b8 test2[1] = {228};
+ at test2 = local_unnamed_addr addrspace(1) constant <4 x i2> <i2 0, i2 1, i2 2, i2 3>, align 1
+
+; CHECK: .visible .global .align 1 .b8 test3[2] = {228, 4};
+ at test3 = local_unnamed_addr addrspace(1) constant <6 x i2> <i2 0, i2 1, i2 2, i2 3, i2 0, i2 1>, align 1
+
+; CHECK: .visible .global .align 1 .b8 test4[1] = {1};
+ at test4 = local_unnamed_addr addrspace(1) constant <1 x i4> <i4 1>, align 1
+
+; CHECK: .visible .global .align 1 .b8 test5[2] = {33, 67};
+ at test5 = local_unnamed_addr addrspace(1) constant <4 x i4> <i4 1, i4 2, i4 3, i4 4>, align 1
+
+; CHECK: .visible .global .align 1 .b8 test6[2] = {228, 228};
+ at test6 = local_unnamed_addr addrspace(1) constant <8 x i2> <i2 0, i2 1, i2 2, i2 3, i2 0, i2 1, i2 2, i2 3>, align 1
----------------
Artem-B wrote:
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'><i>[Re: lines +18 to +29]</i></p><!--__GRAPHITE_HTML_TAG_END__-->
We may also want some test cases that cover tail padding.
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'>See this comment inline on <a href="https://app.graphite.com/github/pr/llvm/llvm-project/183628?utm_source=unchanged-line-comment">Graphite</a>.</p><!--__GRAPHITE_HTML_TAG_END__-->
https://github.com/llvm/llvm-project/pull/183628
More information about the llvm-commits
mailing list