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