Don't form PPC CTR loops for over-sized exit counts
[oota-llvm.git] / test / CodeGen / SystemZ / fp-conv-02.ll
1 ; Test extensions of f32 to f64.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
4
5 ; Check register extension.
6 define double @f1(float %val) {
7 ; CHECK: f1:
8 ; CHECK: ldebr %f0, %f0
9 ; CHECK: br %r14
10   %res = fpext float %val to double
11   ret double %res
12 }
13
14 ; Check the low end of the LDEB range.
15 define double @f2(float *%ptr) {
16 ; CHECK: f2:
17 ; CHECK: ldeb %f0, 0(%r2)
18 ; CHECK: br %r14
19   %val = load float *%ptr
20   %res = fpext float %val to double
21   ret double %res
22 }
23
24 ; Check the high end of the aligned LDEB range.
25 define double @f3(float *%base) {
26 ; CHECK: f3:
27 ; CHECK: ldeb %f0, 4092(%r2)
28 ; CHECK: br %r14
29   %ptr = getelementptr float *%base, i64 1023
30   %val = load float *%ptr
31   %res = fpext float %val to double
32   ret double %res
33 }
34
35 ; Check the next word up, which needs separate address logic.
36 ; Other sequences besides this one would be OK.
37 define double @f4(float *%base) {
38 ; CHECK: f4:
39 ; CHECK: aghi %r2, 4096
40 ; CHECK: ldeb %f0, 0(%r2)
41 ; CHECK: br %r14
42   %ptr = getelementptr float *%base, i64 1024
43   %val = load float *%ptr
44   %res = fpext float %val to double
45   ret double %res
46 }
47
48 ; Check negative displacements, which also need separate address logic.
49 define double @f5(float *%base) {
50 ; CHECK: f5:
51 ; CHECK: aghi %r2, -4
52 ; CHECK: ldeb %f0, 0(%r2)
53 ; CHECK: br %r14
54   %ptr = getelementptr float *%base, i64 -1
55   %val = load float *%ptr
56   %res = fpext float %val to double
57   ret double %res
58 }
59
60 ; Check that LDEB allows indices.
61 define double @f6(float *%base, i64 %index) {
62 ; CHECK: f6:
63 ; CHECK: sllg %r1, %r3, 2
64 ; CHECK: ldeb %f0, 400(%r1,%r2)
65 ; CHECK: br %r14
66   %ptr1 = getelementptr float *%base, i64 %index
67   %ptr2 = getelementptr float *%ptr1, i64 100
68   %val = load float *%ptr2
69   %res = fpext float %val to double
70   ret double %res
71 }