xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/vec-conv-01.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test conversions between integer and float elements.
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; Test conversion of f64s to signed i64s.
6*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @f1(<2 x double> %doubles) {
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
8*9880d681SAndroid Build Coastguard Worker; CHECK: vcgdb %v24, %v24, 0, 5
9*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
10*9880d681SAndroid Build Coastguard Worker  %dwords = fptosi <2 x double> %doubles to <2 x i64>
11*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %dwords
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; Test conversion of f64s to unsigned i64s.
15*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @f2(<2 x double> %doubles) {
16*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
17*9880d681SAndroid Build Coastguard Worker; CHECK: vclgdb %v24, %v24, 0, 5
18*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
19*9880d681SAndroid Build Coastguard Worker  %dwords = fptoui <2 x double> %doubles to <2 x i64>
20*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %dwords
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; Test conversion of signed i64s to f64s.
24*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @f3(<2 x i64> %dwords) {
25*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
26*9880d681SAndroid Build Coastguard Worker; CHECK: vcdgb %v24, %v24, 0, 0
27*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
28*9880d681SAndroid Build Coastguard Worker  %doubles = sitofp <2 x i64> %dwords to <2 x double>
29*9880d681SAndroid Build Coastguard Worker  ret <2 x double> %doubles
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; Test conversion of unsigned i64s to f64s.
33*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @f4(<2 x i64> %dwords) {
34*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4:
35*9880d681SAndroid Build Coastguard Worker; CHECK: vcdlgb %v24, %v24, 0, 0
36*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14
37*9880d681SAndroid Build Coastguard Worker  %doubles = uitofp <2 x i64> %dwords to <2 x double>
38*9880d681SAndroid Build Coastguard Worker  ret <2 x double> %doubles
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker; Test conversion of f64s to signed i32s, which must compile.
42*9880d681SAndroid Build Coastguard Workerdefine void @f5(<2 x double> %doubles, <2 x i32> *%ptr) {
43*9880d681SAndroid Build Coastguard Worker  %words = fptosi <2 x double> %doubles to <2 x i32>
44*9880d681SAndroid Build Coastguard Worker  store <2 x i32> %words, <2 x i32> *%ptr
45*9880d681SAndroid Build Coastguard Worker  ret void
46*9880d681SAndroid Build Coastguard Worker}
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; Test conversion of f64s to unsigned i32s, which must compile.
49*9880d681SAndroid Build Coastguard Workerdefine void @f6(<2 x double> %doubles, <2 x i32> *%ptr) {
50*9880d681SAndroid Build Coastguard Worker  %words = fptoui <2 x double> %doubles to <2 x i32>
51*9880d681SAndroid Build Coastguard Worker  store <2 x i32> %words, <2 x i32> *%ptr
52*9880d681SAndroid Build Coastguard Worker  ret void
53*9880d681SAndroid Build Coastguard Worker}
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker; Test conversion of signed i32s to f64s, which must compile.
56*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @f7(<2 x i32> *%ptr) {
57*9880d681SAndroid Build Coastguard Worker  %words = load <2 x i32>, <2 x i32> *%ptr
58*9880d681SAndroid Build Coastguard Worker  %doubles = sitofp <2 x i32> %words to <2 x double>
59*9880d681SAndroid Build Coastguard Worker  ret <2 x double> %doubles
60*9880d681SAndroid Build Coastguard Worker}
61*9880d681SAndroid Build Coastguard Worker
62*9880d681SAndroid Build Coastguard Worker; Test conversion of unsigned i32s to f64s, which must compile.
63*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @f8(<2 x i32> *%ptr) {
64*9880d681SAndroid Build Coastguard Worker  %words = load <2 x i32>, <2 x i32> *%ptr
65*9880d681SAndroid Build Coastguard Worker  %doubles = uitofp <2 x i32> %words to <2 x double>
66*9880d681SAndroid Build Coastguard Worker  ret <2 x double> %doubles
67*9880d681SAndroid Build Coastguard Worker}
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Worker; Test conversion of f32s to signed i64s, which must compile.
70*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @f9(<2 x float> *%ptr) {
71*9880d681SAndroid Build Coastguard Worker  %floats = load <2 x float>, <2 x float> *%ptr
72*9880d681SAndroid Build Coastguard Worker  %dwords = fptosi <2 x float> %floats to <2 x i64>
73*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %dwords
74*9880d681SAndroid Build Coastguard Worker}
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker; Test conversion of f32s to unsigned i64s, which must compile.
77*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @f10(<2 x float> *%ptr) {
78*9880d681SAndroid Build Coastguard Worker  %floats = load <2 x float>, <2 x float> *%ptr
79*9880d681SAndroid Build Coastguard Worker  %dwords = fptoui <2 x float> %floats to <2 x i64>
80*9880d681SAndroid Build Coastguard Worker  ret <2 x i64> %dwords
81*9880d681SAndroid Build Coastguard Worker}
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Worker; Test conversion of signed i64s to f32, which must compile.
84*9880d681SAndroid Build Coastguard Workerdefine void @f11(<2 x i64> %dwords, <2 x float> *%ptr) {
85*9880d681SAndroid Build Coastguard Worker  %floats = sitofp <2 x i64> %dwords to <2 x float>
86*9880d681SAndroid Build Coastguard Worker  store <2 x float> %floats, <2 x float> *%ptr
87*9880d681SAndroid Build Coastguard Worker  ret void
88*9880d681SAndroid Build Coastguard Worker}
89*9880d681SAndroid Build Coastguard Worker
90*9880d681SAndroid Build Coastguard Worker; Test conversion of unsigned i64s to f32, which must compile.
91*9880d681SAndroid Build Coastguard Workerdefine void @f12(<2 x i64> %dwords, <2 x float> *%ptr) {
92*9880d681SAndroid Build Coastguard Worker  %floats = uitofp <2 x i64> %dwords to <2 x float>
93*9880d681SAndroid Build Coastguard Worker  store <2 x float> %floats, <2 x float> *%ptr
94*9880d681SAndroid Build Coastguard Worker  ret void
95*9880d681SAndroid Build Coastguard Worker}
96