1 ; RUN: not --crash llc < %s -march=nvptx -mcpu=sm_20 -mattr=+ptx70 2>&1 | \
2 ; RUN: FileCheck %s --check-prefix=ERROR
4 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -mattr=+ptx71 | \
5 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK32
6 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 -mattr=+ptx71 | \
7 ; RUN: FileCheck %s --check-prefixes=CHECK,CHECK64
8 ; RUN: %if ptxas-11.1 && !ptxas-12.0%{ llc < %s -march=nvptx -mcpu=sm_20 -mattr=+ptx71 | %ptxas-verify %}
9 ; RUN: %if ptxas-11.1 %{ llc < %s -march=nvptx64 -mcpu=sm_20 -mattr=+ptx71 | %ptxas-verify %}
11 ;; Test that packed structs with symbol references are represented using the
15 @p = addrspace(1) global i8 0
16 ; CHECK: .extern .func func
19 %t1 = type <{ i16, ptr, i8, ptr, ptr, i32 }>
20 @s1 = addrspace(1) global %t1 <{
21 ; ERROR: initialized packed aggregate with pointers 's1' requires at least PTX ISA version 7.1
22 ; CHECK32: .global .align 1 .u8 s1[19] = {
23 ; CHECK64: .global .align 1 .u8 s1[31] = {
26 ptr addrspacecast (ptr addrspace(1) @p to ptr),
27 ; CHECK-SAME: 0xFF(generic(p)), 0xFF00(generic(p)), 0xFF0000(generic(p)), 0xFF000000(generic(p)),
28 ; CHECK64-SAME: 0xFF00000000(generic(p)), 0xFF0000000000(generic(p)), 0xFF000000000000(generic(p)), 0xFF00000000000000(generic(p)),
32 ; CHECK-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func),
33 ; CHECK64-SAME: 0xFF00000000(func), 0xFF0000000000(func), 0xFF000000000000(func), 0xFF00000000000000(func),
34 ptr addrspacecast (ptr addrspace(1) getelementptr (i8, ptr addrspace(1) @p, i32 3) to ptr),
35 ; CHECK-SAME: 0xFF(generic(p)+3), 0xFF00(generic(p)+3), 0xFF0000(generic(p)+3), 0xFF000000(generic(p)+3),
36 ; CHECK64-SAME: 0xFF00000000(generic(p)+3), 0xFF0000000000(generic(p)+3), 0xFF000000000000(generic(p)+3), 0xFF00000000000000(generic(p)+3),
38 ; CHECK-SAME: 56, 0, 0, 0};
40 ;; Test a case than an unaligned pointer is in a nested struct.
43 %t2o = type { i8, %t2i, i32 }
44 @s2 = addrspace(1) global %t2o {
45 ; CHECK32: .global .align 8 .u8 s2[12] = {
46 ; CHECK64: .global .align 8 .u8 s2[16] = {
50 ; CHECK-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func),
51 ; CHECK64-SAME: 0xFF00000000(func), 0xFF0000000000(func), 0xFF000000000000(func), 0xFF00000000000000(func),
53 ; CHECK-SAME: 0, 0, 0,
54 ; CHECK-SAME: 34, 0, 0, 0};
56 ;; Test that a packed struct which size is not multiple of the pointer size
57 ;; is printed in bytes and uses the mask() operator for pointers even though
58 ;; the pointers are aligned.
60 %t3 = type <{ ptr, i8 }>
61 @s3 = addrspace(1) global %t3 <{
62 ; CHECK32: .global .align 1 .u8 s3[5] = {
63 ; CHECK64: .global .align 1 .u8 s3[9] = {
65 ; CHECK-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func),
66 ; CHECK64-SAME: 0xFF00000000(func), 0xFF0000000000(func), 0xFF000000000000(func), 0xFF00000000000000(func),
70 ;; Test that a packed struct with aligned pointers is printed in words.
72 %t4 = type <{ ptr, i64 }>
73 @s4 = addrspace(1) global %t4 <{
74 ; CHECK32: .global .align 1 .u32 s4[3] = {
75 ; CHECK64: .global .align 1 .u64 s4[2] = {
79 ; CHECK32-SAME: 15, 0};
82 ;; Test that a packed struct with unaligned pointers inside an array is handled.
84 %t5 = type <{ ptr, i16 }>
85 @a5 = addrspace(1) global [2 x %t5] [%t5 <{ ptr @func, i16 5 }>, %t5 <{ ptr @func, i16 9 }> ]
86 ; CHECK32: .global .align 8 .u8 a5[12] = {
87 ; CHECK32-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func), 5, 0,
88 ; CHECK32-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func), 9, 0};
89 ; CHECK64: .global .align 8 .u8 a5[20] = {
90 ; CHECK64-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func),
91 ; CHECK64-SAME: 0xFF00000000(func), 0xFF0000000000(func), 0xFF000000000000(func), 0xFF00000000000000(func),
93 ; CHECK64-SAME: 0xFF(func), 0xFF00(func), 0xFF0000(func), 0xFF000000(func),
94 ; CHECK64-SAME: 0xFF00000000(func), 0xFF0000000000(func), 0xFF000000000000(func), 0xFF00000000000000(func),
95 ; CHECK64-SAME: 9, 0};