llvm/llvm/test/CodeGen/AMDGPU/fp-min-max-num-flat-atomics.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -global-isel=0 -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs | FileCheck %s -check-prefixes=GFX12,GFX12-SDAG
; RUN: llc < %s -global-isel=1 -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs | FileCheck %s -check-prefixes=GFX12,GFX12-GISEL

declare float @llvm.amdgcn.flat.atomic.fmin.num.f32.p1.f32(ptr %ptr, float %data)
declare float @llvm.amdgcn.flat.atomic.fmax.num.f32.p1.f32(ptr %ptr, float %data)

define amdgpu_cs void @flat_atomic_fmin_num_f32_noret(ptr %ptr, float %data) {
; GFX12-LABEL: flat_atomic_fmin_num_f32_noret:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    flat_atomic_min_num_f32 v[0:1], v2
; GFX12-NEXT:    s_endpgm
  %ret = call float @llvm.amdgcn.flat.atomic.fmin.num.f32.p1.f32(ptr %ptr, float %data)
  ret void
}

define amdgpu_cs void @flat_atomic_fmax_num_f32_noret(ptr %ptr, float %data) {
; GFX12-LABEL: flat_atomic_fmax_num_f32_noret:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    flat_atomic_max_num_f32 v[0:1], v2
; GFX12-NEXT:    s_endpgm
  %ret = call float @llvm.amdgcn.flat.atomic.fmax.num.f32.p1.f32(ptr %ptr, float %data)
  ret void
}

define amdgpu_cs float @flat_atomic_fmin_num_f32_rtn(ptr %ptr, float %data, ptr %out) {
; GFX12-LABEL: flat_atomic_fmin_num_f32_rtn:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    flat_atomic_min_num_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN
; GFX12-NEXT:    s_wait_loadcnt_dscnt 0x0
; GFX12-NEXT:    flat_store_b32 v[3:4], v0
; GFX12-NEXT:    s_wait_dscnt 0x0
; GFX12-NEXT:    ; return to shader part epilog
  %ret = call float @llvm.amdgcn.flat.atomic.fmin.num.f32.p1.f32(ptr %ptr, float %data)
  store float %ret, ptr %out
  ret float %ret
}

define amdgpu_cs float @flat_atomic_fmax_num_f32_rtn(ptr %ptr, float %data, ptr %out) {
; GFX12-LABEL: flat_atomic_fmax_num_f32_rtn:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    flat_atomic_max_num_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN
; GFX12-NEXT:    s_wait_loadcnt_dscnt 0x0
; GFX12-NEXT:    flat_store_b32 v[3:4], v0
; GFX12-NEXT:    s_wait_dscnt 0x0
; GFX12-NEXT:    ; return to shader part epilog
  %ret = call float @llvm.amdgcn.flat.atomic.fmax.num.f32.p1.f32(ptr %ptr, float %data)
  store float %ret, ptr %out
  ret float %ret
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; GFX12-GISEL: {{.*}}
; GFX12-SDAG: {{.*}}