blob: b8155ed067dad1e7e4f6a0dd1815c6089a2908bb [file] [log] [blame]
Richard Sandiforddc6c2c92014-03-21 10:56:30 +00001; Test conversion of floating-point values to unsigned i32s (z10 only).
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00002;
Richard Sandiforddc6c2c92014-03-21 10:56:30 +00003; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
Ulrich Weigand9e3577f2013-05-06 16:17:29 +00004
5; z10 doesn't have native support for unsigned fp-to-i32 conversions;
6; they were added in z196 as the Convert to Logical family of instructions.
7; Promoting to i64 doesn't generate an inexact condition for values that are
8; outside the i32 range but in the i64 range, so use the default expansion.
9
10; Test f32->i32.
11define i32 @f1(float %f) {
Stephen Lind24ab202013-07-14 06:24:09 +000012; CHECK-LABEL: f1:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000013; CHECK: cebr
14; CHECK: sebr
15; CHECK: cfebr
16; CHECK: xilf
17; CHECK: br %r14
18 %conv = fptoui float %f to i32
19 ret i32 %conv
20}
21
22; Test f64->i32.
23define i32 @f2(double %f) {
Stephen Lind24ab202013-07-14 06:24:09 +000024; CHECK-LABEL: f2:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000025; CHECK: cdbr
26; CHECK: sdbr
27; CHECK: cfdbr
28; CHECK: xilf
29; CHECK: br %r14
30 %conv = fptoui double %f to i32
31 ret i32 %conv
32}
33
34; Test f128->i32.
35define i32 @f3(fp128 *%src) {
Stephen Lind24ab202013-07-14 06:24:09 +000036; CHECK-LABEL: f3:
Ulrich Weigand9e3577f2013-05-06 16:17:29 +000037; CHECK: cxbr
38; CHECK: sxbr
39; CHECK: cfxbr
40; CHECK: xilf
41; CHECK: br %r14
42 %f = load fp128 *%src
43 %conv = fptoui fp128 %f to i32
44 ret i32 %conv
45}