Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality...
[oota-llvm.git] / test / Transforms / InstCombine / exp2-1.ll
1 ; Test that the exp2 library call simplifier works correctly.
2 ;
3 ; RUN: opt < %s -instcombine -S | FileCheck %s
4
5 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
6
7 declare double @exp2(double)
8 declare float @exp2f(float)
9
10 ; Check exp2(sitofp(x)) -> ldexp(1.0, sext(x)).
11
12 define double @test_simplify1(i32 %x) {
13 ; CHECK-LABEL: @test_simplify1(
14   %conv = sitofp i32 %x to double
15   %ret = call double @exp2(double %conv)
16 ; CHECK: call double @ldexp
17   ret double %ret
18 }
19
20 define double @test_simplify2(i16 signext %x) {
21 ; CHECK-LABEL: @test_simplify2(
22   %conv = sitofp i16 %x to double
23   %ret = call double @exp2(double %conv)
24 ; CHECK: call double @ldexp
25   ret double %ret
26 }
27
28 define double @test_simplify3(i8 signext %x) {
29 ; CHECK-LABEL: @test_simplify3(
30   %conv = sitofp i8 %x to double
31   %ret = call double @exp2(double %conv)
32 ; CHECK: call double @ldexp
33   ret double %ret
34 }
35
36 define float @test_simplify4(i32 %x) {
37 ; CHECK-LABEL: @test_simplify4(
38   %conv = sitofp i32 %x to float
39   %ret = call float @exp2f(float %conv)
40 ; CHECK: call float @ldexpf
41   ret float %ret
42 }
43
44 ; Check exp2(uitofp(x)) -> ldexp(1.0, zext(x)).
45
46 define double @test_no_simplify1(i32 %x) {
47 ; CHECK-LABEL: @test_no_simplify1(
48   %conv = uitofp i32 %x to double
49   %ret = call double @exp2(double %conv)
50 ; CHECK: call double @exp2
51   ret double %ret
52 }
53
54 define double @test_simplify6(i16 zeroext %x) {
55 ; CHECK-LABEL: @test_simplify6(
56   %conv = uitofp i16 %x to double
57   %ret = call double @exp2(double %conv)
58 ; CHECK: call double @ldexp
59   ret double %ret
60 }
61
62 define double @test_simplify7(i8 zeroext %x) {
63 ; CHECK-LABEL: @test_simplify7(
64   %conv = uitofp i8 %x to double
65   %ret = call double @exp2(double %conv)
66 ; CHECK: call double @ldexp
67   ret double %ret
68 }
69
70 define float @test_simplify8(i8 zeroext %x) {
71 ; CHECK-LABEL: @test_simplify8(
72   %conv = uitofp i8 %x to float
73   %ret = call float @exp2f(float %conv)
74 ; CHECK: call float @ldexpf
75   ret float %ret
76 }