reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
; 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, double)
declare double @pow(double, double)

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)
  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
}