xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/fp-conv-06.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test conversions of unsigned i32s to floating-point values (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; Check i32->f32.  There is no native instruction, so we must promote
6*9880d681SAndroid Build Coastguard Worker; to i64 first.
7*9880d681SAndroid Build Coastguard Workerdefine float @f1(i32 %i) {
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
9*9880d681SAndroid Build Coastguard Worker; CHECK: llgfr [[REGISTER:%r[0-5]]], %r2
10*9880d681SAndroid Build Coastguard Worker; CHECK: cegbr %f0, [[REGISTER]]
11*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
12*9880d681SAndroid Build Coastguard Worker  %conv = uitofp i32 %i to float
13*9880d681SAndroid Build Coastguard Worker  ret float %conv
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; Check i32->f64.
17*9880d681SAndroid Build Coastguard Workerdefine double @f2(i32 %i) {
18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
19*9880d681SAndroid Build Coastguard Worker; CHECK: llgfr [[REGISTER:%r[0-5]]], %r2
20*9880d681SAndroid Build Coastguard Worker; CHECK: cdgbr %f0, [[REGISTER]]
21*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
22*9880d681SAndroid Build Coastguard Worker  %conv = uitofp i32 %i to double
23*9880d681SAndroid Build Coastguard Worker  ret double %conv
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker; Check i32->f128.
27*9880d681SAndroid Build Coastguard Workerdefine void @f3(i32 %i, fp128 *%dst) {
28*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
29*9880d681SAndroid Build Coastguard Worker; CHECK: llgfr [[REGISTER:%r[0-5]]], %r2
30*9880d681SAndroid Build Coastguard Worker; CHECK: cxgbr %f0, [[REGISTER]]
31*9880d681SAndroid Build Coastguard Worker; CHECK: std %f0, 0(%r3)
32*9880d681SAndroid Build Coastguard Worker; CHECK: std %f2, 8(%r3)
33*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
34*9880d681SAndroid Build Coastguard Worker  %conv = uitofp i32 %i to fp128
35*9880d681SAndroid Build Coastguard Worker  store fp128 %conv, fp128 *%dst
36*9880d681SAndroid Build Coastguard Worker  ret void
37*9880d681SAndroid Build Coastguard Worker}
38