mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
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
This commit is contained in:
parent
126fde57f3
commit
200b306f20
@ -69,6 +69,28 @@ void llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
|
||||
DecodeMOVHLPSMask(2, ShuffleMask);
|
||||
break;
|
||||
|
||||
case X86::PALIGNR128rr:
|
||||
case X86::VPALIGNR128rr:
|
||||
Src1Name = getRegName(MI->getOperand(2).getReg());
|
||||
// FALL THROUGH.
|
||||
case X86::PALIGNR128rm:
|
||||
case X86::VPALIGNR128rm:
|
||||
Src2Name = getRegName(MI->getOperand(1).getReg());
|
||||
DestName = getRegName(MI->getOperand(0).getReg());
|
||||
DecodePALIGNMask(MVT::v16i8,
|
||||
MI->getOperand(MI->getNumOperands()-1).getImm(),
|
||||
ShuffleMask);
|
||||
break;
|
||||
case X86::VPALIGNR256rr:
|
||||
Src1Name = getRegName(MI->getOperand(2).getReg());
|
||||
// FALL THROUGH.
|
||||
case X86::VPALIGNR256rm:
|
||||
Src2Name = getRegName(MI->getOperand(1).getReg());
|
||||
DestName = getRegName(MI->getOperand(0).getReg());
|
||||
DecodePALIGNMask(MVT::v32i8,
|
||||
MI->getOperand(MI->getNumOperands()-1).getImm(),
|
||||
ShuffleMask);
|
||||
|
||||
case X86::PSHUFDri:
|
||||
case X86::VPSHUFDri:
|
||||
Src1Name = getRegName(MI->getOperand(1).getReg());
|
||||
|
@ -61,6 +61,14 @@ void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask) {
|
||||
ShuffleMask.push_back(NElts+i);
|
||||
}
|
||||
|
||||
void DecodePALIGNMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask) {
|
||||
unsigned NumElts = VT.getVectorNumElements();
|
||||
unsigned Offset = Imm * (VT.getVectorElementType().getSizeInBits() / 8);
|
||||
|
||||
for (unsigned i = 0; i != NumElts; ++i)
|
||||
ShuffleMask.push_back((i + Offset) % (NumElts * 2));
|
||||
}
|
||||
|
||||
/// DecodePSHUFMask - This decodes the shuffle masks for pshufd, and vpermilp*.
|
||||
/// VT indicates the type of the vector allowing it to handle different
|
||||
/// datatypes and vector widths.
|
||||
|
@ -35,6 +35,8 @@ void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
|
||||
// <0,2> or <0,1,4,5>
|
||||
void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
|
||||
|
||||
void DecodePALIGNMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
|
||||
|
||||
void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
|
||||
|
||||
void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
|
||||
|
@ -4592,6 +4592,10 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT,
|
||||
case X86ISD::MOVLHPS:
|
||||
DecodeMOVLHPSMask(NumElems, Mask);
|
||||
break;
|
||||
case X86ISD::PALIGN:
|
||||
ImmN = N->getOperand(N->getNumOperands()-1);
|
||||
DecodePALIGNMask(VT, cast<ConstantSDNode>(ImmN)->getZExtValue(), Mask);
|
||||
break;
|
||||
case X86ISD::PSHUFD:
|
||||
case X86ISD::VPERMILP:
|
||||
ImmN = N->getOperand(N->getNumOperands()-1);
|
||||
@ -4635,7 +4639,6 @@ static bool getTargetShuffleMask(SDNode *N, MVT VT,
|
||||
case X86ISD::MOVLPS:
|
||||
case X86ISD::MOVSHDUP:
|
||||
case X86ISD::MOVSLDUP:
|
||||
case X86ISD::PALIGN:
|
||||
// Not yet implemented
|
||||
return false;
|
||||
default: llvm_unreachable("unknown target shuffle node");
|
||||
|
31
test/MC/X86/shuffle-comments.s
Normal file
31
test/MC/X86/shuffle-comments.s
Normal file
@ -0,0 +1,31 @@
|
||||
# RUN: llvm-mc %s -triple=x86_64-unknown-unknown | FileCheck %s
|
||||
|
||||
palignr $8, %xmm0, %xmm1
|
||||
# CHECK: xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
|
||||
palignr $8, (%rax), %xmm1
|
||||
# CHECK: xmm1 = mem[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
|
||||
|
||||
palignr $16, %xmm0, %xmm1
|
||||
# CHECK: xmm1 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
palignr $16, (%rax), %xmm1
|
||||
# CHECK: xmm1 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
|
||||
palignr $0, %xmm0, %xmm1
|
||||
# CHECK: xmm1 = xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
palignr $0, (%rax), %xmm1
|
||||
# CHECK: xmm1 = mem[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
|
||||
vpalignr $8, %xmm0, %xmm1, %xmm2
|
||||
# CHECK: xmm2 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
|
||||
vpalignr $8, (%rax), %xmm1, %xmm2
|
||||
# CHECK: xmm2 = mem[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
|
||||
|
||||
vpalignr $16, %xmm0, %xmm1, %xmm2
|
||||
# CHECK: xmm2 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
vpalignr $16, (%rax), %xmm1, %xmm2
|
||||
# CHECK: xmm2 = xmm1[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
|
||||
vpalignr $0, %xmm0, %xmm1, %xmm2
|
||||
# CHECK: xmm2 = xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
||||
vpalignr $0, (%rax), %xmm1, %xmm2
|
||||
# CHECK: xmm2 = mem[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
Loading…
x
Reference in New Issue
Block a user