mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
75660cfed9
See also: http://reviews.llvm.org/rL255555 http://reviews.llvm.org/rL256871 http://reviews.llvm.org/rL256964 http://reviews.llvm.org/rL257400 http://reviews.llvm.org/rL257404 http://reviews.llvm.org/rL257414 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257491 91177308-0d34-0410-b5e6-96231b3b80d8
50 lines
1.6 KiB
LLVM
50 lines
1.6 KiB
LLVM
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
define double @pow_exp(double %x, double %y) {
|
|
%call = call fast double @exp(double %x) nounwind readnone
|
|
%pow = call fast double @llvm.pow.f64(double %call, double %y)
|
|
ret double %pow
|
|
}
|
|
|
|
; CHECK-LABEL: define double @pow_exp(
|
|
; CHECK-NEXT: %mul = fmul fast double %x, %y
|
|
; CHECK-NEXT: %exp = call fast double @exp(double %mul)
|
|
; CHECK-NEXT: ret double %exp
|
|
|
|
define double @pow_exp2(double %x, double %y) {
|
|
%call = call fast double @exp2(double %x) nounwind readnone
|
|
%pow = call fast double @llvm.pow.f64(double %call, double %y)
|
|
ret double %pow
|
|
}
|
|
|
|
; CHECK-LABEL: define double @pow_exp2(
|
|
; CHECK-NEXT: %mul = fmul fast double %x, %y
|
|
; CHECK-NEXT: %exp2 = call fast double @exp2(double %mul)
|
|
; CHECK-NEXT: ret double %exp2
|
|
|
|
define double @pow_exp_not_fast(double %x, double %y) {
|
|
%call = call double @exp(double %x)
|
|
%pow = call fast double @llvm.pow.f64(double %call, double %y)
|
|
ret double %pow
|
|
}
|
|
|
|
; CHECK-LABEL: define double @pow_exp_not_fast(
|
|
; CHECK-NEXT: %call = call double @exp(double %x)
|
|
; CHECK-NEXT: %pow = call fast double @llvm.pow.f64(double %call, double %y)
|
|
; CHECK-NEXT: ret double %pow
|
|
|
|
define double @function_pointer(double ()* %fptr, double %p1) {
|
|
%call1 = call fast double %fptr()
|
|
%pow = call fast double @llvm.pow.f64(double %call1, double %p1)
|
|
ret double %pow
|
|
}
|
|
|
|
; CHECK-LABEL: @function_pointer
|
|
; CHECK-NEXT: %call1 = call fast double %fptr()
|
|
; CHECK-NEXT: %pow = call fast double @llvm.pow.f64(double %call1, double %p1)
|
|
|
|
declare double @exp(double)
|
|
declare double @exp2(double)
|
|
declare double @llvm.pow.f64(double, double)
|
|
|