
optimizeTan has been renamed to optimizeTrigInversionPairs as a result. Sadly, this is not mathematically true that all inverse pairs fold to x. For example, asin(sin(x)) does not fold to x if x is over 2pi.
141 lines
4.4 KiB
LLVM
141 lines
4.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
|
|
define float @tanAtanInverseFast(float %x) {
|
|
; CHECK-LABEL: define float @tanAtanInverseFast(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call fast float @atanf(float [[X]])
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
%call = call fast float @atanf(float %x)
|
|
%call1 = call fast float @tanf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @atanhTanhInverseFast(float %x) {
|
|
; CHECK-LABEL: define float @atanhTanhInverseFast(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call fast float @tanhf(float [[X]])
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
%call = call fast float @tanhf(float %x)
|
|
%call1 = call fast float @atanhf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @sinhAsinhInverseFast(float %x) {
|
|
; CHECK-LABEL: define float @sinhAsinhInverseFast(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call fast float @asinhf(float [[X]])
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
%call = call fast float @asinhf(float %x)
|
|
%call1 = call fast float @sinhf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @asinhSinhInverseFast(float %x) {
|
|
; CHECK-LABEL: define float @asinhSinhInverseFast(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call fast float @sinhf(float [[X]])
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
%call = call fast float @sinhf(float %x)
|
|
%call1 = call fast float @asinhf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @coshAcoshInverseFast(float %x) {
|
|
; CHECK-LABEL: define float @coshAcoshInverseFast(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call fast float @acoshf(float [[X]])
|
|
; CHECK-NEXT: ret float [[X]]
|
|
;
|
|
%call = call fast float @acoshf(float %x)
|
|
%call1 = call fast float @coshf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @indirectTanCall(ptr %fptr) {
|
|
; CHECK-LABEL: define float @indirectTanCall(
|
|
; CHECK-SAME: ptr [[FPTR:%.*]]) {
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call fast float [[FPTR]]()
|
|
; CHECK-NEXT: [[TAN:%.*]] = call fast float @tanf(float [[CALL1]])
|
|
; CHECK-NEXT: ret float [[TAN]]
|
|
;
|
|
%call1 = call fast float %fptr()
|
|
%tan = call fast float @tanf(float %call1)
|
|
ret float %tan
|
|
}
|
|
|
|
; No fast-math.
|
|
|
|
define float @tanAtanInverse(float %x) {
|
|
; CHECK-LABEL: define float @tanAtanInverse(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call float @atanf(float [[X]])
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call float @tanf(float [[CALL]])
|
|
; CHECK-NEXT: ret float [[CALL1]]
|
|
;
|
|
%call = call float @atanf(float %x)
|
|
%call1 = call float @tanf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @atanhTanhInverse(float %x) {
|
|
; CHECK-LABEL: define float @atanhTanhInverse(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call float @tanhf(float [[X]])
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call float @atanhf(float [[CALL]])
|
|
; CHECK-NEXT: ret float [[CALL1]]
|
|
;
|
|
%call = call float @tanhf(float %x)
|
|
%call1 = call float @atanhf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @sinhAsinhInverse(float %x) {
|
|
; CHECK-LABEL: define float @sinhAsinhInverse(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call float @asinhf(float [[X]])
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call float @sinhf(float [[CALL]])
|
|
; CHECK-NEXT: ret float [[CALL1]]
|
|
;
|
|
%call = call float @asinhf(float %x)
|
|
%call1 = call float @sinhf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @asinhSinhInverse(float %x) {
|
|
; CHECK-LABEL: define float @asinhSinhInverse(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call float @sinhf(float [[X]])
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call float @asinhf(float [[CALL]])
|
|
; CHECK-NEXT: ret float [[CALL1]]
|
|
;
|
|
%call = call float @sinhf(float %x)
|
|
%call1 = call float @asinhf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
define float @coshAcoshInverse(float %x) {
|
|
; CHECK-LABEL: define float @coshAcoshInverse(
|
|
; CHECK-SAME: float [[X:%.*]]) {
|
|
; CHECK-NEXT: [[CALL:%.*]] = call float @acoshf(float [[X]])
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call float @coshf(float [[CALL]])
|
|
; CHECK-NEXT: ret float [[CALL1]]
|
|
;
|
|
%call = call float @acoshf(float %x)
|
|
%call1 = call float @coshf(float %call)
|
|
ret float %call1
|
|
}
|
|
|
|
declare float @asinhf(float)
|
|
declare float @sinhf(float)
|
|
declare float @acoshf(float)
|
|
declare float @coshf(float)
|
|
declare float @tanhf(float)
|
|
declare float @atanhf(float)
|
|
declare float @tanf(float)
|
|
declare float @atanf(float)
|