@@ -1422,9 +1422,8 @@ static void printDstRegisterName(raw_ostream &CS, const MachineInstr *MI,
1422
1422
// MASKZ: zmmX {%kY} {z}
1423
1423
if (X86II::isKMasked (MI->getDesc ().TSFlags )) {
1424
1424
const MachineOperand &WriteMaskOp = MI->getOperand (SrcOpIdx - 1 );
1425
- CS << " {%" ;
1426
- CS << X86ATTInstPrinter::getRegisterName (WriteMaskOp.getReg ());
1427
- CS << " }" ;
1425
+ StringRef Mask = X86ATTInstPrinter::getRegisterName (WriteMaskOp.getReg ());
1426
+ CS << " {%" << Mask << " }" ;
1428
1427
if (!X86II::isKMergeMasked (MI->getDesc ().TSFlags )) {
1429
1428
CS << " {z}" ;
1430
1429
}
@@ -1604,16 +1603,15 @@ static void printBroadcast(const MachineInstr *MI, MCStreamer &OutStreamer,
1604
1603
1605
1604
static bool printExtend (const MachineInstr *MI, MCStreamer &OutStreamer,
1606
1605
int SrcEltBits, int DstEltBits, bool IsSext) {
1607
- auto *C = X86::getConstantFromPool (*MI, 1 );
1606
+ unsigned SrcIdx = getSrcIdx (MI, 1 );
1607
+ auto *C = X86::getConstantFromPool (*MI, SrcIdx);
1608
1608
if (C && C->getType ()->getScalarSizeInBits () == unsigned (SrcEltBits)) {
1609
1609
if (auto *CDS = dyn_cast<ConstantDataSequential>(C)) {
1610
1610
int NumElts = CDS->getNumElements ();
1611
1611
std::string Comment;
1612
1612
raw_string_ostream CS (Comment);
1613
-
1614
- const MachineOperand &DstOp = MI->getOperand (0 );
1615
- CS << X86ATTInstPrinter::getRegisterName (DstOp.getReg ()) << " = " ;
1616
- CS << " [" ;
1613
+ printDstRegisterName (CS, MI, SrcIdx);
1614
+ CS << " = [" ;
1617
1615
for (int i = 0 ; i != NumElts; ++i) {
1618
1616
if (i != 0 )
1619
1617
CS << " ," ;
@@ -1644,22 +1642,16 @@ static void printZeroExtend(const MachineInstr *MI, MCStreamer &OutStreamer,
1644
1642
// We didn't find a constant load, fallback to a shuffle mask decode.
1645
1643
std::string Comment;
1646
1644
raw_string_ostream CS (Comment);
1645
+ printDstRegisterName (CS, MI, getSrcIdx (MI, 1 ));
1646
+ CS << " = " ;
1647
1647
1648
- const MachineOperand &DstOp = MI->getOperand (0 );
1649
- CS << X86ATTInstPrinter::getRegisterName (DstOp.getReg ()) << " = " ;
1650
-
1648
+ SmallVector<int > Mask;
1651
1649
unsigned Width = getRegisterWidth (MI->getDesc ().operands ()[0 ]);
1652
1650
assert ((Width % DstEltBits) == 0 && (DstEltBits % SrcEltBits) == 0 &&
1653
1651
" Illegal extension ratio" );
1654
- unsigned NumElts = Width / DstEltBits;
1655
- unsigned Scale = DstEltBits / SrcEltBits;
1656
- for (unsigned I = 0 ; I != NumElts; ++I) {
1657
- if (I != 0 )
1658
- CS << " ," ;
1659
- CS << " mem[" << I << " ]" ;
1660
- for (unsigned S = 1 ; S != Scale; ++S)
1661
- CS << " ,zero" ;
1662
- }
1652
+ DecodeZeroExtendMask (SrcEltBits, DstEltBits, Width / DstEltBits, false , Mask);
1653
+ printShuffleMask (CS, " mem" , " " , Mask);
1654
+
1663
1655
OutStreamer.AddComment (CS.str ());
1664
1656
}
1665
1657
@@ -2010,16 +2002,22 @@ static void addConstantComments(const MachineInstr *MI,
2010
2002
printBroadcast (MI, OutStreamer, 64 , 8 );
2011
2003
break ;
2012
2004
2013
- #define MOVX_CASE (Prefix, Ext, Type, Suffix ) \
2014
- case X86::Prefix##PMOV##Ext##Type##Suffix##rm:
2005
+ #define MOVX_CASE (Prefix, Ext, Type, Suffix, Postfix ) \
2006
+ case X86::Prefix##PMOV##Ext##Type##Suffix##rm##Postfix :
2015
2007
2016
2008
#define CASE_MOVX_RM (Ext, Type ) \
2017
- MOVX_CASE (, Ext, Type, ) \
2018
- MOVX_CASE (V, Ext, Type, ) \
2019
- MOVX_CASE (V, Ext, Type, Y) \
2020
- MOVX_CASE (V, Ext, Type, Z128) \
2021
- MOVX_CASE (V, Ext, Type, Z256) \
2022
- MOVX_CASE (V, Ext, Type, Z)
2009
+ MOVX_CASE (, Ext, Type, , ) \
2010
+ MOVX_CASE (V, Ext, Type, , ) \
2011
+ MOVX_CASE (V, Ext, Type, Y, ) \
2012
+ MOVX_CASE (V, Ext, Type, Z128, ) \
2013
+ MOVX_CASE (V, Ext, Type, Z128, k ) \
2014
+ MOVX_CASE (V, Ext, Type, Z128, kz ) \
2015
+ MOVX_CASE (V, Ext, Type, Z256, ) \
2016
+ MOVX_CASE (V, Ext, Type, Z256, k ) \
2017
+ MOVX_CASE (V, Ext, Type, Z256, kz ) \
2018
+ MOVX_CASE (V, Ext, Type, Z, ) \
2019
+ MOVX_CASE (V, Ext, Type, Z, k ) \
2020
+ MOVX_CASE (V, Ext, Type, Z, kz )
2023
2021
2024
2022
CASE_MOVX_RM (SX, BD)
2025
2023
printSignExtend (MI, OutStreamer, 8 , 32 );
0 commit comments