1; Test strict conversions of unsigned integers to floating-point values
2; (z196 and above).
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
5
6declare float @llvm.experimental.constrained.uitofp.f32.i32(i32, metadata, metadata)
7declare double @llvm.experimental.constrained.uitofp.f64.i32(i32, metadata, metadata)
8declare fp128 @llvm.experimental.constrained.uitofp.f128.i32(i32, metadata, metadata)
9
10declare float @llvm.experimental.constrained.uitofp.f32.i64(i64, metadata, metadata)
11declare double @llvm.experimental.constrained.uitofp.f64.i64(i64, metadata, metadata)
12declare fp128 @llvm.experimental.constrained.uitofp.f128.i64(i64, metadata, metadata)
13
14; Check i32->f32.
15define float @f1(i32 %i) #0 {
16; CHECK-LABEL: f1:
17; CHECK: celfbr %f0, 0, %r2, 0
18; CHECK: br %r14
19  %conv = call float @llvm.experimental.constrained.uitofp.f32.i32(i32 %i,
20                                               metadata !"round.dynamic",
21                                               metadata !"fpexcept.strict") #0
22  ret float %conv
23}
24
25; Check i32->f64.
26define double @f2(i32 %i) #0 {
27; CHECK-LABEL: f2:
28; CHECK: cdlfbr %f0, 0, %r2, 0
29; CHECK: br %r14
30  %conv = call double @llvm.experimental.constrained.uitofp.f64.i32(i32 %i,
31                                               metadata !"round.dynamic",
32                                               metadata !"fpexcept.strict") #0
33  ret double %conv
34}
35
36; Check i32->f128.
37define void @f3(i32 %i, fp128 *%dst) #0 {
38; CHECK-LABEL: f3:
39; CHECK: cxlfbr %f0, 0, %r2, 0
40; CHECK-DAG: std %f0, 0(%r3)
41; CHECK-DAG: std %f2, 8(%r3)
42; CHECK: br %r14
43  %conv = call fp128 @llvm.experimental.constrained.uitofp.f128.i32(i32 %i,
44                                               metadata !"round.dynamic",
45                                               metadata !"fpexcept.strict") #0
46  store fp128 %conv, fp128 *%dst
47  ret void
48}
49
50; Check i64->f32.
51define float @f4(i64 %i) #0 {
52; CHECK-LABEL: f4:
53; CHECK: celgbr %f0, 0, %r2, 0
54; CHECK: br %r14
55  %conv = call float @llvm.experimental.constrained.uitofp.f32.i64(i64 %i,
56                                               metadata !"round.dynamic",
57                                               metadata !"fpexcept.strict") #0
58  ret float %conv
59}
60
61; Check i64->f64.
62define double @f5(i64 %i) #0 {
63; CHECK-LABEL: f5:
64; CHECK: cdlgbr %f0, 0, %r2, 0
65; CHECK: br %r14
66  %conv = call double @llvm.experimental.constrained.uitofp.f64.i64(i64 %i,
67                                               metadata !"round.dynamic",
68                                               metadata !"fpexcept.strict") #0
69  ret double %conv
70}
71
72; Check i64->f128.
73define void @f6(i64 %i, fp128 *%dst) #0 {
74; CHECK-LABEL: f6:
75; CHECK: cxlgbr %f0, 0, %r2, 0
76; CHECK-DAG: std %f0, 0(%r3)
77; CHECK-DAG: std %f2, 8(%r3)
78; CHECK: br %r14
79  %conv = call fp128 @llvm.experimental.constrained.uitofp.f128.i64(i64 %i,
80                                               metadata !"round.dynamic",
81                                               metadata !"fpexcept.strict") #0
82  store fp128 %conv, fp128 *%dst
83  ret void
84}
85
86attributes #0 = { strictfp }
87