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