@@ -158,23 +158,85 @@ void test_ds_faddf(local float *out, float src) {
158158}
159159
160160// CHECK-LABEL: @test_ds_fmin
161- // CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.ds.fmin.f32(ptr addrspace(3) %out, float %src, i32 0, i32 0, i1 false)
161+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
162+ // CHECK: atomicrmw volatile fmin ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
163+
164+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src acquire, align 4{{$}}
165+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src acquire, align 4{{$}}
166+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src release, align 4{{$}}
167+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src acq_rel, align 4{{$}}
168+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src seq_cst, align 4{{$}}
169+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src seq_cst, align 4{{$}}
170+
171+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src syncscope("agent") monotonic, align 4{{$}}
172+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src syncscope("workgroup") monotonic, align 4{{$}}
173+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src syncscope("wavefront") monotonic, align 4{{$}}
174+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src syncscope("singlethread") monotonic, align 4{{$}}
175+ // CHECK: atomicrmw fmin ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
176+
162177#if !defined(__SPIRV__ )
163178void test_ds_fminf (local float * out , float src ) {
164179#else
165180void test_ds_fminf (__attribute__((address_space (3 ))) float * out , float src ) {
166181#endif
167182 * out = __builtin_amdgcn_ds_fminf (out , src , 0 , 0 , false);
183+ * out = __builtin_amdgcn_ds_fminf (out , src , 0 , 0 , true);
184+
185+ // Test all orders.
186+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_CONSUME , __MEMORY_SCOPE_SYSTEM , false);
187+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_ACQUIRE , __MEMORY_SCOPE_SYSTEM , false);
188+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_RELEASE , __MEMORY_SCOPE_SYSTEM , false);
189+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_ACQ_REL , __MEMORY_SCOPE_SYSTEM , false);
190+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_SEQ_CST , __MEMORY_SCOPE_SYSTEM , false);
191+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_SEQ_CST , __MEMORY_SCOPE_SYSTEM , false); // invalid
192+
193+ // Test all syncscopes.
194+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_DEVICE , false);
195+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_WRKGRP , false);
196+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_WVFRNT , false);
197+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_SINGLE , false);
198+ * out = __builtin_amdgcn_ds_fminf (out , src , __ATOMIC_RELAXED , 5 , false); // invalid
168199}
169200
170201// CHECK-LABEL: @test_ds_fmax
171- // CHECK: {{.*}}call{{.*}} float @llvm.amdgcn.ds.fmax.f32(ptr addrspace(3) %out, float %src, i32 0, i32 0, i1 false)
202+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
203+ // CHECK: atomicrmw volatile fmax ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
204+
205+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src acquire, align 4{{$}}
206+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src acquire, align 4{{$}}
207+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src release, align 4{{$}}
208+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src acq_rel, align 4{{$}}
209+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src seq_cst, align 4{{$}}
210+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src seq_cst, align 4{{$}}
211+
212+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src syncscope("agent") monotonic, align 4{{$}}
213+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src syncscope("workgroup") monotonic, align 4{{$}}
214+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src syncscope("wavefront") monotonic, align 4{{$}}
215+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src syncscope("singlethread") monotonic, align 4{{$}}
216+ // CHECK: atomicrmw fmax ptr addrspace(3) %out, float %src monotonic, align 4{{$}}
217+
172218#if !defined(__SPIRV__ )
173219void test_ds_fmaxf (local float * out , float src ) {
174220#else
175221void test_ds_fmaxf (__attribute__((address_space (3 ))) float * out , float src ) {
176222#endif
177223 * out = __builtin_amdgcn_ds_fmaxf (out , src , 0 , 0 , false);
224+ * out = __builtin_amdgcn_ds_fmaxf (out , src , 0 , 0 , true);
225+
226+ // Test all orders.
227+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_CONSUME , __MEMORY_SCOPE_SYSTEM , false);
228+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_ACQUIRE , __MEMORY_SCOPE_SYSTEM , false);
229+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_RELEASE , __MEMORY_SCOPE_SYSTEM , false);
230+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_ACQ_REL , __MEMORY_SCOPE_SYSTEM , false);
231+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_SEQ_CST , __MEMORY_SCOPE_SYSTEM , false);
232+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_SEQ_CST , __MEMORY_SCOPE_SYSTEM , false); // invalid
233+
234+ // Test all syncscopes.
235+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_DEVICE , false);
236+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_WRKGRP , false);
237+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_WVFRNT , false);
238+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_RELAXED , __MEMORY_SCOPE_SINGLE , false);
239+ * out = __builtin_amdgcn_ds_fmaxf (out , src , __ATOMIC_RELAXED , 5 , false); // invalid
178240}
179241
180242// CHECK-LABEL: @test_s_memtime
0 commit comments