annotate llvm/test/CodeGen/AMDGPU/local-atomics-fp.ll @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI,GFX678,HAS-ATOMICS %s
anatofuz
parents:
diff changeset
2 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX9,HAS-ATOMICS %s
anatofuz
parents:
diff changeset
3 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX678,NO-ATOMICS %s
anatofuz
parents:
diff changeset
4 ; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX678,NO-ATOMICS %s
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 ; GCN-LABEL: {{^}}lds_atomic_fadd_ret_f32:
anatofuz
parents:
diff changeset
7 ; GFX678-DAG: s_mov_b32 m0
anatofuz
parents:
diff changeset
8 ; GFX9-NOT: m0
anatofuz
parents:
diff changeset
9 ; HAS-ATOMICS-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 4.0
anatofuz
parents:
diff changeset
10 ; HAS-ATOMICS: ds_add_rtn_f32 v0, v0, [[K]]
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 ; NO-ATOMICS: ds_read_b32
anatofuz
parents:
diff changeset
13 ; NO-ATOMICS: v_add_f32
anatofuz
parents:
diff changeset
14 ; NO-ATOMICS: ds_cmpst_rtn_b32
anatofuz
parents:
diff changeset
15 ; NO-ATOMICS: s_cbranch_execnz
anatofuz
parents:
diff changeset
16 define float @lds_atomic_fadd_ret_f32(float addrspace(3)* %ptr) nounwind {
anatofuz
parents:
diff changeset
17 %result = atomicrmw fadd float addrspace(3)* %ptr, float 4.0 seq_cst
anatofuz
parents:
diff changeset
18 ret float %result
anatofuz
parents:
diff changeset
19 }
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 ; GCN-LABEL: {{^}}lds_atomic_fadd_noret_f32:
anatofuz
parents:
diff changeset
22 ; GFX678-DAG: s_mov_b32 m0
anatofuz
parents:
diff changeset
23 ; GFX9-NOT: m0
anatofuz
parents:
diff changeset
24 ; HAS-ATOMICS-DAG: v_mov_b32_e32 [[K:v[0-9]+]], 4.0
anatofuz
parents:
diff changeset
25 ; HAS-ATOMICS: ds_add_f32 v0, [[K]]
anatofuz
parents:
diff changeset
26 define void @lds_atomic_fadd_noret_f32(float addrspace(3)* %ptr) nounwind {
anatofuz
parents:
diff changeset
27 %result = atomicrmw fadd float addrspace(3)* %ptr, float 4.0 seq_cst
anatofuz
parents:
diff changeset
28 ret void
anatofuz
parents:
diff changeset
29 }
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 ; GCN-LABEL: {{^}}lds_ds_fadd:
anatofuz
parents:
diff changeset
32 ; VI-DAG: s_mov_b32 m0
anatofuz
parents:
diff changeset
33 ; GFX9-NOT: m0
anatofuz
parents:
diff changeset
34 ; HAS-ATOMICS-DAG: v_mov_b32_e32 [[V0:v[0-9]+]], 0x42280000
anatofuz
parents:
diff changeset
35 ; HAS-ATOMICS: ds_add_rtn_f32 [[V2:v[0-9]+]], [[V1:v[0-9]+]], [[V0]] offset:32
anatofuz
parents:
diff changeset
36 ; HAS-ATOMICS: ds_add_f32 [[V3:v[0-9]+]], [[V0]] offset:64
anatofuz
parents:
diff changeset
37 ; HAS-ATOMICS: s_waitcnt vmcnt(0) lgkmcnt(0)
anatofuz
parents:
diff changeset
38 ; HAS-ATOMICS: ds_add_rtn_f32 {{v[0-9]+}}, {{v[0-9]+}}, [[V2]]
anatofuz
parents:
diff changeset
39 define amdgpu_kernel void @lds_ds_fadd(float addrspace(1)* %out, float addrspace(3)* %ptrf, i32 %idx) {
anatofuz
parents:
diff changeset
40 %idx.add = add nuw i32 %idx, 4
anatofuz
parents:
diff changeset
41 %shl0 = shl i32 %idx.add, 3
anatofuz
parents:
diff changeset
42 %shl1 = shl i32 %idx.add, 4
anatofuz
parents:
diff changeset
43 %ptr0 = inttoptr i32 %shl0 to float addrspace(3)*
anatofuz
parents:
diff changeset
44 %ptr1 = inttoptr i32 %shl1 to float addrspace(3)*
anatofuz
parents:
diff changeset
45 %a1 = atomicrmw fadd float addrspace(3)* %ptr0, float 4.2e+1 seq_cst
anatofuz
parents:
diff changeset
46 %a2 = atomicrmw fadd float addrspace(3)* %ptr1, float 4.2e+1 seq_cst
anatofuz
parents:
diff changeset
47 %a3 = atomicrmw fadd float addrspace(3)* %ptrf, float %a1 seq_cst
anatofuz
parents:
diff changeset
48 store float %a3, float addrspace(1)* %out
anatofuz
parents:
diff changeset
49 ret void
anatofuz
parents:
diff changeset
50 }
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 ; GCN-LABEL: {{^}}lds_ds_fadd_one_as:
anatofuz
parents:
diff changeset
53 ; VI-DAG: s_mov_b32 m0
anatofuz
parents:
diff changeset
54 ; GFX9-NOT: m0
anatofuz
parents:
diff changeset
55 ; HAS-ATOMICS-DAG: v_mov_b32_e32 [[V0:v[0-9]+]], 0x42280000
anatofuz
parents:
diff changeset
56 ; HAS-ATOMICS: ds_add_rtn_f32 [[V2:v[0-9]+]], [[V1:v[0-9]+]], [[V0]] offset:32
anatofuz
parents:
diff changeset
57 ; HAS-ATOMICS: ds_add_f32 [[V3:v[0-9]+]], [[V0]] offset:64
anatofuz
parents:
diff changeset
58 ; HAS-ATOMICS: s_waitcnt lgkmcnt(1)
anatofuz
parents:
diff changeset
59 ; HAS-ATOMICS: ds_add_rtn_f32 {{v[0-9]+}}, {{v[0-9]+}}, [[V2]]
anatofuz
parents:
diff changeset
60 define amdgpu_kernel void @lds_ds_fadd_one_as(float addrspace(1)* %out, float addrspace(3)* %ptrf, i32 %idx) {
anatofuz
parents:
diff changeset
61 %idx.add = add nuw i32 %idx, 4
anatofuz
parents:
diff changeset
62 %shl0 = shl i32 %idx.add, 3
anatofuz
parents:
diff changeset
63 %shl1 = shl i32 %idx.add, 4
anatofuz
parents:
diff changeset
64 %ptr0 = inttoptr i32 %shl0 to float addrspace(3)*
anatofuz
parents:
diff changeset
65 %ptr1 = inttoptr i32 %shl1 to float addrspace(3)*
anatofuz
parents:
diff changeset
66 %a1 = atomicrmw fadd float addrspace(3)* %ptr0, float 4.2e+1 syncscope("one-as") seq_cst
anatofuz
parents:
diff changeset
67 %a2 = atomicrmw fadd float addrspace(3)* %ptr1, float 4.2e+1 syncscope("one-as") seq_cst
anatofuz
parents:
diff changeset
68 %a3 = atomicrmw fadd float addrspace(3)* %ptrf, float %a1 syncscope("one-as") seq_cst
anatofuz
parents:
diff changeset
69 store float %a3, float addrspace(1)* %out
anatofuz
parents:
diff changeset
70 ret void
anatofuz
parents:
diff changeset
71 }
anatofuz
parents:
diff changeset
72
anatofuz
parents:
diff changeset
73 ; GCN-LABEL: {{^}}lds_atomic_fadd_ret_f64:
anatofuz
parents:
diff changeset
74 ; GCN: ds_read_b64
anatofuz
parents:
diff changeset
75 ; GCN: v_add_f64
anatofuz
parents:
diff changeset
76 ; GCN: ds_cmpst_rtn_b64
anatofuz
parents:
diff changeset
77 ; GCN: s_cbranch_execnz
anatofuz
parents:
diff changeset
78 define double @lds_atomic_fadd_ret_f64(double addrspace(3)* %ptr) nounwind {
anatofuz
parents:
diff changeset
79 %result = atomicrmw fadd double addrspace(3)* %ptr, double 4.0 seq_cst
anatofuz
parents:
diff changeset
80 ret double %result
anatofuz
parents:
diff changeset
81 }
anatofuz
parents:
diff changeset
82
anatofuz
parents:
diff changeset
83 ; GCN-LABEL: {{^}}lds_atomic_fadd_noret_f64:
anatofuz
parents:
diff changeset
84 ; GCN: ds_read_b64
anatofuz
parents:
diff changeset
85 ; GCN: v_add_f64
anatofuz
parents:
diff changeset
86 ; GCN: ds_cmpst_rtn_b64
anatofuz
parents:
diff changeset
87 ; GCN: s_cbranch_execnz
anatofuz
parents:
diff changeset
88 define void @lds_atomic_fadd_noret_f64(double addrspace(3)* %ptr) nounwind {
anatofuz
parents:
diff changeset
89 %result = atomicrmw fadd double addrspace(3)* %ptr, double 4.0 seq_cst
anatofuz
parents:
diff changeset
90 ret void
anatofuz
parents:
diff changeset
91 }
anatofuz
parents:
diff changeset
92
anatofuz
parents:
diff changeset
93 ; GCN-LABEL: {{^}}lds_atomic_fsub_ret_f32:
anatofuz
parents:
diff changeset
94 ; GCN: ds_read_b32
anatofuz
parents:
diff changeset
95 ; GCN: v_sub_f32
anatofuz
parents:
diff changeset
96 ; GCN: ds_cmpst_rtn_b32
anatofuz
parents:
diff changeset
97 ; GCN: s_cbranch_execnz
anatofuz
parents:
diff changeset
98 define float @lds_atomic_fsub_ret_f32(float addrspace(3)* %ptr, float %val) nounwind {
anatofuz
parents:
diff changeset
99 %result = atomicrmw fsub float addrspace(3)* %ptr, float %val seq_cst
anatofuz
parents:
diff changeset
100 ret float %result
anatofuz
parents:
diff changeset
101 }
anatofuz
parents:
diff changeset
102
anatofuz
parents:
diff changeset
103 ; GCN-LABEL: {{^}}lds_atomic_fsub_noret_f32:
anatofuz
parents:
diff changeset
104 ; GCN: ds_read_b32
anatofuz
parents:
diff changeset
105 ; GCN: v_sub_f32
anatofuz
parents:
diff changeset
106 ; GCN: ds_cmpst_rtn_b32
anatofuz
parents:
diff changeset
107 define void @lds_atomic_fsub_noret_f32(float addrspace(3)* %ptr, float %val) nounwind {
anatofuz
parents:
diff changeset
108 %result = atomicrmw fsub float addrspace(3)* %ptr, float %val seq_cst
anatofuz
parents:
diff changeset
109 ret void
anatofuz
parents:
diff changeset
110 }
anatofuz
parents:
diff changeset
111
anatofuz
parents:
diff changeset
112 ; GCN-LABEL: {{^}}lds_atomic_fsub_ret_f64:
anatofuz
parents:
diff changeset
113 ; GCN: ds_read_b64
anatofuz
parents:
diff changeset
114 ; GCN: v_add_f64 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, -v{{\[[0-9]+:[0-9]+\]}}
anatofuz
parents:
diff changeset
115 ; GCN: ds_cmpst_rtn_b64
anatofuz
parents:
diff changeset
116
anatofuz
parents:
diff changeset
117 define double @lds_atomic_fsub_ret_f64(double addrspace(3)* %ptr, double %val) nounwind {
anatofuz
parents:
diff changeset
118 %result = atomicrmw fsub double addrspace(3)* %ptr, double %val seq_cst
anatofuz
parents:
diff changeset
119 ret double %result
anatofuz
parents:
diff changeset
120 }
anatofuz
parents:
diff changeset
121
anatofuz
parents:
diff changeset
122 ; GCN-LABEL: {{^}}lds_atomic_fsub_noret_f64:
anatofuz
parents:
diff changeset
123 ; GCN: ds_read_b64
anatofuz
parents:
diff changeset
124 ; GCN: v_add_f64 v{{\[[0-9]+:[0-9]+\]}}, v{{\[[0-9]+:[0-9]+\]}}, -v{{\[[0-9]+:[0-9]+\]}}
anatofuz
parents:
diff changeset
125 ; GCN: ds_cmpst_rtn_b64
anatofuz
parents:
diff changeset
126 ; GCN: s_cbranch_execnz
anatofuz
parents:
diff changeset
127 define void @lds_atomic_fsub_noret_f64(double addrspace(3)* %ptr, double %val) nounwind {
anatofuz
parents:
diff changeset
128 %result = atomicrmw fsub double addrspace(3)* %ptr, double %val seq_cst
anatofuz
parents:
diff changeset
129 ret void
anatofuz
parents:
diff changeset
130 }