[llvm] r339467 - [InstCombine] add tests to show disabling of libcall/intrinsic shrinking; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 10 13:12:37 PDT 2018


Author: spatel
Date: Fri Aug 10 13:12:36 2018
New Revision: 339467

URL: http://llvm.org/viewvc/llvm-project?rev=339467&view=rev
Log:
[InstCombine] add tests to show disabling of libcall/intrinsic shrinking; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/pow-3.ll

Modified: llvm/trunk/test/Transforms/InstCombine/pow-3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pow-3.ll?rev=339467&r1=339466&r2=339467&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pow-3.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/pow-3.ll Fri Aug 10 13:12:36 2018
@@ -1,12 +1,51 @@
-; Test that the pow won't get simplified to sqrt(fabs) when they are not available.
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; Test that the pow() won't get simplified to when it's disabled.
 ;
 ; RUN: opt < %s -disable-simplify-libcalls -instcombine -S | FileCheck %s
 
-declare double @llvm.pow.f64(double %Val, double %Power)
+declare double @llvm.pow.f64(double, double)
+declare double @pow(double, double)
 
-define double @test_simplify_unavailable(double %x) {
-; CHECK-LABEL: @test_simplify_unavailable(
+define double @test_simplify_unavailable1(double %x) {
+; CHECK-LABEL: @test_simplify_unavailable1(
+; CHECK-NEXT:    [[RETVAL:%.*]] = call double @llvm.pow.f64(double [[X:%.*]], double 5.000000e-01)
+; CHECK-NEXT:    ret double [[RETVAL]]
+;
   %retval = call double @llvm.pow.f64(double %x, double 0.5)
-; CHECK-NEXT: call double @llvm.pow.f64(double %x, double 5.000000e-01)
   ret double %retval
 }
+
+; Shrinking is disabled too.
+
+define float @test_simplify_unavailable2(float %f, float %g) {
+; CHECK-LABEL: @test_simplify_unavailable2(
+; CHECK-NEXT:    [[DF:%.*]] = fpext float [[F:%.*]] to double
+; CHECK-NEXT:    [[DG:%.*]] = fpext float [[G:%.*]] to double
+; CHECK-NEXT:    [[CALL:%.*]] = call fast double @pow(double [[DF]], double [[DG]])
+; CHECK-NEXT:    [[FR:%.*]] = fptrunc double [[CALL]] to float
+; CHECK-NEXT:    ret float [[FR]]
+;
+  %df = fpext float %f to double
+  %dg = fpext float %g to double
+  %call = call fast double @pow(double %df, double %dg)
+  %fr = fptrunc double %call to float
+  ret float %fr
+}
+
+; Shrinking is disabled for the intrinsic too.
+
+define float @test_simplify_unavailable3(float %f, float %g) {
+; CHECK-LABEL: @test_simplify_unavailable3(
+; CHECK-NEXT:    [[DF:%.*]] = fpext float [[F:%.*]] to double
+; CHECK-NEXT:    [[DG:%.*]] = fpext float [[G:%.*]] to double
+; CHECK-NEXT:    [[CALL:%.*]] = call fast double @llvm.pow.f64(double [[DF]], double [[DG]])
+; CHECK-NEXT:    [[FR:%.*]] = fptrunc double [[CALL]] to float
+; CHECK-NEXT:    ret float [[FR]]
+;
+  %df = fpext float %f to double
+  %dg = fpext float %g to double
+  %call = call fast double @llvm.pow.f64(double %df, double %dg)
+  %fr = fptrunc double %call to float
+  ret float %fr
+}
+




More information about the llvm-commits mailing list