@@ -1585,12 +1585,12 @@ static void printZeroUpperMove(const MachineInstr *MI, MCStreamer &OutStreamer,
15851585
15861586static void printBroadcast (const MachineInstr *MI, MCStreamer &OutStreamer,
15871587 int Repeats, int BitWidth) {
1588- if (auto *C = X86::getConstantFromPool (*MI, 1 )) {
1588+ unsigned SrcIdx = getSrcIdx (MI, 1 );
1589+ if (auto *C = X86::getConstantFromPool (*MI, SrcIdx)) {
15891590 std::string Comment;
15901591 raw_string_ostream CS (Comment);
1591- const MachineOperand &DstOp = MI->getOperand (0 );
1592- CS << X86ATTInstPrinter::getRegisterName (DstOp.getReg ()) << " = " ;
1593- CS << " [" ;
1592+ printDstRegisterName (CS, MI, SrcIdx);
1593+ CS << " = [" ;
15941594 for (int l = 0 ; l != Repeats; ++l) {
15951595 if (l != 0 )
15961596 CS << " ," ;
@@ -1856,6 +1856,11 @@ static void addConstantComments(const MachineInstr *MI,
18561856 break ;
18571857 }
18581858
1859+ #define MASK_AVX512_CASE (Instr ) \
1860+ case Instr: \
1861+ case Instr##k: \
1862+ case Instr##kz:
1863+
18591864 case X86::MOVSDrm:
18601865 case X86::VMOVSDrm:
18611866 case X86::VMOVSDZrm:
@@ -1888,29 +1893,35 @@ static void addConstantComments(const MachineInstr *MI,
18881893 case X86::Prefix##MOVDQA##Suffix##rm: \
18891894 case X86::Prefix##MOVDQU##Suffix##rm:
18901895
1891- #define MOV_AVX512_CASE (Suffix ) \
1892- case X86::VMOVDQA64##Suffix##rm: \
1893- case X86::VMOVDQA32##Suffix##rm: \
1894- case X86::VMOVDQU64##Suffix##rm: \
1895- case X86::VMOVDQU32##Suffix##rm: \
1896- case X86::VMOVDQU16##Suffix##rm: \
1897- case X86::VMOVDQU8##Suffix##rm: \
1898- case X86::VMOVAPS##Suffix##rm: \
1899- case X86::VMOVAPD##Suffix##rm: \
1900- case X86::VMOVUPS##Suffix##rm: \
1901- case X86::VMOVUPD##Suffix##rm:
1896+ #define MOV_AVX512_CASE (Suffix, Postfix ) \
1897+ case X86::VMOVDQA64##Suffix##rm##Postfix: \
1898+ case X86::VMOVDQA32##Suffix##rm##Postfix: \
1899+ case X86::VMOVDQU64##Suffix##rm##Postfix: \
1900+ case X86::VMOVDQU32##Suffix##rm##Postfix: \
1901+ case X86::VMOVDQU16##Suffix##rm##Postfix: \
1902+ case X86::VMOVDQU8##Suffix##rm##Postfix: \
1903+ case X86::VMOVAPS##Suffix##rm##Postfix: \
1904+ case X86::VMOVAPD##Suffix##rm##Postfix: \
1905+ case X86::VMOVUPS##Suffix##rm##Postfix: \
1906+ case X86::VMOVUPD##Suffix##rm##Postfix :
19021907
19031908#define CASE_128_MOV_RM () \
19041909 MOV_CASE (, ) /* SSE */ \
19051910 MOV_CASE (V, ) /* AVX-128 */ \
1906- MOV_AVX512_CASE (Z128)
1911+ MOV_AVX512_CASE (Z128, ) \
1912+ MOV_AVX512_CASE (Z128, k) \
1913+ MOV_AVX512_CASE (Z128, kz)
19071914
19081915#define CASE_256_MOV_RM () \
19091916 MOV_CASE (V, Y) /* AVX-256 */ \
1910- MOV_AVX512_CASE (Z256)
1917+ MOV_AVX512_CASE (Z256, ) \
1918+ MOV_AVX512_CASE (Z256, k) \
1919+ MOV_AVX512_CASE (Z256, kz) \
19111920
19121921#define CASE_512_MOV_RM () \
1913- MOV_AVX512_CASE (Z)
1922+ MOV_AVX512_CASE (Z, ) \
1923+ MOV_AVX512_CASE (Z, k) \
1924+ MOV_AVX512_CASE (Z, kz) \
19141925
19151926 // For loads from a constant pool to a vector register, print the constant
19161927 // loaded.
@@ -1925,80 +1936,80 @@ static void addConstantComments(const MachineInstr *MI,
19251936 break ;
19261937 case X86::VBROADCASTF128rm:
19271938 case X86::VBROADCASTI128rm:
1928- case X86::VBROADCASTF32X4Z256rm:
1929- case X86::VBROADCASTF64X2Z128rm:
1930- case X86::VBROADCASTI32X4Z256rm:
1931- case X86::VBROADCASTI64X2Z128rm:
1939+ MASK_AVX512_CASE ( X86::VBROADCASTF32X4Z256rm)
1940+ MASK_AVX512_CASE ( X86::VBROADCASTF64X2Z128rm)
1941+ MASK_AVX512_CASE ( X86::VBROADCASTI32X4Z256rm)
1942+ MASK_AVX512_CASE ( X86::VBROADCASTI64X2Z128rm)
19321943 printBroadcast (MI, OutStreamer, 2 , 128 );
19331944 break ;
1934- case X86::VBROADCASTF32X4rm:
1935- case X86::VBROADCASTF64X2rm:
1936- case X86::VBROADCASTI32X4rm:
1937- case X86::VBROADCASTI64X2rm:
1945+ MASK_AVX512_CASE ( X86::VBROADCASTF32X4rm)
1946+ MASK_AVX512_CASE ( X86::VBROADCASTF64X2rm)
1947+ MASK_AVX512_CASE ( X86::VBROADCASTI32X4rm)
1948+ MASK_AVX512_CASE ( X86::VBROADCASTI64X2rm)
19381949 printBroadcast (MI, OutStreamer, 4 , 128 );
19391950 break ;
1940- case X86::VBROADCASTF32X8rm:
1941- case X86::VBROADCASTF64X4rm:
1942- case X86::VBROADCASTI32X8rm:
1943- case X86::VBROADCASTI64X4rm:
1951+ MASK_AVX512_CASE ( X86::VBROADCASTF32X8rm)
1952+ MASK_AVX512_CASE ( X86::VBROADCASTF64X4rm)
1953+ MASK_AVX512_CASE ( X86::VBROADCASTI32X8rm)
1954+ MASK_AVX512_CASE ( X86::VBROADCASTI64X4rm)
19441955 printBroadcast (MI, OutStreamer, 2 , 256 );
19451956 break ;
19461957
19471958 // For broadcast loads from a constant pool to a vector register, repeatedly
19481959 // print the constant loaded.
19491960 case X86::MOVDDUPrm:
19501961 case X86::VMOVDDUPrm:
1951- case X86::VMOVDDUPZ128rm:
1962+ MASK_AVX512_CASE ( X86::VMOVDDUPZ128rm)
19521963 case X86::VPBROADCASTQrm:
1953- case X86::VPBROADCASTQZ128rm:
1964+ MASK_AVX512_CASE ( X86::VPBROADCASTQZ128rm)
19541965 printBroadcast (MI, OutStreamer, 2 , 64 );
19551966 break ;
19561967 case X86::VBROADCASTSDYrm:
1957- case X86::VBROADCASTSDZ256rm:
1968+ MASK_AVX512_CASE ( X86::VBROADCASTSDZ256rm)
19581969 case X86::VPBROADCASTQYrm:
1959- case X86::VPBROADCASTQZ256rm:
1970+ MASK_AVX512_CASE ( X86::VPBROADCASTQZ256rm)
19601971 printBroadcast (MI, OutStreamer, 4 , 64 );
19611972 break ;
1962- case X86::VBROADCASTSDZrm:
1963- case X86::VPBROADCASTQZrm:
1973+ MASK_AVX512_CASE ( X86::VBROADCASTSDZrm)
1974+ MASK_AVX512_CASE ( X86::VPBROADCASTQZrm)
19641975 printBroadcast (MI, OutStreamer, 8 , 64 );
19651976 break ;
19661977 case X86::VBROADCASTSSrm:
1967- case X86::VBROADCASTSSZ128rm:
1978+ MASK_AVX512_CASE ( X86::VBROADCASTSSZ128rm)
19681979 case X86::VPBROADCASTDrm:
1969- case X86::VPBROADCASTDZ128rm:
1980+ MASK_AVX512_CASE ( X86::VPBROADCASTDZ128rm)
19701981 printBroadcast (MI, OutStreamer, 4 , 32 );
19711982 break ;
19721983 case X86::VBROADCASTSSYrm:
1973- case X86::VBROADCASTSSZ256rm:
1984+ MASK_AVX512_CASE ( X86::VBROADCASTSSZ256rm)
19741985 case X86::VPBROADCASTDYrm:
1975- case X86::VPBROADCASTDZ256rm:
1986+ MASK_AVX512_CASE ( X86::VPBROADCASTDZ256rm)
19761987 printBroadcast (MI, OutStreamer, 8 , 32 );
19771988 break ;
1978- case X86::VBROADCASTSSZrm:
1979- case X86::VPBROADCASTDZrm:
1989+ MASK_AVX512_CASE ( X86::VBROADCASTSSZrm)
1990+ MASK_AVX512_CASE ( X86::VPBROADCASTDZrm)
19801991 printBroadcast (MI, OutStreamer, 16 , 32 );
19811992 break ;
19821993 case X86::VPBROADCASTWrm:
1983- case X86::VPBROADCASTWZ128rm:
1994+ MASK_AVX512_CASE ( X86::VPBROADCASTWZ128rm)
19841995 printBroadcast (MI, OutStreamer, 8 , 16 );
19851996 break ;
19861997 case X86::VPBROADCASTWYrm:
1987- case X86::VPBROADCASTWZ256rm:
1998+ MASK_AVX512_CASE ( X86::VPBROADCASTWZ256rm)
19881999 printBroadcast (MI, OutStreamer, 16 , 16 );
19892000 break ;
1990- case X86::VPBROADCASTWZrm:
2001+ MASK_AVX512_CASE ( X86::VPBROADCASTWZrm)
19912002 printBroadcast (MI, OutStreamer, 32 , 16 );
19922003 break ;
19932004 case X86::VPBROADCASTBrm:
1994- case X86::VPBROADCASTBZ128rm:
2005+ MASK_AVX512_CASE ( X86::VPBROADCASTBZ128rm)
19952006 printBroadcast (MI, OutStreamer, 16 , 8 );
19962007 break ;
19972008 case X86::VPBROADCASTBYrm:
1998- case X86::VPBROADCASTBZ256rm:
2009+ MASK_AVX512_CASE ( X86::VPBROADCASTBZ256rm)
19992010 printBroadcast (MI, OutStreamer, 32 , 8 );
20002011 break ;
2001- case X86::VPBROADCASTBZrm:
2012+ MASK_AVX512_CASE ( X86::VPBROADCASTBZrm)
20022013 printBroadcast (MI, OutStreamer, 64 , 8 );
20032014 break ;
20042015
0 commit comments