xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/fp-conv-10.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test conversion of floating-point values to unsigned i32s (z10 only).
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; z10 doesn't have native support for unsigned fp-to-i32 conversions;
6*9880d681SAndroid Build Coastguard Worker; they were added in z196 as the Convert to Logical family of instructions.
7*9880d681SAndroid Build Coastguard Worker; Promoting to i64 doesn't generate an inexact condition for values that are
8*9880d681SAndroid Build Coastguard Worker; outside the i32 range but in the i64 range, so use the default expansion.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; Test f32->i32.
11*9880d681SAndroid Build Coastguard Workerdefine i32 @f1(float %f) {
12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
13*9880d681SAndroid Build Coastguard Worker; CHECK: cebr
14*9880d681SAndroid Build Coastguard Worker; CHECK: sebr
15*9880d681SAndroid Build Coastguard Worker; CHECK: cfebr
16*9880d681SAndroid Build Coastguard Worker; CHECK: xilf
17*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
18*9880d681SAndroid Build Coastguard Worker  %conv = fptoui float %f to i32
19*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; Test f64->i32.
23*9880d681SAndroid Build Coastguard Workerdefine i32 @f2(double %f) {
24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
25*9880d681SAndroid Build Coastguard Worker; CHECK: cdbr
26*9880d681SAndroid Build Coastguard Worker; CHECK: sdbr
27*9880d681SAndroid Build Coastguard Worker; CHECK: cfdbr
28*9880d681SAndroid Build Coastguard Worker; CHECK: xilf
29*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
30*9880d681SAndroid Build Coastguard Worker  %conv = fptoui double %f to i32
31*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; Test f128->i32.
35*9880d681SAndroid Build Coastguard Workerdefine i32 @f3(fp128 *%src) {
36*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
37*9880d681SAndroid Build Coastguard Worker; CHECK: cxbr
38*9880d681SAndroid Build Coastguard Worker; CHECK: sxbr
39*9880d681SAndroid Build Coastguard Worker; CHECK: cfxbr
40*9880d681SAndroid Build Coastguard Worker; CHECK: xilf
41*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
42*9880d681SAndroid Build Coastguard Worker  %f = load fp128 , fp128 *%src
43*9880d681SAndroid Build Coastguard Worker  %conv = fptoui fp128 %f to i32
44*9880d681SAndroid Build Coastguard Worker  ret i32 %conv
45*9880d681SAndroid Build Coastguard Worker}
46