1 ; Test strict extensions of f32 to f128.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
5 declare fp128 @llvm.experimental.constrained.fpext.f128.f32(float, metadata)
7 ; Check register extension.
8 define void @f1(ptr %dst, float %val) #0 {
10 ; CHECK: lxebr %f0, %f0
11 ; CHECK: std %f0, 0(%r2)
12 ; CHECK: std %f2, 8(%r2)
14 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f32(float %val,
15 metadata !"fpexcept.strict") #0
16 store fp128 %res, ptr %dst
20 ; Check the low end of the LXEB range.
21 define void @f2(ptr %dst, ptr %ptr) #0 {
23 ; CHECK: lxeb %f0, 0(%r3)
24 ; CHECK: std %f0, 0(%r2)
25 ; CHECK: std %f2, 8(%r2)
27 %val = load float, ptr %ptr
28 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f32(float %val,
29 metadata !"fpexcept.strict") #0
30 store fp128 %res, ptr %dst
34 ; Check the high end of the aligned LXEB range.
35 define void @f3(ptr %dst, ptr %base) #0 {
37 ; CHECK: lxeb %f0, 4092(%r3)
38 ; CHECK: std %f0, 0(%r2)
39 ; CHECK: std %f2, 8(%r2)
41 %ptr = getelementptr float, ptr %base, i64 1023
42 %val = load float, ptr %ptr
43 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f32(float %val,
44 metadata !"fpexcept.strict") #0
45 store fp128 %res, ptr %dst
49 ; Check the next word 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: lxeb %f0, 0(%r3)
55 ; CHECK: std %f0, 0(%r2)
56 ; CHECK: std %f2, 8(%r2)
58 %ptr = getelementptr float, ptr %base, i64 1024
59 %val = load float, ptr %ptr
60 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f32(float %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: lxeb %f0, 0(%r3)
71 ; CHECK: std %f0, 0(%r2)
72 ; CHECK: std %f2, 8(%r2)
74 %ptr = getelementptr float, ptr %base, i64 -1
75 %val = load float, ptr %ptr
76 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f32(float %val,
77 metadata !"fpexcept.strict") #0
78 store fp128 %res, ptr %dst
82 ; Check that LXEB allows indices.
83 define void @f6(ptr %dst, ptr %base, i64 %index) #0 {
85 ; CHECK: sllg %r1, %r4, 2
86 ; CHECK: lxeb %f0, 400(%r1,%r3)
87 ; CHECK: std %f0, 0(%r2)
88 ; CHECK: std %f2, 8(%r2)
90 %ptr1 = getelementptr float, ptr %base, i64 %index
91 %ptr2 = getelementptr float, ptr %ptr1, i64 100
92 %val = load float, ptr %ptr2
93 %res = call fp128 @llvm.experimental.constrained.fpext.f128.f32(float %val,
94 metadata !"fpexcept.strict") #0
95 store fp128 %res, ptr %dst
99 attributes #0 = { strictfp }