1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_20 | %ptxas-verify %}
5 define void @plain(ptr %a, ptr %b, ptr %c, ptr %d) local_unnamed_addr {
6 ; CHECK: ld.u8 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
7 %a.load = load i8, ptr %a
8 %a.add = add i8 %a.load, 1
9 ; CHECK: st.u8 [%rd{{[0-9]+}}], %rs{{[0-9]+}}
10 store i8 %a.add, ptr %a
12 ; CHECK: ld.u16 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
13 %b.load = load i16, ptr %b
14 %b.add = add i16 %b.load, 1
15 ; CHECK: st.u16 [%rd{{[0-9]+}}], %rs{{[0-9]+}}
16 store i16 %b.add, ptr %b
18 ; CHECK: ld.u32 %r{{[0-9]+}}, [%rd{{[0-9]+}}]
19 %c.load = load i32, ptr %c
20 %c.add = add i32 %c.load, 1
21 ; CHECK: st.u32 [%rd{{[0-9]+}}], %r{{[0-9]+}}
22 store i32 %c.add, ptr %c
24 ; CHECK: ld.u64 %rd{{[0-9]+}}, [%rd{{[0-9]+}}]
25 %d.load = load i64, ptr %d
26 %d.add = add i64 %d.load, 1
27 ; CHECK: st.u64 [%rd{{[0-9]+}}], %rd{{[0-9]+}}
28 store i64 %d.add, ptr %d
33 ; CHECK-LABEL: volatile
34 define void @volatile(ptr %a, ptr %b, ptr %c, ptr %d) local_unnamed_addr {
35 ; CHECK: ld.volatile.u8 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
36 %a.load = load volatile i8, ptr %a
37 %a.add = add i8 %a.load, 1
38 ; CHECK: st.volatile.u8 [%rd{{[0-9]+}}], %rs{{[0-9]+}}
39 store volatile i8 %a.add, ptr %a
41 ; CHECK: ld.volatile.u16 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
42 %b.load = load volatile i16, ptr %b
43 %b.add = add i16 %b.load, 1
44 ; CHECK: st.volatile.u16 [%rd{{[0-9]+}}], %rs{{[0-9]+}}
45 store volatile i16 %b.add, ptr %b
47 ; CHECK: ld.volatile.u32 %r{{[0-9]+}}, [%rd{{[0-9]+}}]
48 %c.load = load volatile i32, ptr %c
49 %c.add = add i32 %c.load, 1
50 ; CHECK: st.volatile.u32 [%rd{{[0-9]+}}], %r{{[0-9]+}}
51 store volatile i32 %c.add, ptr %c
53 ; CHECK: ld.volatile.u64 %rd{{[0-9]+}}, [%rd{{[0-9]+}}]
54 %d.load = load volatile i64, ptr %d
55 %d.add = add i64 %d.load, 1
56 ; CHECK: st.volatile.u64 [%rd{{[0-9]+}}], %rd{{[0-9]+}}
57 store volatile i64 %d.add, ptr %d
62 ; CHECK-LABEL: monotonic
63 define void @monotonic(ptr %a, ptr %b, ptr %c, ptr %d, ptr %e) local_unnamed_addr {
64 ; CHECK: ld.volatile.u8 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
65 %a.load = load atomic i8, ptr %a monotonic, align 1
66 %a.add = add i8 %a.load, 1
67 ; CHECK: st.volatile.u8 [%rd{{[0-9]+}}], %rs{{[0-9]+}}
68 store atomic i8 %a.add, ptr %a monotonic, align 1
70 ; CHECK: ld.volatile.u16 %rs{{[0-9]+}}, [%rd{{[0-9]+}}]
71 %b.load = load atomic i16, ptr %b monotonic, align 2
72 %b.add = add i16 %b.load, 1
73 ; CHECK: st.volatile.u16 [%rd{{[0-9]+}}], %rs{{[0-9]+}}
74 store atomic i16 %b.add, ptr %b monotonic, align 2
76 ; CHECK: ld.volatile.u32 %r{{[0-9]+}}, [%rd{{[0-9]+}}]
77 %c.load = load atomic i32, ptr %c monotonic, align 4
78 %c.add = add i32 %c.load, 1
79 ; CHECK: st.volatile.u32 [%rd{{[0-9]+}}], %r{{[0-9]+}}
80 store atomic i32 %c.add, ptr %c monotonic, align 4
82 ; CHECK: ld.volatile.u64 %rd{{[0-9]+}}, [%rd{{[0-9]+}}]
83 %d.load = load atomic i64, ptr %d monotonic, align 8
84 %d.add = add i64 %d.load, 1
85 ; CHECK: st.volatile.u64 [%rd{{[0-9]+}}], %rd{{[0-9]+}}
86 store atomic i64 %d.add, ptr %d monotonic, align 8
88 ; CHECK: ld.volatile.f32 %f{{[0-9]+}}, [%rd{{[0-9]+}}]
89 %e.load = load atomic float, ptr %e monotonic, align 4
90 %e.add = fadd float %e.load, 1.0
91 ; CHECK: st.volatile.f32 [%rd{{[0-9]+}}], %f{{[0-9]+}}
92 store atomic float %e.add, ptr %e monotonic, align 4