1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[InstCombine] adjust recip sqrt tests for better coverage; NFC

Goes with D86726
This commit is contained in:
Sanjay Patel 2020-09-01 09:41:43 -04:00
parent c3c7a59967
commit 41c06ff50d

View File

@ -101,34 +101,34 @@ define double @rsqrt_squared(double %x) {
define double @rsqrt_x_reassociate_extra_use(double %x, double * %p) {
; CHECK-LABEL: @rsqrt_x_reassociate_extra_use(
; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[X:%.*]])
; CHECK-NEXT: [[RSQRT:%.*]] = fdiv fast double 1.000000e+00, [[SQRT]]
; CHECK-NEXT: [[RES:%.*]] = fmul reassoc double [[RSQRT]], [[X:%.*]]
; CHECK-NEXT: store double [[RSQRT]], double* %p
; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
; CHECK-NEXT: [[RSQRT:%.*]] = fdiv double 1.000000e+00, [[SQRT]]
; CHECK-NEXT: [[RES:%.*]] = fmul reassoc nsz double [[RSQRT]], [[X]]
; CHECK-NEXT: store double [[RSQRT]], double* [[P:%.*]], align 8
; CHECK-NEXT: ret double [[RES]]
;
%sqrt = call fast double @llvm.sqrt.f64(double %x)
%rsqrt = fdiv fast double 1.0, %sqrt
%res = fmul reassoc double %rsqrt, %x
%sqrt = call double @llvm.sqrt.f64(double %x)
%rsqrt = fdiv double 1.0, %sqrt
%res = fmul reassoc nsz double %rsqrt, %x
store double %rsqrt, double* %p
ret double %res
}
define double @x_add_y_rsqrt_reassociate_extra_use(double %x, double %y, double * %p) {
define <2 x float> @x_add_y_rsqrt_reassociate_extra_use(<2 x float> %x, <2 x float> %y, <2 x float>* %p) {
; CHECK-LABEL: @x_add_y_rsqrt_reassociate_extra_use(
; CHECK-NEXT: [[ADD:%.*]] = fadd fast double %x, %y
; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[ADD]])
; CHECK-NEXT: [[RSQRT:%.*]] = fdiv fast double 1.000000e+00, [[SQRT]]
; CHECK-NEXT: [[RES:%.*]] = fmul reassoc double [[ADD]], [[RSQRT]]
; CHECK-NEXT: store double [[RSQRT]], double* %p
; CHECK-NEXT: ret double [[RES]]
; CHECK-NEXT: [[ADD:%.*]] = fadd fast <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: [[SQRT:%.*]] = call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> [[ADD]])
; CHECK-NEXT: [[RSQRT:%.*]] = fdiv fast <2 x float> <float 1.000000e+00, float 1.000000e+00>, [[SQRT]]
; CHECK-NEXT: [[RES:%.*]] = fmul fast <2 x float> [[ADD]], [[RSQRT]]
; CHECK-NEXT: store <2 x float> [[RSQRT]], <2 x float>* [[P:%.*]], align 8
; CHECK-NEXT: ret <2 x float> [[RES]]
;
%add = fadd fast double %x, %y ; thwart complexity-based canonicalization
%sqrt = call fast double @llvm.sqrt.f64(double %add)
%rsqrt = fdiv fast double 1.0, %sqrt
%res = fmul reassoc double %add, %rsqrt
store double %rsqrt, double* %p
ret double %res
%add = fadd fast <2 x float> %x, %y ; thwart complexity-based canonicalization
%sqrt = call fast <2 x float> @llvm.sqrt.v2f32(<2 x float> %add)
%rsqrt = fdiv fast <2 x float> <float 1.0, float 1.0>, %sqrt
%res = fmul fast <2 x float> %add, %rsqrt
store <2 x float> %rsqrt, <2 x float>* %p
ret <2 x float> %res
}
define double @sqrt_divisor_squared(double %x, double %y) {