1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/test/Transforms/InstCombine/tan-nofastmath.ll
Davide Italiano c3b20ee04f [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

llvm-svn: 252098
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)