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