blob: d6299b8bb142e8ae49d7631a36ea14be3ff2533b [file] [log] [blame]
Stephen Hinesc6a4f5e2014-07-21 00:45:20 -07001; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
3
4declare float @llvm.AMDGPU.rsq.f32(float) nounwind readnone
5
Stephen Hines37ed9c12014-12-01 14:51:49 -08006; FUNC-LABEL: {{^}}rsq_f32:
7; SI: v_rsq_f32_e32 {{v[0-9]+}}, {{s[0-9]+}}
Stephen Hinesc6a4f5e2014-07-21 00:45:20 -07008; EG: RECIPSQRT_IEEE
9define void @rsq_f32(float addrspace(1)* %out, float %src) nounwind {
10 %rsq = call float @llvm.AMDGPU.rsq.f32(float %src) nounwind readnone
11 store float %rsq, float addrspace(1)* %out, align 4
12 ret void
13}
Stephen Hines37ed9c12014-12-01 14:51:49 -080014
15; TODO: Really these should be constant folded
16; FUNC-LABEL: {{^}}rsq_f32_constant_4.0
17; SI: v_rsq_f32_e32 {{v[0-9]+}}, 4.0
18; EG: RECIPSQRT_IEEE
19define void @rsq_f32_constant_4.0(float addrspace(1)* %out) nounwind {
20 %rsq = call float @llvm.AMDGPU.rsq.f32(float 4.0) nounwind readnone
21 store float %rsq, float addrspace(1)* %out, align 4
22 ret void
23}
24
25; FUNC-LABEL: {{^}}rsq_f32_constant_100.0
26; SI: v_rsq_f32_e32 {{v[0-9]+}}, 0x42c80000
27; EG: RECIPSQRT_IEEE
28define void @rsq_f32_constant_100.0(float addrspace(1)* %out) nounwind {
29 %rsq = call float @llvm.AMDGPU.rsq.f32(float 100.0) nounwind readnone
30 store float %rsq, float addrspace(1)* %out, align 4
31 ret void
32}