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