1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.amdgcn.rcp.f32(float) #0 4*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.amdgcn.rcp.f64(double) #0 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.sqrt.f64(double) #0 7*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.sqrt.f32(float) #0 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}rcp_undef_f32: 10*9880d681SAndroid Build Coastguard Worker; SI-NOT: v_rcp_f32 11*9880d681SAndroid Build Coastguard Workerdefine void @rcp_undef_f32(float addrspace(1)* %out) #1 { 12*9880d681SAndroid Build Coastguard Worker %rcp = call float @llvm.amdgcn.rcp.f32(float undef) 13*9880d681SAndroid Build Coastguard Worker store float %rcp, float addrspace(1)* %out, align 4 14*9880d681SAndroid Build Coastguard Worker ret void 15*9880d681SAndroid Build Coastguard Worker} 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}safe_no_fp32_denormals_rcp_f32: 18*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f32_e32 [[RESULT:v[0-9]+]], s{{[0-9]+}} 19*9880d681SAndroid Build Coastguard Worker; SI-NOT: [[RESULT]] 20*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dword [[RESULT]] 21*9880d681SAndroid Build Coastguard Workerdefine void @safe_no_fp32_denormals_rcp_f32(float addrspace(1)* %out, float %src) #1 { 22*9880d681SAndroid Build Coastguard Worker %rcp = fdiv float 1.0, %src 23*9880d681SAndroid Build Coastguard Worker store float %rcp, float addrspace(1)* %out, align 4 24*9880d681SAndroid Build Coastguard Worker ret void 25*9880d681SAndroid Build Coastguard Worker} 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}safe_f32_denormals_rcp_pat_f32: 28*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f32_e32 [[RESULT:v[0-9]+]], s{{[0-9]+}} 29*9880d681SAndroid Build Coastguard Worker; SI-NOT: [[RESULT]] 30*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dword [[RESULT]] 31*9880d681SAndroid Build Coastguard Workerdefine void @safe_f32_denormals_rcp_pat_f32(float addrspace(1)* %out, float %src) #4 { 32*9880d681SAndroid Build Coastguard Worker %rcp = fdiv float 1.0, %src 33*9880d681SAndroid Build Coastguard Worker store float %rcp, float addrspace(1)* %out, align 4 34*9880d681SAndroid Build Coastguard Worker ret void 35*9880d681SAndroid Build Coastguard Worker} 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}unsafe_f32_denormals_rcp_pat_f32: 38*9880d681SAndroid Build Coastguard Worker; SI: v_div_scale_f32 39*9880d681SAndroid Build Coastguard Workerdefine void @unsafe_f32_denormals_rcp_pat_f32(float addrspace(1)* %out, float %src) #3 { 40*9880d681SAndroid Build Coastguard Worker %rcp = fdiv float 1.0, %src 41*9880d681SAndroid Build Coastguard Worker store float %rcp, float addrspace(1)* %out, align 4 42*9880d681SAndroid Build Coastguard Worker ret void 43*9880d681SAndroid Build Coastguard Worker} 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}safe_rsq_rcp_pat_f32: 46*9880d681SAndroid Build Coastguard Worker; SI: v_sqrt_f32_e32 47*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f32_e32 48*9880d681SAndroid Build Coastguard Workerdefine void @safe_rsq_rcp_pat_f32(float addrspace(1)* %out, float %src) #1 { 49*9880d681SAndroid Build Coastguard Worker %sqrt = call float @llvm.sqrt.f32(float %src) 50*9880d681SAndroid Build Coastguard Worker %rcp = call float @llvm.amdgcn.rcp.f32(float %sqrt) 51*9880d681SAndroid Build Coastguard Worker store float %rcp, float addrspace(1)* %out, align 4 52*9880d681SAndroid Build Coastguard Worker ret void 53*9880d681SAndroid Build Coastguard Worker} 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}unsafe_rsq_rcp_pat_f32: 56*9880d681SAndroid Build Coastguard Worker; SI: v_rsq_f32_e32 57*9880d681SAndroid Build Coastguard Workerdefine void @unsafe_rsq_rcp_pat_f32(float addrspace(1)* %out, float %src) #2 { 58*9880d681SAndroid Build Coastguard Worker %sqrt = call float @llvm.sqrt.f32(float %src) 59*9880d681SAndroid Build Coastguard Worker %rcp = call float @llvm.amdgcn.rcp.f32(float %sqrt) 60*9880d681SAndroid Build Coastguard Worker store float %rcp, float addrspace(1)* %out, align 4 61*9880d681SAndroid Build Coastguard Worker ret void 62*9880d681SAndroid Build Coastguard Worker} 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}rcp_f64: 65*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f64_e32 [[RESULT:v\[[0-9]+:[0-9]+\]]], s{{\[[0-9]+:[0-9]+\]}} 66*9880d681SAndroid Build Coastguard Worker; SI-NOT: [[RESULT]] 67*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dwordx2 [[RESULT]] 68*9880d681SAndroid Build Coastguard Workerdefine void @rcp_f64(double addrspace(1)* %out, double %src) #1 { 69*9880d681SAndroid Build Coastguard Worker %rcp = call double @llvm.amdgcn.rcp.f64(double %src) 70*9880d681SAndroid Build Coastguard Worker store double %rcp, double addrspace(1)* %out, align 8 71*9880d681SAndroid Build Coastguard Worker ret void 72*9880d681SAndroid Build Coastguard Worker} 73*9880d681SAndroid Build Coastguard Worker 74*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}unsafe_rcp_f64: 75*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f64_e32 [[RESULT:v\[[0-9]+:[0-9]+\]]], s{{\[[0-9]+:[0-9]+\]}} 76*9880d681SAndroid Build Coastguard Worker; SI-NOT: [[RESULT]] 77*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dwordx2 [[RESULT]] 78*9880d681SAndroid Build Coastguard Workerdefine void @unsafe_rcp_f64(double addrspace(1)* %out, double %src) #2 { 79*9880d681SAndroid Build Coastguard Worker %rcp = call double @llvm.amdgcn.rcp.f64(double %src) 80*9880d681SAndroid Build Coastguard Worker store double %rcp, double addrspace(1)* %out, align 8 81*9880d681SAndroid Build Coastguard Worker ret void 82*9880d681SAndroid Build Coastguard Worker} 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}rcp_pat_f64: 85*9880d681SAndroid Build Coastguard Worker; SI: v_div_scale_f64 86*9880d681SAndroid Build Coastguard Workerdefine void @rcp_pat_f64(double addrspace(1)* %out, double %src) #1 { 87*9880d681SAndroid Build Coastguard Worker %rcp = fdiv double 1.0, %src 88*9880d681SAndroid Build Coastguard Worker store double %rcp, double addrspace(1)* %out, align 8 89*9880d681SAndroid Build Coastguard Worker ret void 90*9880d681SAndroid Build Coastguard Worker} 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}unsafe_rcp_pat_f64: 93*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f64_e32 [[RESULT:v\[[0-9]+:[0-9]+\]]], s{{\[[0-9]+:[0-9]+\]}} 94*9880d681SAndroid Build Coastguard Worker; SI-NOT: [[RESULT]] 95*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dwordx2 [[RESULT]] 96*9880d681SAndroid Build Coastguard Workerdefine void @unsafe_rcp_pat_f64(double addrspace(1)* %out, double %src) #2 { 97*9880d681SAndroid Build Coastguard Worker %rcp = fdiv double 1.0, %src 98*9880d681SAndroid Build Coastguard Worker store double %rcp, double addrspace(1)* %out, align 8 99*9880d681SAndroid Build Coastguard Worker ret void 100*9880d681SAndroid Build Coastguard Worker} 101*9880d681SAndroid Build Coastguard Worker 102*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}safe_rsq_rcp_pat_f64: 103*9880d681SAndroid Build Coastguard Worker; SI-NOT: v_rsq_f64_e32 104*9880d681SAndroid Build Coastguard Worker; SI: v_sqrt_f64 105*9880d681SAndroid Build Coastguard Worker; SI: v_rcp_f64 106*9880d681SAndroid Build Coastguard Workerdefine void @safe_rsq_rcp_pat_f64(double addrspace(1)* %out, double %src) #1 { 107*9880d681SAndroid Build Coastguard Worker %sqrt = call double @llvm.sqrt.f64(double %src) 108*9880d681SAndroid Build Coastguard Worker %rcp = call double @llvm.amdgcn.rcp.f64(double %sqrt) 109*9880d681SAndroid Build Coastguard Worker store double %rcp, double addrspace(1)* %out, align 8 110*9880d681SAndroid Build Coastguard Worker ret void 111*9880d681SAndroid Build Coastguard Worker} 112*9880d681SAndroid Build Coastguard Worker 113*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}unsafe_rsq_rcp_pat_f64: 114*9880d681SAndroid Build Coastguard Worker; SI: v_rsq_f64_e32 [[RESULT:v\[[0-9]+:[0-9]+\]]], s{{\[[0-9]+:[0-9]+\]}} 115*9880d681SAndroid Build Coastguard Worker; SI-NOT: [[RESULT]] 116*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dwordx2 [[RESULT]] 117*9880d681SAndroid Build Coastguard Workerdefine void @unsafe_rsq_rcp_pat_f64(double addrspace(1)* %out, double %src) #2 { 118*9880d681SAndroid Build Coastguard Worker %sqrt = call double @llvm.sqrt.f64(double %src) 119*9880d681SAndroid Build Coastguard Worker %rcp = call double @llvm.amdgcn.rcp.f64(double %sqrt) 120*9880d681SAndroid Build Coastguard Worker store double %rcp, double addrspace(1)* %out, align 8 121*9880d681SAndroid Build Coastguard Worker ret void 122*9880d681SAndroid Build Coastguard Worker} 123*9880d681SAndroid Build Coastguard Worker 124*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone } 125*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind "unsafe-fp-math"="false" "target-features"="-fp32-denormals" } 126*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind "unsafe-fp-math"="true" "target-features"="-fp32-denormals" } 127*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind "unsafe-fp-math"="false" "target-features"="+fp32-denormals" } 128*9880d681SAndroid Build Coastguard Workerattributes #4 = { nounwind "unsafe-fp-math"="true" "target-features"="+fp32-denormals" } 129