xref: /minix3/external/bsd/llvm/dist/llvm/lib/Target/PowerPC/PPCInstrAltivec.td (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc//===-- PPCInstrAltivec.td - The PowerPC Altivec Extension -*- tablegen -*-===//
2f4a2713aSLionel Sambuc//
3f4a2713aSLionel Sambuc//                     The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc//
5f4a2713aSLionel Sambuc// This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc// License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc//
8f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc//
10f4a2713aSLionel Sambuc// This file describes the Altivec extension to the PowerPC instruction set.
11f4a2713aSLionel Sambuc//
12f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
13f4a2713aSLionel Sambuc
14f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
15f4a2713aSLionel Sambuc// Altivec transformation functions and pattern fragments.
16f4a2713aSLionel Sambuc//
17f4a2713aSLionel Sambuc
18f4a2713aSLionel Sambuc// Since we canonicalize buildvectors to v16i8, all vnots "-1" operands will be
19f4a2713aSLionel Sambuc// of that type.
20f4a2713aSLionel Sambucdef vnot_ppc : PatFrag<(ops node:$in),
21f4a2713aSLionel Sambuc                       (xor node:$in, (bitconvert (v16i8 immAllOnesV)))>;
22f4a2713aSLionel Sambuc
23f4a2713aSLionel Sambucdef vpkuhum_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
24f4a2713aSLionel Sambuc                              (vector_shuffle node:$lhs, node:$rhs), [{
25*0a6a1f1dSLionel Sambuc  return PPC::isVPKUHUMShuffleMask(cast<ShuffleVectorSDNode>(N), 0, *CurDAG);
26f4a2713aSLionel Sambuc}]>;
27f4a2713aSLionel Sambucdef vpkuwum_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
28f4a2713aSLionel Sambuc                              (vector_shuffle node:$lhs, node:$rhs), [{
29*0a6a1f1dSLionel Sambuc  return PPC::isVPKUWUMShuffleMask(cast<ShuffleVectorSDNode>(N), 0, *CurDAG);
30f4a2713aSLionel Sambuc}]>;
31f4a2713aSLionel Sambucdef vpkuhum_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
32f4a2713aSLionel Sambuc                                    (vector_shuffle node:$lhs, node:$rhs), [{
33*0a6a1f1dSLionel Sambuc  return PPC::isVPKUHUMShuffleMask(cast<ShuffleVectorSDNode>(N), 1, *CurDAG);
34f4a2713aSLionel Sambuc}]>;
35f4a2713aSLionel Sambucdef vpkuwum_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
36f4a2713aSLionel Sambuc                                    (vector_shuffle node:$lhs, node:$rhs), [{
37*0a6a1f1dSLionel Sambuc  return PPC::isVPKUWUMShuffleMask(cast<ShuffleVectorSDNode>(N), 1, *CurDAG);
38f4a2713aSLionel Sambuc}]>;
39f4a2713aSLionel Sambuc
40*0a6a1f1dSLionel Sambuc// These fragments are provided for little-endian, where the inputs must be
41*0a6a1f1dSLionel Sambuc// swapped for correct semantics.
42*0a6a1f1dSLionel Sambucdef vpkuhum_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
43*0a6a1f1dSLionel Sambuc                                      (vector_shuffle node:$lhs, node:$rhs), [{
44*0a6a1f1dSLionel Sambuc  return PPC::isVPKUHUMShuffleMask(cast<ShuffleVectorSDNode>(N), 2, *CurDAG);
45*0a6a1f1dSLionel Sambuc}]>;
46*0a6a1f1dSLionel Sambucdef vpkuwum_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
47*0a6a1f1dSLionel Sambuc                                      (vector_shuffle node:$lhs, node:$rhs), [{
48*0a6a1f1dSLionel Sambuc  return PPC::isVPKUWUMShuffleMask(cast<ShuffleVectorSDNode>(N), 2, *CurDAG);
49*0a6a1f1dSLionel Sambuc}]>;
50f4a2713aSLionel Sambuc
51f4a2713aSLionel Sambucdef vmrglb_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
52f4a2713aSLionel Sambuc                             (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
53*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 0, *CurDAG);
54f4a2713aSLionel Sambuc}]>;
55f4a2713aSLionel Sambucdef vmrglh_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
56f4a2713aSLionel Sambuc                             (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
57*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 0, *CurDAG);
58f4a2713aSLionel Sambuc}]>;
59f4a2713aSLionel Sambucdef vmrglw_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
60f4a2713aSLionel Sambuc                             (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
61*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 0, *CurDAG);
62f4a2713aSLionel Sambuc}]>;
63f4a2713aSLionel Sambucdef vmrghb_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
64f4a2713aSLionel Sambuc                             (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
65*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 0, *CurDAG);
66f4a2713aSLionel Sambuc}]>;
67f4a2713aSLionel Sambucdef vmrghh_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
68f4a2713aSLionel Sambuc                             (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
69*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 0, *CurDAG);
70f4a2713aSLionel Sambuc}]>;
71f4a2713aSLionel Sambucdef vmrghw_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
72f4a2713aSLionel Sambuc                             (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
73*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 0, *CurDAG);
74f4a2713aSLionel Sambuc}]>;
75f4a2713aSLionel Sambuc
76f4a2713aSLionel Sambuc
77f4a2713aSLionel Sambucdef vmrglb_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
78f4a2713aSLionel Sambuc                               (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
79*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 1, *CurDAG);
80f4a2713aSLionel Sambuc}]>;
81f4a2713aSLionel Sambucdef vmrglh_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
82f4a2713aSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
83*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 1, *CurDAG);
84f4a2713aSLionel Sambuc}]>;
85f4a2713aSLionel Sambucdef vmrglw_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
86f4a2713aSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
87*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 1, *CurDAG);
88f4a2713aSLionel Sambuc}]>;
89f4a2713aSLionel Sambucdef vmrghb_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
90f4a2713aSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
91*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 1, *CurDAG);
92f4a2713aSLionel Sambuc}]>;
93f4a2713aSLionel Sambucdef vmrghh_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
94f4a2713aSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
95*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 1, *CurDAG);
96f4a2713aSLionel Sambuc}]>;
97f4a2713aSLionel Sambucdef vmrghw_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
98f4a2713aSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
99*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 1, *CurDAG);
100*0a6a1f1dSLionel Sambuc}]>;
101*0a6a1f1dSLionel Sambuc
102*0a6a1f1dSLionel Sambuc
103*0a6a1f1dSLionel Sambuc// These fragments are provided for little-endian, where the inputs must be
104*0a6a1f1dSLionel Sambuc// swapped for correct semantics.
105*0a6a1f1dSLionel Sambucdef vmrglb_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
106*0a6a1f1dSLionel Sambuc                               (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{
107*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 2, *CurDAG);
108*0a6a1f1dSLionel Sambuc}]>;
109*0a6a1f1dSLionel Sambucdef vmrglh_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
110*0a6a1f1dSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
111*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 2, *CurDAG);
112*0a6a1f1dSLionel Sambuc}]>;
113*0a6a1f1dSLionel Sambucdef vmrglw_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
114*0a6a1f1dSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
115*0a6a1f1dSLionel Sambuc  return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 2, *CurDAG);
116*0a6a1f1dSLionel Sambuc}]>;
117*0a6a1f1dSLionel Sambucdef vmrghb_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
118*0a6a1f1dSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
119*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 2, *CurDAG);
120*0a6a1f1dSLionel Sambuc}]>;
121*0a6a1f1dSLionel Sambucdef vmrghh_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
122*0a6a1f1dSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
123*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 2, *CurDAG);
124*0a6a1f1dSLionel Sambuc}]>;
125*0a6a1f1dSLionel Sambucdef vmrghw_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
126*0a6a1f1dSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
127*0a6a1f1dSLionel Sambuc  return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 2, *CurDAG);
128f4a2713aSLionel Sambuc}]>;
129f4a2713aSLionel Sambuc
130f4a2713aSLionel Sambuc
131f4a2713aSLionel Sambucdef VSLDOI_get_imm : SDNodeXForm<vector_shuffle, [{
132*0a6a1f1dSLionel Sambuc  return getI32Imm(PPC::isVSLDOIShuffleMask(N, 0, *CurDAG));
133f4a2713aSLionel Sambuc}]>;
134f4a2713aSLionel Sambucdef vsldoi_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
135f4a2713aSLionel Sambuc                             (vector_shuffle node:$lhs, node:$rhs), [{
136*0a6a1f1dSLionel Sambuc  return PPC::isVSLDOIShuffleMask(N, 0, *CurDAG) != -1;
137f4a2713aSLionel Sambuc}], VSLDOI_get_imm>;
138f4a2713aSLionel Sambuc
139f4a2713aSLionel Sambuc
140f4a2713aSLionel Sambuc/// VSLDOI_unary* - These are used to match vsldoi(X,X), which is turned into
141f4a2713aSLionel Sambuc/// vector_shuffle(X,undef,mask) by the dag combiner.
142f4a2713aSLionel Sambucdef VSLDOI_unary_get_imm : SDNodeXForm<vector_shuffle, [{
143*0a6a1f1dSLionel Sambuc  return getI32Imm(PPC::isVSLDOIShuffleMask(N, 1, *CurDAG));
144f4a2713aSLionel Sambuc}]>;
145f4a2713aSLionel Sambucdef vsldoi_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
146f4a2713aSLionel Sambuc                                   (vector_shuffle node:$lhs, node:$rhs), [{
147*0a6a1f1dSLionel Sambuc  return PPC::isVSLDOIShuffleMask(N, 1, *CurDAG) != -1;
148f4a2713aSLionel Sambuc}], VSLDOI_unary_get_imm>;
149f4a2713aSLionel Sambuc
150f4a2713aSLionel Sambuc
151*0a6a1f1dSLionel Sambuc/// VSLDOI_swapped* - These fragments are provided for little-endian, where
152*0a6a1f1dSLionel Sambuc/// the inputs must be swapped for correct semantics.
153*0a6a1f1dSLionel Sambucdef VSLDOI_swapped_get_imm : SDNodeXForm<vector_shuffle, [{
154*0a6a1f1dSLionel Sambuc  return getI32Imm(PPC::isVSLDOIShuffleMask(N, 2, *CurDAG));
155*0a6a1f1dSLionel Sambuc}]>;
156*0a6a1f1dSLionel Sambucdef vsldoi_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
157*0a6a1f1dSLionel Sambuc                                     (vector_shuffle node:$lhs, node:$rhs), [{
158*0a6a1f1dSLionel Sambuc  return PPC::isVSLDOIShuffleMask(N, 2, *CurDAG) != -1;
159*0a6a1f1dSLionel Sambuc}], VSLDOI_get_imm>;
160*0a6a1f1dSLionel Sambuc
161*0a6a1f1dSLionel Sambuc
162f4a2713aSLionel Sambuc// VSPLT*_get_imm xform function: convert vector_shuffle mask to VSPLT* imm.
163f4a2713aSLionel Sambucdef VSPLTB_get_imm : SDNodeXForm<vector_shuffle, [{
164*0a6a1f1dSLionel Sambuc  return getI32Imm(PPC::getVSPLTImmediate(N, 1, *CurDAG));
165f4a2713aSLionel Sambuc}]>;
166f4a2713aSLionel Sambucdef vspltb_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
167f4a2713aSLionel Sambuc                             (vector_shuffle node:$lhs, node:$rhs), [{
168f4a2713aSLionel Sambuc  return PPC::isSplatShuffleMask(cast<ShuffleVectorSDNode>(N), 1);
169f4a2713aSLionel Sambuc}], VSPLTB_get_imm>;
170f4a2713aSLionel Sambucdef VSPLTH_get_imm : SDNodeXForm<vector_shuffle, [{
171*0a6a1f1dSLionel Sambuc  return getI32Imm(PPC::getVSPLTImmediate(N, 2, *CurDAG));
172f4a2713aSLionel Sambuc}]>;
173f4a2713aSLionel Sambucdef vsplth_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
174f4a2713aSLionel Sambuc                             (vector_shuffle node:$lhs, node:$rhs), [{
175f4a2713aSLionel Sambuc  return PPC::isSplatShuffleMask(cast<ShuffleVectorSDNode>(N), 2);
176f4a2713aSLionel Sambuc}], VSPLTH_get_imm>;
177f4a2713aSLionel Sambucdef VSPLTW_get_imm : SDNodeXForm<vector_shuffle, [{
178*0a6a1f1dSLionel Sambuc  return getI32Imm(PPC::getVSPLTImmediate(N, 4, *CurDAG));
179f4a2713aSLionel Sambuc}]>;
180f4a2713aSLionel Sambucdef vspltw_shuffle : PatFrag<(ops node:$lhs, node:$rhs),
181f4a2713aSLionel Sambuc                             (vector_shuffle node:$lhs, node:$rhs), [{
182f4a2713aSLionel Sambuc  return PPC::isSplatShuffleMask(cast<ShuffleVectorSDNode>(N), 4);
183f4a2713aSLionel Sambuc}], VSPLTW_get_imm>;
184f4a2713aSLionel Sambuc
185f4a2713aSLionel Sambuc
186f4a2713aSLionel Sambuc// VSPLTISB_get_imm xform function: convert build_vector to VSPLTISB imm.
187f4a2713aSLionel Sambucdef VSPLTISB_get_imm : SDNodeXForm<build_vector, [{
188f4a2713aSLionel Sambuc  return PPC::get_VSPLTI_elt(N, 1, *CurDAG);
189f4a2713aSLionel Sambuc}]>;
190f4a2713aSLionel Sambucdef vecspltisb : PatLeaf<(build_vector), [{
191f4a2713aSLionel Sambuc  return PPC::get_VSPLTI_elt(N, 1, *CurDAG).getNode() != 0;
192f4a2713aSLionel Sambuc}], VSPLTISB_get_imm>;
193f4a2713aSLionel Sambuc
194f4a2713aSLionel Sambuc// VSPLTISH_get_imm xform function: convert build_vector to VSPLTISH imm.
195f4a2713aSLionel Sambucdef VSPLTISH_get_imm : SDNodeXForm<build_vector, [{
196f4a2713aSLionel Sambuc  return PPC::get_VSPLTI_elt(N, 2, *CurDAG);
197f4a2713aSLionel Sambuc}]>;
198f4a2713aSLionel Sambucdef vecspltish : PatLeaf<(build_vector), [{
199f4a2713aSLionel Sambuc  return PPC::get_VSPLTI_elt(N, 2, *CurDAG).getNode() != 0;
200f4a2713aSLionel Sambuc}], VSPLTISH_get_imm>;
201f4a2713aSLionel Sambuc
202f4a2713aSLionel Sambuc// VSPLTISW_get_imm xform function: convert build_vector to VSPLTISW imm.
203f4a2713aSLionel Sambucdef VSPLTISW_get_imm : SDNodeXForm<build_vector, [{
204f4a2713aSLionel Sambuc  return PPC::get_VSPLTI_elt(N, 4, *CurDAG);
205f4a2713aSLionel Sambuc}]>;
206f4a2713aSLionel Sambucdef vecspltisw : PatLeaf<(build_vector), [{
207f4a2713aSLionel Sambuc  return PPC::get_VSPLTI_elt(N, 4, *CurDAG).getNode() != 0;
208f4a2713aSLionel Sambuc}], VSPLTISW_get_imm>;
209f4a2713aSLionel Sambuc
210f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
211f4a2713aSLionel Sambuc// Helpers for defining instructions that directly correspond to intrinsics.
212f4a2713aSLionel Sambuc
213f4a2713aSLionel Sambuc// VA1a_Int_Ty - A VAForm_1a intrinsic definition of specific type.
214f4a2713aSLionel Sambucclass VA1a_Int_Ty<bits<6> xo, string opc, Intrinsic IntID, ValueType Ty>
215f4a2713aSLionel Sambuc  : VAForm_1a<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC),
216*0a6a1f1dSLionel Sambuc              !strconcat(opc, " $vD, $vA, $vB, $vC"), IIC_VecFP,
217f4a2713aSLionel Sambuc                       [(set Ty:$vD, (IntID Ty:$vA, Ty:$vB, Ty:$vC))]>;
218f4a2713aSLionel Sambuc
219f4a2713aSLionel Sambuc// VA1a_Int_Ty2 - A VAForm_1a intrinsic definition where the type of the
220f4a2713aSLionel Sambuc// inputs doesn't match the type of the output.
221f4a2713aSLionel Sambucclass VA1a_Int_Ty2<bits<6> xo, string opc, Intrinsic IntID, ValueType OutTy,
222f4a2713aSLionel Sambuc                   ValueType InTy>
223f4a2713aSLionel Sambuc  : VAForm_1a<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC),
224*0a6a1f1dSLionel Sambuc              !strconcat(opc, " $vD, $vA, $vB, $vC"), IIC_VecFP,
225f4a2713aSLionel Sambuc                       [(set OutTy:$vD, (IntID InTy:$vA, InTy:$vB, InTy:$vC))]>;
226f4a2713aSLionel Sambuc
227f4a2713aSLionel Sambuc// VA1a_Int_Ty3 - A VAForm_1a intrinsic definition where there are two
228f4a2713aSLionel Sambuc// input types and an output type.
229f4a2713aSLionel Sambucclass VA1a_Int_Ty3<bits<6> xo, string opc, Intrinsic IntID, ValueType OutTy,
230f4a2713aSLionel Sambuc                   ValueType In1Ty, ValueType In2Ty>
231f4a2713aSLionel Sambuc  : VAForm_1a<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC),
232*0a6a1f1dSLionel Sambuc              !strconcat(opc, " $vD, $vA, $vB, $vC"), IIC_VecFP,
233f4a2713aSLionel Sambuc                       [(set OutTy:$vD,
234f4a2713aSLionel Sambuc                         (IntID In1Ty:$vA, In1Ty:$vB, In2Ty:$vC))]>;
235f4a2713aSLionel Sambuc
236f4a2713aSLionel Sambuc// VX1_Int_Ty - A VXForm_1 intrinsic definition of specific type.
237f4a2713aSLionel Sambucclass VX1_Int_Ty<bits<11> xo, string opc, Intrinsic IntID, ValueType Ty>
238f4a2713aSLionel Sambuc  : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
239*0a6a1f1dSLionel Sambuc             !strconcat(opc, " $vD, $vA, $vB"), IIC_VecFP,
240f4a2713aSLionel Sambuc             [(set Ty:$vD, (IntID Ty:$vA, Ty:$vB))]>;
241f4a2713aSLionel Sambuc
242f4a2713aSLionel Sambuc// VX1_Int_Ty2 - A VXForm_1 intrinsic definition where the type of the
243f4a2713aSLionel Sambuc// inputs doesn't match the type of the output.
244f4a2713aSLionel Sambucclass VX1_Int_Ty2<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy,
245f4a2713aSLionel Sambuc                  ValueType InTy>
246f4a2713aSLionel Sambuc  : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
247*0a6a1f1dSLionel Sambuc             !strconcat(opc, " $vD, $vA, $vB"), IIC_VecFP,
248f4a2713aSLionel Sambuc             [(set OutTy:$vD, (IntID InTy:$vA, InTy:$vB))]>;
249f4a2713aSLionel Sambuc
250f4a2713aSLionel Sambuc// VX1_Int_Ty3 - A VXForm_1 intrinsic definition where there are two
251f4a2713aSLionel Sambuc// input types and an output type.
252f4a2713aSLionel Sambucclass VX1_Int_Ty3<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy,
253f4a2713aSLionel Sambuc                  ValueType In1Ty, ValueType In2Ty>
254f4a2713aSLionel Sambuc  : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
255*0a6a1f1dSLionel Sambuc             !strconcat(opc, " $vD, $vA, $vB"), IIC_VecFP,
256f4a2713aSLionel Sambuc             [(set OutTy:$vD, (IntID In1Ty:$vA, In2Ty:$vB))]>;
257f4a2713aSLionel Sambuc
258f4a2713aSLionel Sambuc// VX2_Int_SP - A VXForm_2 intrinsic definition of vector single-precision type.
259f4a2713aSLionel Sambucclass VX2_Int_SP<bits<11> xo, string opc, Intrinsic IntID>
260f4a2713aSLionel Sambuc  : VXForm_2<xo, (outs vrrc:$vD), (ins vrrc:$vB),
261*0a6a1f1dSLionel Sambuc             !strconcat(opc, " $vD, $vB"), IIC_VecFP,
262f4a2713aSLionel Sambuc             [(set v4f32:$vD, (IntID v4f32:$vB))]>;
263f4a2713aSLionel Sambuc
264f4a2713aSLionel Sambuc// VX2_Int_Ty2 - A VXForm_2 intrinsic definition where the type of the
265f4a2713aSLionel Sambuc// inputs doesn't match the type of the output.
266f4a2713aSLionel Sambucclass VX2_Int_Ty2<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy,
267f4a2713aSLionel Sambuc                  ValueType InTy>
268f4a2713aSLionel Sambuc  : VXForm_2<xo, (outs vrrc:$vD), (ins vrrc:$vB),
269*0a6a1f1dSLionel Sambuc             !strconcat(opc, " $vD, $vB"), IIC_VecFP,
270f4a2713aSLionel Sambuc             [(set OutTy:$vD, (IntID InTy:$vB))]>;
271f4a2713aSLionel Sambuc
272f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
273f4a2713aSLionel Sambuc// Instruction Definitions.
274f4a2713aSLionel Sambuc
275*0a6a1f1dSLionel Sambucdef HasAltivec : Predicate<"PPCSubTarget->hasAltivec()">;
276f4a2713aSLionel Sambuclet Predicates = [HasAltivec] in {
277f4a2713aSLionel Sambuc
278*0a6a1f1dSLionel Sambucdef DSS      : DSS_Form<0, 822, (outs), (ins u5imm:$STRM),
279*0a6a1f1dSLionel Sambuc                        "dss $STRM", IIC_LdStLoad /*FIXME*/, [(int_ppc_altivec_dss imm:$STRM)]>,
280*0a6a1f1dSLionel Sambuc                        Deprecated<DeprecatedDST> {
281*0a6a1f1dSLionel Sambuc  let A = 0;
282*0a6a1f1dSLionel Sambuc  let B = 0;
283*0a6a1f1dSLionel Sambuc}
284*0a6a1f1dSLionel Sambuc
285*0a6a1f1dSLionel Sambucdef DSSALL   : DSS_Form<1, 822, (outs), (ins),
286*0a6a1f1dSLionel Sambuc                        "dssall", IIC_LdStLoad /*FIXME*/, [(int_ppc_altivec_dssall)]>,
287*0a6a1f1dSLionel Sambuc                        Deprecated<DeprecatedDST> {
288*0a6a1f1dSLionel Sambuc  let STRM = 0;
289*0a6a1f1dSLionel Sambuc  let A = 0;
290*0a6a1f1dSLionel Sambuc  let B = 0;
291*0a6a1f1dSLionel Sambuc}
292*0a6a1f1dSLionel Sambuc
293*0a6a1f1dSLionel Sambucdef DST      : DSS_Form<0, 342, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB),
294*0a6a1f1dSLionel Sambuc                        "dst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
295*0a6a1f1dSLionel Sambuc                        [(int_ppc_altivec_dst i32:$rA, i32:$rB, imm:$STRM)]>,
296f4a2713aSLionel Sambuc                        Deprecated<DeprecatedDST>;
297f4a2713aSLionel Sambuc
298*0a6a1f1dSLionel Sambucdef DSTT     : DSS_Form<1, 342, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB),
299*0a6a1f1dSLionel Sambuc                        "dstt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
300*0a6a1f1dSLionel Sambuc                        [(int_ppc_altivec_dstt i32:$rA, i32:$rB, imm:$STRM)]>,
301f4a2713aSLionel Sambuc                        Deprecated<DeprecatedDST>;
302*0a6a1f1dSLionel Sambuc
303*0a6a1f1dSLionel Sambucdef DSTST    : DSS_Form<0, 374, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB),
304*0a6a1f1dSLionel Sambuc                        "dstst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
305*0a6a1f1dSLionel Sambuc                        [(int_ppc_altivec_dstst i32:$rA, i32:$rB, imm:$STRM)]>,
306f4a2713aSLionel Sambuc                        Deprecated<DeprecatedDST>;
307*0a6a1f1dSLionel Sambuc
308*0a6a1f1dSLionel Sambucdef DSTSTT   : DSS_Form<1, 374, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB),
309*0a6a1f1dSLionel Sambuc                        "dststt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
310*0a6a1f1dSLionel Sambuc                        [(int_ppc_altivec_dststt i32:$rA, i32:$rB, imm:$STRM)]>,
311f4a2713aSLionel Sambuc                        Deprecated<DeprecatedDST>;
312*0a6a1f1dSLionel Sambuc
313*0a6a1f1dSLionel Sambuclet isCodeGenOnly = 1 in {
314*0a6a1f1dSLionel Sambuc  // The very same instructions as above, but formally matching 64bit registers.
315*0a6a1f1dSLionel Sambuc  def DST64    : DSS_Form<0, 342, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB),
316*0a6a1f1dSLionel Sambuc                          "dst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
317*0a6a1f1dSLionel Sambuc                          [(int_ppc_altivec_dst i64:$rA, i32:$rB, imm:$STRM)]>,
318*0a6a1f1dSLionel Sambuc                          Deprecated<DeprecatedDST>;
319*0a6a1f1dSLionel Sambuc
320*0a6a1f1dSLionel Sambuc  def DSTT64   : DSS_Form<1, 342, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB),
321*0a6a1f1dSLionel Sambuc                          "dstt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
322*0a6a1f1dSLionel Sambuc                          [(int_ppc_altivec_dstt i64:$rA, i32:$rB, imm:$STRM)]>,
323*0a6a1f1dSLionel Sambuc                          Deprecated<DeprecatedDST>;
324*0a6a1f1dSLionel Sambuc
325*0a6a1f1dSLionel Sambuc  def DSTST64  : DSS_Form<0, 374, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB),
326*0a6a1f1dSLionel Sambuc                          "dstst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
327*0a6a1f1dSLionel Sambuc                          [(int_ppc_altivec_dstst i64:$rA, i32:$rB,
328*0a6a1f1dSLionel Sambuc                                                  imm:$STRM)]>,
329*0a6a1f1dSLionel Sambuc                          Deprecated<DeprecatedDST>;
330*0a6a1f1dSLionel Sambuc
331*0a6a1f1dSLionel Sambuc  def DSTSTT64 : DSS_Form<1, 374, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB),
332*0a6a1f1dSLionel Sambuc                          "dststt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/,
333*0a6a1f1dSLionel Sambuc                          [(int_ppc_altivec_dststt i64:$rA, i32:$rB,
334*0a6a1f1dSLionel Sambuc                                                   imm:$STRM)]>,
335f4a2713aSLionel Sambuc                          Deprecated<DeprecatedDST>;
336f4a2713aSLionel Sambuc}
337f4a2713aSLionel Sambuc
338f4a2713aSLionel Sambucdef MFVSCR : VXForm_4<1540, (outs vrrc:$vD), (ins),
339*0a6a1f1dSLionel Sambuc                      "mfvscr $vD", IIC_LdStStore,
340f4a2713aSLionel Sambuc                      [(set v8i16:$vD, (int_ppc_altivec_mfvscr))]>;
341f4a2713aSLionel Sambucdef MTVSCR : VXForm_5<1604, (outs), (ins vrrc:$vB),
342*0a6a1f1dSLionel Sambuc                      "mtvscr $vB", IIC_LdStLoad,
343f4a2713aSLionel Sambuc                      [(int_ppc_altivec_mtvscr v4i32:$vB)]>;
344f4a2713aSLionel Sambuc
345f4a2713aSLionel Sambuclet canFoldAsLoad = 1, PPC970_Unit = 2 in {  // Loads.
346f4a2713aSLionel Sambucdef LVEBX: XForm_1<31,   7, (outs vrrc:$vD), (ins memrr:$src),
347*0a6a1f1dSLionel Sambuc                   "lvebx $vD, $src", IIC_LdStLoad,
348f4a2713aSLionel Sambuc                   [(set v16i8:$vD, (int_ppc_altivec_lvebx xoaddr:$src))]>;
349f4a2713aSLionel Sambucdef LVEHX: XForm_1<31,  39, (outs vrrc:$vD), (ins memrr:$src),
350*0a6a1f1dSLionel Sambuc                   "lvehx $vD, $src", IIC_LdStLoad,
351f4a2713aSLionel Sambuc                   [(set v8i16:$vD, (int_ppc_altivec_lvehx xoaddr:$src))]>;
352f4a2713aSLionel Sambucdef LVEWX: XForm_1<31,  71, (outs vrrc:$vD), (ins memrr:$src),
353*0a6a1f1dSLionel Sambuc                   "lvewx $vD, $src", IIC_LdStLoad,
354f4a2713aSLionel Sambuc                   [(set v4i32:$vD, (int_ppc_altivec_lvewx xoaddr:$src))]>;
355f4a2713aSLionel Sambucdef LVX  : XForm_1<31, 103, (outs vrrc:$vD), (ins memrr:$src),
356*0a6a1f1dSLionel Sambuc                   "lvx $vD, $src", IIC_LdStLoad,
357f4a2713aSLionel Sambuc                   [(set v4i32:$vD, (int_ppc_altivec_lvx xoaddr:$src))]>;
358f4a2713aSLionel Sambucdef LVXL : XForm_1<31, 359, (outs vrrc:$vD), (ins memrr:$src),
359*0a6a1f1dSLionel Sambuc                   "lvxl $vD, $src", IIC_LdStLoad,
360f4a2713aSLionel Sambuc                   [(set v4i32:$vD, (int_ppc_altivec_lvxl xoaddr:$src))]>;
361f4a2713aSLionel Sambuc}
362f4a2713aSLionel Sambuc
363f4a2713aSLionel Sambucdef LVSL : XForm_1<31,   6, (outs vrrc:$vD), (ins memrr:$src),
364*0a6a1f1dSLionel Sambuc                   "lvsl $vD, $src", IIC_LdStLoad,
365f4a2713aSLionel Sambuc                   [(set v16i8:$vD, (int_ppc_altivec_lvsl xoaddr:$src))]>,
366f4a2713aSLionel Sambuc                   PPC970_Unit_LSU;
367f4a2713aSLionel Sambucdef LVSR : XForm_1<31,  38, (outs vrrc:$vD), (ins memrr:$src),
368*0a6a1f1dSLionel Sambuc                   "lvsr $vD, $src", IIC_LdStLoad,
369f4a2713aSLionel Sambuc                   [(set v16i8:$vD, (int_ppc_altivec_lvsr xoaddr:$src))]>,
370f4a2713aSLionel Sambuc                   PPC970_Unit_LSU;
371f4a2713aSLionel Sambuc
372f4a2713aSLionel Sambuclet PPC970_Unit = 2 in {   // Stores.
373f4a2713aSLionel Sambucdef STVEBX: XForm_8<31, 135, (outs), (ins vrrc:$rS, memrr:$dst),
374*0a6a1f1dSLionel Sambuc                   "stvebx $rS, $dst", IIC_LdStStore,
375f4a2713aSLionel Sambuc                   [(int_ppc_altivec_stvebx v16i8:$rS, xoaddr:$dst)]>;
376f4a2713aSLionel Sambucdef STVEHX: XForm_8<31, 167, (outs), (ins vrrc:$rS, memrr:$dst),
377*0a6a1f1dSLionel Sambuc                   "stvehx $rS, $dst", IIC_LdStStore,
378f4a2713aSLionel Sambuc                   [(int_ppc_altivec_stvehx v8i16:$rS, xoaddr:$dst)]>;
379f4a2713aSLionel Sambucdef STVEWX: XForm_8<31, 199, (outs), (ins vrrc:$rS, memrr:$dst),
380*0a6a1f1dSLionel Sambuc                   "stvewx $rS, $dst", IIC_LdStStore,
381f4a2713aSLionel Sambuc                   [(int_ppc_altivec_stvewx v4i32:$rS, xoaddr:$dst)]>;
382f4a2713aSLionel Sambucdef STVX  : XForm_8<31, 231, (outs), (ins vrrc:$rS, memrr:$dst),
383*0a6a1f1dSLionel Sambuc                   "stvx $rS, $dst", IIC_LdStStore,
384f4a2713aSLionel Sambuc                   [(int_ppc_altivec_stvx v4i32:$rS, xoaddr:$dst)]>;
385f4a2713aSLionel Sambucdef STVXL : XForm_8<31, 487, (outs), (ins vrrc:$rS, memrr:$dst),
386*0a6a1f1dSLionel Sambuc                   "stvxl $rS, $dst", IIC_LdStStore,
387f4a2713aSLionel Sambuc                   [(int_ppc_altivec_stvxl v4i32:$rS, xoaddr:$dst)]>;
388f4a2713aSLionel Sambuc}
389f4a2713aSLionel Sambuc
390f4a2713aSLionel Sambuclet PPC970_Unit = 5 in {  // VALU Operations.
391f4a2713aSLionel Sambuc// VA-Form instructions.  3-input AltiVec ops.
392*0a6a1f1dSLionel Sambuclet isCommutable = 1 in {
393f4a2713aSLionel Sambucdef VMADDFP : VAForm_1<46, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vC, vrrc:$vB),
394*0a6a1f1dSLionel Sambuc                       "vmaddfp $vD, $vA, $vC, $vB", IIC_VecFP,
395f4a2713aSLionel Sambuc                       [(set v4f32:$vD,
396f4a2713aSLionel Sambuc                        (fma v4f32:$vA, v4f32:$vC, v4f32:$vB))]>;
397f4a2713aSLionel Sambuc
398f4a2713aSLionel Sambuc// FIXME: The fma+fneg pattern won't match because fneg is not legal.
399f4a2713aSLionel Sambucdef VNMSUBFP: VAForm_1<47, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vC, vrrc:$vB),
400*0a6a1f1dSLionel Sambuc                       "vnmsubfp $vD, $vA, $vC, $vB", IIC_VecFP,
401f4a2713aSLionel Sambuc                       [(set v4f32:$vD, (fneg (fma v4f32:$vA, v4f32:$vC,
402f4a2713aSLionel Sambuc                                                  (fneg v4f32:$vB))))]>;
403f4a2713aSLionel Sambuc
404f4a2713aSLionel Sambucdef VMHADDSHS  : VA1a_Int_Ty<32, "vmhaddshs", int_ppc_altivec_vmhaddshs, v8i16>;
405f4a2713aSLionel Sambucdef VMHRADDSHS : VA1a_Int_Ty<33, "vmhraddshs", int_ppc_altivec_vmhraddshs,
406f4a2713aSLionel Sambuc                             v8i16>;
407f4a2713aSLionel Sambucdef VMLADDUHM  : VA1a_Int_Ty<34, "vmladduhm", int_ppc_altivec_vmladduhm, v8i16>;
408*0a6a1f1dSLionel Sambuc} // isCommutable
409f4a2713aSLionel Sambuc
410f4a2713aSLionel Sambucdef VPERM      : VA1a_Int_Ty3<43, "vperm", int_ppc_altivec_vperm,
411f4a2713aSLionel Sambuc                              v4i32, v4i32, v16i8>;
412f4a2713aSLionel Sambucdef VSEL       : VA1a_Int_Ty<42, "vsel",  int_ppc_altivec_vsel, v4i32>;
413f4a2713aSLionel Sambuc
414f4a2713aSLionel Sambuc// Shuffles.
415f4a2713aSLionel Sambucdef VSLDOI  : VAForm_2<44, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, u5imm:$SH),
416*0a6a1f1dSLionel Sambuc                       "vsldoi $vD, $vA, $vB, $SH", IIC_VecFP,
417f4a2713aSLionel Sambuc                       [(set v16i8:$vD,
418f4a2713aSLionel Sambuc                         (vsldoi_shuffle:$SH v16i8:$vA, v16i8:$vB))]>;
419f4a2713aSLionel Sambuc
420f4a2713aSLionel Sambuc// VX-Form instructions.  AltiVec arithmetic ops.
421*0a6a1f1dSLionel Sambuclet isCommutable = 1 in {
422f4a2713aSLionel Sambucdef VADDFP : VXForm_1<10, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
423*0a6a1f1dSLionel Sambuc                      "vaddfp $vD, $vA, $vB", IIC_VecFP,
424f4a2713aSLionel Sambuc                      [(set v4f32:$vD, (fadd v4f32:$vA, v4f32:$vB))]>;
425f4a2713aSLionel Sambuc
426f4a2713aSLionel Sambucdef VADDUBM : VXForm_1<0, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
427*0a6a1f1dSLionel Sambuc                      "vaddubm $vD, $vA, $vB", IIC_VecGeneral,
428f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (add v16i8:$vA, v16i8:$vB))]>;
429f4a2713aSLionel Sambucdef VADDUHM : VXForm_1<64, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
430*0a6a1f1dSLionel Sambuc                      "vadduhm $vD, $vA, $vB", IIC_VecGeneral,
431f4a2713aSLionel Sambuc                      [(set v8i16:$vD, (add v8i16:$vA, v8i16:$vB))]>;
432f4a2713aSLionel Sambucdef VADDUWM : VXForm_1<128, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
433*0a6a1f1dSLionel Sambuc                      "vadduwm $vD, $vA, $vB", IIC_VecGeneral,
434f4a2713aSLionel Sambuc                      [(set v4i32:$vD, (add v4i32:$vA, v4i32:$vB))]>;
435f4a2713aSLionel Sambuc
436f4a2713aSLionel Sambucdef VADDCUW : VX1_Int_Ty<384, "vaddcuw", int_ppc_altivec_vaddcuw, v4i32>;
437f4a2713aSLionel Sambucdef VADDSBS : VX1_Int_Ty<768, "vaddsbs", int_ppc_altivec_vaddsbs, v16i8>;
438f4a2713aSLionel Sambucdef VADDSHS : VX1_Int_Ty<832, "vaddshs", int_ppc_altivec_vaddshs, v8i16>;
439f4a2713aSLionel Sambucdef VADDSWS : VX1_Int_Ty<896, "vaddsws", int_ppc_altivec_vaddsws, v4i32>;
440f4a2713aSLionel Sambucdef VADDUBS : VX1_Int_Ty<512, "vaddubs", int_ppc_altivec_vaddubs, v16i8>;
441f4a2713aSLionel Sambucdef VADDUHS : VX1_Int_Ty<576, "vadduhs", int_ppc_altivec_vadduhs, v8i16>;
442f4a2713aSLionel Sambucdef VADDUWS : VX1_Int_Ty<640, "vadduws", int_ppc_altivec_vadduws, v4i32>;
443*0a6a1f1dSLionel Sambuc} // isCommutable
444f4a2713aSLionel Sambuc
445*0a6a1f1dSLionel Sambuclet isCommutable = 1 in
446f4a2713aSLionel Sambucdef VAND : VXForm_1<1028, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
447*0a6a1f1dSLionel Sambuc                    "vand $vD, $vA, $vB", IIC_VecFP,
448f4a2713aSLionel Sambuc                    [(set v4i32:$vD, (and v4i32:$vA, v4i32:$vB))]>;
449f4a2713aSLionel Sambucdef VANDC : VXForm_1<1092, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
450*0a6a1f1dSLionel Sambuc                     "vandc $vD, $vA, $vB", IIC_VecFP,
451f4a2713aSLionel Sambuc                     [(set v4i32:$vD, (and v4i32:$vA,
452f4a2713aSLionel Sambuc                                           (vnot_ppc v4i32:$vB)))]>;
453f4a2713aSLionel Sambuc
454f4a2713aSLionel Sambucdef VCFSX  : VXForm_1<842, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
455*0a6a1f1dSLionel Sambuc                      "vcfsx $vD, $vB, $UIMM", IIC_VecFP,
456f4a2713aSLionel Sambuc                      [(set v4f32:$vD,
457f4a2713aSLionel Sambuc                             (int_ppc_altivec_vcfsx v4i32:$vB, imm:$UIMM))]>;
458f4a2713aSLionel Sambucdef VCFUX  : VXForm_1<778, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
459*0a6a1f1dSLionel Sambuc                      "vcfux $vD, $vB, $UIMM", IIC_VecFP,
460f4a2713aSLionel Sambuc                      [(set v4f32:$vD,
461f4a2713aSLionel Sambuc                             (int_ppc_altivec_vcfux v4i32:$vB, imm:$UIMM))]>;
462f4a2713aSLionel Sambucdef VCTSXS : VXForm_1<970, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
463*0a6a1f1dSLionel Sambuc                      "vctsxs $vD, $vB, $UIMM", IIC_VecFP,
464f4a2713aSLionel Sambuc                      [(set v4i32:$vD,
465f4a2713aSLionel Sambuc                             (int_ppc_altivec_vctsxs v4f32:$vB, imm:$UIMM))]>;
466f4a2713aSLionel Sambucdef VCTUXS : VXForm_1<906, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
467*0a6a1f1dSLionel Sambuc                      "vctuxs $vD, $vB, $UIMM", IIC_VecFP,
468f4a2713aSLionel Sambuc                      [(set v4i32:$vD,
469f4a2713aSLionel Sambuc                             (int_ppc_altivec_vctuxs v4f32:$vB, imm:$UIMM))]>;
470f4a2713aSLionel Sambuc
471f4a2713aSLionel Sambuc// Defines with the UIM field set to 0 for floating-point
472f4a2713aSLionel Sambuc// to integer (fp_to_sint/fp_to_uint) conversions and integer
473f4a2713aSLionel Sambuc// to floating-point (sint_to_fp/uint_to_fp) conversions.
474f4a2713aSLionel Sambuclet isCodeGenOnly = 1, VA = 0 in {
475f4a2713aSLionel Sambucdef VCFSX_0 : VXForm_1<842, (outs vrrc:$vD), (ins vrrc:$vB),
476*0a6a1f1dSLionel Sambuc                       "vcfsx $vD, $vB, 0", IIC_VecFP,
477f4a2713aSLionel Sambuc                       [(set v4f32:$vD,
478f4a2713aSLionel Sambuc                             (int_ppc_altivec_vcfsx v4i32:$vB, 0))]>;
479f4a2713aSLionel Sambucdef VCTUXS_0 : VXForm_1<906, (outs vrrc:$vD), (ins vrrc:$vB),
480*0a6a1f1dSLionel Sambuc                        "vctuxs $vD, $vB, 0", IIC_VecFP,
481f4a2713aSLionel Sambuc                        [(set v4i32:$vD,
482f4a2713aSLionel Sambuc                               (int_ppc_altivec_vctuxs v4f32:$vB, 0))]>;
483f4a2713aSLionel Sambucdef VCFUX_0 : VXForm_1<778, (outs vrrc:$vD), (ins vrrc:$vB),
484*0a6a1f1dSLionel Sambuc                       "vcfux $vD, $vB, 0", IIC_VecFP,
485f4a2713aSLionel Sambuc                       [(set v4f32:$vD,
486f4a2713aSLionel Sambuc                               (int_ppc_altivec_vcfux v4i32:$vB, 0))]>;
487f4a2713aSLionel Sambucdef VCTSXS_0 : VXForm_1<970, (outs vrrc:$vD), (ins vrrc:$vB),
488*0a6a1f1dSLionel Sambuc                      "vctsxs $vD, $vB, 0", IIC_VecFP,
489f4a2713aSLionel Sambuc                      [(set v4i32:$vD,
490f4a2713aSLionel Sambuc                             (int_ppc_altivec_vctsxs v4f32:$vB, 0))]>;
491f4a2713aSLionel Sambuc}
492f4a2713aSLionel Sambucdef VEXPTEFP : VX2_Int_SP<394, "vexptefp", int_ppc_altivec_vexptefp>;
493f4a2713aSLionel Sambucdef VLOGEFP  : VX2_Int_SP<458, "vlogefp",  int_ppc_altivec_vlogefp>;
494f4a2713aSLionel Sambuc
495*0a6a1f1dSLionel Sambuclet isCommutable = 1 in {
496f4a2713aSLionel Sambucdef VAVGSB : VX1_Int_Ty<1282, "vavgsb", int_ppc_altivec_vavgsb, v16i8>;
497f4a2713aSLionel Sambucdef VAVGSH : VX1_Int_Ty<1346, "vavgsh", int_ppc_altivec_vavgsh, v8i16>;
498f4a2713aSLionel Sambucdef VAVGSW : VX1_Int_Ty<1410, "vavgsw", int_ppc_altivec_vavgsw, v4i32>;
499f4a2713aSLionel Sambucdef VAVGUB : VX1_Int_Ty<1026, "vavgub", int_ppc_altivec_vavgub, v16i8>;
500f4a2713aSLionel Sambucdef VAVGUH : VX1_Int_Ty<1090, "vavguh", int_ppc_altivec_vavguh, v8i16>;
501f4a2713aSLionel Sambucdef VAVGUW : VX1_Int_Ty<1154, "vavguw", int_ppc_altivec_vavguw, v4i32>;
502f4a2713aSLionel Sambuc
503f4a2713aSLionel Sambucdef VMAXFP : VX1_Int_Ty<1034, "vmaxfp", int_ppc_altivec_vmaxfp, v4f32>;
504f4a2713aSLionel Sambucdef VMAXSB : VX1_Int_Ty< 258, "vmaxsb", int_ppc_altivec_vmaxsb, v16i8>;
505f4a2713aSLionel Sambucdef VMAXSH : VX1_Int_Ty< 322, "vmaxsh", int_ppc_altivec_vmaxsh, v8i16>;
506f4a2713aSLionel Sambucdef VMAXSW : VX1_Int_Ty< 386, "vmaxsw", int_ppc_altivec_vmaxsw, v4i32>;
507f4a2713aSLionel Sambucdef VMAXUB : VX1_Int_Ty<   2, "vmaxub", int_ppc_altivec_vmaxub, v16i8>;
508f4a2713aSLionel Sambucdef VMAXUH : VX1_Int_Ty<  66, "vmaxuh", int_ppc_altivec_vmaxuh, v8i16>;
509f4a2713aSLionel Sambucdef VMAXUW : VX1_Int_Ty< 130, "vmaxuw", int_ppc_altivec_vmaxuw, v4i32>;
510f4a2713aSLionel Sambucdef VMINFP : VX1_Int_Ty<1098, "vminfp", int_ppc_altivec_vminfp, v4f32>;
511f4a2713aSLionel Sambucdef VMINSB : VX1_Int_Ty< 770, "vminsb", int_ppc_altivec_vminsb, v16i8>;
512f4a2713aSLionel Sambucdef VMINSH : VX1_Int_Ty< 834, "vminsh", int_ppc_altivec_vminsh, v8i16>;
513f4a2713aSLionel Sambucdef VMINSW : VX1_Int_Ty< 898, "vminsw", int_ppc_altivec_vminsw, v4i32>;
514f4a2713aSLionel Sambucdef VMINUB : VX1_Int_Ty< 514, "vminub", int_ppc_altivec_vminub, v16i8>;
515f4a2713aSLionel Sambucdef VMINUH : VX1_Int_Ty< 578, "vminuh", int_ppc_altivec_vminuh, v8i16>;
516f4a2713aSLionel Sambucdef VMINUW : VX1_Int_Ty< 642, "vminuw", int_ppc_altivec_vminuw, v4i32>;
517*0a6a1f1dSLionel Sambuc} // isCommutable
518f4a2713aSLionel Sambuc
519f4a2713aSLionel Sambucdef VMRGHB : VXForm_1< 12, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
520*0a6a1f1dSLionel Sambuc                      "vmrghb $vD, $vA, $vB", IIC_VecFP,
521f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (vmrghb_shuffle v16i8:$vA, v16i8:$vB))]>;
522f4a2713aSLionel Sambucdef VMRGHH : VXForm_1< 76, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
523*0a6a1f1dSLionel Sambuc                      "vmrghh $vD, $vA, $vB", IIC_VecFP,
524f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (vmrghh_shuffle v16i8:$vA, v16i8:$vB))]>;
525f4a2713aSLionel Sambucdef VMRGHW : VXForm_1<140, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
526*0a6a1f1dSLionel Sambuc                      "vmrghw $vD, $vA, $vB", IIC_VecFP,
527f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (vmrghw_shuffle v16i8:$vA, v16i8:$vB))]>;
528f4a2713aSLionel Sambucdef VMRGLB : VXForm_1<268, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
529*0a6a1f1dSLionel Sambuc                      "vmrglb $vD, $vA, $vB", IIC_VecFP,
530f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (vmrglb_shuffle v16i8:$vA, v16i8:$vB))]>;
531f4a2713aSLionel Sambucdef VMRGLH : VXForm_1<332, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
532*0a6a1f1dSLionel Sambuc                      "vmrglh $vD, $vA, $vB", IIC_VecFP,
533f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (vmrglh_shuffle v16i8:$vA, v16i8:$vB))]>;
534f4a2713aSLionel Sambucdef VMRGLW : VXForm_1<396, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
535*0a6a1f1dSLionel Sambuc                      "vmrglw $vD, $vA, $vB", IIC_VecFP,
536f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (vmrglw_shuffle v16i8:$vA, v16i8:$vB))]>;
537f4a2713aSLionel Sambuc
538f4a2713aSLionel Sambucdef VMSUMMBM : VA1a_Int_Ty3<37, "vmsummbm", int_ppc_altivec_vmsummbm,
539f4a2713aSLionel Sambuc                            v4i32, v16i8, v4i32>;
540f4a2713aSLionel Sambucdef VMSUMSHM : VA1a_Int_Ty3<40, "vmsumshm", int_ppc_altivec_vmsumshm,
541f4a2713aSLionel Sambuc                            v4i32, v8i16, v4i32>;
542f4a2713aSLionel Sambucdef VMSUMSHS : VA1a_Int_Ty3<41, "vmsumshs", int_ppc_altivec_vmsumshs,
543f4a2713aSLionel Sambuc                            v4i32, v8i16, v4i32>;
544f4a2713aSLionel Sambucdef VMSUMUBM : VA1a_Int_Ty3<36, "vmsumubm", int_ppc_altivec_vmsumubm,
545f4a2713aSLionel Sambuc                            v4i32, v16i8, v4i32>;
546f4a2713aSLionel Sambucdef VMSUMUHM : VA1a_Int_Ty3<38, "vmsumuhm", int_ppc_altivec_vmsumuhm,
547f4a2713aSLionel Sambuc                            v4i32, v8i16, v4i32>;
548f4a2713aSLionel Sambucdef VMSUMUHS : VA1a_Int_Ty3<39, "vmsumuhs", int_ppc_altivec_vmsumuhs,
549f4a2713aSLionel Sambuc                            v4i32, v8i16, v4i32>;
550f4a2713aSLionel Sambuc
551*0a6a1f1dSLionel Sambuclet isCommutable = 1 in {
552f4a2713aSLionel Sambucdef VMULESB : VX1_Int_Ty2<776, "vmulesb", int_ppc_altivec_vmulesb,
553f4a2713aSLionel Sambuc                          v8i16, v16i8>;
554f4a2713aSLionel Sambucdef VMULESH : VX1_Int_Ty2<840, "vmulesh", int_ppc_altivec_vmulesh,
555f4a2713aSLionel Sambuc                          v4i32, v8i16>;
556f4a2713aSLionel Sambucdef VMULEUB : VX1_Int_Ty2<520, "vmuleub", int_ppc_altivec_vmuleub,
557f4a2713aSLionel Sambuc                          v8i16, v16i8>;
558f4a2713aSLionel Sambucdef VMULEUH : VX1_Int_Ty2<584, "vmuleuh", int_ppc_altivec_vmuleuh,
559f4a2713aSLionel Sambuc                          v4i32, v8i16>;
560f4a2713aSLionel Sambucdef VMULOSB : VX1_Int_Ty2<264, "vmulosb", int_ppc_altivec_vmulosb,
561f4a2713aSLionel Sambuc                          v8i16, v16i8>;
562f4a2713aSLionel Sambucdef VMULOSH : VX1_Int_Ty2<328, "vmulosh", int_ppc_altivec_vmulosh,
563f4a2713aSLionel Sambuc                          v4i32, v8i16>;
564f4a2713aSLionel Sambucdef VMULOUB : VX1_Int_Ty2<  8, "vmuloub", int_ppc_altivec_vmuloub,
565f4a2713aSLionel Sambuc                          v8i16, v16i8>;
566f4a2713aSLionel Sambucdef VMULOUH : VX1_Int_Ty2< 72, "vmulouh", int_ppc_altivec_vmulouh,
567f4a2713aSLionel Sambuc                          v4i32, v8i16>;
568*0a6a1f1dSLionel Sambuc} // isCommutable
569f4a2713aSLionel Sambuc
570f4a2713aSLionel Sambucdef VREFP     : VX2_Int_SP<266, "vrefp",     int_ppc_altivec_vrefp>;
571f4a2713aSLionel Sambucdef VRFIM     : VX2_Int_SP<714, "vrfim",     int_ppc_altivec_vrfim>;
572f4a2713aSLionel Sambucdef VRFIN     : VX2_Int_SP<522, "vrfin",     int_ppc_altivec_vrfin>;
573f4a2713aSLionel Sambucdef VRFIP     : VX2_Int_SP<650, "vrfip",     int_ppc_altivec_vrfip>;
574f4a2713aSLionel Sambucdef VRFIZ     : VX2_Int_SP<586, "vrfiz",     int_ppc_altivec_vrfiz>;
575f4a2713aSLionel Sambucdef VRSQRTEFP : VX2_Int_SP<330, "vrsqrtefp", int_ppc_altivec_vrsqrtefp>;
576f4a2713aSLionel Sambuc
577f4a2713aSLionel Sambucdef VSUBCUW : VX1_Int_Ty<1408, "vsubcuw", int_ppc_altivec_vsubcuw, v4i32>;
578f4a2713aSLionel Sambuc
579f4a2713aSLionel Sambucdef VSUBFP  : VXForm_1<74, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
580*0a6a1f1dSLionel Sambuc                      "vsubfp $vD, $vA, $vB", IIC_VecGeneral,
581f4a2713aSLionel Sambuc                      [(set v4f32:$vD, (fsub v4f32:$vA, v4f32:$vB))]>;
582f4a2713aSLionel Sambucdef VSUBUBM : VXForm_1<1024, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
583*0a6a1f1dSLionel Sambuc                      "vsububm $vD, $vA, $vB", IIC_VecGeneral,
584f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (sub v16i8:$vA, v16i8:$vB))]>;
585f4a2713aSLionel Sambucdef VSUBUHM : VXForm_1<1088, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
586*0a6a1f1dSLionel Sambuc                      "vsubuhm $vD, $vA, $vB", IIC_VecGeneral,
587f4a2713aSLionel Sambuc                      [(set v8i16:$vD, (sub v8i16:$vA, v8i16:$vB))]>;
588f4a2713aSLionel Sambucdef VSUBUWM : VXForm_1<1152, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
589*0a6a1f1dSLionel Sambuc                      "vsubuwm $vD, $vA, $vB", IIC_VecGeneral,
590f4a2713aSLionel Sambuc                      [(set v4i32:$vD, (sub v4i32:$vA, v4i32:$vB))]>;
591f4a2713aSLionel Sambuc
592f4a2713aSLionel Sambucdef VSUBSBS : VX1_Int_Ty<1792, "vsubsbs" , int_ppc_altivec_vsubsbs, v16i8>;
593f4a2713aSLionel Sambucdef VSUBSHS : VX1_Int_Ty<1856, "vsubshs" , int_ppc_altivec_vsubshs, v8i16>;
594f4a2713aSLionel Sambucdef VSUBSWS : VX1_Int_Ty<1920, "vsubsws" , int_ppc_altivec_vsubsws, v4i32>;
595f4a2713aSLionel Sambucdef VSUBUBS : VX1_Int_Ty<1536, "vsububs" , int_ppc_altivec_vsububs, v16i8>;
596f4a2713aSLionel Sambucdef VSUBUHS : VX1_Int_Ty<1600, "vsubuhs" , int_ppc_altivec_vsubuhs, v8i16>;
597f4a2713aSLionel Sambucdef VSUBUWS : VX1_Int_Ty<1664, "vsubuws" , int_ppc_altivec_vsubuws, v4i32>;
598f4a2713aSLionel Sambuc
599f4a2713aSLionel Sambucdef VSUMSWS : VX1_Int_Ty<1928, "vsumsws" , int_ppc_altivec_vsumsws, v4i32>;
600f4a2713aSLionel Sambucdef VSUM2SWS: VX1_Int_Ty<1672, "vsum2sws", int_ppc_altivec_vsum2sws, v4i32>;
601f4a2713aSLionel Sambuc
602f4a2713aSLionel Sambucdef VSUM4SBS: VX1_Int_Ty3<1800, "vsum4sbs", int_ppc_altivec_vsum4sbs,
603f4a2713aSLionel Sambuc                          v4i32, v16i8, v4i32>;
604f4a2713aSLionel Sambucdef VSUM4SHS: VX1_Int_Ty3<1608, "vsum4shs", int_ppc_altivec_vsum4shs,
605f4a2713aSLionel Sambuc                          v4i32, v8i16, v4i32>;
606f4a2713aSLionel Sambucdef VSUM4UBS: VX1_Int_Ty3<1544, "vsum4ubs", int_ppc_altivec_vsum4ubs,
607f4a2713aSLionel Sambuc                          v4i32, v16i8, v4i32>;
608f4a2713aSLionel Sambuc
609f4a2713aSLionel Sambucdef VNOR : VXForm_1<1284, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
610*0a6a1f1dSLionel Sambuc                    "vnor $vD, $vA, $vB", IIC_VecFP,
611f4a2713aSLionel Sambuc                    [(set v4i32:$vD, (vnot_ppc (or v4i32:$vA,
612f4a2713aSLionel Sambuc                                                   v4i32:$vB)))]>;
613*0a6a1f1dSLionel Sambuclet isCommutable = 1 in {
614f4a2713aSLionel Sambucdef VOR : VXForm_1<1156, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
615*0a6a1f1dSLionel Sambuc                      "vor $vD, $vA, $vB", IIC_VecFP,
616f4a2713aSLionel Sambuc                      [(set v4i32:$vD, (or v4i32:$vA, v4i32:$vB))]>;
617f4a2713aSLionel Sambucdef VXOR : VXForm_1<1220, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
618*0a6a1f1dSLionel Sambuc                      "vxor $vD, $vA, $vB", IIC_VecFP,
619f4a2713aSLionel Sambuc                      [(set v4i32:$vD, (xor v4i32:$vA, v4i32:$vB))]>;
620*0a6a1f1dSLionel Sambuc} // isCommutable
621f4a2713aSLionel Sambuc
622f4a2713aSLionel Sambucdef VRLB   : VX1_Int_Ty<   4, "vrlb", int_ppc_altivec_vrlb, v16i8>;
623f4a2713aSLionel Sambucdef VRLH   : VX1_Int_Ty<  68, "vrlh", int_ppc_altivec_vrlh, v8i16>;
624f4a2713aSLionel Sambucdef VRLW   : VX1_Int_Ty< 132, "vrlw", int_ppc_altivec_vrlw, v4i32>;
625f4a2713aSLionel Sambuc
626f4a2713aSLionel Sambucdef VSL    : VX1_Int_Ty< 452, "vsl" , int_ppc_altivec_vsl,  v4i32 >;
627f4a2713aSLionel Sambucdef VSLO   : VX1_Int_Ty<1036, "vslo", int_ppc_altivec_vslo, v4i32>;
628f4a2713aSLionel Sambuc
629f4a2713aSLionel Sambucdef VSLB   : VX1_Int_Ty< 260, "vslb", int_ppc_altivec_vslb, v16i8>;
630f4a2713aSLionel Sambucdef VSLH   : VX1_Int_Ty< 324, "vslh", int_ppc_altivec_vslh, v8i16>;
631f4a2713aSLionel Sambucdef VSLW   : VX1_Int_Ty< 388, "vslw", int_ppc_altivec_vslw, v4i32>;
632f4a2713aSLionel Sambuc
633f4a2713aSLionel Sambucdef VSPLTB : VXForm_1<524, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
634*0a6a1f1dSLionel Sambuc                      "vspltb $vD, $vB, $UIMM", IIC_VecPerm,
635f4a2713aSLionel Sambuc                      [(set v16i8:$vD,
636f4a2713aSLionel Sambuc                        (vspltb_shuffle:$UIMM v16i8:$vB, (undef)))]>;
637f4a2713aSLionel Sambucdef VSPLTH : VXForm_1<588, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
638*0a6a1f1dSLionel Sambuc                      "vsplth $vD, $vB, $UIMM", IIC_VecPerm,
639f4a2713aSLionel Sambuc                      [(set v16i8:$vD,
640f4a2713aSLionel Sambuc                        (vsplth_shuffle:$UIMM v16i8:$vB, (undef)))]>;
641f4a2713aSLionel Sambucdef VSPLTW : VXForm_1<652, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB),
642*0a6a1f1dSLionel Sambuc                      "vspltw $vD, $vB, $UIMM", IIC_VecPerm,
643f4a2713aSLionel Sambuc                      [(set v16i8:$vD,
644f4a2713aSLionel Sambuc                        (vspltw_shuffle:$UIMM v16i8:$vB, (undef)))]>;
645f4a2713aSLionel Sambuc
646f4a2713aSLionel Sambucdef VSR    : VX1_Int_Ty< 708, "vsr"  , int_ppc_altivec_vsr,  v4i32>;
647f4a2713aSLionel Sambucdef VSRO   : VX1_Int_Ty<1100, "vsro" , int_ppc_altivec_vsro, v4i32>;
648f4a2713aSLionel Sambuc
649f4a2713aSLionel Sambucdef VSRAB  : VX1_Int_Ty< 772, "vsrab", int_ppc_altivec_vsrab, v16i8>;
650f4a2713aSLionel Sambucdef VSRAH  : VX1_Int_Ty< 836, "vsrah", int_ppc_altivec_vsrah, v8i16>;
651f4a2713aSLionel Sambucdef VSRAW  : VX1_Int_Ty< 900, "vsraw", int_ppc_altivec_vsraw, v4i32>;
652f4a2713aSLionel Sambucdef VSRB   : VX1_Int_Ty< 516, "vsrb" , int_ppc_altivec_vsrb , v16i8>;
653f4a2713aSLionel Sambucdef VSRH   : VX1_Int_Ty< 580, "vsrh" , int_ppc_altivec_vsrh , v8i16>;
654f4a2713aSLionel Sambucdef VSRW   : VX1_Int_Ty< 644, "vsrw" , int_ppc_altivec_vsrw , v4i32>;
655f4a2713aSLionel Sambuc
656f4a2713aSLionel Sambuc
657f4a2713aSLionel Sambucdef VSPLTISB : VXForm_3<780, (outs vrrc:$vD), (ins s5imm:$SIMM),
658*0a6a1f1dSLionel Sambuc                       "vspltisb $vD, $SIMM", IIC_VecPerm,
659f4a2713aSLionel Sambuc                       [(set v16i8:$vD, (v16i8 vecspltisb:$SIMM))]>;
660f4a2713aSLionel Sambucdef VSPLTISH : VXForm_3<844, (outs vrrc:$vD), (ins s5imm:$SIMM),
661*0a6a1f1dSLionel Sambuc                       "vspltish $vD, $SIMM", IIC_VecPerm,
662f4a2713aSLionel Sambuc                       [(set v8i16:$vD, (v8i16 vecspltish:$SIMM))]>;
663f4a2713aSLionel Sambucdef VSPLTISW : VXForm_3<908, (outs vrrc:$vD), (ins s5imm:$SIMM),
664*0a6a1f1dSLionel Sambuc                       "vspltisw $vD, $SIMM", IIC_VecPerm,
665f4a2713aSLionel Sambuc                       [(set v4i32:$vD, (v4i32 vecspltisw:$SIMM))]>;
666f4a2713aSLionel Sambuc
667f4a2713aSLionel Sambuc// Vector Pack.
668f4a2713aSLionel Sambucdef VPKPX   : VX1_Int_Ty2<782, "vpkpx", int_ppc_altivec_vpkpx,
669f4a2713aSLionel Sambuc                          v8i16, v4i32>;
670f4a2713aSLionel Sambucdef VPKSHSS : VX1_Int_Ty2<398, "vpkshss", int_ppc_altivec_vpkshss,
671f4a2713aSLionel Sambuc                          v16i8, v8i16>;
672f4a2713aSLionel Sambucdef VPKSHUS : VX1_Int_Ty2<270, "vpkshus", int_ppc_altivec_vpkshus,
673f4a2713aSLionel Sambuc                          v16i8, v8i16>;
674f4a2713aSLionel Sambucdef VPKSWSS : VX1_Int_Ty2<462, "vpkswss", int_ppc_altivec_vpkswss,
675f4a2713aSLionel Sambuc                          v16i8, v4i32>;
676f4a2713aSLionel Sambucdef VPKSWUS : VX1_Int_Ty2<334, "vpkswus", int_ppc_altivec_vpkswus,
677f4a2713aSLionel Sambuc                          v8i16, v4i32>;
678f4a2713aSLionel Sambucdef VPKUHUM : VXForm_1<14, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
679*0a6a1f1dSLionel Sambuc                       "vpkuhum $vD, $vA, $vB", IIC_VecFP,
680f4a2713aSLionel Sambuc                       [(set v16i8:$vD,
681f4a2713aSLionel Sambuc                         (vpkuhum_shuffle v16i8:$vA, v16i8:$vB))]>;
682f4a2713aSLionel Sambucdef VPKUHUS : VX1_Int_Ty2<142, "vpkuhus", int_ppc_altivec_vpkuhus,
683f4a2713aSLionel Sambuc                          v16i8, v8i16>;
684f4a2713aSLionel Sambucdef VPKUWUM : VXForm_1<78, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
685*0a6a1f1dSLionel Sambuc                       "vpkuwum $vD, $vA, $vB", IIC_VecFP,
686f4a2713aSLionel Sambuc                       [(set v16i8:$vD,
687f4a2713aSLionel Sambuc                         (vpkuwum_shuffle v16i8:$vA, v16i8:$vB))]>;
688f4a2713aSLionel Sambucdef VPKUWUS : VX1_Int_Ty2<206, "vpkuwus", int_ppc_altivec_vpkuwus,
689f4a2713aSLionel Sambuc                          v8i16, v4i32>;
690f4a2713aSLionel Sambuc
691f4a2713aSLionel Sambuc// Vector Unpack.
692f4a2713aSLionel Sambucdef VUPKHPX : VX2_Int_Ty2<846, "vupkhpx", int_ppc_altivec_vupkhpx,
693f4a2713aSLionel Sambuc                          v4i32, v8i16>;
694f4a2713aSLionel Sambucdef VUPKHSB : VX2_Int_Ty2<526, "vupkhsb", int_ppc_altivec_vupkhsb,
695f4a2713aSLionel Sambuc                          v8i16, v16i8>;
696f4a2713aSLionel Sambucdef VUPKHSH : VX2_Int_Ty2<590, "vupkhsh", int_ppc_altivec_vupkhsh,
697f4a2713aSLionel Sambuc                          v4i32, v8i16>;
698f4a2713aSLionel Sambucdef VUPKLPX : VX2_Int_Ty2<974, "vupklpx", int_ppc_altivec_vupklpx,
699f4a2713aSLionel Sambuc                          v4i32, v8i16>;
700f4a2713aSLionel Sambucdef VUPKLSB : VX2_Int_Ty2<654, "vupklsb", int_ppc_altivec_vupklsb,
701f4a2713aSLionel Sambuc                          v8i16, v16i8>;
702f4a2713aSLionel Sambucdef VUPKLSH : VX2_Int_Ty2<718, "vupklsh", int_ppc_altivec_vupklsh,
703f4a2713aSLionel Sambuc                          v4i32, v8i16>;
704f4a2713aSLionel Sambuc
705f4a2713aSLionel Sambuc
706f4a2713aSLionel Sambuc// Altivec Comparisons.
707f4a2713aSLionel Sambuc
708f4a2713aSLionel Sambucclass VCMP<bits<10> xo, string asmstr, ValueType Ty>
709*0a6a1f1dSLionel Sambuc  : VXRForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), asmstr,
710*0a6a1f1dSLionel Sambuc              IIC_VecFPCompare,
711f4a2713aSLionel Sambuc              [(set Ty:$vD, (Ty (PPCvcmp Ty:$vA, Ty:$vB, xo)))]>;
712f4a2713aSLionel Sambucclass VCMPo<bits<10> xo, string asmstr, ValueType Ty>
713*0a6a1f1dSLionel Sambuc  : VXRForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), asmstr,
714*0a6a1f1dSLionel Sambuc              IIC_VecFPCompare,
715f4a2713aSLionel Sambuc              [(set Ty:$vD, (Ty (PPCvcmp_o Ty:$vA, Ty:$vB, xo)))]> {
716f4a2713aSLionel Sambuc  let Defs = [CR6];
717f4a2713aSLionel Sambuc  let RC = 1;
718f4a2713aSLionel Sambuc}
719f4a2713aSLionel Sambuc
720f4a2713aSLionel Sambuc// f32 element comparisons.0
721f4a2713aSLionel Sambucdef VCMPBFP   : VCMP <966, "vcmpbfp $vD, $vA, $vB"  , v4f32>;
722f4a2713aSLionel Sambucdef VCMPBFPo  : VCMPo<966, "vcmpbfp. $vD, $vA, $vB" , v4f32>;
723f4a2713aSLionel Sambucdef VCMPEQFP  : VCMP <198, "vcmpeqfp $vD, $vA, $vB" , v4f32>;
724f4a2713aSLionel Sambucdef VCMPEQFPo : VCMPo<198, "vcmpeqfp. $vD, $vA, $vB", v4f32>;
725f4a2713aSLionel Sambucdef VCMPGEFP  : VCMP <454, "vcmpgefp $vD, $vA, $vB" , v4f32>;
726f4a2713aSLionel Sambucdef VCMPGEFPo : VCMPo<454, "vcmpgefp. $vD, $vA, $vB", v4f32>;
727f4a2713aSLionel Sambucdef VCMPGTFP  : VCMP <710, "vcmpgtfp $vD, $vA, $vB" , v4f32>;
728f4a2713aSLionel Sambucdef VCMPGTFPo : VCMPo<710, "vcmpgtfp. $vD, $vA, $vB", v4f32>;
729f4a2713aSLionel Sambuc
730f4a2713aSLionel Sambuc// i8 element comparisons.
731f4a2713aSLionel Sambucdef VCMPEQUB  : VCMP <  6, "vcmpequb $vD, $vA, $vB" , v16i8>;
732f4a2713aSLionel Sambucdef VCMPEQUBo : VCMPo<  6, "vcmpequb. $vD, $vA, $vB", v16i8>;
733f4a2713aSLionel Sambucdef VCMPGTSB  : VCMP <774, "vcmpgtsb $vD, $vA, $vB" , v16i8>;
734f4a2713aSLionel Sambucdef VCMPGTSBo : VCMPo<774, "vcmpgtsb. $vD, $vA, $vB", v16i8>;
735f4a2713aSLionel Sambucdef VCMPGTUB  : VCMP <518, "vcmpgtub $vD, $vA, $vB" , v16i8>;
736f4a2713aSLionel Sambucdef VCMPGTUBo : VCMPo<518, "vcmpgtub. $vD, $vA, $vB", v16i8>;
737f4a2713aSLionel Sambuc
738f4a2713aSLionel Sambuc// i16 element comparisons.
739f4a2713aSLionel Sambucdef VCMPEQUH  : VCMP < 70, "vcmpequh $vD, $vA, $vB" , v8i16>;
740f4a2713aSLionel Sambucdef VCMPEQUHo : VCMPo< 70, "vcmpequh. $vD, $vA, $vB", v8i16>;
741f4a2713aSLionel Sambucdef VCMPGTSH  : VCMP <838, "vcmpgtsh $vD, $vA, $vB" , v8i16>;
742f4a2713aSLionel Sambucdef VCMPGTSHo : VCMPo<838, "vcmpgtsh. $vD, $vA, $vB", v8i16>;
743f4a2713aSLionel Sambucdef VCMPGTUH  : VCMP <582, "vcmpgtuh $vD, $vA, $vB" , v8i16>;
744f4a2713aSLionel Sambucdef VCMPGTUHo : VCMPo<582, "vcmpgtuh. $vD, $vA, $vB", v8i16>;
745f4a2713aSLionel Sambuc
746f4a2713aSLionel Sambuc// i32 element comparisons.
747f4a2713aSLionel Sambucdef VCMPEQUW  : VCMP <134, "vcmpequw $vD, $vA, $vB" , v4i32>;
748f4a2713aSLionel Sambucdef VCMPEQUWo : VCMPo<134, "vcmpequw. $vD, $vA, $vB", v4i32>;
749f4a2713aSLionel Sambucdef VCMPGTSW  : VCMP <902, "vcmpgtsw $vD, $vA, $vB" , v4i32>;
750f4a2713aSLionel Sambucdef VCMPGTSWo : VCMPo<902, "vcmpgtsw. $vD, $vA, $vB", v4i32>;
751f4a2713aSLionel Sambucdef VCMPGTUW  : VCMP <646, "vcmpgtuw $vD, $vA, $vB" , v4i32>;
752f4a2713aSLionel Sambucdef VCMPGTUWo : VCMPo<646, "vcmpgtuw. $vD, $vA, $vB", v4i32>;
753f4a2713aSLionel Sambuc
754f4a2713aSLionel Sambuclet isCodeGenOnly = 1 in {
755f4a2713aSLionel Sambucdef V_SET0B : VXForm_setzero<1220, (outs vrrc:$vD), (ins),
756*0a6a1f1dSLionel Sambuc                      "vxor $vD, $vD, $vD", IIC_VecFP,
757f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (v16i8 immAllZerosV))]>;
758f4a2713aSLionel Sambucdef V_SET0H : VXForm_setzero<1220, (outs vrrc:$vD), (ins),
759*0a6a1f1dSLionel Sambuc                      "vxor $vD, $vD, $vD", IIC_VecFP,
760f4a2713aSLionel Sambuc                      [(set v8i16:$vD, (v8i16 immAllZerosV))]>;
761f4a2713aSLionel Sambucdef V_SET0  : VXForm_setzero<1220, (outs vrrc:$vD), (ins),
762*0a6a1f1dSLionel Sambuc                      "vxor $vD, $vD, $vD", IIC_VecFP,
763f4a2713aSLionel Sambuc                      [(set v4i32:$vD, (v4i32 immAllZerosV))]>;
764f4a2713aSLionel Sambuc
765f4a2713aSLionel Sambuclet IMM=-1 in {
766f4a2713aSLionel Sambucdef V_SETALLONESB : VXForm_3<908, (outs vrrc:$vD), (ins),
767*0a6a1f1dSLionel Sambuc                      "vspltisw $vD, -1", IIC_VecFP,
768f4a2713aSLionel Sambuc                      [(set v16i8:$vD, (v16i8 immAllOnesV))]>;
769f4a2713aSLionel Sambucdef V_SETALLONESH : VXForm_3<908, (outs vrrc:$vD), (ins),
770*0a6a1f1dSLionel Sambuc                      "vspltisw $vD, -1", IIC_VecFP,
771f4a2713aSLionel Sambuc                      [(set v8i16:$vD, (v8i16 immAllOnesV))]>;
772f4a2713aSLionel Sambucdef V_SETALLONES  : VXForm_3<908, (outs vrrc:$vD), (ins),
773*0a6a1f1dSLionel Sambuc                      "vspltisw $vD, -1", IIC_VecFP,
774f4a2713aSLionel Sambuc                      [(set v4i32:$vD, (v4i32 immAllOnesV))]>;
775f4a2713aSLionel Sambuc}
776f4a2713aSLionel Sambuc}
777f4a2713aSLionel Sambuc} // VALU Operations.
778f4a2713aSLionel Sambuc
779f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
780f4a2713aSLionel Sambuc// Additional Altivec Patterns
781f4a2713aSLionel Sambuc//
782f4a2713aSLionel Sambuc
783f4a2713aSLionel Sambuc// Loads.
784f4a2713aSLionel Sambucdef : Pat<(v4i32 (load xoaddr:$src)), (LVX xoaddr:$src)>;
785f4a2713aSLionel Sambuc
786f4a2713aSLionel Sambuc// Stores.
787f4a2713aSLionel Sambucdef : Pat<(store v4i32:$rS, xoaddr:$dst),
788f4a2713aSLionel Sambuc          (STVX $rS, xoaddr:$dst)>;
789f4a2713aSLionel Sambuc
790f4a2713aSLionel Sambuc// Bit conversions.
791f4a2713aSLionel Sambucdef : Pat<(v16i8 (bitconvert (v8i16 VRRC:$src))), (v16i8 VRRC:$src)>;
792f4a2713aSLionel Sambucdef : Pat<(v16i8 (bitconvert (v4i32 VRRC:$src))), (v16i8 VRRC:$src)>;
793f4a2713aSLionel Sambucdef : Pat<(v16i8 (bitconvert (v4f32 VRRC:$src))), (v16i8 VRRC:$src)>;
794f4a2713aSLionel Sambuc
795f4a2713aSLionel Sambucdef : Pat<(v8i16 (bitconvert (v16i8 VRRC:$src))), (v8i16 VRRC:$src)>;
796f4a2713aSLionel Sambucdef : Pat<(v8i16 (bitconvert (v4i32 VRRC:$src))), (v8i16 VRRC:$src)>;
797f4a2713aSLionel Sambucdef : Pat<(v8i16 (bitconvert (v4f32 VRRC:$src))), (v8i16 VRRC:$src)>;
798f4a2713aSLionel Sambuc
799f4a2713aSLionel Sambucdef : Pat<(v4i32 (bitconvert (v16i8 VRRC:$src))), (v4i32 VRRC:$src)>;
800f4a2713aSLionel Sambucdef : Pat<(v4i32 (bitconvert (v8i16 VRRC:$src))), (v4i32 VRRC:$src)>;
801f4a2713aSLionel Sambucdef : Pat<(v4i32 (bitconvert (v4f32 VRRC:$src))), (v4i32 VRRC:$src)>;
802f4a2713aSLionel Sambuc
803f4a2713aSLionel Sambucdef : Pat<(v4f32 (bitconvert (v16i8 VRRC:$src))), (v4f32 VRRC:$src)>;
804f4a2713aSLionel Sambucdef : Pat<(v4f32 (bitconvert (v8i16 VRRC:$src))), (v4f32 VRRC:$src)>;
805f4a2713aSLionel Sambucdef : Pat<(v4f32 (bitconvert (v4i32 VRRC:$src))), (v4f32 VRRC:$src)>;
806f4a2713aSLionel Sambuc
807f4a2713aSLionel Sambuc// Shuffles.
808f4a2713aSLionel Sambuc
809f4a2713aSLionel Sambuc// Match vsldoi(x,x), vpkuwum(x,x), vpkuhum(x,x)
810f4a2713aSLionel Sambucdef:Pat<(vsldoi_unary_shuffle:$in v16i8:$vA, undef),
811f4a2713aSLionel Sambuc        (VSLDOI $vA, $vA, (VSLDOI_unary_get_imm $in))>;
812f4a2713aSLionel Sambucdef:Pat<(vpkuwum_unary_shuffle v16i8:$vA, undef),
813f4a2713aSLionel Sambuc        (VPKUWUM $vA, $vA)>;
814f4a2713aSLionel Sambucdef:Pat<(vpkuhum_unary_shuffle v16i8:$vA, undef),
815f4a2713aSLionel Sambuc        (VPKUHUM $vA, $vA)>;
816f4a2713aSLionel Sambuc
817*0a6a1f1dSLionel Sambuc// Match vsldoi(y,x), vpkuwum(y,x), vpkuhum(y,x), i.e., swapped operands.
818*0a6a1f1dSLionel Sambuc// These fragments are matched for little-endian, where the inputs must
819*0a6a1f1dSLionel Sambuc// be swapped for correct semantics.
820*0a6a1f1dSLionel Sambucdef:Pat<(vsldoi_swapped_shuffle:$in v16i8:$vA, v16i8:$vB),
821*0a6a1f1dSLionel Sambuc        (VSLDOI $vB, $vA, (VSLDOI_swapped_get_imm $in))>;
822*0a6a1f1dSLionel Sambucdef:Pat<(vpkuwum_swapped_shuffle v16i8:$vA, v16i8:$vB),
823*0a6a1f1dSLionel Sambuc        (VPKUWUM $vB, $vA)>;
824*0a6a1f1dSLionel Sambucdef:Pat<(vpkuhum_swapped_shuffle v16i8:$vA, v16i8:$vB),
825*0a6a1f1dSLionel Sambuc        (VPKUHUM $vB, $vA)>;
826*0a6a1f1dSLionel Sambuc
827f4a2713aSLionel Sambuc// Match vmrg*(x,x)
828f4a2713aSLionel Sambucdef:Pat<(vmrglb_unary_shuffle v16i8:$vA, undef),
829f4a2713aSLionel Sambuc        (VMRGLB $vA, $vA)>;
830f4a2713aSLionel Sambucdef:Pat<(vmrglh_unary_shuffle v16i8:$vA, undef),
831f4a2713aSLionel Sambuc        (VMRGLH $vA, $vA)>;
832f4a2713aSLionel Sambucdef:Pat<(vmrglw_unary_shuffle v16i8:$vA, undef),
833f4a2713aSLionel Sambuc        (VMRGLW $vA, $vA)>;
834f4a2713aSLionel Sambucdef:Pat<(vmrghb_unary_shuffle v16i8:$vA, undef),
835f4a2713aSLionel Sambuc        (VMRGHB $vA, $vA)>;
836f4a2713aSLionel Sambucdef:Pat<(vmrghh_unary_shuffle v16i8:$vA, undef),
837f4a2713aSLionel Sambuc        (VMRGHH $vA, $vA)>;
838f4a2713aSLionel Sambucdef:Pat<(vmrghw_unary_shuffle v16i8:$vA, undef),
839f4a2713aSLionel Sambuc        (VMRGHW $vA, $vA)>;
840f4a2713aSLionel Sambuc
841*0a6a1f1dSLionel Sambuc// Match vmrg*(y,x), i.e., swapped operands.  These fragments
842*0a6a1f1dSLionel Sambuc// are matched for little-endian, where the inputs must be
843*0a6a1f1dSLionel Sambuc// swapped for correct semantics.
844*0a6a1f1dSLionel Sambucdef:Pat<(vmrglb_swapped_shuffle v16i8:$vA, v16i8:$vB),
845*0a6a1f1dSLionel Sambuc        (VMRGLB $vB, $vA)>;
846*0a6a1f1dSLionel Sambucdef:Pat<(vmrglh_swapped_shuffle v16i8:$vA, v16i8:$vB),
847*0a6a1f1dSLionel Sambuc        (VMRGLH $vB, $vA)>;
848*0a6a1f1dSLionel Sambucdef:Pat<(vmrglw_swapped_shuffle v16i8:$vA, v16i8:$vB),
849*0a6a1f1dSLionel Sambuc        (VMRGLW $vB, $vA)>;
850*0a6a1f1dSLionel Sambucdef:Pat<(vmrghb_swapped_shuffle v16i8:$vA, v16i8:$vB),
851*0a6a1f1dSLionel Sambuc        (VMRGHB $vB, $vA)>;
852*0a6a1f1dSLionel Sambucdef:Pat<(vmrghh_swapped_shuffle v16i8:$vA, v16i8:$vB),
853*0a6a1f1dSLionel Sambuc        (VMRGHH $vB, $vA)>;
854*0a6a1f1dSLionel Sambucdef:Pat<(vmrghw_swapped_shuffle v16i8:$vA, v16i8:$vB),
855*0a6a1f1dSLionel Sambuc        (VMRGHW $vB, $vA)>;
856*0a6a1f1dSLionel Sambuc
857f4a2713aSLionel Sambuc// Logical Operations
858f4a2713aSLionel Sambucdef : Pat<(vnot_ppc v4i32:$vA), (VNOR $vA, $vA)>;
859f4a2713aSLionel Sambuc
860f4a2713aSLionel Sambucdef : Pat<(vnot_ppc (or v4i32:$A, v4i32:$B)),
861f4a2713aSLionel Sambuc          (VNOR $A, $B)>;
862f4a2713aSLionel Sambucdef : Pat<(and v4i32:$A, (vnot_ppc v4i32:$B)),
863f4a2713aSLionel Sambuc          (VANDC $A, $B)>;
864f4a2713aSLionel Sambuc
865f4a2713aSLionel Sambucdef : Pat<(fmul v4f32:$vA, v4f32:$vB),
866f4a2713aSLionel Sambuc          (VMADDFP $vA, $vB,
867f4a2713aSLionel Sambuc             (v4i32 (VSLW (V_SETALLONES), (V_SETALLONES))))>;
868f4a2713aSLionel Sambuc
869f4a2713aSLionel Sambuc// Fused multiply add and multiply sub for packed float.  These are represented
870f4a2713aSLionel Sambuc// separately from the real instructions above, for operations that must have
871f4a2713aSLionel Sambuc// the additional precision, such as Newton-Rhapson (used by divide, sqrt)
872f4a2713aSLionel Sambucdef : Pat<(PPCvmaddfp v4f32:$A, v4f32:$B, v4f32:$C),
873f4a2713aSLionel Sambuc          (VMADDFP $A, $B, $C)>;
874f4a2713aSLionel Sambucdef : Pat<(PPCvnmsubfp v4f32:$A, v4f32:$B, v4f32:$C),
875f4a2713aSLionel Sambuc          (VNMSUBFP $A, $B, $C)>;
876f4a2713aSLionel Sambuc
877f4a2713aSLionel Sambucdef : Pat<(int_ppc_altivec_vmaddfp v4f32:$A, v4f32:$B, v4f32:$C),
878f4a2713aSLionel Sambuc          (VMADDFP $A, $B, $C)>;
879f4a2713aSLionel Sambucdef : Pat<(int_ppc_altivec_vnmsubfp v4f32:$A, v4f32:$B, v4f32:$C),
880f4a2713aSLionel Sambuc          (VNMSUBFP $A, $B, $C)>;
881f4a2713aSLionel Sambuc
882f4a2713aSLionel Sambucdef : Pat<(PPCvperm v16i8:$vA, v16i8:$vB, v16i8:$vC),
883f4a2713aSLionel Sambuc          (VPERM $vA, $vB, $vC)>;
884f4a2713aSLionel Sambuc
885f4a2713aSLionel Sambucdef : Pat<(PPCfre v4f32:$A), (VREFP $A)>;
886f4a2713aSLionel Sambucdef : Pat<(PPCfrsqrte v4f32:$A), (VRSQRTEFP $A)>;
887f4a2713aSLionel Sambuc
888f4a2713aSLionel Sambuc// Vector shifts
889f4a2713aSLionel Sambucdef : Pat<(v16i8 (shl v16i8:$vA, v16i8:$vB)),
890f4a2713aSLionel Sambuc          (v16i8 (VSLB $vA, $vB))>;
891f4a2713aSLionel Sambucdef : Pat<(v8i16 (shl v8i16:$vA, v8i16:$vB)),
892f4a2713aSLionel Sambuc          (v8i16 (VSLH $vA, $vB))>;
893f4a2713aSLionel Sambucdef : Pat<(v4i32 (shl v4i32:$vA, v4i32:$vB)),
894f4a2713aSLionel Sambuc          (v4i32 (VSLW $vA, $vB))>;
895f4a2713aSLionel Sambuc
896f4a2713aSLionel Sambucdef : Pat<(v16i8 (srl v16i8:$vA, v16i8:$vB)),
897f4a2713aSLionel Sambuc          (v16i8 (VSRB $vA, $vB))>;
898f4a2713aSLionel Sambucdef : Pat<(v8i16 (srl v8i16:$vA, v8i16:$vB)),
899f4a2713aSLionel Sambuc          (v8i16 (VSRH $vA, $vB))>;
900f4a2713aSLionel Sambucdef : Pat<(v4i32 (srl v4i32:$vA, v4i32:$vB)),
901f4a2713aSLionel Sambuc          (v4i32 (VSRW $vA, $vB))>;
902f4a2713aSLionel Sambuc
903f4a2713aSLionel Sambucdef : Pat<(v16i8 (sra v16i8:$vA, v16i8:$vB)),
904f4a2713aSLionel Sambuc          (v16i8 (VSRAB $vA, $vB))>;
905f4a2713aSLionel Sambucdef : Pat<(v8i16 (sra v8i16:$vA, v8i16:$vB)),
906f4a2713aSLionel Sambuc          (v8i16 (VSRAH $vA, $vB))>;
907f4a2713aSLionel Sambucdef : Pat<(v4i32 (sra v4i32:$vA, v4i32:$vB)),
908f4a2713aSLionel Sambuc          (v4i32 (VSRAW $vA, $vB))>;
909f4a2713aSLionel Sambuc
910f4a2713aSLionel Sambuc// Float to integer and integer to float conversions
911f4a2713aSLionel Sambucdef : Pat<(v4i32 (fp_to_sint v4f32:$vA)),
912f4a2713aSLionel Sambuc           (VCTSXS_0 $vA)>;
913f4a2713aSLionel Sambucdef : Pat<(v4i32 (fp_to_uint v4f32:$vA)),
914f4a2713aSLionel Sambuc           (VCTUXS_0 $vA)>;
915f4a2713aSLionel Sambucdef : Pat<(v4f32 (sint_to_fp v4i32:$vA)),
916f4a2713aSLionel Sambuc           (VCFSX_0 $vA)>;
917f4a2713aSLionel Sambucdef : Pat<(v4f32 (uint_to_fp v4i32:$vA)),
918f4a2713aSLionel Sambuc           (VCFUX_0 $vA)>;
919f4a2713aSLionel Sambuc
920f4a2713aSLionel Sambuc// Floating-point rounding
921f4a2713aSLionel Sambucdef : Pat<(v4f32 (ffloor v4f32:$vA)),
922f4a2713aSLionel Sambuc          (VRFIM $vA)>;
923f4a2713aSLionel Sambucdef : Pat<(v4f32 (fceil v4f32:$vA)),
924f4a2713aSLionel Sambuc          (VRFIP $vA)>;
925f4a2713aSLionel Sambucdef : Pat<(v4f32 (ftrunc v4f32:$vA)),
926f4a2713aSLionel Sambuc          (VRFIZ $vA)>;
927f4a2713aSLionel Sambucdef : Pat<(v4f32 (fnearbyint v4f32:$vA)),
928f4a2713aSLionel Sambuc          (VRFIN $vA)>;
929f4a2713aSLionel Sambuc
930f4a2713aSLionel Sambuc} // end HasAltivec
931f4a2713aSLionel Sambuc
932