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