[SystemZ] Add CodeGen support for v2f64
[oota-llvm.git] / test / CodeGen / SystemZ / vec-perm-01.ll
1 ; Test vector splat.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5 ; Test v16i8 splat of the first element.
6 define <16 x i8> @f1(<16 x i8> %val) {
7 ; CHECK-LABEL: f1:
8 ; CHECK: vrepb %v24, %v24, 0
9 ; CHECK: br %r14
10   %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
11                        <16 x i32> zeroinitializer
12   ret <16 x i8> %ret
13 }
14
15 ; Test v16i8 splat of the last element.
16 define <16 x i8> @f2(<16 x i8> %val) {
17 ; CHECK-LABEL: f2:
18 ; CHECK: vrepb %v24, %v24, 15
19 ; CHECK: br %r14
20   %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
21                        <16 x i32> <i32 15, i32 15, i32 15, i32 15,
22                                    i32 15, i32 15, i32 15, i32 15,
23                                    i32 15, i32 15, i32 15, i32 15,
24                                    i32 15, i32 15, i32 15, i32 15>
25   ret <16 x i8> %ret
26 }
27
28 ; Test v16i8 splat of an arbitrary element, using the second operand of
29 ; the shufflevector.
30 define <16 x i8> @f3(<16 x i8> %val) {
31 ; CHECK-LABEL: f3:
32 ; CHECK: vrepb %v24, %v24, 4
33 ; CHECK: br %r14
34   %ret = shufflevector <16 x i8> undef, <16 x i8> %val,
35                        <16 x i32> <i32 20, i32 20, i32 20, i32 20,
36                                    i32 20, i32 20, i32 20, i32 20,
37                                    i32 20, i32 20, i32 20, i32 20,
38                                    i32 20, i32 20, i32 20, i32 20>
39   ret <16 x i8> %ret
40 }
41
42 ; Test v8i16 splat of the first element.
43 define <8 x i16> @f4(<8 x i16> %val) {
44 ; CHECK-LABEL: f4:
45 ; CHECK: vreph %v24, %v24, 0
46 ; CHECK: br %r14
47   %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
48                        <8 x i32> zeroinitializer
49   ret <8 x i16> %ret
50 }
51
52 ; Test v8i16 splat of the last element.
53 define <8 x i16> @f5(<8 x i16> %val) {
54 ; CHECK-LABEL: f5:
55 ; CHECK: vreph %v24, %v24, 7
56 ; CHECK: br %r14
57   %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
58                        <8 x i32> <i32 7, i32 7, i32 7, i32 7,
59                                   i32 7, i32 7, i32 7, i32 7>
60   ret <8 x i16> %ret
61 }
62
63 ; Test v8i16 splat of an arbitrary element, using the second operand of
64 ; the shufflevector.
65 define <8 x i16> @f6(<8 x i16> %val) {
66 ; CHECK-LABEL: f6:
67 ; CHECK: vreph %v24, %v24, 2
68 ; CHECK: br %r14
69   %ret = shufflevector <8 x i16> undef, <8 x i16> %val,
70                        <8 x i32> <i32 10, i32 10, i32 10, i32 10,
71                                   i32 10, i32 10, i32 10, i32 10>
72   ret <8 x i16> %ret
73 }
74
75 ; Test v4i32 splat of the first element.
76 define <4 x i32> @f7(<4 x i32> %val) {
77 ; CHECK-LABEL: f7:
78 ; CHECK: vrepf %v24, %v24, 0
79 ; CHECK: br %r14
80   %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
81                        <4 x i32> zeroinitializer
82   ret <4 x i32> %ret
83 }
84
85 ; Test v4i32 splat of the last element.
86 define <4 x i32> @f8(<4 x i32> %val) {
87 ; CHECK-LABEL: f8:
88 ; CHECK: vrepf %v24, %v24, 3
89 ; CHECK: br %r14
90   %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
91                        <4 x i32> <i32 3, i32 3, i32 3, i32 3>
92   ret <4 x i32> %ret
93 }
94
95 ; Test v4i32 splat of an arbitrary element, using the second operand of
96 ; the shufflevector.
97 define <4 x i32> @f9(<4 x i32> %val) {
98 ; CHECK-LABEL: f9:
99 ; CHECK: vrepf %v24, %v24, 1
100 ; CHECK: br %r14
101   %ret = shufflevector <4 x i32> undef, <4 x i32> %val,
102                        <4 x i32> <i32 5, i32 5, i32 5, i32 5>
103   ret <4 x i32> %ret
104 }
105
106 ; Test v2i64 splat of the first element.
107 define <2 x i64> @f10(<2 x i64> %val) {
108 ; CHECK-LABEL: f10:
109 ; CHECK: vrepg %v24, %v24, 0
110 ; CHECK: br %r14
111   %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
112                        <2 x i32> zeroinitializer
113   ret <2 x i64> %ret
114 }
115
116 ; Test v2i64 splat of the last element.
117 define <2 x i64> @f11(<2 x i64> %val) {
118 ; CHECK-LABEL: f11:
119 ; CHECK: vrepg %v24, %v24, 1
120 ; CHECK: br %r14
121   %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
122                        <2 x i32> <i32 1, i32 1>
123   ret <2 x i64> %ret
124 }
125
126 ; Test v2f64 splat of the first element.
127 define <2 x double> @f15(<2 x double> %val) {
128 ; CHECK-LABEL: f15:
129 ; CHECK: vrepg %v24, %v24, 0
130 ; CHECK: br %r14
131   %ret = shufflevector <2 x double> %val, <2 x double> undef,
132                        <2 x i32> zeroinitializer
133   ret <2 x double> %ret
134 }
135
136 ; Test v2f64 splat of the last element.
137 define <2 x double> @f16(<2 x double> %val) {
138 ; CHECK-LABEL: f16:
139 ; CHECK: vrepg %v24, %v24, 1
140 ; CHECK: br %r14
141   %ret = shufflevector <2 x double> %val, <2 x double> undef,
142                        <2 x i32> <i32 1, i32 1>
143   ret <2 x double> %ret
144 }