1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GFX908 %s
3 ; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GFX90A %s
5 define void @global_atomic_fadd_f32(ptr addrspace(1) %ptr, float %data) {
6 ; GFX908-LABEL: global_atomic_fadd_f32:
8 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
10 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13 ; GFX90A-LABEL: global_atomic_fadd_f32:
15 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
17 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
18 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
19 %ret = call float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) %ptr, float %data)
23 define void @global_atomic_fadd_f32_off_2048(ptr addrspace(1) %ptr, float %data) {
24 ; GFX908-LABEL: global_atomic_fadd_f32_off_2048:
26 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
27 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off offset:2048
28 ; GFX908-NEXT: s_waitcnt vmcnt(0)
29 ; GFX908-NEXT: s_setpc_b64 s[30:31]
31 ; GFX90A-LABEL: global_atomic_fadd_f32_off_2048:
33 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
34 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off offset:2048
35 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
36 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
37 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 512
38 %ret = call float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) %gep, float %data)
42 define void @global_atomic_fadd_f32_off_neg2047(ptr addrspace(1) %ptr, float %data) {
43 ; GFX908-LABEL: global_atomic_fadd_f32_off_neg2047:
45 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
46 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off offset:-2044
47 ; GFX908-NEXT: s_waitcnt vmcnt(0)
48 ; GFX908-NEXT: s_setpc_b64 s[30:31]
50 ; GFX90A-LABEL: global_atomic_fadd_f32_off_neg2047:
52 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
53 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off offset:-2044
54 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
55 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
56 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 -511
57 %ret = call float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) %gep, float %data)
61 define amdgpu_kernel void @global_atomic_fadd_f32_off_ss(ptr addrspace(1) %ptr, float %data) {
62 ; GFX908-LABEL: global_atomic_fadd_f32_off_ss:
64 ; GFX908-NEXT: s_load_dword s2, s[6:7], 0x8
65 ; GFX908-NEXT: s_load_dwordx2 s[0:1], s[6:7], 0x0
66 ; GFX908-NEXT: v_mov_b32_e32 v1, 0
67 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
68 ; GFX908-NEXT: v_mov_b32_e32 v0, s2
69 ; GFX908-NEXT: global_atomic_add_f32 v1, v0, s[0:1] offset:2048
70 ; GFX908-NEXT: s_endpgm
72 ; GFX90A-LABEL: global_atomic_fadd_f32_off_ss:
74 ; GFX90A-NEXT: s_load_dword s2, s[6:7], 0x8
75 ; GFX90A-NEXT: s_load_dwordx2 s[0:1], s[6:7], 0x0
76 ; GFX90A-NEXT: v_mov_b32_e32 v1, 0
77 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
78 ; GFX90A-NEXT: v_mov_b32_e32 v0, s2
79 ; GFX90A-NEXT: global_atomic_add_f32 v1, v0, s[0:1] offset:2048
80 ; GFX90A-NEXT: s_endpgm
81 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 512
82 %ret = call float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) %gep, float %data)
86 define void @global_atomic_fadd_v2f16(ptr addrspace(1) %ptr, <2 x half> %data) {
87 ; GFX908-LABEL: global_atomic_fadd_v2f16:
89 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
90 ; GFX908-NEXT: global_atomic_pk_add_f16 v[0:1], v2, off
91 ; GFX908-NEXT: s_waitcnt vmcnt(0)
92 ; GFX908-NEXT: s_setpc_b64 s[30:31]
94 ; GFX90A-LABEL: global_atomic_fadd_v2f16:
96 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
97 ; GFX90A-NEXT: global_atomic_pk_add_f16 v[0:1], v2, off
98 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
99 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
100 %ret = call <2 x half> @llvm.amdgcn.global.atomic.fadd.v2f16.p1.v2f16(ptr addrspace(1) %ptr, <2 x half> %data)
104 define void @global_atomic_fadd_v2f16_off_neg2047(ptr addrspace(1) %ptr, <2 x half> %data) {
105 ; GFX908-LABEL: global_atomic_fadd_v2f16_off_neg2047:
107 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
108 ; GFX908-NEXT: global_atomic_pk_add_f16 v[0:1], v2, off offset:-2044
109 ; GFX908-NEXT: s_waitcnt vmcnt(0)
110 ; GFX908-NEXT: s_setpc_b64 s[30:31]
112 ; GFX90A-LABEL: global_atomic_fadd_v2f16_off_neg2047:
114 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
115 ; GFX90A-NEXT: global_atomic_pk_add_f16 v[0:1], v2, off offset:-2044
116 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
117 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
118 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 -511
119 %ret = call <2 x half> @llvm.amdgcn.global.atomic.fadd.v2f16.p1.v2f16(ptr addrspace(1) %gep, <2 x half> %data)
123 declare float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) nocapture, float) #0
124 declare <2 x half> @llvm.amdgcn.global.atomic.fadd.v2f16.p1.v2f16(ptr addrspace(1) nocapture, <2 x half>) #0
126 attributes #0 = { argmemonly nounwind willreturn }