David Greene | 20a1cbe | 2011-02-28 19:06:56 +0000 | [diff] [blame] | 1 | //===-- X86ShuffleDecode.cpp - X86 shuffle decode logic -------------------===// |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Define several functions to decode x86 specific shuffle semantics into a |
| 11 | // generic vector mask. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
David Greene | 3a2b508 | 2011-02-17 19:18:59 +0000 | [diff] [blame] | 15 | #include "X86ShuffleDecode.h" |
Chandler Carruth | 185cc18 | 2014-07-25 23:47:11 +0000 | [diff] [blame] | 16 | #include "llvm/IR/Constants.h" |
Patrik Hagglund | 8d09a6c | 2014-03-15 09:11:41 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/MachineValueType.h" |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 18 | |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | // Vector Mask Decoding |
| 21 | //===----------------------------------------------------------------------===// |
| 22 | |
David Greene | 3a2b508 | 2011-02-17 19:18:59 +0000 | [diff] [blame] | 23 | namespace llvm { |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 24 | |
Craig Topper | cbc96a6 | 2012-03-20 06:42:26 +0000 | [diff] [blame] | 25 | void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask) { |
Bruno Cardoso Lopes | 02a05a6 | 2010-09-02 22:43:39 +0000 | [diff] [blame] | 26 | // Defaults the copying the dest value. |
| 27 | ShuffleMask.push_back(0); |
| 28 | ShuffleMask.push_back(1); |
| 29 | ShuffleMask.push_back(2); |
| 30 | ShuffleMask.push_back(3); |
| 31 | |
| 32 | // Decode the immediate. |
| 33 | unsigned ZMask = Imm & 15; |
| 34 | unsigned CountD = (Imm >> 4) & 3; |
| 35 | unsigned CountS = (Imm >> 6) & 3; |
| 36 | |
| 37 | // CountS selects which input element to use. |
| 38 | unsigned InVal = 4+CountS; |
| 39 | // CountD specifies which element of destination to update. |
| 40 | ShuffleMask[CountD] = InVal; |
| 41 | // ZMask zaps values, potentially overriding the CountD elt. |
| 42 | if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero; |
| 43 | if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero; |
| 44 | if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero; |
| 45 | if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero; |
| 46 | } |
| 47 | |
Bruno Cardoso Lopes | 814a69c | 2010-09-02 21:51:11 +0000 | [diff] [blame] | 48 | // <3,1> or <6,7,2,3> |
Craig Topper | cbc96a6 | 2012-03-20 06:42:26 +0000 | [diff] [blame] | 49 | void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask) { |
Bruno Cardoso Lopes | 814a69c | 2010-09-02 21:51:11 +0000 | [diff] [blame] | 50 | for (unsigned i = NElts/2; i != NElts; ++i) |
| 51 | ShuffleMask.push_back(NElts+i); |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 52 | |
Bruno Cardoso Lopes | 814a69c | 2010-09-02 21:51:11 +0000 | [diff] [blame] | 53 | for (unsigned i = NElts/2; i != NElts; ++i) |
| 54 | ShuffleMask.push_back(i); |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 55 | } |
| 56 | |
Bruno Cardoso Lopes | 814a69c | 2010-09-02 21:51:11 +0000 | [diff] [blame] | 57 | // <0,2> or <0,1,4,5> |
Craig Topper | cbc96a6 | 2012-03-20 06:42:26 +0000 | [diff] [blame] | 58 | void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask) { |
Bruno Cardoso Lopes | 814a69c | 2010-09-02 21:51:11 +0000 | [diff] [blame] | 59 | for (unsigned i = 0; i != NElts/2; ++i) |
| 60 | ShuffleMask.push_back(i); |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 61 | |
Bruno Cardoso Lopes | 814a69c | 2010-09-02 21:51:11 +0000 | [diff] [blame] | 62 | for (unsigned i = 0; i != NElts/2; ++i) |
| 63 | ShuffleMask.push_back(NElts+i); |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 64 | } |
| 65 | |
Chandler Carruth | 41a25dd | 2014-09-15 11:15:23 +0000 | [diff] [blame] | 66 | void DecodeMOVSLDUPMask(MVT VT, SmallVectorImpl<int> &ShuffleMask) { |
| 67 | unsigned NumElts = VT.getVectorNumElements(); |
| 68 | for (int i = 0, e = NumElts / 2; i < e; ++i) { |
| 69 | ShuffleMask.push_back(2 * i); |
| 70 | ShuffleMask.push_back(2 * i); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void DecodeMOVSHDUPMask(MVT VT, SmallVectorImpl<int> &ShuffleMask) { |
| 75 | unsigned NumElts = VT.getVectorNumElements(); |
| 76 | for (int i = 0, e = NumElts / 2; i < e; ++i) { |
| 77 | ShuffleMask.push_back(2 * i + 1); |
| 78 | ShuffleMask.push_back(2 * i + 1); |
| 79 | } |
| 80 | } |
| 81 | |
Craig Topper | 8fb09f0 | 2013-01-28 06:48:25 +0000 | [diff] [blame] | 82 | void DecodePALIGNRMask(MVT VT, unsigned Imm, |
| 83 | SmallVectorImpl<int> &ShuffleMask) { |
Benjamin Kramer | 6a93596 | 2013-01-26 13:31:37 +0000 | [diff] [blame] | 84 | unsigned NumElts = VT.getVectorNumElements(); |
| 85 | unsigned Offset = Imm * (VT.getVectorElementType().getSizeInBits() / 8); |
| 86 | |
Craig Topper | 5c68397 | 2013-01-28 07:41:18 +0000 | [diff] [blame] | 87 | unsigned NumLanes = VT.getSizeInBits() / 128; |
| 88 | unsigned NumLaneElts = NumElts / NumLanes; |
| 89 | |
| 90 | for (unsigned l = 0; l != NumElts; l += NumLaneElts) { |
| 91 | for (unsigned i = 0; i != NumLaneElts; ++i) { |
| 92 | unsigned Base = i + Offset; |
| 93 | // if i+offset is out of this lane then we actually need the other source |
| 94 | if (Base >= NumLaneElts) Base += NumElts - NumLaneElts; |
| 95 | ShuffleMask.push_back(Base + l); |
| 96 | } |
| 97 | } |
Benjamin Kramer | 6a93596 | 2013-01-26 13:31:37 +0000 | [diff] [blame] | 98 | } |
| 99 | |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 100 | /// DecodePSHUFMask - This decodes the shuffle masks for pshufd, and vpermilp*. |
| 101 | /// VT indicates the type of the vector allowing it to handle different |
| 102 | /// datatypes and vector widths. |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 103 | void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask) { |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 104 | unsigned NumElts = VT.getVectorNumElements(); |
| 105 | |
| 106 | unsigned NumLanes = VT.getSizeInBits() / 128; |
| 107 | unsigned NumLaneElts = NumElts / NumLanes; |
| 108 | |
Craig Topper | c73bc39 | 2012-05-02 08:03:44 +0000 | [diff] [blame] | 109 | unsigned NewImm = Imm; |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 110 | for (unsigned l = 0; l != NumElts; l += NumLaneElts) { |
| 111 | for (unsigned i = 0; i != NumLaneElts; ++i) { |
| 112 | ShuffleMask.push_back(NewImm % NumLaneElts + l); |
| 113 | NewImm /= NumLaneElts; |
| 114 | } |
| 115 | if (NumLaneElts == 4) NewImm = Imm; // reload imm |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 116 | } |
| 117 | } |
| 118 | |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 119 | void DecodePSHUFHWMask(MVT VT, unsigned Imm, |
Craig Topper | c73bc39 | 2012-05-02 08:03:44 +0000 | [diff] [blame] | 120 | SmallVectorImpl<int> &ShuffleMask) { |
Craig Topper | 315a5cc | 2012-05-03 07:12:59 +0000 | [diff] [blame] | 121 | unsigned NumElts = VT.getVectorNumElements(); |
Craig Topper | c73bc39 | 2012-05-02 08:03:44 +0000 | [diff] [blame] | 122 | |
| 123 | for (unsigned l = 0; l != NumElts; l += 8) { |
| 124 | unsigned NewImm = Imm; |
| 125 | for (unsigned i = 0, e = 4; i != e; ++i) { |
| 126 | ShuffleMask.push_back(l + i); |
| 127 | } |
| 128 | for (unsigned i = 4, e = 8; i != e; ++i) { |
| 129 | ShuffleMask.push_back(l + 4 + (NewImm & 3)); |
| 130 | NewImm >>= 2; |
| 131 | } |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 132 | } |
| 133 | } |
| 134 | |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 135 | void DecodePSHUFLWMask(MVT VT, unsigned Imm, |
Craig Topper | c73bc39 | 2012-05-02 08:03:44 +0000 | [diff] [blame] | 136 | SmallVectorImpl<int> &ShuffleMask) { |
Craig Topper | 315a5cc | 2012-05-03 07:12:59 +0000 | [diff] [blame] | 137 | unsigned NumElts = VT.getVectorNumElements(); |
Craig Topper | c73bc39 | 2012-05-02 08:03:44 +0000 | [diff] [blame] | 138 | |
| 139 | for (unsigned l = 0; l != NumElts; l += 8) { |
| 140 | unsigned NewImm = Imm; |
| 141 | for (unsigned i = 0, e = 4; i != e; ++i) { |
| 142 | ShuffleMask.push_back(l + (NewImm & 3)); |
| 143 | NewImm >>= 2; |
| 144 | } |
| 145 | for (unsigned i = 4, e = 8; i != e; ++i) { |
| 146 | ShuffleMask.push_back(l + i); |
| 147 | } |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 148 | } |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 149 | } |
| 150 | |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 151 | /// DecodeSHUFPMask - This decodes the shuffle masks for shufp*. VT indicates |
| 152 | /// the type of the vector allowing it to handle different datatypes and vector |
| 153 | /// widths. |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 154 | void DecodeSHUFPMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask) { |
Craig Topper | c16db84 | 2011-11-29 07:49:05 +0000 | [diff] [blame] | 155 | unsigned NumElts = VT.getVectorNumElements(); |
| 156 | |
| 157 | unsigned NumLanes = VT.getSizeInBits() / 128; |
| 158 | unsigned NumLaneElts = NumElts / NumLanes; |
| 159 | |
Craig Topper | c73bc39 | 2012-05-02 08:03:44 +0000 | [diff] [blame] | 160 | unsigned NewImm = Imm; |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 161 | for (unsigned l = 0; l != NumElts; l += NumLaneElts) { |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 162 | // each half of a lane comes from different source |
| 163 | for (unsigned s = 0; s != NumElts*2; s += NumElts) { |
| 164 | for (unsigned i = 0; i != NumLaneElts/2; ++i) { |
| 165 | ShuffleMask.push_back(NewImm % NumLaneElts + s + l); |
| 166 | NewImm /= NumLaneElts; |
| 167 | } |
Craig Topper | c16db84 | 2011-11-29 07:49:05 +0000 | [diff] [blame] | 168 | } |
| 169 | if (NumLaneElts == 4) NewImm = Imm; // reload imm |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 173 | /// DecodeUNPCKHMask - This decodes the shuffle masks for unpckhps/unpckhpd |
| 174 | /// and punpckh*. VT indicates the type of the vector allowing it to handle |
| 175 | /// different datatypes and vector widths. |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 176 | void DecodeUNPCKHMask(MVT VT, SmallVectorImpl<int> &ShuffleMask) { |
Craig Topper | ccb7097 | 2011-11-22 01:57:35 +0000 | [diff] [blame] | 177 | unsigned NumElts = VT.getVectorNumElements(); |
| 178 | |
| 179 | // Handle 128 and 256-bit vector lengths. AVX defines UNPCK* to operate |
| 180 | // independently on 128-bit lanes. |
| 181 | unsigned NumLanes = VT.getSizeInBits() / 128; |
| 182 | if (NumLanes == 0 ) NumLanes = 1; // Handle MMX |
| 183 | unsigned NumLaneElts = NumElts / NumLanes; |
| 184 | |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 185 | for (unsigned l = 0; l != NumElts; l += NumLaneElts) { |
| 186 | for (unsigned i = l + NumLaneElts/2, e = l + NumLaneElts; i != e; ++i) { |
Craig Topper | ccb7097 | 2011-11-22 01:57:35 +0000 | [diff] [blame] | 187 | ShuffleMask.push_back(i); // Reads from dest/src1 |
| 188 | ShuffleMask.push_back(i+NumElts); // Reads from src/src2 |
| 189 | } |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 190 | } |
| 191 | } |
| 192 | |
Craig Topper | 3cb802c | 2011-12-06 05:31:16 +0000 | [diff] [blame] | 193 | /// DecodeUNPCKLMask - This decodes the shuffle masks for unpcklps/unpcklpd |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 194 | /// and punpckl*. VT indicates the type of the vector allowing it to handle |
| 195 | /// different datatypes and vector widths. |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 196 | void DecodeUNPCKLMask(MVT VT, SmallVectorImpl<int> &ShuffleMask) { |
David Greene | dd567b2 | 2011-03-02 17:23:43 +0000 | [diff] [blame] | 197 | unsigned NumElts = VT.getVectorNumElements(); |
David Greene | 20a1cbe | 2011-02-28 19:06:56 +0000 | [diff] [blame] | 198 | |
Bruno Cardoso Lopes | f8fe47b | 2011-07-26 22:03:40 +0000 | [diff] [blame] | 199 | // Handle 128 and 256-bit vector lengths. AVX defines UNPCK* to operate |
| 200 | // independently on 128-bit lanes. |
| 201 | unsigned NumLanes = VT.getSizeInBits() / 128; |
| 202 | if (NumLanes == 0 ) NumLanes = 1; // Handle MMX |
| 203 | unsigned NumLaneElts = NumElts / NumLanes; |
David Greene | 20a1cbe | 2011-02-28 19:06:56 +0000 | [diff] [blame] | 204 | |
Craig Topper | 1f71057 | 2012-02-06 07:17:51 +0000 | [diff] [blame] | 205 | for (unsigned l = 0; l != NumElts; l += NumLaneElts) { |
| 206 | for (unsigned i = l, e = l + NumLaneElts/2; i != e; ++i) { |
Craig Topper | ccb7097 | 2011-11-22 01:57:35 +0000 | [diff] [blame] | 207 | ShuffleMask.push_back(i); // Reads from dest/src1 |
| 208 | ShuffleMask.push_back(i+NumElts); // Reads from src/src2 |
David Greene | dd567b2 | 2011-03-02 17:23:43 +0000 | [diff] [blame] | 209 | } |
Bruno Cardoso Lopes | c79f501 | 2010-09-02 18:40:13 +0000 | [diff] [blame] | 210 | } |
| 211 | } |
| 212 | |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 213 | void DecodeVPERM2X128Mask(MVT VT, unsigned Imm, |
Craig Topper | cbc96a6 | 2012-03-20 06:42:26 +0000 | [diff] [blame] | 214 | SmallVectorImpl<int> &ShuffleMask) { |
Craig Topper | 354103d | 2012-04-17 05:54:54 +0000 | [diff] [blame] | 215 | if (Imm & 0x88) |
| 216 | return; // Not a shuffle |
| 217 | |
Bruno Cardoso Lopes | f15dfe5 | 2011-08-12 21:48:26 +0000 | [diff] [blame] | 218 | unsigned HalfSize = VT.getVectorNumElements()/2; |
Bruno Cardoso Lopes | f15dfe5 | 2011-08-12 21:48:26 +0000 | [diff] [blame] | 219 | |
Craig Topper | 00a1e6d | 2012-05-06 19:46:21 +0000 | [diff] [blame] | 220 | for (unsigned l = 0; l != 2; ++l) { |
| 221 | unsigned HalfBegin = ((Imm >> (l*4)) & 0x3) * HalfSize; |
| 222 | for (unsigned i = HalfBegin, e = HalfBegin+HalfSize; i != e; ++i) |
| 223 | ShuffleMask.push_back(i); |
| 224 | } |
Bruno Cardoso Lopes | f15dfe5 | 2011-08-12 21:48:26 +0000 | [diff] [blame] | 225 | } |
| 226 | |
Chandler Carruth | 185cc18 | 2014-07-25 23:47:11 +0000 | [diff] [blame] | 227 | void DecodePSHUFBMask(const ConstantDataSequential *C, |
| 228 | SmallVectorImpl<int> &ShuffleMask) { |
| 229 | Type *MaskTy = C->getType(); |
| 230 | assert(MaskTy->isVectorTy() && "Expected a vector constant mask!"); |
NAKAMURA Takumi | 1fa7769 | 2014-07-26 04:53:05 +0000 | [diff] [blame] | 231 | assert(MaskTy->getVectorElementType()->isIntegerTy(8) && |
| 232 | "Expected i8 constant mask elements!"); |
Chandler Carruth | 185cc18 | 2014-07-25 23:47:11 +0000 | [diff] [blame] | 233 | int NumElements = MaskTy->getVectorNumElements(); |
| 234 | // FIXME: Add support for AVX-512. |
| 235 | assert((NumElements == 16 || NumElements == 32) && |
| 236 | "Only 128-bit and 256-bit vectors supported!"); |
| 237 | assert((unsigned)NumElements == C->getNumElements() && |
| 238 | "Constant mask has a different number of elements!"); |
| 239 | |
| 240 | ShuffleMask.reserve(NumElements); |
| 241 | for (int i = 0; i < NumElements; ++i) { |
| 242 | // For AVX vectors with 32 bytes the base of the shuffle is the half of the |
| 243 | // vector we're inside. |
| 244 | int Base = i < 16 ? 0 : 16; |
| 245 | uint64_t Element = C->getElementAsInteger(i); |
| 246 | // If the high bit (7) of the byte is set, the element is zeroed. |
| 247 | if (Element & (1 << 7)) |
| 248 | ShuffleMask.push_back(SM_SentinelZero); |
| 249 | else { |
| 250 | int Index = Base + Element; |
Nick Lewycky | d7c726c | 2014-07-26 05:44:15 +0000 | [diff] [blame] | 251 | assert((Index >= 0 && Index < NumElements) && |
Chandler Carruth | 185cc18 | 2014-07-25 23:47:11 +0000 | [diff] [blame] | 252 | "Out of bounds shuffle index for pshub instruction!"); |
| 253 | ShuffleMask.push_back(Index); |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
Chandler Carruth | 4c57955 | 2014-08-02 10:39:15 +0000 | [diff] [blame] | 258 | void DecodePSHUFBMask(ArrayRef<uint64_t> RawMask, |
| 259 | SmallVectorImpl<int> &ShuffleMask) { |
| 260 | for (int i = 0, e = RawMask.size(); i < e; ++i) { |
| 261 | uint64_t M = RawMask[i]; |
| 262 | // For AVX vectors with 32 bytes the base of the shuffle is the half of |
| 263 | // the vector we're inside. |
| 264 | int Base = i < 16 ? 0 : 16; |
| 265 | // If the high bit (7) of the byte is set, the element is zeroed. |
| 266 | if (M & (1 << 7)) |
| 267 | ShuffleMask.push_back(SM_SentinelZero); |
| 268 | else { |
| 269 | int Index = Base + M; |
| 270 | assert((Index >= 0 && (unsigned)Index < RawMask.size()) && |
| 271 | "Out of bounds shuffle index for pshub instruction!"); |
| 272 | ShuffleMask.push_back(Index); |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | |
Chandler Carruth | 0288620 | 2014-08-15 11:01:37 +0000 | [diff] [blame] | 277 | void DecodeBLENDMask(MVT VT, unsigned Imm, |
| 278 | SmallVectorImpl<int> &ShuffleMask) { |
| 279 | int NumElements = VT.getVectorNumElements(); |
| 280 | for (int i = 0; i < NumElements; ++i) |
| 281 | ShuffleMask.push_back(((Imm >> i) & 1) ? NumElements + i : i); |
| 282 | } |
| 283 | |
Craig Topper | 54bdb35 | 2012-05-06 18:44:02 +0000 | [diff] [blame] | 284 | /// DecodeVPERMMask - this decodes the shuffle masks for VPERMQ/VPERMPD. |
| 285 | /// No VT provided since it only works on 256-bit, 4 element vectors. |
| 286 | void DecodeVPERMMask(unsigned Imm, SmallVectorImpl<int> &ShuffleMask) { |
| 287 | for (unsigned i = 0; i != 4; ++i) { |
| 288 | ShuffleMask.push_back((Imm >> (2*i)) & 3); |
| 289 | } |
| 290 | } |
| 291 | |
David Greene | 3a2b508 | 2011-02-17 19:18:59 +0000 | [diff] [blame] | 292 | } // llvm namespace |