1 ; Test f128 floating-point strict conversion to/from integers on z14.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
5 declare fp128 @llvm.experimental.constrained.sitofp.f128.i32(i32, metadata, metadata)
6 declare fp128 @llvm.experimental.constrained.sitofp.f128.i64(i64, metadata, metadata)
8 declare fp128 @llvm.experimental.constrained.uitofp.f128.i32(i32, metadata, metadata)
9 declare fp128 @llvm.experimental.constrained.uitofp.f128.i64(i64, metadata, metadata)
11 declare i32 @llvm.experimental.constrained.fptosi.i32.f128(fp128, metadata)
12 declare i64 @llvm.experimental.constrained.fptosi.i64.f128(fp128, metadata)
14 declare i32 @llvm.experimental.constrained.fptoui.i32.f128(fp128, metadata)
15 declare i64 @llvm.experimental.constrained.fptoui.i64.f128(fp128, metadata)
17 ; Test signed i32->f128.
18 define void @f1(i32 %i, ptr %dst) #0 {
20 ; CHECK: cxfbr %f0, %r2
21 ; CHECK: vmrhg %v0, %v0, %v2
22 ; CHECK: vst %v0, 0(%r3)
24 %conv = call fp128 @llvm.experimental.constrained.sitofp.f128.i32(i32 %i,
25 metadata !"round.dynamic",
26 metadata !"fpexcept.strict") #0
27 store fp128 %conv, ptr %dst
31 ; Test signed i64->f128.
32 define void @f2(i64 %i, ptr %dst) #0 {
34 ; CHECK: cxgbr %f0, %r2
35 ; CHECK: vmrhg %v0, %v0, %v2
36 ; CHECK: vst %v0, 0(%r3)
38 %conv = call fp128 @llvm.experimental.constrained.sitofp.f128.i64(i64 %i,
39 metadata !"round.dynamic",
40 metadata !"fpexcept.strict") #0
41 store fp128 %conv, ptr %dst
45 ; Test unsigned i32->f128.
46 define void @f3(i32 %i, ptr %dst) #0 {
48 ; CHECK: cxlfbr %f0, 0, %r2, 0
49 ; CHECK: vmrhg %v0, %v0, %v2
50 ; CHECK: vst %v0, 0(%r3)
52 %conv = call fp128 @llvm.experimental.constrained.uitofp.f128.i32(i32 %i,
53 metadata !"round.dynamic",
54 metadata !"fpexcept.strict") #0
55 store fp128 %conv, ptr %dst
59 ; Test unsigned i64->f128.
60 define void @f4(i64 %i, ptr %dst) #0 {
62 ; CHECK: cxlgbr %f0, 0, %r2, 0
63 ; CHECK: vmrhg %v0, %v0, %v2
64 ; CHECK: vst %v0, 0(%r3)
66 %conv = call fp128 @llvm.experimental.constrained.uitofp.f128.i64(i64 %i,
67 metadata !"round.dynamic",
68 metadata !"fpexcept.strict") #0
69 store fp128 %conv, ptr %dst
73 ; Test signed f128->i32.
74 define i32 @f5(ptr %src) #0 {
76 ; CHECK: vl %v0, 0(%r2)
77 ; CHECK: vrepg %v2, %v0, 1
78 ; CHECK: cfxbr %r2, 5, %f0
80 %f = load fp128, ptr %src
81 %conv = call i32 @llvm.experimental.constrained.fptosi.i32.f128(fp128 %f,
82 metadata !"fpexcept.strict") #0
86 ; Test signed f128->i64.
87 define i64 @f6(ptr %src) #0 {
89 ; CHECK: vl %v0, 0(%r2)
90 ; CHECK: vrepg %v2, %v0, 1
91 ; CHECK: cgxbr %r2, 5, %f0
93 %f = load fp128, ptr %src
94 %conv = call i64 @llvm.experimental.constrained.fptosi.i64.f128(fp128 %f,
95 metadata !"fpexcept.strict") #0
99 ; Test unsigned f128->i32.
100 define i32 @f7(ptr %src) #0 {
102 ; CHECK: vl %v0, 0(%r2)
103 ; CHECK: vrepg %v2, %v0, 1
104 ; CHECK: clfxbr %r2, 5, %f0, 0
106 %f = load fp128, ptr %src
107 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.f128(fp128 %f,
108 metadata !"fpexcept.strict") #0
112 ; Test unsigned f128->i64.
113 define i64 @f8(ptr %src) #0 {
115 ; CHECK: vl %v0, 0(%r2)
116 ; CHECK: vrepg %v2, %v0, 1
117 ; CHECK: clgxbr %r2, 5, %f0, 0
119 %f = load fp128, ptr %src
120 %conv = call i64 @llvm.experimental.constrained.fptoui.i64.f128(fp128 %f,
121 metadata !"fpexcept.strict") #0
125 attributes #0 = { strictfp }