xref: /llvm-project/llvm/test/CodeGen/SystemZ/vec-strict-conv-01.ll (revision a1710eb3cd5823c5d14899112ca3086acbdbe9cb)
1; Test strict conversions between integer and float elements.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5declare <2 x i64> @llvm.experimental.constrained.fptoui.v2i64.v2f64(<2 x double>, metadata)
6declare <2 x i64> @llvm.experimental.constrained.fptosi.v2i64.v2f64(<2 x double>, metadata)
7declare <2 x double> @llvm.experimental.constrained.uitofp.v2f64.v2i64(<2 x i64>, metadata, metadata)
8declare <2 x double> @llvm.experimental.constrained.sitofp.v2f64.v2i64(<2 x i64>, metadata, metadata)
9
10declare <2 x i32> @llvm.experimental.constrained.fptoui.v2i32.v2f64(<2 x double>, metadata)
11declare <2 x i32> @llvm.experimental.constrained.fptosi.v2i32.v2f64(<2 x double>, metadata)
12declare <2 x double> @llvm.experimental.constrained.uitofp.v2f64.v2i32(<2 x i32>, metadata, metadata)
13declare <2 x double> @llvm.experimental.constrained.sitofp.v2f64.v2i32(<2 x i32>, metadata, metadata)
14
15declare <2 x i64> @llvm.experimental.constrained.fptoui.v2i64.v2f32(<2 x float>, metadata)
16declare <2 x i64> @llvm.experimental.constrained.fptosi.v2i64.v2f32(<2 x float>, metadata)
17declare <2 x float> @llvm.experimental.constrained.uitofp.v2f32.v2i64(<2 x i64>, metadata, metadata)
18declare <2 x float> @llvm.experimental.constrained.sitofp.v2f32.v2i64(<2 x i64>, metadata, metadata)
19
20; Test conversion of f64s to signed i64s.
21define <2 x i64> @f1(<2 x double> %doubles) #0 {
22; CHECK-LABEL: f1:
23; CHECK: vcgdb %v24, %v24, 0, 5
24; CHECK: br %r14
25  %dwords = call <2 x i64> @llvm.experimental.constrained.fptosi.v2i64.v2f64(<2 x double> %doubles,
26                                               metadata !"fpexcept.strict") #0
27  ret <2 x i64> %dwords
28}
29
30; Test conversion of f64s to unsigned i64s.
31define <2 x i64> @f2(<2 x double> %doubles) #0 {
32; CHECK-LABEL: f2:
33; CHECK: vclgdb %v24, %v24, 0, 5
34; CHECK: br %r14
35  %dwords = call <2 x i64> @llvm.experimental.constrained.fptoui.v2i64.v2f64(<2 x double> %doubles,
36                                               metadata !"fpexcept.strict") #0
37  ret <2 x i64> %dwords
38}
39
40; Test conversion of signed i64s to f64s.
41define <2 x double> @f3(<2 x i64> %dwords) #0 {
42; CHECK-LABEL: f3:
43; CHECK: vcdgb %v24, %v24, 0, 0
44; CHECK: br %r14
45  %doubles = call <2 x double> @llvm.experimental.constrained.sitofp.v2f64.v2i64(<2 x i64> %dwords,
46                                               metadata !"round.dynamic",
47                                               metadata !"fpexcept.strict") #0
48  ret <2 x double> %doubles
49}
50
51; Test conversion of unsigned i64s to f64s.
52define <2 x double> @f4(<2 x i64> %dwords) #0 {
53; CHECK-LABEL: f4:
54; CHECK: vcdlgb %v24, %v24, 0, 0
55; CHECK: br %r14
56  %doubles = call <2 x double> @llvm.experimental.constrained.uitofp.v2f64.v2i64(<2 x i64> %dwords,
57                                               metadata !"round.dynamic",
58                                               metadata !"fpexcept.strict") #0
59  ret <2 x double> %doubles
60}
61
62; Test conversion of f64s to signed i32s, which must compile.
63define void @f5(<2 x double> %doubles, ptr %ptr) #0 {
64  %words = call <2 x i32> @llvm.experimental.constrained.fptosi.v2i32.v2f64(<2 x double> %doubles,
65                                               metadata !"fpexcept.strict") #0
66  store <2 x i32> %words, ptr %ptr
67  ret void
68}
69
70; Test conversion of f64s to unsigned i32s, which must compile.
71define void @f6(<2 x double> %doubles, ptr %ptr) #0 {
72  %words = call <2 x i32> @llvm.experimental.constrained.fptoui.v2i32.v2f64(<2 x double> %doubles,
73                                               metadata !"fpexcept.strict") #0
74  store <2 x i32> %words, ptr %ptr
75  ret void
76}
77
78; Test conversion of signed i32s to f64s, which must compile.
79define <2 x double> @f7(ptr %ptr) #0 {
80  %words = load <2 x i32>, ptr %ptr
81  %doubles = call <2 x double> @llvm.experimental.constrained.sitofp.v2f64.v2i32(<2 x i32> %words,
82                                               metadata !"round.dynamic",
83                                               metadata !"fpexcept.strict") #0
84  ret <2 x double> %doubles
85}
86
87; Test conversion of unsigned i32s to f64s, which must compile.
88define <2 x double> @f8(ptr %ptr) #0 {
89  %words = load <2 x i32>, ptr %ptr
90  %doubles = call <2 x double> @llvm.experimental.constrained.uitofp.v2f64.v2i32(<2 x i32> %words,
91                                               metadata !"round.dynamic",
92                                               metadata !"fpexcept.strict") #0
93  ret <2 x double> %doubles
94}
95
96; Test conversion of f32s to signed i64s, which must compile.
97define <2 x i64> @f9(ptr %ptr) #0 {
98  %floats = load <2 x float>, ptr %ptr
99  %dwords = call <2 x i64> @llvm.experimental.constrained.fptosi.v2i64.v2f32(<2 x float> %floats,
100                                               metadata !"fpexcept.strict") #0
101  ret <2 x i64> %dwords
102}
103
104; Test conversion of f32s to unsigned i64s, which must compile.
105define <2 x i64> @f10(ptr %ptr) #0 {
106  %floats = load <2 x float>, ptr %ptr
107  %dwords = call <2 x i64> @llvm.experimental.constrained.fptoui.v2i64.v2f32(<2 x float> %floats,
108                                               metadata !"fpexcept.strict") #0
109  ret <2 x i64> %dwords
110}
111
112; Test conversion of signed i64s to f32, which must compile.
113define void @f11(<2 x i64> %dwords, ptr %ptr) #0 {
114  %floats = call <2 x float> @llvm.experimental.constrained.sitofp.v2f32.v2i64(<2 x i64> %dwords,
115                                               metadata !"round.dynamic",
116                                               metadata !"fpexcept.strict") #0
117  store <2 x float> %floats, ptr %ptr
118  ret void
119}
120
121; Test conversion of unsigned i64s to f32, which must compile.
122define void @f12(<2 x i64> %dwords, ptr %ptr) #0 {
123  %floats = call <2 x float> @llvm.experimental.constrained.uitofp.v2f32.v2i64(<2 x i64> %dwords,
124                                               metadata !"round.dynamic",
125                                               metadata !"fpexcept.strict") #0
126  store <2 x float> %floats, ptr %ptr
127  ret void
128}
129
130attributes #0 = { strictfp }
131