File: pow-exp.ll

package info (click to toggle)
llvm-toolchain-5.0 1:5.0.1-2~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 553,688 kB
  • sloc: cpp: 2,878,786; ansic: 584,110; asm: 246,252; python: 124,751; objc: 106,925; sh: 21,542; lisp: 8,628; pascal: 5,885; ml: 5,544; perl: 5,312; makefile: 2,208; cs: 2,022; xml: 686; php: 212; csh: 117
file content (49 lines) | stat: -rw-r--r-- 1,633 bytes parent folder | download | duplicates (15)
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
; 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)