1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx908 < %s | FileCheck --check-prefix=GCN %s
4 ; Test using saddr addressing mode of global_* flat atomic instructions.
6 ; --------------------------------------------------------------------------------
7 ; amdgcn global atomic fadd
8 ; --------------------------------------------------------------------------------
10 define amdgpu_ps void @global_fadd_saddr_f32_nortn(ptr addrspace(1) inreg %sbase, i32 %voffset, float %data) {
11 ; GCN-LABEL: global_fadd_saddr_f32_nortn:
13 ; GCN-NEXT: global_atomic_add_f32 v0, v1, s[2:3]
15 %zext.offset = zext i32 %voffset to i64
16 %gep0 = getelementptr inbounds i8, ptr addrspace(1) %sbase, i64 %zext.offset
17 %ret = call float @llvm.amdgcn.global.atomic.fadd.f32.p1(ptr addrspace(1) %gep0, float %data)
21 define amdgpu_ps void @global_fadd_saddr_f32_nortn_neg128(ptr addrspace(1) inreg %sbase, i32 %voffset, float %data) {
22 ; GCN-LABEL: global_fadd_saddr_f32_nortn_neg128:
24 ; GCN-NEXT: global_atomic_add_f32 v0, v1, s[2:3] offset:-128
26 %zext.offset = zext i32 %voffset to i64
27 %gep0 = getelementptr inbounds i8, ptr addrspace(1) %sbase, i64 %zext.offset
28 %gep1 = getelementptr inbounds i8, ptr addrspace(1) %gep0, i64 -128
29 %ret = call float @llvm.amdgcn.global.atomic.fadd.f32.p1(ptr addrspace(1) %gep1, float %data)
33 define amdgpu_ps void @global_fadd_saddr_v2f16_nortn(ptr addrspace(1) inreg %sbase, i32 %voffset, <2 x half> %data) {
34 ; GCN-LABEL: global_fadd_saddr_v2f16_nortn:
36 ; GCN-NEXT: global_atomic_pk_add_f16 v0, v1, s[2:3]
38 %zext.offset = zext i32 %voffset to i64
39 %gep0 = getelementptr inbounds i8, ptr addrspace(1) %sbase, i64 %zext.offset
40 %ret = call <2 x half> @llvm.amdgcn.global.atomic.fadd.v2f16.p1(ptr addrspace(1) %gep0, <2 x half> %data)
44 define amdgpu_ps void @global_fadd_saddr_v2f16_nortn_neg128(ptr addrspace(1) inreg %sbase, i32 %voffset, <2 x half> %data) {
45 ; GCN-LABEL: global_fadd_saddr_v2f16_nortn_neg128:
47 ; GCN-NEXT: global_atomic_pk_add_f16 v0, v1, s[2:3] offset:-128
49 %zext.offset = zext i32 %voffset to i64
50 %gep0 = getelementptr inbounds i8, ptr addrspace(1) %sbase, i64 %zext.offset
51 %gep1 = getelementptr inbounds i8, ptr addrspace(1) %gep0, i64 -128
52 %ret = call <2 x half> @llvm.amdgcn.global.atomic.fadd.v2f16.p1(ptr addrspace(1) %gep1, <2 x half> %data)
56 declare float @llvm.amdgcn.global.atomic.fadd.f32.p1(ptr addrspace(1) nocapture, float) #0
57 declare <2 x half> @llvm.amdgcn.global.atomic.fadd.v2f16.p1(ptr addrspace(1) nocapture, <2 x half>) #0
59 attributes #0 = { argmemonly nounwind willreturn }