1 ; RUN: llc -march=amdgcn -mcpu=SI -mattr=-fp32-denormals -enable-unsafe-fp-math -verify-machineinstrs < %s | FileCheck -check-prefix=SI-UNSAFE -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=amdgcn -mcpu=SI -mattr=-fp32-denormals -verify-machineinstrs < %s | FileCheck -check-prefix=SI-SAFE -check-prefix=SI -check-prefix=FUNC %s
3 ; XUN: llc -march=amdgcn -mcpu=SI -mattr=+fp32-denormals -verify-machineinstrs < %s | FileCheck -check-prefix=SI-SAFE-SPDENORM -check-prefix=SI -check-prefix=FUNC %s
5 ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG-SAFE -check-prefix=FUNC %s
6 ; RUN: llc -march=r600 -mcpu=cayman -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
8 declare float @llvm.AMDGPU.rcp.f32(float) nounwind readnone
9 declare double @llvm.AMDGPU.rcp.f64(double) nounwind readnone
11 declare float @llvm.sqrt.f32(float) nounwind readnone
13 ; FUNC-LABEL: {{^}}rcp_f32:
16 define void @rcp_f32(float addrspace(1)* %out, float %src) nounwind {
17 %rcp = call float @llvm.AMDGPU.rcp.f32(float %src) nounwind readnone
18 store float %rcp, float addrspace(1)* %out, align 4
22 ; FIXME: Evergreen only ever does unsafe fp math.
23 ; FUNC-LABEL: {{^}}rcp_pat_f32:
25 ; SI-SAFE: v_rcp_f32_e32
26 ; XSI-SAFE-SPDENORM-NOT: v_rcp_f32_e32
30 define void @rcp_pat_f32(float addrspace(1)* %out, float %src) nounwind {
31 %rcp = fdiv float 1.0, %src
32 store float %rcp, float addrspace(1)* %out, align 4
36 ; FUNC-LABEL: {{^}}rsq_rcp_pat_f32:
37 ; SI-UNSAFE: v_rsq_f32_e32
38 ; SI-SAFE: v_sqrt_f32_e32
39 ; SI-SAFE: v_rcp_f32_e32
42 define void @rsq_rcp_pat_f32(float addrspace(1)* %out, float %src) nounwind {
43 %sqrt = call float @llvm.sqrt.f32(float %src) nounwind readnone
44 %rcp = call float @llvm.AMDGPU.rcp.f32(float %sqrt) nounwind readnone
45 store float %rcp, float addrspace(1)* %out, align 4