1 ; RUN: llc < %s --mtriple=nvptx64-unknown-unknown | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s --mtriple=nvptx64-unknown-unknown | %ptxas-verify %}
4 ; This is IR generated with clang using -O3 optimization level
5 ; and nvptx-unknown-unknown target from the following C code.
7 ; struct StNoalign { unsigned int field[5]; };
8 ; struct StAlign8 { _Alignas(8) unsigned int field[5]; };
9 ; struct StAlign16 { _Alignas(16) unsigned int field[5]; };
11 ; #define DECLARE_FUNC(StName) \
12 ; struct StName func_##StName(struct StName in) { \
13 ; struct StName ret; \
14 ; ret.field[4] = in.field[0]; \
18 ; DECLARE_FUNC(StNoalign)
19 ; DECLARE_FUNC(StAlign8)
20 ; DECLARE_FUNC(StAlign16)
22 %struct.StNoalign = type { [5 x i32] }
24 define %struct.StNoalign @func_StNoalign(ptr nocapture noundef readonly byval(%struct.StNoalign) align 4 %in) {
25 ; CHECK-LABEL: .func{{.*}}func_StNoalign
26 ; CHECK: ld.param.u32 [[R1:%r[0-9]+]], [func_StNoalign_param_0];
27 ; CHECK-NOT: st.param.b32 [func_retval0+0], %r{{[0-9]+}};
28 ; CHECK-NOT: st.param.b32 [func_retval0+4], %r{{[0-9]+}};
29 ; CHECK-NOT: st.param.b32 [func_retval0+8], %r{{[0-9]+}};
30 ; CHECK-NOT: st.param.b32 [func_retval0+12], %r{{[0-9]+}};
31 ; CHECK: st.param.b32 [func_retval0+16], [[R1]];
33 %1 = load i32, ptr %in, align 4
34 %.fca.0.4.insert = insertvalue %struct.StNoalign { [5 x i32] [i32 undef, i32 undef, i32 undef, i32 undef, i32 poison] }, i32 %1, 0, 4
35 ret %struct.StNoalign %.fca.0.4.insert
38 %struct.StAlign8 = type { [5 x i32], [4 x i8] }
40 define %struct.StAlign8 @func_StAlign8(ptr nocapture noundef readonly byval(%struct.StAlign8) align 8 %in) {
41 ; CHECK-LABEL: .func{{.*}}func_StAlign8
42 ; CHECK: ld.param.u32 [[R1:%r[0-9]+]], [func_StAlign8_param_0];
43 ; CHECK-NOT: st.param.b32 [func_retval0+0], %r{{[0-9]+}};
44 ; CHECK-NOT: st.param.b32 [func_retval0+4], %r{{[0-9]+}};
45 ; CHECK-NOT: st.param.b32 [func_retval0+8], %r{{[0-9]+}};
46 ; CHECK-NOT: st.param.b32 [func_retval0+12], %r{{[0-9]+}};
47 ; CHECK: st.param.b32 [func_retval0+16], [[R1]];
48 ; CHECK-NOT: st.param.v4.b8 [func_retval0+20], {%rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}};
50 %1 = load i32, ptr %in, align 8
51 %.fca.0.4.insert = insertvalue %struct.StAlign8 { [5 x i32] [i32 undef, i32 undef, i32 undef, i32 undef, i32 poison], [4 x i8] poison }, i32 %1, 0, 4
52 ret %struct.StAlign8 %.fca.0.4.insert
55 %struct.StAlign16 = type { [5 x i32], [12 x i8] }
57 define %struct.StAlign16 @func_StAlign16(ptr nocapture noundef readonly byval(%struct.StAlign16) align 16 %in) {
58 ; CHECK-LABEL: .func{{.*}}func_StAlign16
59 ; CHECK: ld.param.u32 [[R1:%r[0-9]+]], [func_StAlign16_param_0];
60 ; CHECK-NOT: st.param.b32 [func_retval0+0], %r{{[0-9]+}};
61 ; CHECK-NOT: st.param.b32 [func_retval0+4], %r{{[0-9]+}};
62 ; CHECK-NOT: st.param.b32 [func_retval0+8], %r{{[0-9]+}};
63 ; CHECK-NOT: st.param.b32 [func_retval0+12], %r{{[0-9]+}};
64 ; CHECK: st.param.b32 [func_retval0+16], [[R1]];
65 ; CHECK-NOT: st.param.v4.b8 [func_retval0+20], {%rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}};
66 ; CHECK-NOT: st.param.v4.b8 [func_retval0+24], {%rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}};
67 ; CHECK-NOT: st.param.v4.b8 [func_retval0+28], {%rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}, %rs{{[0-9]+}}};
69 %1 = load i32, ptr %in, align 16
70 %.fca.0.4.insert = insertvalue %struct.StAlign16 { [5 x i32] [i32 undef, i32 undef, i32 undef, i32 undef, i32 poison], [12 x i8] poison }, i32 %1, 0, 4
71 ret %struct.StAlign16 %.fca.0.4.insert