1; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX900 %s 2; RUN: llc -march=amdgcn -mcpu=gfx908 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX908 %s 3 4; GCN-LABEL: {{^}}global_atomic_fadd_ret_f32: 5; GCN: [[LOOP:BB[0-9]+_[0-9]+]] 6; GCN: v_add_f32_e32 7; GCN: global_atomic_cmpswap 8; GCN: s_andn2_b64 exec, exec, 9; GCN-NEXT: s_cbranch_execnz [[LOOP]] 10define amdgpu_kernel void @global_atomic_fadd_ret_f32(float addrspace(1)* %ptr) #0 { 11 %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 seq_cst 12 store float %result, float addrspace(1)* undef 13 ret void 14} 15 16; GCN-LABEL: {{^}}global_atomic_fadd_ret_f32_ieee: 17; GCN: [[LOOP:BB[0-9]+_[0-9]+]] 18; GCN: v_add_f32_e32 19; GCN: global_atomic_cmpswap 20; GCN: s_andn2_b64 exec, exec, 21; GCN-NEXT: s_cbranch_execnz [[LOOP]] 22define amdgpu_kernel void @global_atomic_fadd_ret_f32_ieee(float addrspace(1)* %ptr) { 23 %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 seq_cst 24 store float %result, float addrspace(1)* undef 25 ret void 26} 27 28; GCN-LABEL: {{^}}global_atomic_fadd_noret_f32: 29; GFX900: [[LOOP:BB[0-9]+_[0-9]+]] 30; GFX900: v_add_f32_e32 31; GFX900: global_atomic_cmpswap 32; GFX900: s_andn2_b64 exec, exec, 33; GFX900-NEXT: s_cbranch_execnz [[LOOP]] 34 35; GFX908-NOT: v_add_f32 36; GFX908: global_atomic_add_f32 v{{[0-9]+}}, v{{[0-9]+}}, s 37; GFX908-NOT: s_cbranch_execnz 38define amdgpu_kernel void @global_atomic_fadd_noret_f32(float addrspace(1)* %ptr) #0 { 39 %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 seq_cst 40 ret void 41} 42 43; GCN-LABEL: {{^}}global_atomic_fadd_noret_f32_ieee: 44; GCN: global_atomic_cmpswap 45define amdgpu_kernel void @global_atomic_fadd_noret_f32_ieee(float addrspace(1)* %ptr) { 46 %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 seq_cst 47 ret void 48} 49 50; Make sure this artificially selects with an incorrect subtarget, but the feature set. 51; GCN-LABEL: {{^}}global_atomic_fadd_ret_f32_wrong_subtarget: 52define amdgpu_kernel void @global_atomic_fadd_ret_f32_wrong_subtarget(float addrspace(1)* %ptr) #1 { 53 %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 seq_cst 54 store float %result, float addrspace(1)* undef 55 ret void 56} 57 58; GCN-LABEL: {{^}}global_atomic_fadd_noret_f32_wrong_subtarget: 59define amdgpu_kernel void @global_atomic_fadd_noret_f32_wrong_subtarget(float addrspace(1)* %ptr) #1 { 60 %result = atomicrmw fadd float addrspace(1)* %ptr, float 4.0 seq_cst 61 ret void 62} 63 64attributes #0 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign"} 65attributes #1 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign" "target-cpu"="gfx803" "target-features"="+atomic-fadd-insts" } 66