1 ; Test strict extensions of f64 to f128.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare fp128 @llvm.experimental.constrained.fpext.f128.f64(double, metadata)
7 ; Check register extension.
8 define void @f1(ptr %dst, double %val) #0 {
10 ; CHECK: lxdbr %f0, %f0
11 ; CHECK: std %f0, 0(%r2)
12 ; CHECK: std %f2, 8(%r2)
14 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f64(double %val,
15 metadata !"fpexcept.strict") #0
16 store fp128 %res, ptr %dst
20 ; Check the low end of the LXDB range.
21 define void @f2(ptr %dst, ptr %ptr) #0 {
23 ; CHECK: lxdb %f0, 0(%r3)
24 ; CHECK: std %f0, 0(%r2)
25 ; CHECK: std %f2, 8(%r2)
27 %val = load double, ptr %ptr
28 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f64(double %val,
29 metadata !"fpexcept.strict") #0
30 store fp128 %res, ptr %dst
34 ; Check the high end of the aligned LXDB range.
35 define void @f3(ptr %dst, ptr %base) #0 {
37 ; CHECK: lxdb %f0, 4088(%r3)
38 ; CHECK: std %f0, 0(%r2)
39 ; CHECK: std %f2, 8(%r2)
41 %ptr = getelementptr double, ptr %base, i64 511
42 %val = load double, ptr %ptr
43 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f64(double %val,
44 metadata !"fpexcept.strict") #0
45 store fp128 %res, ptr %dst
49 ; Check the next doubleword up, which needs separate address logic.
50 ; Other sequences besides this one would be OK.
51 define void @f4(ptr %dst, ptr %base) #0 {
53 ; CHECK: aghi %r3, 4096
54 ; CHECK: lxdb %f0, 0(%r3)
55 ; CHECK: std %f0, 0(%r2)
56 ; CHECK: std %f2, 8(%r2)
58 %ptr = getelementptr double, ptr %base, i64 512
59 %val = load double, ptr %ptr
60 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f64(double %val,
61 metadata !"fpexcept.strict") #0
62 store fp128 %res, ptr %dst
66 ; Check negative displacements, which also need separate address logic.
67 define void @f5(ptr %dst, ptr %base) #0 {
70 ; CHECK: lxdb %f0, 0(%r3)
71 ; CHECK: std %f0, 0(%r2)
72 ; CHECK: std %f2, 8(%r2)
74 %ptr = getelementptr double, ptr %base, i64 -1
75 %val = load double, ptr %ptr
76 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f64(double %val,
77 metadata !"fpexcept.strict") #0
78 store fp128 %res, ptr %dst
82 ; Check that LXDB allows indices.
83 define void @f6(ptr %dst, ptr %base, i64 %index) #0 {
85 ; CHECK: sllg %r1, %r4, 3
86 ; CHECK: lxdb %f0, 800(%r1,%r3)
87 ; CHECK: std %f0, 0(%r2)
88 ; CHECK: std %f2, 8(%r2)
90 %ptr1 = getelementptr double, ptr %base, i64 %index
91 %ptr2 = getelementptr double, ptr %ptr1, i64 100
92 %val = load double, ptr %ptr2
93 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f64(double %val,
94 metadata !"fpexcept.strict") #0
95 store fp128 %res, ptr %dst
99 attributes #0 = { strictfp }