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