R600/SI: Add a stub GCNTargetMachine
[oota-llvm.git] / test / CodeGen / R600 / llvm.AMDGPU.rcp.ll
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
4
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
7
8 declare float @llvm.AMDGPU.rcp.f32(float) nounwind readnone
9 declare double @llvm.AMDGPU.rcp.f64(double) nounwind readnone
10
11 declare float @llvm.sqrt.f32(float) nounwind readnone
12
13 ; FUNC-LABEL: {{^}}rcp_f32:
14 ; SI: v_rcp_f32_e32
15 ; EG: RECIP_IEEE
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
19   ret void
20 }
21
22 ; FIXME: Evergreen only ever does unsafe fp math.
23 ; FUNC-LABEL: {{^}}rcp_pat_f32:
24
25 ; SI-SAFE: v_rcp_f32_e32
26 ; XSI-SAFE-SPDENORM-NOT: v_rcp_f32_e32
27
28 ; EG: RECIP_IEEE
29
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
33   ret void
34 }
35
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
40
41 ; EG: RECIPSQRT_IEEE
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
46   ret void
47 }