1; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -verify-machineinstrs --pass-remarks=atomic-expand \ 2; RUN: %s -o - 2>&1 | FileCheck %s --check-prefix=GFX90A-CAS 3 4; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at system memory scope 5; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at agent memory scope 6; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at workgroup memory scope 7; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at wavefront memory scope 8; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at singlethread memory scope 9; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at one-as memory scope 10; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at agent-one-as memory scope 11; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at workgroup-one-as memory scope 12; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at wavefront-one-as memory scope 13; GFX90A-CAS: A compare and swap loop was generated for an atomic fadd operation at singlethread-one-as memory scope 14 15; GFX90A-CAS-LABEL: atomic_add_cas: 16; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 17; GFX90A-CAS: s_cbranch_execnz 18define dso_local void @atomic_add_cas(ptr %p, float %q) { 19entry: 20 %ret = atomicrmw fadd ptr %p, float %q monotonic, align 4 21 ret void 22} 23 24; GFX90A-CAS-LABEL: atomic_add_cas_agent: 25; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 26; GFX90A-CAS: s_cbranch_execnz 27define dso_local void @atomic_add_cas_agent(ptr %p, float %q) { 28entry: 29 %ret = atomicrmw fadd ptr %p, float %q syncscope("agent") monotonic, align 4 30 ret void 31} 32 33; GFX90A-CAS-LABEL: atomic_add_cas_workgroup: 34; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 35; GFX90A-CAS: s_cbranch_execnz 36define dso_local void @atomic_add_cas_workgroup(ptr %p, float %q) { 37entry: 38 %ret = atomicrmw fadd ptr %p, float %q syncscope("workgroup") monotonic, align 4 39 ret void 40} 41 42; GFX90A-CAS-LABEL: atomic_add_cas_wavefront: 43; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 44; GFX90A-CAS: s_cbranch_execnz 45define dso_local void @atomic_add_cas_wavefront(ptr %p, float %q) { 46entry: 47 %ret = atomicrmw fadd ptr %p, float %q syncscope("wavefront") monotonic, align 4 48 ret void 49} 50 51; GFX90A-CAS-LABEL: atomic_add_cas_singlethread: 52; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 53; GFX90A-CAS: s_cbranch_execnz 54define dso_local void @atomic_add_cas_singlethread(ptr %p, float %q) { 55entry: 56 %ret = atomicrmw fadd ptr %p, float %q syncscope("singlethread") monotonic, align 4 57 ret void 58} 59 60; GFX90A-CAS-LABEL: atomic_add_cas_one_as: 61; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 62; GFX90A-CAS: s_cbranch_execnz 63define dso_local void @atomic_add_cas_one_as(ptr %p, float %q) { 64entry: 65 %ret = atomicrmw fadd ptr %p, float %q syncscope("one-as") monotonic, align 4 66 ret void 67} 68 69; GFX90A-CAS-LABEL: atomic_add_cas_agent_one_as: 70; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 71; GFX90A-CAS: s_cbranch_execnz 72define dso_local void @atomic_add_cas_agent_one_as(ptr %p, float %q) { 73entry: 74 %ret = atomicrmw fadd ptr %p, float %q syncscope("agent-one-as") monotonic, align 4 75 ret void 76} 77 78; GFX90A-CAS-LABEL: atomic_add_cas_workgroup_one_as: 79; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 80; GFX90A-CAS: s_cbranch_execnz 81define dso_local void @atomic_add_cas_workgroup_one_as(ptr %p, float %q) { 82entry: 83 %ret = atomicrmw fadd ptr %p, float %q syncscope("workgroup-one-as") monotonic, align 4 84 ret void 85} 86 87; GFX90A-CAS-LABEL: atomic_add_cas_wavefront_one_as: 88; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 89; GFX90A-CAS: s_cbranch_execnz 90define dso_local void @atomic_add_cas_wavefront_one_as(ptr %p, float %q) { 91entry: 92 %ret = atomicrmw fadd ptr %p, float %q syncscope("wavefront-one-as") monotonic, align 4 93 ret void 94} 95 96; GFX90A-CAS-LABEL: atomic_add_cas_singlethread_one_as: 97; GFX90A-CAS: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc 98; GFX90A-CAS: s_cbranch_execnz 99define dso_local void @atomic_add_cas_singlethread_one_as(ptr %p, float %q) { 100entry: 101 %ret = atomicrmw fadd ptr %p, float %q syncscope("singlethread-one-as") monotonic, align 4 102 ret void 103} 104