[llvm] r357939 - [InstCombine] add extra-use tests for fmul+sqrt; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 13:37:35 PDT 2019
Author: spatel
Date: Mon Apr 8 13:37:34 2019
New Revision: 357939
URL: http://llvm.org/viewvc/llvm-project?rev=357939&view=rev
Log:
[InstCombine] add extra-use tests for fmul+sqrt; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/fmul-sqrt.ll
Modified: llvm/trunk/test/Transforms/InstCombine/fmul-sqrt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fmul-sqrt.ll?rev=357939&r1=357938&r2=357939&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fmul-sqrt.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fmul-sqrt.ll Mon Apr 8 13:37:34 2019
@@ -127,6 +127,36 @@ define double @sqrt_dividend_squared(dou
ret double %squared
}
+define double @sqrt_divisor_squared_extra_use(double %x, double %y) {
+; CHECK-LABEL: @sqrt_divisor_squared_extra_use(
+; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
+; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[Y:%.*]], [[SQRT]]
+; CHECK-NEXT: call void @use(double [[DIV]])
+; CHECK-NEXT: [[SQUARED:%.*]] = fmul reassoc nnan nsz double [[DIV]], [[DIV]]
+; CHECK-NEXT: ret double [[SQUARED]]
+;
+ %sqrt = call double @llvm.sqrt.f64(double %x)
+ %div = fdiv double %y, %sqrt
+ call void @use(double %div)
+ %squared = fmul reassoc nnan nsz double %div, %div
+ ret double %squared
+}
+
+define double @sqrt_dividend_squared_extra_use(double %x, double %y) {
+; CHECK-LABEL: @sqrt_dividend_squared_extra_use(
+; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
+; CHECK-NEXT: call void @use(double [[SQRT]])
+; CHECK-NEXT: [[DIV:%.*]] = fdiv fast double [[SQRT]], [[Y:%.*]]
+; CHECK-NEXT: [[SQUARED:%.*]] = fmul fast double [[DIV]], [[DIV]]
+; CHECK-NEXT: ret double [[SQUARED]]
+;
+ %sqrt = call double @llvm.sqrt.f64(double %x)
+ call void @use(double %sqrt)
+ %div = fdiv fast double %sqrt, %y
+ %squared = fmul fast double %div, %div
+ ret double %squared
+}
+
; Negative test - require 'nsz'.
define double @sqrt_divisor_not_enough_FMF(double %x, double %y) {
More information about the llvm-commits
mailing list