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