Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AMDGPU/fpenv.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

375 lines
17 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=amdgcn -global-isel=0 -mcpu=tahiti < %s | FileCheck -check-prefixes=GFX6-SDAG %s
; RUN: llc -mtriple=amdgcn -global-isel=1 -new-reg-bank-select -mcpu=tahiti < %s | FileCheck -check-prefixes=GFX6-ISEL %s
; RUN: llc -mtriple=amdgcn -global-isel=0 -mcpu=fiji < %s | FileCheck -check-prefixes=GFX8-SDAG %s
; RUN: llc -mtriple=amdgcn -global-isel=1 -new-reg-bank-select -mcpu=fiji < %s | FileCheck -check-prefixes=GFX8-ISEL %s
; RUN: llc -mtriple=amdgcn -global-isel=0 -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9-SDAG %s
; RUN: llc -mtriple=amdgcn -global-isel=1 -new-reg-bank-select -mcpu=gfx900 < %s | FileCheck -check-prefixes=GFX9-ISEL %s
; RUN: llc -mtriple=amdgcn -global-isel=0 -mcpu=gfx1030 < %s | FileCheck -check-prefixes=GFX10-SDAG %s
; RUN: llc -mtriple=amdgcn -global-isel=1 -new-reg-bank-select -mcpu=gfx1030 < %s | FileCheck -check-prefixes=GFX10-ISEL %s
; RUN: llc -mtriple=amdgcn -amdgpu-enable-delay-alu=0 -global-isel=0 -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GFX11-SDAG %s
; RUN: llc -mtriple=amdgcn -amdgpu-enable-delay-alu=0 -global-isel=1 -new-reg-bank-select -mcpu=gfx1100 < %s | FileCheck -check-prefixes=GFX11-ISEL %s
declare i64 @llvm.get.fpenv.i64()
declare void @llvm.set.fpenv.i64(i64)
define i64 @get_fpenv() {
; GFX6-SDAG-LABEL: get_fpenv:
; GFX6-SDAG: ; %bb.0: ; %entry
; GFX6-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX6-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX6-SDAG-NEXT: v_mov_b32_e32 v0, s5
; GFX6-SDAG-NEXT: v_mov_b32_e32 v1, s4
; GFX6-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX6-ISEL-LABEL: get_fpenv:
; GFX6-ISEL: ; %bb.0: ; %entry
; GFX6-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX6-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX6-ISEL-NEXT: v_mov_b32_e32 v0, s4
; GFX6-ISEL-NEXT: v_mov_b32_e32 v1, s5
; GFX6-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-SDAG-LABEL: get_fpenv:
; GFX8-SDAG: ; %bb.0: ; %entry
; GFX8-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX8-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX8-SDAG-NEXT: v_mov_b32_e32 v0, s5
; GFX8-SDAG-NEXT: v_mov_b32_e32 v1, s4
; GFX8-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-ISEL-LABEL: get_fpenv:
; GFX8-ISEL: ; %bb.0: ; %entry
; GFX8-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX8-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX8-ISEL-NEXT: v_mov_b32_e32 v0, s4
; GFX8-ISEL-NEXT: v_mov_b32_e32 v1, s5
; GFX8-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-SDAG-LABEL: get_fpenv:
; GFX9-SDAG: ; %bb.0: ; %entry
; GFX9-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX9-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX9-SDAG-NEXT: v_mov_b32_e32 v0, s5
; GFX9-SDAG-NEXT: v_mov_b32_e32 v1, s4
; GFX9-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-ISEL-LABEL: get_fpenv:
; GFX9-ISEL: ; %bb.0: ; %entry
; GFX9-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX9-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX9-ISEL-NEXT: v_mov_b32_e32 v0, s4
; GFX9-ISEL-NEXT: v_mov_b32_e32 v1, s5
; GFX9-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-SDAG-LABEL: get_fpenv:
; GFX10-SDAG: ; %bb.0: ; %entry
; GFX10-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX10-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX10-SDAG-NEXT: v_mov_b32_e32 v1, s4
; GFX10-SDAG-NEXT: v_mov_b32_e32 v0, s5
; GFX10-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-ISEL-LABEL: get_fpenv:
; GFX10-ISEL: ; %bb.0: ; %entry
; GFX10-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX10-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX10-ISEL-NEXT: v_mov_b32_e32 v0, s4
; GFX10-ISEL-NEXT: v_mov_b32_e32 v1, s5
; GFX10-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-SDAG-LABEL: get_fpenv:
; GFX11-SDAG: ; %bb.0: ; %entry
; GFX11-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-SDAG-NEXT: s_getreg_b32 s0, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX11-SDAG-NEXT: s_getreg_b32 s1, hwreg(HW_REG_MODE, 0, 23)
; GFX11-SDAG-NEXT: v_dual_mov_b32 v1, s0 :: v_dual_mov_b32 v0, s1
; GFX11-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-ISEL-LABEL: get_fpenv:
; GFX11-ISEL: ; %bb.0: ; %entry
; GFX11-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-ISEL-NEXT: s_getreg_b32 s0, hwreg(HW_REG_MODE, 0, 23)
; GFX11-ISEL-NEXT: s_getreg_b32 s1, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX11-ISEL-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
; GFX11-ISEL-NEXT: s_setpc_b64 s[30:31]
entry:
%0 = call i64 @llvm.get.fpenv.i64()
ret i64 %0
}
define void @set_fpenv(i64 %env) {
; GFX6-SDAG-LABEL: set_fpenv:
; GFX6-SDAG: ; %bb.0: ; %entry
; GFX6-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-SDAG-NEXT: v_readfirstlane_b32 s4, v0
; GFX6-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX6-SDAG-NEXT: v_readfirstlane_b32 s4, v1
; GFX6-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX6-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX6-ISEL-LABEL: set_fpenv:
; GFX6-ISEL: ; %bb.0: ; %entry
; GFX6-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-ISEL-NEXT: v_readfirstlane_b32 s4, v0
; GFX6-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX6-ISEL-NEXT: v_readfirstlane_b32 s4, v1
; GFX6-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX6-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-SDAG-LABEL: set_fpenv:
; GFX8-SDAG: ; %bb.0: ; %entry
; GFX8-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-SDAG-NEXT: v_readfirstlane_b32 s4, v0
; GFX8-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX8-SDAG-NEXT: v_readfirstlane_b32 s4, v1
; GFX8-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX8-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-ISEL-LABEL: set_fpenv:
; GFX8-ISEL: ; %bb.0: ; %entry
; GFX8-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-ISEL-NEXT: v_readfirstlane_b32 s4, v0
; GFX8-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX8-ISEL-NEXT: v_readfirstlane_b32 s4, v1
; GFX8-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX8-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-SDAG-LABEL: set_fpenv:
; GFX9-SDAG: ; %bb.0: ; %entry
; GFX9-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-SDAG-NEXT: v_readfirstlane_b32 s4, v0
; GFX9-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX9-SDAG-NEXT: v_readfirstlane_b32 s4, v1
; GFX9-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX9-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-ISEL-LABEL: set_fpenv:
; GFX9-ISEL: ; %bb.0: ; %entry
; GFX9-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-ISEL-NEXT: v_readfirstlane_b32 s4, v0
; GFX9-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX9-ISEL-NEXT: v_readfirstlane_b32 s4, v1
; GFX9-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX9-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-SDAG-LABEL: set_fpenv:
; GFX10-SDAG: ; %bb.0: ; %entry
; GFX10-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-SDAG-NEXT: v_readfirstlane_b32 s4, v0
; GFX10-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX10-SDAG-NEXT: v_readfirstlane_b32 s4, v1
; GFX10-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX10-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-ISEL-LABEL: set_fpenv:
; GFX10-ISEL: ; %bb.0: ; %entry
; GFX10-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-ISEL-NEXT: v_readfirstlane_b32 s4, v0
; GFX10-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX10-ISEL-NEXT: v_readfirstlane_b32 s4, v1
; GFX10-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX10-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-SDAG-LABEL: set_fpenv:
; GFX11-SDAG: ; %bb.0: ; %entry
; GFX11-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-SDAG-NEXT: v_readfirstlane_b32 s0, v0
; GFX11-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s0
; GFX11-SDAG-NEXT: v_readfirstlane_b32 s0, v1
; GFX11-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s0
; GFX11-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-ISEL-LABEL: set_fpenv:
; GFX11-ISEL: ; %bb.0: ; %entry
; GFX11-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-ISEL-NEXT: v_readfirstlane_b32 s0, v0
; GFX11-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s0
; GFX11-ISEL-NEXT: v_readfirstlane_b32 s0, v1
; GFX11-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s0
; GFX11-ISEL-NEXT: s_setpc_b64 s[30:31]
entry:
call void @llvm.set.fpenv.i64(i64 %env)
ret void
}
define void @set_fpenv_constant() {
; GFX6-SDAG-LABEL: set_fpenv_constant:
; GFX6-SDAG: ; %bb.0: ; %entry
; GFX6-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX6-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX6-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX6-ISEL-LABEL: set_fpenv_constant:
; GFX6-ISEL: ; %bb.0: ; %entry
; GFX6-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX6-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX6-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-SDAG-LABEL: set_fpenv_constant:
; GFX8-SDAG: ; %bb.0: ; %entry
; GFX8-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX8-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX8-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-ISEL-LABEL: set_fpenv_constant:
; GFX8-ISEL: ; %bb.0: ; %entry
; GFX8-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX8-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX8-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-SDAG-LABEL: set_fpenv_constant:
; GFX9-SDAG: ; %bb.0: ; %entry
; GFX9-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX9-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX9-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-ISEL-LABEL: set_fpenv_constant:
; GFX9-ISEL: ; %bb.0: ; %entry
; GFX9-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX9-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX9-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-SDAG-LABEL: set_fpenv_constant:
; GFX10-SDAG: ; %bb.0: ; %entry
; GFX10-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX10-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX10-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-ISEL-LABEL: set_fpenv_constant:
; GFX10-ISEL: ; %bb.0: ; %entry
; GFX10-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX10-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX10-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-SDAG-LABEL: set_fpenv_constant:
; GFX11-SDAG: ; %bb.0: ; %entry
; GFX11-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX11-SDAG-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX11-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-ISEL-LABEL: set_fpenv_constant:
; GFX11-ISEL: ; %bb.0: ; %entry
; GFX11-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 0, 23), 0
; GFX11-ISEL-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_TRAPSTS, 0, 5), 0
; GFX11-ISEL-NEXT: s_setpc_b64 s[30:31]
entry:
call void @llvm.set.fpenv.i64(i64 0)
ret void
}
define void @get_set_fpenv() {
; GFX6-SDAG-LABEL: get_set_fpenv:
; GFX6-SDAG: ; %bb.0: ; %entry
; GFX6-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX6-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX6-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s5
; GFX6-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX6-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX6-ISEL-LABEL: get_set_fpenv:
; GFX6-ISEL: ; %bb.0: ; %entry
; GFX6-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX6-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX6-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX6-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX6-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s5
; GFX6-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-SDAG-LABEL: get_set_fpenv:
; GFX8-SDAG: ; %bb.0: ; %entry
; GFX8-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX8-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX8-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s5
; GFX8-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX8-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX8-ISEL-LABEL: get_set_fpenv:
; GFX8-ISEL: ; %bb.0: ; %entry
; GFX8-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX8-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX8-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX8-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX8-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s5
; GFX8-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-SDAG-LABEL: get_set_fpenv:
; GFX9-SDAG: ; %bb.0: ; %entry
; GFX9-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX9-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX9-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s5
; GFX9-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX9-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX9-ISEL-LABEL: get_set_fpenv:
; GFX9-ISEL: ; %bb.0: ; %entry
; GFX9-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX9-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX9-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX9-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX9-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s5
; GFX9-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-SDAG-LABEL: get_set_fpenv:
; GFX10-SDAG: ; %bb.0: ; %entry
; GFX10-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-SDAG-NEXT: s_getreg_b32 s4, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX10-SDAG-NEXT: s_getreg_b32 s5, hwreg(HW_REG_MODE, 0, 23)
; GFX10-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s5
; GFX10-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s4
; GFX10-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX10-ISEL-LABEL: get_set_fpenv:
; GFX10-ISEL: ; %bb.0: ; %entry
; GFX10-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX10-ISEL-NEXT: s_getreg_b32 s4, hwreg(HW_REG_MODE, 0, 23)
; GFX10-ISEL-NEXT: s_getreg_b32 s5, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX10-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s4
; GFX10-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s5
; GFX10-ISEL-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-SDAG-LABEL: get_set_fpenv:
; GFX11-SDAG: ; %bb.0: ; %entry
; GFX11-SDAG-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-SDAG-NEXT: s_getreg_b32 s0, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX11-SDAG-NEXT: s_getreg_b32 s1, hwreg(HW_REG_MODE, 0, 23)
; GFX11-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s1
; GFX11-SDAG-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s0
; GFX11-SDAG-NEXT: s_setpc_b64 s[30:31]
;
; GFX11-ISEL-LABEL: get_set_fpenv:
; GFX11-ISEL: ; %bb.0: ; %entry
; GFX11-ISEL-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; GFX11-ISEL-NEXT: s_getreg_b32 s0, hwreg(HW_REG_MODE, 0, 23)
; GFX11-ISEL-NEXT: s_getreg_b32 s1, hwreg(HW_REG_TRAPSTS, 0, 5)
; GFX11-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_MODE, 0, 23), s0
; GFX11-ISEL-NEXT: s_setreg_b32 hwreg(HW_REG_TRAPSTS, 0, 5), s1
; GFX11-ISEL-NEXT: s_setpc_b64 s[30:31]
entry:
%0 = call i64 @llvm.get.fpenv.i64()
call void @llvm.set.fpenv.i64(i64 %0)
ret void
}