Home | History | Annotate | Download | only in PerfectShuffle

Lines Matching refs:Mask

28 // Mask manipulation functions.
34 /// getMaskElt - Return element N of the specified mask.
35 static unsigned getMaskElt(unsigned Mask, unsigned Elt) {
36 return (Mask >> ((3-Elt)*4)) & 0xF;
39 static unsigned setMaskElt(unsigned Mask, unsigned Elt, unsigned NewVal) {
41 return (Mask & ~(0xF << FieldShift)) | (NewVal << FieldShift);
45 static bool isValidMask(unsigned short Mask) {
46 unsigned short UndefBits = Mask & 0x8888;
47 return (Mask & ((UndefBits >> 1)|(UndefBits>>2)|(UndefBits>>3))) == 0;
50 /// hasUndefElements - Return true if any of the elements in the mask are undefs
52 static bool hasUndefElements(unsigned short Mask) {
53 return (Mask & 0x8888) != 0;
56 /// isOnlyLHSMask - Return true if this mask only refers to its LHS, not
58 static bool isOnlyLHSMask(unsigned short Mask) {
59 return (Mask & 0x4444) == 0;
62 /// getLHSOnlyMask - Given a mask that refers to its LHS and RHS, modify it to
66 static unsigned short getLHSOnlyMask(unsigned short Mask) {
67 return Mask & 0xBBBB; // Keep only LHS and Undefs.
71 /// getCompressedMask - Turn a 16-bit uncompressed mask (where each elt uses 4
72 /// bits) into a compressed 13-bit mask, where each elt is multiplied by 9.
73 static unsigned getCompressedMask(unsigned short Mask) {
74 return getMaskElt(Mask, 0)*9*9*9 + getMaskElt(Mask, 1)*9*9 +
75 getMaskElt(Mask, 2)*9 + getMaskElt(Mask, 3);