llvm/test/Transforms/InstCombine/tan-nofastmath.ll
Davide Italiano 9496ef1fef [SimplifyLibCalls] New transformation: tan(atan(x)) -> x
This is enabled only under -ffast-math.
So, instead of emitting:
  4007b0:       50                      push   %rax
  4007b1:       e8 8a fd ff ff          callq  400540 <atanf@plt>
  4007b6:       58                      pop    %rax
  4007b7:       e9 94 fd ff ff          jmpq   400550 <tanf@plt>
  4007bc:       0f 1f 40 00             nopl   0x0(%rax)

for:
float mytan(float x) {
  return tanf(atanf(x));
}
we emit a single retq.

Differential Revision:	 http://reviews.llvm.org/D14302


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252098 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 23:36:56 +00:00

18 lines
432 B
LLVM

; RUN: opt < %s -instcombine -S | FileCheck %s
define float @mytan(float %x) {
entry:
%call = call float @atanf(float %x)
%call1 = call float @tanf(float %call)
ret float %call1
}
; CHECK-LABEL: define float @mytan(
; CHECK: %call = call float @atanf(float %x)
; CHECK-NEXT: %call1 = call float @tanf(float %call)
; CHECK-NEXT: ret float %call1
; CHECK-NEXT: }
declare float @tanf(float)
declare float @atanf(float)