[PATCH] D86801: [InstCombine] add extra-use tests for fmul+sqrt; NFC
Venkataramanan Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 12:04:07 PDT 2020
venkataramanan.kumar.llvm created this revision.
venkataramanan.kumar.llvm added a reviewer: spatel.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
venkataramanan.kumar.llvm requested review of this revision.
[InstCombine] add extra-use tests for fmul+sqrt; NFC
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86801
Files:
llvm/test/Transforms/InstCombine/fmul-sqrt.ll
Index: llvm/test/Transforms/InstCombine/fmul-sqrt.ll
===================================================================
--- llvm/test/Transforms/InstCombine/fmul-sqrt.ll
+++ llvm/test/Transforms/InstCombine/fmul-sqrt.ll
@@ -99,6 +99,36 @@
ret double %squared
}
+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: 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
+ store double %rsqrt, double* %p
+ ret double %res
+}
+
+define double @x_rsqrt_reassociate_extra_use(double %x, double * %p) {
+; CHECK-LABEL: @x_rsqrt_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: ret double [[RES]]
+;
+ %sqrt = call fast double @llvm.sqrt.f64(double %x)
+ %rsqrt = fdiv fast double 1.0, %sqrt
+ %res = fmul reassoc double %x, %rsqrt
+ store double %rsqrt, double* %p
+ ret double %res
+}
+
define double @sqrt_divisor_squared(double %x, double %y) {
; CHECK-LABEL: @sqrt_divisor_squared(
; CHECK-NEXT: [[TMP1:%.*]] = fmul reassoc nnan nsz double [[Y:%.*]], [[Y]]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86801.288666.patch
Type: text/x-patch
Size: 1721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200828/34a1308b/attachment.bin>
More information about the llvm-commits
mailing list