llvm.org GIT mirror llvm / 200b306
X86: Decode PALIGN operands so I don't have to do it in my head. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173572 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 7 years ago
5 changed file(s) with 67 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6767 DestName = getRegName(MI->getOperand(0).getReg());
6868 DecodeMOVHLPSMask(2, ShuffleMask);
6969 break;
70
71 case X86::PALIGNR128rr:
72 case X86::VPALIGNR128rr:
73 Src1Name = getRegName(MI->getOperand(2).getReg());
74 // FALL THROUGH.
75 case X86::PALIGNR128rm:
76 case X86::VPALIGNR128rm:
77 Src2Name = getRegName(MI->getOperand(1).getReg());
78 DestName = getRegName(MI->getOperand(0).getReg());
79 DecodePALIGNMask(MVT::v16i8,
80 MI->getOperand(MI->getNumOperands()-1).getImm(),
81 ShuffleMask);
82 break;
83 case X86::VPALIGNR256rr:
84 Src1Name = getRegName(MI->getOperand(2).getReg());
85 // FALL THROUGH.
86 case X86::VPALIGNR256rm:
87 Src2Name = getRegName(MI->getOperand(1).getReg());
88 DestName = getRegName(MI->getOperand(0).getReg());
89 DecodePALIGNMask(MVT::v32i8,
90 MI->getOperand(MI->getNumOperands()-1).getImm(),
91 ShuffleMask);
7092
7193 case X86::PSHUFDri:
7294 case X86::VPSHUFDri:
6060 ShuffleMask.push_back(NElts+i);
6161 }
6262
63 void DecodePALIGNMask(MVT VT, unsigned Imm, SmallVectorImpl &ShuffleMask) {
64 unsigned NumElts = VT.getVectorNumElements();
65 unsigned Offset = Imm * (VT.getVectorElementType().getSizeInBits() / 8);
66
67 for (unsigned i = 0; i != NumElts; ++i)
68 ShuffleMask.push_back((i + Offset) % (NumElts * 2));
69 }
70
6371 /// DecodePSHUFMask - This decodes the shuffle masks for pshufd, and vpermilp*.
6472 /// VT indicates the type of the vector allowing it to handle different
6573 /// datatypes and vector widths.
3434 // <0,2> or <0,1,4,5>
3535 void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl &ShuffleMask);
3636
37 void DecodePALIGNMask(MVT VT, unsigned Imm, SmallVectorImpl &ShuffleMask);
38
3739 void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl &ShuffleMask);
3840
3941 void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl &ShuffleMask);
45914591 case X86ISD::MOVLHPS:
45924592 DecodeMOVLHPSMask(NumElems, Mask);
45934593 break;
4594 case X86ISD::PALIGN:
4595 ImmN = N->getOperand(N->getNumOperands()-1);
4596 DecodePALIGNMask(VT, cast(ImmN)->getZExtValue(), Mask);
4597 break;
45944598 case X86ISD::PSHUFD:
45954599 case X86ISD::VPERMILP:
45964600 ImmN = N->getOperand(N->getNumOperands()-1);
46344638 case X86ISD::MOVLPS:
46354639 case X86ISD::MOVSHDUP:
46364640 case X86ISD::MOVSLDUP:
4637 case X86ISD::PALIGN:
46384641 // Not yet implemented
46394642 return false;
46404643 default: llvm_unreachable("unknown target shuffle node");
0 # RUN: llvm-mc %s -triple=x86_64-unknown-unknown | FileCheck %s
1
2 palignr $8, %xmm0, %xmm1
3 # CHECK: xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
4 palignr $8, (%rax), %xmm1
5 # CHECK: xmm1 = mem[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
6
7 palignr $16, %xmm0, %xmm1
8 # CHECK: xmm1 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
9 palignr $16, (%rax), %xmm1
10 # CHECK: xmm1 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
11
12 palignr $0, %xmm0, %xmm1
13 # CHECK: xmm1 = xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
14 palignr $0, (%rax), %xmm1
15 # CHECK: xmm1 = mem[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
16
17 vpalignr $8, %xmm0, %xmm1, %xmm2
18 # CHECK: xmm2 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
19 vpalignr $8, (%rax), %xmm1, %xmm2
20 # CHECK: xmm2 = mem[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
21
22 vpalignr $16, %xmm0, %xmm1, %xmm2
23 # CHECK: xmm2 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
24 vpalignr $16, (%rax), %xmm1, %xmm2
25 # CHECK: xmm2 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
26
27 vpalignr $0, %xmm0, %xmm1, %xmm2
28 # CHECK: xmm2 = xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
29 vpalignr $0, (%rax), %xmm1, %xmm2
30 # CHECK: xmm2 = mem[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]