46 #define DEBUG_TYPE "x86-instr-info" 48 #define GET_INSTRINFO_CTOR_DTOR 49 #include "X86GenInstrInfo.inc" 53 cl::desc(
"Disable fusing of spill code into instructions"),
57 cl::desc(
"Print instructions that the allocator wants to" 58 " fuse, but the X86 backend currently can't"),
62 cl::desc(
"Re-materialize load from stub in PIC mode"),
66 cl::desc(
"Clearance between two register writes " 67 "for inserting XOR to avoid partial " 72 cl::desc(
"How many idle instructions we would like before " 73 "certain undef register reads"),
78 void X86InstrInfo::anchor() {}
82 : X86::ADJCALLSTACKDOWN32),
83 (STI.isTarget64BitLP64() ? X86::ADJCALLSTACKUP64
84 : X86::ADJCALLSTACKUP32),
86 (STI.
is64Bit() ? X86::RETQ : X86::RETL)),
87 Subtarget(STI), RI(STI.getTargetTriple()) {
92 unsigned &SrcReg,
unsigned &DstReg,
93 unsigned &SubIdx)
const {
100 case X86::MOVSX64rr8:
106 case X86::MOVSX32rr16:
107 case X86::MOVZX32rr16:
108 case X86::MOVSX64rr16:
109 case X86::MOVSX64rr32: {
117 case X86::MOVSX16rr8:
118 case X86::MOVZX16rr8:
119 case X86::MOVSX32rr8:
120 case X86::MOVZX32rr8:
121 case X86::MOVSX64rr8:
122 SubIdx = X86::sub_8bit;
124 case X86::MOVSX32rr16:
125 case X86::MOVZX32rr16:
126 case X86::MOVSX64rr16:
127 SubIdx = X86::sub_16bit;
129 case X86::MOVSX64rr32:
130 SubIdx = X86::sub_32bit;
143 if (isFrameInstr(MI)) {
145 int SPAdj =
alignTo(getFrameSize(MI), StackAlign);
147 if (!isFrameSetup(MI))
158 for (
auto E = MBB->
end();
I !=
E; ++
I) {
159 if (
I->getOpcode() == getCallFrameDestroyOpcode() ||
166 if (
I->getOpcode() != getCallFrameDestroyOpcode())
169 return -(
I->getOperand(1).getImm());
233 case X86::MMX_MOVD64rm:
234 case X86::MMX_MOVQ64rm:
250 case X86::VMOVAPSZ128rm:
251 case X86::VMOVUPSZ128rm:
252 case X86::VMOVAPSZ128rm_NOVLX:
253 case X86::VMOVUPSZ128rm_NOVLX:
254 case X86::VMOVAPDZ128rm:
255 case X86::VMOVUPDZ128rm:
256 case X86::VMOVDQU8Z128rm:
257 case X86::VMOVDQU16Z128rm:
258 case X86::VMOVDQA32Z128rm:
259 case X86::VMOVDQU32Z128rm:
260 case X86::VMOVDQA64Z128rm:
261 case X86::VMOVDQU64Z128rm:
264 case X86::VMOVAPSYrm:
265 case X86::VMOVUPSYrm:
266 case X86::VMOVAPDYrm:
267 case X86::VMOVUPDYrm:
268 case X86::VMOVDQAYrm:
269 case X86::VMOVDQUYrm:
270 case X86::VMOVAPSZ256rm:
271 case X86::VMOVUPSZ256rm:
272 case X86::VMOVAPSZ256rm_NOVLX:
273 case X86::VMOVUPSZ256rm_NOVLX:
274 case X86::VMOVAPDZ256rm:
275 case X86::VMOVUPDZ256rm:
276 case X86::VMOVDQU8Z256rm:
277 case X86::VMOVDQU16Z256rm:
278 case X86::VMOVDQA32Z256rm:
279 case X86::VMOVDQU32Z256rm:
280 case X86::VMOVDQA64Z256rm:
281 case X86::VMOVDQU64Z256rm:
284 case X86::VMOVAPSZrm:
285 case X86::VMOVUPSZrm:
286 case X86::VMOVAPDZrm:
287 case X86::VMOVUPDZrm:
288 case X86::VMOVDQU8Zrm:
289 case X86::VMOVDQU16Zrm:
290 case X86::VMOVDQA32Zrm:
291 case X86::VMOVDQU32Zrm:
292 case X86::VMOVDQA64Zrm:
293 case X86::VMOVDQU64Zrm:
323 case X86::MMX_MOVD64mr:
324 case X86::MMX_MOVQ64mr:
325 case X86::MMX_MOVNTQmr:
341 case X86::VMOVUPSZ128mr:
342 case X86::VMOVAPSZ128mr:
343 case X86::VMOVUPSZ128mr_NOVLX:
344 case X86::VMOVAPSZ128mr_NOVLX:
345 case X86::VMOVUPDZ128mr:
346 case X86::VMOVAPDZ128mr:
347 case X86::VMOVDQA32Z128mr:
348 case X86::VMOVDQU32Z128mr:
349 case X86::VMOVDQA64Z128mr:
350 case X86::VMOVDQU64Z128mr:
351 case X86::VMOVDQU8Z128mr:
352 case X86::VMOVDQU16Z128mr:
355 case X86::VMOVUPSYmr:
356 case X86::VMOVAPSYmr:
357 case X86::VMOVUPDYmr:
358 case X86::VMOVAPDYmr:
359 case X86::VMOVDQUYmr:
360 case X86::VMOVDQAYmr:
361 case X86::VMOVUPSZ256mr:
362 case X86::VMOVAPSZ256mr:
363 case X86::VMOVUPSZ256mr_NOVLX:
364 case X86::VMOVAPSZ256mr_NOVLX:
365 case X86::VMOVUPDZ256mr:
366 case X86::VMOVAPDZ256mr:
367 case X86::VMOVDQU8Z256mr:
368 case X86::VMOVDQU16Z256mr:
369 case X86::VMOVDQA32Z256mr:
370 case X86::VMOVDQU32Z256mr:
371 case X86::VMOVDQA64Z256mr:
372 case X86::VMOVDQU64Z256mr:
375 case X86::VMOVUPSZmr:
376 case X86::VMOVAPSZmr:
377 case X86::VMOVUPDZmr:
378 case X86::VMOVAPDZmr:
379 case X86::VMOVDQU8Zmr:
380 case X86::VMOVDQU16Zmr:
381 case X86::VMOVDQA32Zmr:
382 case X86::VMOVDQU32Zmr:
383 case X86::VMOVDQA64Zmr:
384 case X86::VMOVDQU64Zmr:
392 int &FrameIndex)
const {
399 unsigned &MemBytes)
const {
407 int &FrameIndex)
const {
415 if (hasLoadFromStackSlot(MI, Accesses)) {
426 int &FrameIndex)
const {
433 unsigned &MemBytes)
const {
436 isFrameOperand(MI, 0, FrameIndex))
442 int &FrameIndex)
const {
450 if (hasStoreToStackSlot(MI, Accesses)) {
465 bool isPICBase =
false;
471 assert(!isPICBase &&
"More than one PIC base?");
482 case X86::MOV8rm_NOREX:
503 case X86::VMOVAPSYrm:
504 case X86::VMOVUPSYrm:
505 case X86::VMOVAPDYrm:
506 case X86::VMOVUPDYrm:
507 case X86::VMOVDQAYrm:
508 case X86::VMOVDQUYrm:
509 case X86::MMX_MOVD64rm:
510 case X86::MMX_MOVQ64rm:
514 case X86::VMOVAPDZ128rm:
515 case X86::VMOVAPDZ256rm:
516 case X86::VMOVAPDZrm:
517 case X86::VMOVAPSZ128rm:
518 case X86::VMOVAPSZ256rm:
519 case X86::VMOVAPSZ128rm_NOVLX:
520 case X86::VMOVAPSZ256rm_NOVLX:
521 case X86::VMOVAPSZrm:
522 case X86::VMOVDQA32Z128rm:
523 case X86::VMOVDQA32Z256rm:
524 case X86::VMOVDQA32Zrm:
525 case X86::VMOVDQA64Z128rm:
526 case X86::VMOVDQA64Z256rm:
527 case X86::VMOVDQA64Zrm:
528 case X86::VMOVDQU16Z128rm:
529 case X86::VMOVDQU16Z256rm:
530 case X86::VMOVDQU16Zrm:
531 case X86::VMOVDQU32Z128rm:
532 case X86::VMOVDQU32Z256rm:
533 case X86::VMOVDQU32Zrm:
534 case X86::VMOVDQU64Z128rm:
535 case X86::VMOVDQU64Z256rm:
536 case X86::VMOVDQU64Zrm:
537 case X86::VMOVDQU8Z128rm:
538 case X86::VMOVDQU8Z256rm:
539 case X86::VMOVDQU8Zrm:
540 case X86::VMOVUPDZ128rm:
541 case X86::VMOVUPDZ256rm:
542 case X86::VMOVUPDZrm:
543 case X86::VMOVUPSZ128rm:
544 case X86::VMOVUPSZ256rm:
545 case X86::VMOVUPSZ128rm_NOVLX:
546 case X86::VMOVUPSZ256rm_NOVLX:
547 case X86::VMOVUPSZrm: {
555 if (BaseReg == 0 || BaseReg == X86::RIP)
601 for (
unsigned i = 0; Iter != E && i < 4; ++i) {
602 bool SeenDef =
false;
603 for (
unsigned j = 0, e = Iter->getNumOperands(); j != e; ++j) {
609 if (MO.
getReg() == X86::EFLAGS) {
621 while (Iter != E && Iter->isDebugInstr())
629 if (S->isLiveIn(X86::EFLAGS))
636 for (
unsigned i = 0; i < 4; ++i) {
644 while (Iter != B && Iter->isDebugInstr())
647 bool SawKill =
false;
648 for (
unsigned j = 0, e = Iter->getNumOperands(); j != e; ++j) {
656 if (MO.
isKill()) SawKill =
true;
672 unsigned DestReg,
unsigned SubIdx,
675 bool ClobbersEFLAGS =
false;
677 if (MO.isReg() && MO.isDef() && MO.getReg() == X86::EFLAGS) {
678 ClobbersEFLAGS =
true;
688 case X86::MOV32r0: Value = 0;
break;
689 case X86::MOV32r1: Value = 1;
break;
690 case X86::MOV32r_1: Value = -1;
break;
696 BuildMI(MBB, I, DL,
get(X86::MOV32ri))
722 unsigned ShiftAmtOperandIdx) {
726 return Imm & ShiftCountMask;
737 return ShAmt < 4 && ShAmt > 0;
741 unsigned Opc,
bool AllowSP,
unsigned &NewSrc,
747 RC = Opc != X86::LEA32r ? &X86::GR64RegClass : &X86::GR32RegClass;
749 RC = Opc != X86::LEA32r ?
750 &X86::GR64_NOSPRegClass : &X86::GR32_NOSPRegClass;
752 unsigned SrcReg = Src.
getReg();
756 if (Opc != X86::LEA64_32r) {
759 assert(!Src.
isUndef() &&
"Undef op doesn't need optimization");
776 assert(!Src.
isUndef() &&
"Undef op doesn't need optimization");
797 MachineInstr *X86InstrInfo::convertToThreeAddressWithLEA(
801 bool Is16BitOp = !(MIOpc == X86::ADD8rr || MIOpc == X86::ADD8ri);
805 "Unexpected type for LEA transform");
817 unsigned Opcode = X86::LEA64_32r;
833 unsigned SubReg = Is16BitOp ? X86::sub_16bit : X86::sub_8bit;
860 case X86::ADD16ri_DB:
861 case X86::ADD16ri8_DB:
866 case X86::ADD16rr_DB: {
870 unsigned InRegLEA2 = 0;
875 addRegReg(MIB, InRegLEA,
true, InRegLEA,
false);
887 addRegReg(MIB, InRegLEA,
true, InRegLEA2,
true);
889 if (LV && IsKill2 && InsMI2)
949 bool Is64Bit = Subtarget.
is64Bit();
953 default:
return nullptr;
962 &X86::GR64_NOSPRegClass))
979 unsigned Opc = Is64Bit ? X86::LEA64_32r : X86::LEA32r;
986 SrcReg, isKill, ImplicitOp, LV))
997 if (ImplicitOp.
getReg() != 0)
1003 case X86::SHL16ri: {
1008 return convertToThreeAddressWithLEA(MIOpc, MFI, MI, LV);
1013 unsigned Opc = MIOpc == X86::INC64r ? X86::LEA64r :
1014 (Is64Bit ? X86::LEA64_32r : X86::LEA32r);
1026 if (ImplicitOp.
getReg() != 0)
1027 MIB.
add(ImplicitOp);
1033 return convertToThreeAddressWithLEA(MIOpc, MFI, MI, LV);
1037 unsigned Opc = MIOpc == X86::DEC64r ? X86::LEA64r
1038 : (Is64Bit ? X86::LEA64_32r : X86::LEA32r);
1050 if (ImplicitOp.
getReg() != 0)
1051 MIB.
add(ImplicitOp);
1058 return convertToThreeAddressWithLEA(MIOpc, MFI, MI, LV);
1060 case X86::ADD64rr_DB:
1062 case X86::ADD32rr_DB: {
1065 if (MIOpc == X86::ADD64rr || MIOpc == X86::ADD64rr_DB)
1068 Opc = Is64Bit ? X86::LEA64_32r : X86::LEA32r;
1074 SrcReg, isKill, ImplicitOp, LV))
1082 SrcReg2, isKill2, ImplicitOp2, LV))
1086 if (ImplicitOp.
getReg() != 0)
1087 MIB.
add(ImplicitOp);
1088 if (ImplicitOp2.
getReg() != 0)
1089 MIB.
add(ImplicitOp2);
1091 NewMI =
addRegReg(MIB, SrcReg, isKill, SrcReg2, isKill2);
1098 case X86::ADD16rr_DB:
1099 return convertToThreeAddressWithLEA(MIOpc, MFI, MI, LV);
1100 case X86::ADD64ri32:
1102 case X86::ADD64ri32_DB:
1103 case X86::ADD64ri8_DB:
1111 case X86::ADD32ri_DB:
1112 case X86::ADD32ri8_DB: {
1114 unsigned Opc = Is64Bit ? X86::LEA64_32r : X86::LEA32r;
1120 SrcReg, isKill, ImplicitOp, LV))
1126 if (ImplicitOp.
getReg() != 0)
1127 MIB.
add(ImplicitOp);
1135 case X86::ADD16ri_DB:
1136 case X86::ADD16ri8_DB:
1137 return convertToThreeAddressWithLEA(MIOpc, MFI, MI, LV);
1138 case X86::VMOVDQU8Z128rmk:
1139 case X86::VMOVDQU8Z256rmk:
1140 case X86::VMOVDQU8Zrmk:
1141 case X86::VMOVDQU16Z128rmk:
1142 case X86::VMOVDQU16Z256rmk:
1143 case X86::VMOVDQU16Zrmk:
1144 case X86::VMOVDQU32Z128rmk:
case X86::VMOVDQA32Z128rmk:
1145 case X86::VMOVDQU32Z256rmk:
case X86::VMOVDQA32Z256rmk:
1146 case X86::VMOVDQU32Zrmk:
case X86::VMOVDQA32Zrmk:
1147 case X86::VMOVDQU64Z128rmk:
case X86::VMOVDQA64Z128rmk:
1148 case X86::VMOVDQU64Z256rmk:
case X86::VMOVDQA64Z256rmk:
1149 case X86::VMOVDQU64Zrmk:
case X86::VMOVDQA64Zrmk:
1150 case X86::VMOVUPDZ128rmk:
case X86::VMOVAPDZ128rmk:
1151 case X86::VMOVUPDZ256rmk:
case X86::VMOVAPDZ256rmk:
1152 case X86::VMOVUPDZrmk:
case X86::VMOVAPDZrmk:
1153 case X86::VMOVUPSZ128rmk:
case X86::VMOVAPSZ128rmk:
1154 case X86::VMOVUPSZ256rmk:
case X86::VMOVAPSZ256rmk:
1155 case X86::VMOVUPSZrmk:
case X86::VMOVAPSZrmk: {
1159 case X86::VMOVDQU8Z128rmk: Opc = X86::VPBLENDMBZ128rmk;
break;
1160 case X86::VMOVDQU8Z256rmk: Opc = X86::VPBLENDMBZ256rmk;
break;
1161 case X86::VMOVDQU8Zrmk: Opc = X86::VPBLENDMBZrmk;
break;
1162 case X86::VMOVDQU16Z128rmk: Opc = X86::VPBLENDMWZ128rmk;
break;
1163 case X86::VMOVDQU16Z256rmk: Opc = X86::VPBLENDMWZ256rmk;
break;
1164 case X86::VMOVDQU16Zrmk: Opc = X86::VPBLENDMWZrmk;
break;
1165 case X86::VMOVDQU32Z128rmk: Opc = X86::VPBLENDMDZ128rmk;
break;
1166 case X86::VMOVDQU32Z256rmk: Opc = X86::VPBLENDMDZ256rmk;
break;
1167 case X86::VMOVDQU32Zrmk: Opc = X86::VPBLENDMDZrmk;
break;
1168 case X86::VMOVDQU64Z128rmk: Opc = X86::VPBLENDMQZ128rmk;
break;
1169 case X86::VMOVDQU64Z256rmk: Opc = X86::VPBLENDMQZ256rmk;
break;
1170 case X86::VMOVDQU64Zrmk: Opc = X86::VPBLENDMQZrmk;
break;
1171 case X86::VMOVUPDZ128rmk: Opc = X86::VBLENDMPDZ128rmk;
break;
1172 case X86::VMOVUPDZ256rmk: Opc = X86::VBLENDMPDZ256rmk;
break;
1173 case X86::VMOVUPDZrmk: Opc = X86::VBLENDMPDZrmk;
break;
1174 case X86::VMOVUPSZ128rmk: Opc = X86::VBLENDMPSZ128rmk;
break;
1175 case X86::VMOVUPSZ256rmk: Opc = X86::VBLENDMPSZ256rmk;
break;
1176 case X86::VMOVUPSZrmk: Opc = X86::VBLENDMPSZrmk;
break;
1177 case X86::VMOVDQA32Z128rmk: Opc = X86::VPBLENDMDZ128rmk;
break;
1178 case X86::VMOVDQA32Z256rmk: Opc = X86::VPBLENDMDZ256rmk;
break;
1179 case X86::VMOVDQA32Zrmk: Opc = X86::VPBLENDMDZrmk;
break;
1180 case X86::VMOVDQA64Z128rmk: Opc = X86::VPBLENDMQZ128rmk;
break;
1181 case X86::VMOVDQA64Z256rmk: Opc = X86::VPBLENDMQZ256rmk;
break;
1182 case X86::VMOVDQA64Zrmk: Opc = X86::VPBLENDMQZrmk;
break;
1183 case X86::VMOVAPDZ128rmk: Opc = X86::VBLENDMPDZ128rmk;
break;
1184 case X86::VMOVAPDZ256rmk: Opc = X86::VBLENDMPDZ256rmk;
break;
1185 case X86::VMOVAPDZrmk: Opc = X86::VBLENDMPDZrmk;
break;
1186 case X86::VMOVAPSZ128rmk: Opc = X86::VBLENDMPSZ128rmk;
break;
1187 case X86::VMOVAPSZ256rmk: Opc = X86::VBLENDMPSZ256rmk;
break;
1188 case X86::VMOVAPSZrmk: Opc = X86::VBLENDMPSZrmk;
break;
1202 case X86::VMOVDQU8Z128rrk:
1203 case X86::VMOVDQU8Z256rrk:
1204 case X86::VMOVDQU8Zrrk:
1205 case X86::VMOVDQU16Z128rrk:
1206 case X86::VMOVDQU16Z256rrk:
1207 case X86::VMOVDQU16Zrrk:
1208 case X86::VMOVDQU32Z128rrk:
case X86::VMOVDQA32Z128rrk:
1209 case X86::VMOVDQU32Z256rrk:
case X86::VMOVDQA32Z256rrk:
1210 case X86::VMOVDQU32Zrrk:
case X86::VMOVDQA32Zrrk:
1211 case X86::VMOVDQU64Z128rrk:
case X86::VMOVDQA64Z128rrk:
1212 case X86::VMOVDQU64Z256rrk:
case X86::VMOVDQA64Z256rrk:
1213 case X86::VMOVDQU64Zrrk:
case X86::VMOVDQA64Zrrk:
1214 case X86::VMOVUPDZ128rrk:
case X86::VMOVAPDZ128rrk:
1215 case X86::VMOVUPDZ256rrk:
case X86::VMOVAPDZ256rrk:
1216 case X86::VMOVUPDZrrk:
case X86::VMOVAPDZrrk:
1217 case X86::VMOVUPSZ128rrk:
case X86::VMOVAPSZ128rrk:
1218 case X86::VMOVUPSZ256rrk:
case X86::VMOVAPSZ256rrk:
1219 case X86::VMOVUPSZrrk:
case X86::VMOVAPSZrrk: {
1223 case X86::VMOVDQU8Z128rrk: Opc = X86::VPBLENDMBZ128rrk;
break;
1224 case X86::VMOVDQU8Z256rrk: Opc = X86::VPBLENDMBZ256rrk;
break;
1225 case X86::VMOVDQU8Zrrk: Opc = X86::VPBLENDMBZrrk;
break;
1226 case X86::VMOVDQU16Z128rrk: Opc = X86::VPBLENDMWZ128rrk;
break;
1227 case X86::VMOVDQU16Z256rrk: Opc = X86::VPBLENDMWZ256rrk;
break;
1228 case X86::VMOVDQU16Zrrk: Opc = X86::VPBLENDMWZrrk;
break;
1229 case X86::VMOVDQU32Z128rrk: Opc = X86::VPBLENDMDZ128rrk;
break;
1230 case X86::VMOVDQU32Z256rrk: Opc = X86::VPBLENDMDZ256rrk;
break;
1231 case X86::VMOVDQU32Zrrk: Opc = X86::VPBLENDMDZrrk;
break;
1232 case X86::VMOVDQU64Z128rrk: Opc = X86::VPBLENDMQZ128rrk;
break;
1233 case X86::VMOVDQU64Z256rrk: Opc = X86::VPBLENDMQZ256rrk;
break;
1234 case X86::VMOVDQU64Zrrk: Opc = X86::VPBLENDMQZrrk;
break;
1235 case X86::VMOVUPDZ128rrk: Opc = X86::VBLENDMPDZ128rrk;
break;
1236 case X86::VMOVUPDZ256rrk: Opc = X86::VBLENDMPDZ256rrk;
break;
1237 case X86::VMOVUPDZrrk: Opc = X86::VBLENDMPDZrrk;
break;
1238 case X86::VMOVUPSZ128rrk: Opc = X86::VBLENDMPSZ128rrk;
break;
1239 case X86::VMOVUPSZ256rrk: Opc = X86::VBLENDMPSZ256rrk;
break;
1240 case X86::VMOVUPSZrrk: Opc = X86::VBLENDMPSZrrk;
break;
1241 case X86::VMOVDQA32Z128rrk: Opc = X86::VPBLENDMDZ128rrk;
break;
1242 case X86::VMOVDQA32Z256rrk: Opc = X86::VPBLENDMDZ256rrk;
break;
1243 case X86::VMOVDQA32Zrrk: Opc = X86::VPBLENDMDZrrk;
break;
1244 case X86::VMOVDQA64Z128rrk: Opc = X86::VPBLENDMQZ128rrk;
break;
1245 case X86::VMOVDQA64Z256rrk: Opc = X86::VPBLENDMQZ256rrk;
break;
1246 case X86::VMOVDQA64Zrrk: Opc = X86::VPBLENDMQZrrk;
break;
1247 case X86::VMOVAPDZ128rrk: Opc = X86::VBLENDMPDZ128rrk;
break;
1248 case X86::VMOVAPDZ256rrk: Opc = X86::VBLENDMPDZ256rrk;
break;
1249 case X86::VMOVAPDZrrk: Opc = X86::VBLENDMPDZrrk;
break;
1250 case X86::VMOVAPSZ128rrk: Opc = X86::VBLENDMPSZ128rrk;
break;
1251 case X86::VMOVAPSZ256rrk: Opc = X86::VBLENDMPSZ256rrk;
break;
1252 case X86::VMOVAPSZrrk: Opc = X86::VBLENDMPSZrrk;
break;
1264 if (!NewMI)
return nullptr;
1285 unsigned SrcOpIdx2) {
1287 if (SrcOpIdx1 > SrcOpIdx2)
1290 unsigned Op1 = 1, Op2 = 2, Op3 = 3;
1296 if (SrcOpIdx1 == Op1 && SrcOpIdx2 == Op2)
1298 if (SrcOpIdx1 == Op1 && SrcOpIdx2 == Op3)
1300 if (SrcOpIdx1 == Op2 && SrcOpIdx2 == Op3)
1306 const MachineInstr &MI,
unsigned SrcOpIdx1,
unsigned SrcOpIdx2,
1318 "Intrinsic instructions can't commute operand 1");
1323 assert(Case < 3 &&
"Unexpected case number!");
1328 const unsigned Form132Index = 0;
1329 const unsigned Form213Index = 1;
1330 const unsigned Form231Index = 2;
1331 static const unsigned FormMapping[][3] = {
1336 { Form231Index, Form213Index, Form132Index },
1341 { Form132Index, Form231Index, Form213Index },
1346 { Form213Index, Form132Index, Form231Index }
1349 unsigned FMAForms[3];
1354 for (FormIndex = 0; FormIndex < 3; FormIndex++)
1355 if (Opc == FMAForms[FormIndex])
1359 FormIndex = FormMapping[Case][FormIndex];
1360 return FMAForms[FormIndex];
1364 unsigned SrcOpIdx2) {
1368 assert(Case < 3 &&
"Unexpected case value!");
1371 static const uint8_t SwapMasks[3][4] = {
1372 { 0x04, 0x10, 0x08, 0x20 },
1373 { 0x02, 0x10, 0x08, 0x40 },
1374 { 0x02, 0x04, 0x20, 0x40 },
1379 uint8_t NewImm = Imm & ~(SwapMasks[Case][0] | SwapMasks[Case][1] |
1380 SwapMasks[Case][2] | SwapMasks[Case][3]);
1382 if (Imm & SwapMasks[Case][0]) NewImm |= SwapMasks[Case][1];
1383 if (Imm & SwapMasks[Case][1]) NewImm |= SwapMasks[Case][0];
1384 if (Imm & SwapMasks[Case][2]) NewImm |= SwapMasks[Case][3];
1385 if (Imm & SwapMasks[Case][3]) NewImm |= SwapMasks[Case][2];
1392 #define VPERM_CASES(Suffix) \ 1393 case X86::VPERMI2##Suffix##128rr: case X86::VPERMT2##Suffix##128rr: \ 1394 case X86::VPERMI2##Suffix##256rr: case X86::VPERMT2##Suffix##256rr: \ 1395 case X86::VPERMI2##Suffix##rr: case X86::VPERMT2##Suffix##rr: \ 1396 case X86::VPERMI2##Suffix##128rm: case X86::VPERMT2##Suffix##128rm: \ 1397 case X86::VPERMI2##Suffix##256rm: case X86::VPERMT2##Suffix##256rm: \ 1398 case X86::VPERMI2##Suffix##rm: case X86::VPERMT2##Suffix##rm: \ 1399 case X86::VPERMI2##Suffix##128rrkz: case X86::VPERMT2##Suffix##128rrkz: \ 1400 case X86::VPERMI2##Suffix##256rrkz: case X86::VPERMT2##Suffix##256rrkz: \ 1401 case X86::VPERMI2##Suffix##rrkz: case X86::VPERMT2##Suffix##rrkz: \ 1402 case X86::VPERMI2##Suffix##128rmkz: case X86::VPERMT2##Suffix##128rmkz: \ 1403 case X86::VPERMI2##Suffix##256rmkz: case X86::VPERMT2##Suffix##256rmkz: \ 1404 case X86::VPERMI2##Suffix##rmkz: case X86::VPERMT2##Suffix##rmkz: 1406 #define VPERM_CASES_BROADCAST(Suffix) \ 1407 VPERM_CASES(Suffix) \ 1408 case X86::VPERMI2##Suffix##128rmb: case X86::VPERMT2##Suffix##128rmb: \ 1409 case X86::VPERMI2##Suffix##256rmb: case X86::VPERMT2##Suffix##256rmb: \ 1410 case X86::VPERMI2##Suffix##rmb: case X86::VPERMT2##Suffix##rmb: \ 1411 case X86::VPERMI2##Suffix##128rmbkz: case X86::VPERMT2##Suffix##128rmbkz: \ 1412 case X86::VPERMI2##Suffix##256rmbkz: case X86::VPERMT2##Suffix##256rmbkz: \ 1413 case X86::VPERMI2##Suffix##rmbkz: case X86::VPERMT2##Suffix##rmbkz: 1416 default:
return false;
1425 #undef VPERM_CASES_BROADCAST 1432 #define VPERM_CASES(Orig, New) \ 1433 case X86::Orig##128rr: return X86::New##128rr; \ 1434 case X86::Orig##128rrkz: return X86::New##128rrkz; \ 1435 case X86::Orig##128rm: return X86::New##128rm; \ 1436 case X86::Orig##128rmkz: return X86::New##128rmkz; \ 1437 case X86::Orig##256rr: return X86::New##256rr; \ 1438 case X86::Orig##256rrkz: return X86::New##256rrkz; \ 1439 case X86::Orig##256rm: return X86::New##256rm; \ 1440 case X86::Orig##256rmkz: return X86::New##256rmkz; \ 1441 case X86::Orig##rr: return X86::New##rr; \ 1442 case X86::Orig##rrkz: return X86::New##rrkz; \ 1443 case X86::Orig##rm: return X86::New##rm; \ 1444 case X86::Orig##rmkz: return X86::New##rmkz; 1446 #define VPERM_CASES_BROADCAST(Orig, New) \ 1447 VPERM_CASES(Orig, New) \ 1448 case X86::Orig##128rmb: return X86::New##128rmb; \ 1449 case X86::Orig##128rmbkz: return X86::New##128rmbkz; \ 1450 case X86::Orig##256rmb: return X86::New##256rmb; \ 1451 case X86::Orig##256rmbkz: return X86::New##256rmbkz; \ 1452 case X86::Orig##rmb: return X86::New##rmb; \ 1453 case X86::Orig##rmbkz: return X86::New##rmbkz; 1471 #undef VPERM_CASES_BROADCAST 1477 unsigned OpIdx2)
const {
1485 case X86::SHRD16rri8:
1486 case X86::SHLD16rri8:
1487 case X86::SHRD32rri8:
1488 case X86::SHLD32rri8:
1489 case X86::SHRD64rri8:
1490 case X86::SHLD64rri8:{
1495 case X86::SHRD16rri8: Size = 16; Opc = X86::SHLD16rri8;
break;
1496 case X86::SHLD16rri8: Size = 16; Opc = X86::SHRD16rri8;
break;
1497 case X86::SHRD32rri8: Size = 32; Opc = X86::SHLD32rri8;
break;
1498 case X86::SHLD32rri8: Size = 32; Opc = X86::SHRD32rri8;
break;
1499 case X86::SHRD64rri8: Size = 64; Opc = X86::SHLD64rri8;
break;
1500 case X86::SHLD64rri8: Size = 64; Opc = X86::SHRD64rri8;
break;
1503 auto &WorkingMI = cloneIfNew(MI);
1504 WorkingMI.setDesc(
get(Opc));
1505 WorkingMI.getOperand(3).setImm(Size - Amt);
1510 case X86::PFSUBRrr: {
1514 (X86::PFSUBRrr == MI.
getOpcode() ? X86::PFSUBrr : X86::PFSUBRrr);
1515 auto &WorkingMI = cloneIfNew(MI);
1516 WorkingMI.setDesc(
get(Opc));
1520 case X86::BLENDPDrri:
1521 case X86::BLENDPSrri:
1522 case X86::VBLENDPDrri:
1523 case X86::VBLENDPSrri:
1529 case X86::BLENDPDrri: Opc = X86::MOVSDrr; Mask = 0x03;
break;
1530 case X86::BLENDPSrri: Opc = X86::MOVSSrr; Mask = 0x0F;
break;
1531 case X86::VBLENDPDrri: Opc = X86::VMOVSDrr; Mask = 0x03;
break;
1532 case X86::VBLENDPSrri: Opc = X86::VMOVSSrr; Mask = 0x0F;
break;
1535 auto &WorkingMI = cloneIfNew(MI);
1536 WorkingMI.setDesc(
get(Opc));
1537 WorkingMI.RemoveOperand(3);
1544 case X86::PBLENDWrri:
1545 case X86::VBLENDPDYrri:
1546 case X86::VBLENDPSYrri:
1547 case X86::VPBLENDDrri:
1548 case X86::VPBLENDWrri:
1549 case X86::VPBLENDDYrri:
1550 case X86::VPBLENDWYrri:{
1554 case X86::BLENDPDrri: Mask = 0x03;
break;
1555 case X86::BLENDPSrri: Mask = 0x0F;
break;
1556 case X86::PBLENDWrri: Mask = 0xFF;
break;
1557 case X86::VBLENDPDrri: Mask = 0x03;
break;
1558 case X86::VBLENDPSrri: Mask = 0x0F;
break;
1559 case X86::VBLENDPDYrri: Mask = 0x0F;
break;
1560 case X86::VBLENDPSYrri: Mask = 0xFF;
break;
1561 case X86::VPBLENDDrri: Mask = 0x0F;
break;
1562 case X86::VPBLENDWrri: Mask = 0xFF;
break;
1563 case X86::VPBLENDDYrri: Mask = 0xFF;
break;
1564 case X86::VPBLENDWYrri: Mask = 0xFF;
break;
1568 auto &WorkingMI = cloneIfNew(MI);
1569 WorkingMI.getOperand(3).setImm(Mask ^ Imm);
1576 case X86::VMOVSSrr:{
1578 assert(Subtarget.
hasSSE41() &&
"Commuting MOVSD/MOVSS requires SSE41!");
1583 case X86::MOVSDrr: Opc = X86::BLENDPDrri; Mask = 0x02;
break;
1584 case X86::MOVSSrr: Opc = X86::BLENDPSrri; Mask = 0x0E;
break;
1585 case X86::VMOVSDrr: Opc = X86::VBLENDPDrri; Mask = 0x02;
break;
1586 case X86::VMOVSSrr: Opc = X86::VBLENDPSrri; Mask = 0x0E;
break;
1589 auto &WorkingMI = cloneIfNew(MI);
1590 WorkingMI.setDesc(
get(Opc));
1595 case X86::PCLMULQDQrr:
1596 case X86::VPCLMULQDQrr:
1597 case X86::VPCLMULQDQYrr:
1598 case X86::VPCLMULQDQZrr:
1599 case X86::VPCLMULQDQZ128rr:
1600 case X86::VPCLMULQDQZ256rr: {
1604 unsigned Src1Hi = Imm & 0x01;
1605 unsigned Src2Hi = Imm & 0x10;
1606 auto &WorkingMI = cloneIfNew(MI);
1607 WorkingMI.getOperand(3).setImm((Src1Hi << 4) | (Src2Hi >> 4));
1611 case X86::VPCMPBZ128rri:
case X86::VPCMPUBZ128rri:
1612 case X86::VPCMPBZ256rri:
case X86::VPCMPUBZ256rri:
1613 case X86::VPCMPBZrri:
case X86::VPCMPUBZrri:
1614 case X86::VPCMPDZ128rri:
case X86::VPCMPUDZ128rri:
1615 case X86::VPCMPDZ256rri:
case X86::VPCMPUDZ256rri:
1616 case X86::VPCMPDZrri:
case X86::VPCMPUDZrri:
1617 case X86::VPCMPQZ128rri:
case X86::VPCMPUQZ128rri:
1618 case X86::VPCMPQZ256rri:
case X86::VPCMPUQZ256rri:
1619 case X86::VPCMPQZrri:
case X86::VPCMPUQZrri:
1620 case X86::VPCMPWZ128rri:
case X86::VPCMPUWZ128rri:
1621 case X86::VPCMPWZ256rri:
case X86::VPCMPUWZ256rri:
1622 case X86::VPCMPWZrri:
case X86::VPCMPUWZrri:
1623 case X86::VPCMPBZ128rrik:
case X86::VPCMPUBZ128rrik:
1624 case X86::VPCMPBZ256rrik:
case X86::VPCMPUBZ256rrik:
1625 case X86::VPCMPBZrrik:
case X86::VPCMPUBZrrik:
1626 case X86::VPCMPDZ128rrik:
case X86::VPCMPUDZ128rrik:
1627 case X86::VPCMPDZ256rrik:
case X86::VPCMPUDZ256rrik:
1628 case X86::VPCMPDZrrik:
case X86::VPCMPUDZrrik:
1629 case X86::VPCMPQZ128rrik:
case X86::VPCMPUQZ128rrik:
1630 case X86::VPCMPQZ256rrik:
case X86::VPCMPUQZ256rrik:
1631 case X86::VPCMPQZrrik:
case X86::VPCMPUQZrrik:
1632 case X86::VPCMPWZ128rrik:
case X86::VPCMPUWZ128rrik:
1633 case X86::VPCMPWZ256rrik:
case X86::VPCMPUWZ256rrik:
1634 case X86::VPCMPWZrrik:
case X86::VPCMPUWZrrik: {
1638 auto &WorkingMI = cloneIfNew(MI);
1643 case X86::VPCOMBri:
case X86::VPCOMUBri:
1644 case X86::VPCOMDri:
case X86::VPCOMUDri:
1645 case X86::VPCOMQri:
case X86::VPCOMUQri:
1646 case X86::VPCOMWri:
case X86::VPCOMUWri: {
1650 auto &WorkingMI = cloneIfNew(MI);
1651 WorkingMI.getOperand(3).setImm(Imm);
1655 case X86::VPERM2F128rr:
1656 case X86::VPERM2I128rr: {
1661 auto &WorkingMI = cloneIfNew(MI);
1662 WorkingMI.getOperand(3).setImm(Imm ^ 0x22);
1666 case X86::MOVHLPSrr:
1667 case X86::UNPCKHPDrr:
1668 case X86::VMOVHLPSrr:
1669 case X86::VUNPCKHPDrr:
1670 case X86::VMOVHLPSZrr:
1671 case X86::VUNPCKHPDZ128rr: {
1672 assert(Subtarget.
hasSSE2() &&
"Commuting MOVHLP/UNPCKHPD requires SSE2!");
1677 case X86::MOVHLPSrr: Opc = X86::UNPCKHPDrr;
break;
1678 case X86::UNPCKHPDrr: Opc = X86::MOVHLPSrr;
break;
1679 case X86::VMOVHLPSrr: Opc = X86::VUNPCKHPDrr;
break;
1680 case X86::VUNPCKHPDrr: Opc = X86::VMOVHLPSrr;
break;
1681 case X86::VMOVHLPSZrr: Opc = X86::VUNPCKHPDZ128rr;
break;
1682 case X86::VUNPCKHPDZ128rr: Opc = X86::VMOVHLPSZrr;
break;
1684 auto &WorkingMI = cloneIfNew(MI);
1685 WorkingMI.setDesc(
get(Opc));
1689 case X86::CMOVB16rr:
case X86::CMOVB32rr:
case X86::CMOVB64rr:
1690 case X86::CMOVAE16rr:
case X86::CMOVAE32rr:
case X86::CMOVAE64rr:
1691 case X86::CMOVE16rr:
case X86::CMOVE32rr:
case X86::CMOVE64rr:
1692 case X86::CMOVNE16rr:
case X86::CMOVNE32rr:
case X86::CMOVNE64rr:
1693 case X86::CMOVBE16rr:
case X86::CMOVBE32rr:
case X86::CMOVBE64rr:
1694 case X86::CMOVA16rr:
case X86::CMOVA32rr:
case X86::CMOVA64rr:
1695 case X86::CMOVL16rr:
case X86::CMOVL32rr:
case X86::CMOVL64rr:
1696 case X86::CMOVGE16rr:
case X86::CMOVGE32rr:
case X86::CMOVGE64rr:
1697 case X86::CMOVLE16rr:
case X86::CMOVLE32rr:
case X86::CMOVLE64rr:
1698 case X86::CMOVG16rr:
case X86::CMOVG32rr:
case X86::CMOVG64rr:
1699 case X86::CMOVS16rr:
case X86::CMOVS32rr:
case X86::CMOVS64rr:
1700 case X86::CMOVNS16rr:
case X86::CMOVNS32rr:
case X86::CMOVNS64rr:
1701 case X86::CMOVP16rr:
case X86::CMOVP32rr:
case X86::CMOVP64rr:
1702 case X86::CMOVNP16rr:
case X86::CMOVNP32rr:
case X86::CMOVNP64rr:
1703 case X86::CMOVO16rr:
case X86::CMOVO32rr:
case X86::CMOVO64rr:
1704 case X86::CMOVNO16rr:
case X86::CMOVNO32rr:
case X86::CMOVNO64rr: {
1708 case X86::CMOVB16rr: Opc = X86::CMOVAE16rr;
break;
1709 case X86::CMOVB32rr: Opc = X86::CMOVAE32rr;
break;
1710 case X86::CMOVB64rr: Opc = X86::CMOVAE64rr;
break;
1711 case X86::CMOVAE16rr: Opc = X86::CMOVB16rr;
break;
1712 case X86::CMOVAE32rr: Opc = X86::CMOVB32rr;
break;
1713 case X86::CMOVAE64rr: Opc = X86::CMOVB64rr;
break;
1714 case X86::CMOVE16rr: Opc = X86::CMOVNE16rr;
break;
1715 case X86::CMOVE32rr: Opc = X86::CMOVNE32rr;
break;
1716 case X86::CMOVE64rr: Opc = X86::CMOVNE64rr;
break;
1717 case X86::CMOVNE16rr: Opc = X86::CMOVE16rr;
break;
1718 case X86::CMOVNE32rr: Opc = X86::CMOVE32rr;
break;
1719 case X86::CMOVNE64rr: Opc = X86::CMOVE64rr;
break;
1720 case X86::CMOVBE16rr: Opc = X86::CMOVA16rr;
break;
1721 case X86::CMOVBE32rr: Opc = X86::CMOVA32rr;
break;
1722 case X86::CMOVBE64rr: Opc = X86::CMOVA64rr;
break;
1723 case X86::CMOVA16rr: Opc = X86::CMOVBE16rr;
break;
1724 case X86::CMOVA32rr: Opc = X86::CMOVBE32rr;
break;
1725 case X86::CMOVA64rr: Opc = X86::CMOVBE64rr;
break;
1726 case X86::CMOVL16rr: Opc = X86::CMOVGE16rr;
break;
1727 case X86::CMOVL32rr: Opc = X86::CMOVGE32rr;
break;
1728 case X86::CMOVL64rr: Opc = X86::CMOVGE64rr;
break;
1729 case X86::CMOVGE16rr: Opc = X86::CMOVL16rr;
break;
1730 case X86::CMOVGE32rr: Opc = X86::CMOVL32rr;
break;
1731 case X86::CMOVGE64rr: Opc = X86::CMOVL64rr;
break;
1732 case X86::CMOVLE16rr: Opc = X86::CMOVG16rr;
break;
1733 case X86::CMOVLE32rr: Opc = X86::CMOVG32rr;
break;
1734 case X86::CMOVLE64rr: Opc = X86::CMOVG64rr;
break;
1735 case X86::CMOVG16rr: Opc = X86::CMOVLE16rr;
break;
1736 case X86::CMOVG32rr: Opc = X86::CMOVLE32rr;
break;
1737 case X86::CMOVG64rr: Opc = X86::CMOVLE64rr;
break;
1738 case X86::CMOVS16rr: Opc = X86::CMOVNS16rr;
break;
1739 case X86::CMOVS32rr: Opc = X86::CMOVNS32rr;
break;
1740 case X86::CMOVS64rr: Opc = X86::CMOVNS64rr;
break;
1741 case X86::CMOVNS16rr: Opc = X86::CMOVS16rr;
break;
1742 case X86::CMOVNS32rr: Opc = X86::CMOVS32rr;
break;
1743 case X86::CMOVNS64rr: Opc = X86::CMOVS64rr;
break;
1744 case X86::CMOVP16rr: Opc = X86::CMOVNP16rr;
break;
1745 case X86::CMOVP32rr: Opc = X86::CMOVNP32rr;
break;
1746 case X86::CMOVP64rr: Opc = X86::CMOVNP64rr;
break;
1747 case X86::CMOVNP16rr: Opc = X86::CMOVP16rr;
break;
1748 case X86::CMOVNP32rr: Opc = X86::CMOVP32rr;
break;
1749 case X86::CMOVNP64rr: Opc = X86::CMOVP64rr;
break;
1750 case X86::CMOVO16rr: Opc = X86::CMOVNO16rr;
break;
1751 case X86::CMOVO32rr: Opc = X86::CMOVNO32rr;
break;
1752 case X86::CMOVO64rr: Opc = X86::CMOVNO64rr;
break;
1753 case X86::CMOVNO16rr: Opc = X86::CMOVO16rr;
break;
1754 case X86::CMOVNO32rr: Opc = X86::CMOVO32rr;
break;
1755 case X86::CMOVNO64rr: Opc = X86::CMOVO64rr;
break;
1757 auto &WorkingMI = cloneIfNew(MI);
1758 WorkingMI.setDesc(
get(Opc));
1762 case X86::VPTERNLOGDZrri:
case X86::VPTERNLOGDZrmi:
1763 case X86::VPTERNLOGDZ128rri:
case X86::VPTERNLOGDZ128rmi:
1764 case X86::VPTERNLOGDZ256rri:
case X86::VPTERNLOGDZ256rmi:
1765 case X86::VPTERNLOGQZrri:
case X86::VPTERNLOGQZrmi:
1766 case X86::VPTERNLOGQZ128rri:
case X86::VPTERNLOGQZ128rmi:
1767 case X86::VPTERNLOGQZ256rri:
case X86::VPTERNLOGQZ256rmi:
1768 case X86::VPTERNLOGDZrrik:
1769 case X86::VPTERNLOGDZ128rrik:
1770 case X86::VPTERNLOGDZ256rrik:
1771 case X86::VPTERNLOGQZrrik:
1772 case X86::VPTERNLOGQZ128rrik:
1773 case X86::VPTERNLOGQZ256rrik:
1774 case X86::VPTERNLOGDZrrikz:
case X86::VPTERNLOGDZrmikz:
1775 case X86::VPTERNLOGDZ128rrikz:
case X86::VPTERNLOGDZ128rmikz:
1776 case X86::VPTERNLOGDZ256rrikz:
case X86::VPTERNLOGDZ256rmikz:
1777 case X86::VPTERNLOGQZrrikz:
case X86::VPTERNLOGQZrmikz:
1778 case X86::VPTERNLOGQZ128rrikz:
case X86::VPTERNLOGQZ128rmikz:
1779 case X86::VPTERNLOGQZ256rrikz:
case X86::VPTERNLOGQZ256rmikz:
1780 case X86::VPTERNLOGDZ128rmbi:
1781 case X86::VPTERNLOGDZ256rmbi:
1782 case X86::VPTERNLOGDZrmbi:
1783 case X86::VPTERNLOGQZ128rmbi:
1784 case X86::VPTERNLOGQZ256rmbi:
1785 case X86::VPTERNLOGQZrmbi:
1786 case X86::VPTERNLOGDZ128rmbikz:
1787 case X86::VPTERNLOGDZ256rmbikz:
1788 case X86::VPTERNLOGDZrmbikz:
1789 case X86::VPTERNLOGQZ128rmbikz:
1790 case X86::VPTERNLOGQZ256rmbikz:
1791 case X86::VPTERNLOGQZrmbikz: {
1792 auto &WorkingMI = cloneIfNew(MI);
1800 auto &WorkingMI = cloneIfNew(MI);
1801 WorkingMI.setDesc(
get(Opc));
1811 auto &WorkingMI = cloneIfNew(MI);
1812 WorkingMI.setDesc(
get(Opc));
1823 X86InstrInfo::findThreeSrcCommutedOpIndices(
const MachineInstr &MI,
1824 unsigned &SrcOpIdx1,
1825 unsigned &SrcOpIdx2,
1826 bool IsIntrinsic)
const {
1829 unsigned FirstCommutableVecOp = 1;
1830 unsigned LastCommutableVecOp = 3;
1831 unsigned KMaskOp = -1U;
1854 FirstCommutableVecOp = 3;
1856 LastCommutableVecOp++;
1857 }
else if (IsIntrinsic) {
1860 FirstCommutableVecOp = 2;
1863 if (
isMem(MI, LastCommutableVecOp))
1864 LastCommutableVecOp--;
1869 if (SrcOpIdx1 != CommuteAnyOperandIndex &&
1870 (SrcOpIdx1 < FirstCommutableVecOp || SrcOpIdx1 > LastCommutableVecOp ||
1871 SrcOpIdx1 == KMaskOp))
1873 if (SrcOpIdx2 != CommuteAnyOperandIndex &&
1874 (SrcOpIdx2 < FirstCommutableVecOp || SrcOpIdx2 > LastCommutableVecOp ||
1875 SrcOpIdx2 == KMaskOp))
1880 if (SrcOpIdx1 == CommuteAnyOperandIndex ||
1881 SrcOpIdx2 == CommuteAnyOperandIndex) {
1882 unsigned CommutableOpIdx1 = SrcOpIdx1;
1883 unsigned CommutableOpIdx2 = SrcOpIdx2;
1887 if (SrcOpIdx1 == SrcOpIdx2)
1890 CommutableOpIdx2 = LastCommutableVecOp;
1891 else if (SrcOpIdx2 == CommuteAnyOperandIndex)
1893 CommutableOpIdx2 = SrcOpIdx1;
1898 for (CommutableOpIdx1 = LastCommutableVecOp;
1899 CommutableOpIdx1 >= FirstCommutableVecOp; CommutableOpIdx1--) {
1901 if (CommutableOpIdx1 == KMaskOp)
1912 if (CommutableOpIdx1 < FirstCommutableVecOp)
1917 if (!fixCommutedOpIndices(SrcOpIdx1, SrcOpIdx2,
1918 CommutableOpIdx1, CommutableOpIdx2))
1926 unsigned &SrcOpIdx2)
const {
1938 case X86::VCMPPDrri:
1939 case X86::VCMPPSrri:
1940 case X86::VCMPPDYrri:
1941 case X86::VCMPPSYrri:
1942 case X86::VCMPSDZrr:
1943 case X86::VCMPSSZrr:
1944 case X86::VCMPPDZrri:
1945 case X86::VCMPPSZrri:
1946 case X86::VCMPPDZ128rri:
1947 case X86::VCMPPSZ128rri:
1948 case X86::VCMPPDZ256rri:
1949 case X86::VCMPPSZ256rri: {
1960 return fixCommutedOpIndices(SrcOpIdx1, SrcOpIdx2, 1, 2);
1971 case X86::MOVHLPSrr:
1972 case X86::UNPCKHPDrr:
1973 case X86::VMOVHLPSrr:
1974 case X86::VUNPCKHPDrr:
1975 case X86::VMOVHLPSZrr:
1976 case X86::VUNPCKHPDZ128rr:
1980 case X86::VPTERNLOGDZrri:
case X86::VPTERNLOGDZrmi:
1981 case X86::VPTERNLOGDZ128rri:
case X86::VPTERNLOGDZ128rmi:
1982 case X86::VPTERNLOGDZ256rri:
case X86::VPTERNLOGDZ256rmi:
1983 case X86::VPTERNLOGQZrri:
case X86::VPTERNLOGQZrmi:
1984 case X86::VPTERNLOGQZ128rri:
case X86::VPTERNLOGQZ128rmi:
1985 case X86::VPTERNLOGQZ256rri:
case X86::VPTERNLOGQZ256rmi:
1986 case X86::VPTERNLOGDZrrik:
1987 case X86::VPTERNLOGDZ128rrik:
1988 case X86::VPTERNLOGDZ256rrik:
1989 case X86::VPTERNLOGQZrrik:
1990 case X86::VPTERNLOGQZ128rrik:
1991 case X86::VPTERNLOGQZ256rrik:
1992 case X86::VPTERNLOGDZrrikz:
case X86::VPTERNLOGDZrmikz:
1993 case X86::VPTERNLOGDZ128rrikz:
case X86::VPTERNLOGDZ128rmikz:
1994 case X86::VPTERNLOGDZ256rrikz:
case X86::VPTERNLOGDZ256rmikz:
1995 case X86::VPTERNLOGQZrrikz:
case X86::VPTERNLOGQZrmikz:
1996 case X86::VPTERNLOGQZ128rrikz:
case X86::VPTERNLOGQZ128rmikz:
1997 case X86::VPTERNLOGQZ256rrikz:
case X86::VPTERNLOGQZ256rmikz:
1998 case X86::VPTERNLOGDZ128rmbi:
1999 case X86::VPTERNLOGDZ256rmbi:
2000 case X86::VPTERNLOGDZrmbi:
2001 case X86::VPTERNLOGQZ128rmbi:
2002 case X86::VPTERNLOGQZ256rmbi:
2003 case X86::VPTERNLOGQZrmbi:
2004 case X86::VPTERNLOGDZ128rmbikz:
2005 case X86::VPTERNLOGDZ256rmbikz:
2006 case X86::VPTERNLOGDZrmbikz:
2007 case X86::VPTERNLOGQZ128rmbikz:
2008 case X86::VPTERNLOGQZ256rmbikz:
2009 case X86::VPTERNLOGQZrmbikz:
2010 return findThreeSrcCommutedOpIndices(MI, SrcOpIdx1, SrcOpIdx2);
2011 case X86::VPMADD52HUQZ128r:
2012 case X86::VPMADD52HUQZ128rk:
2013 case X86::VPMADD52HUQZ128rkz:
2014 case X86::VPMADD52HUQZ256r:
2015 case X86::VPMADD52HUQZ256rk:
2016 case X86::VPMADD52HUQZ256rkz:
2017 case X86::VPMADD52HUQZr:
2018 case X86::VPMADD52HUQZrk:
2019 case X86::VPMADD52HUQZrkz:
2020 case X86::VPMADD52LUQZ128r:
2021 case X86::VPMADD52LUQZ128rk:
2022 case X86::VPMADD52LUQZ128rkz:
2023 case X86::VPMADD52LUQZ256r:
2024 case X86::VPMADD52LUQZ256rk:
2025 case X86::VPMADD52LUQZ256rkz:
2026 case X86::VPMADD52LUQZr:
2027 case X86::VPMADD52LUQZrk:
2028 case X86::VPMADD52LUQZrkz: {
2029 unsigned CommutableOpIdx1 = 2;
2030 unsigned CommutableOpIdx2 = 3;
2036 if (!fixCommutedOpIndices(SrcOpIdx1, SrcOpIdx2,
2037 CommutableOpIdx1, CommutableOpIdx2))
2050 return findThreeSrcCommutedOpIndices(MI, SrcOpIdx1, SrcOpIdx2,
2057 unsigned CommutableOpIdx1 = Desc.
getNumDefs() + 1;
2058 unsigned CommutableOpIdx2 = Desc.
getNumDefs() + 2;
2076 if (!fixCommutedOpIndices(SrcOpIdx1, SrcOpIdx2,
2077 CommutableOpIdx1, CommutableOpIdx2))
2118 case X86::SETAr:
case X86::SETAm:
return X86::COND_A;
2119 case X86::SETAEr:
case X86::SETAEm:
return X86::COND_AE;
2120 case X86::SETBr:
case X86::SETBm:
return X86::COND_B;
2121 case X86::SETBEr:
case X86::SETBEm:
return X86::COND_BE;
2122 case X86::SETEr:
case X86::SETEm:
return X86::COND_E;
2123 case X86::SETGr:
case X86::SETGm:
return X86::COND_G;
2124 case X86::SETGEr:
case X86::SETGEm:
return X86::COND_GE;
2125 case X86::SETLr:
case X86::SETLm:
return X86::COND_L;
2126 case X86::SETLEr:
case X86::SETLEm:
return X86::COND_LE;
2127 case X86::SETNEr:
case X86::SETNEm:
return X86::COND_NE;
2128 case X86::SETNOr:
case X86::SETNOm:
return X86::COND_NO;
2129 case X86::SETNPr:
case X86::SETNPm:
return X86::COND_NP;
2130 case X86::SETNSr:
case X86::SETNSm:
return X86::COND_NS;
2131 case X86::SETOr:
case X86::SETOm:
return X86::COND_O;
2132 case X86::SETPr:
case X86::SETPm:
return X86::COND_P;
2133 case X86::SETSr:
case X86::SETSm:
return X86::COND_S;
2141 case X86::CMOVA16rm:
case X86::CMOVA16rr:
case X86::CMOVA32rm:
2142 case X86::CMOVA32rr:
case X86::CMOVA64rm:
case X86::CMOVA64rr:
2144 case X86::CMOVAE16rm:
case X86::CMOVAE16rr:
case X86::CMOVAE32rm:
2145 case X86::CMOVAE32rr:
case X86::CMOVAE64rm:
case X86::CMOVAE64rr:
2147 case X86::CMOVB16rm:
case X86::CMOVB16rr:
case X86::CMOVB32rm:
2148 case X86::CMOVB32rr:
case X86::CMOVB64rm:
case X86::CMOVB64rr:
2150 case X86::CMOVBE16rm:
case X86::CMOVBE16rr:
case X86::CMOVBE32rm:
2151 case X86::CMOVBE32rr:
case X86::CMOVBE64rm:
case X86::CMOVBE64rr:
2153 case X86::CMOVE16rm:
case X86::CMOVE16rr:
case X86::CMOVE32rm:
2154 case X86::CMOVE32rr:
case X86::CMOVE64rm:
case X86::CMOVE64rr:
2156 case X86::CMOVG16rm:
case X86::CMOVG16rr:
case X86::CMOVG32rm:
2157 case X86::CMOVG32rr:
case X86::CMOVG64rm:
case X86::CMOVG64rr:
2159 case X86::CMOVGE16rm:
case X86::CMOVGE16rr:
case X86::CMOVGE32rm:
2160 case X86::CMOVGE32rr:
case X86::CMOVGE64rm:
case X86::CMOVGE64rr:
2162 case X86::CMOVL16rm:
case X86::CMOVL16rr:
case X86::CMOVL32rm:
2163 case X86::CMOVL32rr:
case X86::CMOVL64rm:
case X86::CMOVL64rr:
2165 case X86::CMOVLE16rm:
case X86::CMOVLE16rr:
case X86::CMOVLE32rm:
2166 case X86::CMOVLE32rr:
case X86::CMOVLE64rm:
case X86::CMOVLE64rr:
2168 case X86::CMOVNE16rm:
case X86::CMOVNE16rr:
case X86::CMOVNE32rm:
2169 case X86::CMOVNE32rr:
case X86::CMOVNE64rm:
case X86::CMOVNE64rr:
2171 case X86::CMOVNO16rm:
case X86::CMOVNO16rr:
case X86::CMOVNO32rm:
2172 case X86::CMOVNO32rr:
case X86::CMOVNO64rm:
case X86::CMOVNO64rr:
2174 case X86::CMOVNP16rm:
case X86::CMOVNP16rr:
case X86::CMOVNP32rm:
2175 case X86::CMOVNP32rr:
case X86::CMOVNP64rm:
case X86::CMOVNP64rr:
2177 case X86::CMOVNS16rm:
case X86::CMOVNS16rr:
case X86::CMOVNS32rm:
2178 case X86::CMOVNS32rr:
case X86::CMOVNS64rm:
case X86::CMOVNS64rr:
2180 case X86::CMOVO16rm:
case X86::CMOVO16rr:
case X86::CMOVO32rm:
2181 case X86::CMOVO32rr:
case X86::CMOVO64rm:
case X86::CMOVO64rr:
2183 case X86::CMOVP16rm:
case X86::CMOVP16rr:
case X86::CMOVP32rm:
2184 case X86::CMOVP32rr:
case X86::CMOVP64rm:
case X86::CMOVP64rr:
2186 case X86::CMOVS16rm:
case X86::CMOVS16rr:
case X86::CMOVS32rm:
2187 case X86::CMOVS32rr:
case X86::CMOVS64rm:
case X86::CMOVS64rr:
2258 std::pair<X86::CondCode, bool>
2261 bool NeedSwap =
false;
2262 switch (Predicate) {
2293 return std::make_pair(CC, NeedSwap);
2299 static const uint16_t Opc[16][2] = {
2300 { X86::SETAr, X86::SETAm },
2301 { X86::SETAEr, X86::SETAEm },
2302 { X86::SETBr, X86::SETBm },
2303 { X86::SETBEr, X86::SETBEm },
2304 { X86::SETEr, X86::SETEm },
2305 { X86::SETGr, X86::SETGm },
2306 { X86::SETGEr, X86::SETGEm },
2307 { X86::SETLr, X86::SETLm },
2308 { X86::SETLEr, X86::SETLEm },
2309 { X86::SETNEr, X86::SETNEm },
2310 { X86::SETNOr, X86::SETNOm },
2311 { X86::SETNPr, X86::SETNPm },
2312 { X86::SETNSr, X86::SETNSm },
2313 { X86::SETOr, X86::SETOm },
2314 { X86::SETPr, X86::SETPm },
2315 { X86::SETSr, X86::SETSm }
2319 return Opc[CC][HasMemoryOperand ? 1 : 0];
2325 bool HasMemoryOperand) {
2326 static const uint16_t Opc[32][3] = {
2327 { X86::CMOVA16rr, X86::CMOVA32rr, X86::CMOVA64rr },
2328 { X86::CMOVAE16rr, X86::CMOVAE32rr, X86::CMOVAE64rr },
2329 { X86::CMOVB16rr, X86::CMOVB32rr, X86::CMOVB64rr },
2330 { X86::CMOVBE16rr, X86::CMOVBE32rr, X86::CMOVBE64rr },
2331 { X86::CMOVE16rr, X86::CMOVE32rr, X86::CMOVE64rr },
2332 { X86::CMOVG16rr, X86::CMOVG32rr, X86::CMOVG64rr },
2333 { X86::CMOVGE16rr, X86::CMOVGE32rr, X86::CMOVGE64rr },
2334 { X86::CMOVL16rr, X86::CMOVL32rr, X86::CMOVL64rr },
2335 { X86::CMOVLE16rr, X86::CMOVLE32rr, X86::CMOVLE64rr },
2336 { X86::CMOVNE16rr, X86::CMOVNE32rr, X86::CMOVNE64rr },
2337 { X86::CMOVNO16rr, X86::CMOVNO32rr, X86::CMOVNO64rr },
2338 { X86::CMOVNP16rr, X86::CMOVNP32rr, X86::CMOVNP64rr },
2339 { X86::CMOVNS16rr, X86::CMOVNS32rr, X86::CMOVNS64rr },
2340 { X86::CMOVO16rr, X86::CMOVO32rr, X86::CMOVO64rr },
2341 { X86::CMOVP16rr, X86::CMOVP32rr, X86::CMOVP64rr },
2342 { X86::CMOVS16rr, X86::CMOVS32rr, X86::CMOVS64rr },
2343 { X86::CMOVA16rm, X86::CMOVA32rm, X86::CMOVA64rm },
2344 { X86::CMOVAE16rm, X86::CMOVAE32rm, X86::CMOVAE64rm },
2345 { X86::CMOVB16rm, X86::CMOVB32rm, X86::CMOVB64rm },
2346 { X86::CMOVBE16rm, X86::CMOVBE32rm, X86::CMOVBE64rm },
2347 { X86::CMOVE16rm, X86::CMOVE32rm, X86::CMOVE64rm },
2348 { X86::CMOVG16rm, X86::CMOVG32rm, X86::CMOVG64rm },
2349 { X86::CMOVGE16rm, X86::CMOVGE32rm, X86::CMOVGE64rm },
2350 { X86::CMOVL16rm, X86::CMOVL32rm, X86::CMOVL64rm },
2351 { X86::CMOVLE16rm, X86::CMOVLE32rm, X86::CMOVLE64rm },
2352 { X86::CMOVNE16rm, X86::CMOVNE32rm, X86::CMOVNE64rm },
2353 { X86::CMOVNO16rm, X86::CMOVNO32rm, X86::CMOVNO64rm },
2354 { X86::CMOVNP16rm, X86::CMOVNP32rm, X86::CMOVNP64rm },
2355 { X86::CMOVNS16rm, X86::CMOVNS32rm, X86::CMOVNS64rm },
2356 { X86::CMOVO16rm, X86::CMOVO32rm, X86::CMOVO64rm },
2357 { X86::CMOVP16rm, X86::CMOVP32rm, X86::CMOVP64rm },
2358 { X86::CMOVS16rm, X86::CMOVS32rm, X86::CMOVS64rm }
2361 assert(CC < 16 &&
"Can only handle standard cond codes");
2362 unsigned Idx = HasMemoryOperand ? 16+CC : CC;
2365 case 2:
return Opc[Idx][0];
2366 case 4:
return Opc[Idx][1];
2367 case 8:
return Opc[Idx][2];
2392 case 0x01: Imm = 0x06;
break;
2393 case 0x02: Imm = 0x05;
break;
2394 case 0x05: Imm = 0x02;
break;
2395 case 0x06: Imm = 0x01;
break;
2410 case 0x00: Imm = 0x02;
break;
2411 case 0x01: Imm = 0x03;
break;
2412 case 0x02: Imm = 0x00;
break;
2413 case 0x03: Imm = 0x01;
break;
2437 case X86::TCRETURNdi:
2438 case X86::TCRETURNri:
2439 case X86::TCRETURNmi:
2440 case X86::TCRETURNdi64:
2441 case X86::TCRETURNri64:
2442 case X86::TCRETURNmi64:
2452 if (TailCall.
getOpcode() != X86::TCRETURNdi &&
2453 TailCall.
getOpcode() != X86::TCRETURNdi64) {
2486 while (I != MBB.
begin()) {
2488 if (I->isDebugInstr())
2491 assert(0 &&
"Can't find the branch to replace!");
2495 if (CC != BranchCond[0].getImm())
2501 unsigned Opc = TailCall.
getOpcode() == X86::TCRETURNdi ? X86::TCRETURNdicc
2502 : X86::TCRETURNdi64cc;
2507 MIB->addOperand(BranchCond[0]);
2508 MIB.copyImplicitOps(TailCall);
2516 for (
const auto &
C : Clobbers) {
2521 I->eraseFromParent();
2535 if ((*SI)->isEHPad() || (*
SI == TBB && FallthroughBB))
2538 if (FallthroughBB && FallthroughBB != TBB)
2540 FallthroughBB = *
SI;
2542 return FallthroughBB;
2545 bool X86InstrInfo::AnalyzeBranchImpl(
2554 while (I != MBB.
begin()) {
2556 if (I->isDebugInstr())
2570 if (I->getOpcode() == X86::JMP_1) {
2574 TBB = I->getOperand(0).getMBB();
2579 while (std::next(I) != MBB.
end())
2580 std::next(I)->eraseFromParent();
2588 I->eraseFromParent();
2590 UnCondBrIter = MBB.
end();
2595 TBB = I->getOperand(0).getMBB();
2606 if (I->getOperand(1).isUndef())
2612 if (AllowModify && UnCondBrIter != MBB.
end() &&
2636 .
addMBB(UnCondBrIter->getOperand(0).getMBB());
2640 OldInst->eraseFromParent();
2641 UnCondBrIter->eraseFromParent();
2644 UnCondBrIter = MBB.
end();
2650 TBB = I->getOperand(0).getMBB();
2664 auto NewTBB = I->getOperand(0).getMBB();
2665 if (OldBranchCode == BranchCode && TBB == NewTBB)
2671 if (TBB == NewTBB &&
2704 Cond[0].setImm(BranchCode);
2715 bool AllowModify)
const {
2717 return AnalyzeBranchImpl(MBB, TBB, FBB, Cond, CondBranches, AllowModify);
2721 MachineBranchPredicate &MBP,
2722 bool AllowModify)
const {
2723 using namespace std::placeholders;
2727 if (AnalyzeBranchImpl(MBB, MBP.TrueDest, MBP.FalseDest, Cond, CondBranches,
2731 if (Cond.
size() != 1)
2734 assert(MBP.TrueDest &&
"expected!");
2742 bool SingleUseCondition =
true;
2745 if (
I->modifiesRegister(X86::EFLAGS, TRI)) {
2750 if (
I->readsRegister(X86::EFLAGS, TRI))
2751 SingleUseCondition =
false;
2757 if (SingleUseCondition) {
2759 if (Succ->isLiveIn(X86::EFLAGS))
2760 SingleUseCondition =
false;
2763 MBP.ConditionDef = ConditionDef;
2764 MBP.SingleUseCondition = SingleUseCondition;
2771 const unsigned TestOpcode =
2772 Subtarget.is64Bit() ? X86::TEST64rr : X86::TEST32rr;
2774 if (ConditionDef->
getOpcode() == TestOpcode &&
2790 int *BytesRemoved)
const {
2791 assert(!BytesRemoved &&
"code size not handled");
2796 while (I != MBB.
begin()) {
2798 if (I->isDebugInstr())
2800 if (I->getOpcode() != X86::JMP_1 &&
2804 I->eraseFromParent();
2817 int *BytesAdded)
const {
2819 assert(TBB &&
"insertBranch must not be told to insert a fallthrough");
2821 "X86 branch conditions have one component!");
2822 assert(!BytesAdded &&
"code size not handled");
2826 assert(!FBB &&
"Unconditional branch with multiple successors!");
2832 bool FallThru = FBB ==
nullptr;
2847 if (FBB ==
nullptr) {
2849 assert(FBB &&
"MBB cannot be the last block in function when the false " 2850 "body is a fall-through.");
2875 unsigned TrueReg,
unsigned FalseReg,
2876 int &CondCycles,
int &TrueCycles,
int &FalseCycles)
const {
2878 if (!Subtarget.hasCMov())
2880 if (Cond.
size() != 1)
2894 if (X86::GR16RegClass.hasSubClassEq(RC) ||
2895 X86::GR32RegClass.hasSubClassEq(RC) ||
2896 X86::GR64RegClass.hasSubClassEq(RC)) {
2911 const DebugLoc &DL,
unsigned DstReg,
2913 unsigned FalseReg)
const {
2917 assert(Cond.
size() == 1 &&
"Invalid Cond array");
2926 return X86::GR8_ABCD_HRegClass.contains(Reg);
2932 bool HasAVX = Subtarget.
hasAVX();
2939 if (X86::VK16RegClass.
contains(SrcReg)) {
2940 if (X86::GR64RegClass.
contains(DestReg)) {
2942 return X86::KMOVQrk;
2944 if (X86::GR32RegClass.
contains(DestReg))
2945 return Subtarget.
hasBWI() ? X86::KMOVDrk : X86::KMOVWrk;
2952 if (X86::VK16RegClass.
contains(DestReg)) {
2953 if (X86::GR64RegClass.
contains(SrcReg)) {
2955 return X86::KMOVQkr;
2957 if (X86::GR32RegClass.
contains(SrcReg))
2958 return Subtarget.
hasBWI() ? X86::KMOVDkr : X86::KMOVWkr;
2967 if (X86::GR64RegClass.
contains(DestReg)) {
2968 if (X86::VR128XRegClass.
contains(SrcReg))
2970 return HasAVX512 ? X86::VMOVPQIto64Zrr :
2971 HasAVX ? X86::VMOVPQIto64rr :
2973 if (X86::VR64RegClass.
contains(SrcReg))
2975 return X86::MMX_MOVD64from64rr;
2976 }
else if (X86::GR64RegClass.
contains(SrcReg)) {
2978 if (X86::VR128XRegClass.
contains(DestReg))
2979 return HasAVX512 ? X86::VMOV64toPQIZrr :
2980 HasAVX ? X86::VMOV64toPQIrr :
2983 if (X86::VR64RegClass.
contains(DestReg))
2984 return X86::MMX_MOVD64to64rr;
2990 if (X86::GR32RegClass.
contains(DestReg) &&
2991 X86::FR32XRegClass.
contains(SrcReg))
2993 return HasAVX512 ? X86::VMOVSS2DIZrr :
2994 HasAVX ? X86::VMOVSS2DIrr :
2997 if (X86::FR32XRegClass.
contains(DestReg) &&
2998 X86::GR32RegClass.
contains(SrcReg))
3000 return HasAVX512 ? X86::VMOVDI2SSZrr :
3001 HasAVX ? X86::VMOVDI2SSrr :
3008 const DebugLoc &DL,
unsigned DestReg,
3009 unsigned SrcReg,
bool KillSrc)
const {
3011 bool HasAVX = Subtarget.hasAVX();
3012 bool HasVLX = Subtarget.hasVLX();
3014 if (X86::GR64RegClass.
contains(DestReg, SrcReg))
3016 else if (X86::GR32RegClass.
contains(DestReg, SrcReg))
3018 else if (X86::GR16RegClass.
contains(DestReg, SrcReg))
3020 else if (X86::GR8RegClass.
contains(DestReg, SrcReg)) {
3024 Subtarget.is64Bit()) {
3025 Opc = X86::MOV8rr_NOREX;
3028 "8-bit H register can not be copied outside GR8_NOREX");
3032 else if (X86::VR64RegClass.
contains(DestReg, SrcReg))
3033 Opc = X86::MMX_MOVQ64rr;
3034 else if (X86::VR128XRegClass.
contains(DestReg, SrcReg)) {
3036 Opc = X86::VMOVAPSZ128rr;
3037 else if (X86::VR128RegClass.
contains(DestReg, SrcReg))
3038 Opc = HasAVX ? X86::VMOVAPSrr : X86::MOVAPSrr;
3042 Opc = X86::VMOVAPSZrr;
3045 &X86::VR512RegClass);
3047 &X86::VR512RegClass);
3049 }
else if (X86::VR256XRegClass.
contains(DestReg, SrcReg)) {
3051 Opc = X86::VMOVAPSZ256rr;
3052 else if (X86::VR256RegClass.
contains(DestReg, SrcReg))
3053 Opc = X86::VMOVAPSYrr;
3057 Opc = X86::VMOVAPSZrr;
3060 &X86::VR512RegClass);
3062 &X86::VR512RegClass);
3064 }
else if (X86::VR512RegClass.
contains(DestReg, SrcReg))
3065 Opc = X86::VMOVAPSZrr;
3067 else if (X86::VK16RegClass.
contains(DestReg, SrcReg))
3068 Opc = Subtarget.hasBWI() ? X86::KMOVQkk : X86::KMOVWkk;
3073 BuildMI(MBB, MI, DL,
get(Opc), DestReg)
3078 if (SrcReg == X86::EFLAGS || DestReg == X86::EFLAGS) {
3086 LLVM_DEBUG(
dbgs() <<
"Cannot copy " << RI.getName(SrcReg) <<
" to " 3087 << RI.getName(DestReg) <<
'\n');
3104 bool isStackAligned,
3107 bool HasAVX = STI.
hasAVX();
3109 bool HasVLX = STI.
hasVLX();
3115 assert(X86::GR8RegClass.hasSubClassEq(RC) &&
"Unknown 1-byte regclass");
3119 if (
isHReg(Reg) || X86::GR8_ABCD_HRegClass.hasSubClassEq(RC))
3120 return load ? X86::MOV8rm_NOREX : X86::MOV8mr_NOREX;
3121 return load ? X86::MOV8rm : X86::MOV8mr;
3123 if (X86::VK16RegClass.hasSubClassEq(RC))
3124 return load ? X86::KMOVWkm : X86::KMOVWmk;
3125 assert(X86::GR16RegClass.hasSubClassEq(RC) &&
"Unknown 2-byte regclass");
3126 return load ? X86::MOV16rm : X86::MOV16mr;
3128 if (X86::GR32RegClass.hasSubClassEq(RC))
3129 return load ? X86::MOV32rm : X86::MOV32mr;
3130 if (X86::FR32XRegClass.hasSubClassEq(RC))
3132 (HasAVX512 ? X86::VMOVSSZrm : HasAVX ? X86::VMOVSSrm : X86::MOVSSrm) :
3133 (HasAVX512 ? X86::VMOVSSZmr : HasAVX ? X86::VMOVSSmr : X86::MOVSSmr);
3134 if (X86::RFP32RegClass.hasSubClassEq(RC))
3135 return load ? X86::LD_Fp32m : X86::ST_Fp32m;
3136 if (X86::VK32RegClass.hasSubClassEq(RC)) {
3138 return load ? X86::KMOVDkm : X86::KMOVDmk;
3142 if (X86::GR64RegClass.hasSubClassEq(RC))
3143 return load ? X86::MOV64rm : X86::MOV64mr;
3144 if (X86::FR64XRegClass.hasSubClassEq(RC))
3146 (HasAVX512 ? X86::VMOVSDZrm : HasAVX ? X86::VMOVSDrm : X86::MOVSDrm) :
3147 (HasAVX512 ? X86::VMOVSDZmr : HasAVX ? X86::VMOVSDmr : X86::MOVSDmr);
3148 if (X86::VR64RegClass.hasSubClassEq(RC))
3149 return load ? X86::MMX_MOVQ64rm : X86::MMX_MOVQ64mr;
3150 if (X86::RFP64RegClass.hasSubClassEq(RC))
3151 return load ? X86::LD_Fp64m : X86::ST_Fp64m;
3152 if (X86::VK64RegClass.hasSubClassEq(RC)) {
3154 return load ? X86::KMOVQkm : X86::KMOVQmk;
3158 assert(X86::RFP80RegClass.hasSubClassEq(RC) &&
"Unknown 10-byte regclass");
3159 return load ? X86::LD_Fp80m : X86::ST_FpP80m;
3161 if (X86::VR128XRegClass.hasSubClassEq(RC)) {
3165 (HasVLX ? X86::VMOVAPSZ128rm :
3166 HasAVX512 ? X86::VMOVAPSZ128rm_NOVLX :
3167 HasAVX ? X86::VMOVAPSrm :
3169 (HasVLX ? X86::VMOVAPSZ128mr :
3170 HasAVX512 ? X86::VMOVAPSZ128mr_NOVLX :
3171 HasAVX ? X86::VMOVAPSmr :
3175 (HasVLX ? X86::VMOVUPSZ128rm :
3176 HasAVX512 ? X86::VMOVUPSZ128rm_NOVLX :
3177 HasAVX ? X86::VMOVUPSrm :
3179 (HasVLX ? X86::VMOVUPSZ128mr :
3180 HasAVX512 ? X86::VMOVUPSZ128mr_NOVLX :
3181 HasAVX ? X86::VMOVUPSmr :
3184 if (X86::BNDRRegClass.hasSubClassEq(RC)) {
3186 return load ? X86::BNDMOV64rm : X86::BNDMOV64mr;
3188 return load ? X86::BNDMOV32rm : X86::BNDMOV32mr;
3193 assert(X86::VR256XRegClass.hasSubClassEq(RC) &&
"Unknown 32-byte regclass");
3197 (HasVLX ? X86::VMOVAPSZ256rm :
3198 HasAVX512 ? X86::VMOVAPSZ256rm_NOVLX :
3200 (HasVLX ? X86::VMOVAPSZ256mr :
3201 HasAVX512 ? X86::VMOVAPSZ256mr_NOVLX :
3205 (HasVLX ? X86::VMOVUPSZ256rm :
3206 HasAVX512 ? X86::VMOVUPSZ256rm_NOVLX :
3208 (HasVLX ? X86::VMOVUPSZ256mr :
3209 HasAVX512 ? X86::VMOVUPSZ256mr_NOVLX :
3212 assert(X86::VR512RegClass.hasSubClassEq(RC) &&
"Unknown 64-byte regclass");
3215 return load ? X86::VMOVAPSZrm : X86::VMOVAPSZmr;
3217 return load ? X86::VMOVUPSZrm : X86::VMOVUPSZmr;
3226 if (MemRefBegin < 0)
3232 if (!BaseOp->
isReg())
3245 if (!DispMO.
isImm())
3248 Offset = DispMO.
getImm();
3250 assert(BaseOp->
isReg() &&
"getMemOperandWithOffset only supports base " 3251 "operands of type register.");
3257 bool isStackAligned,
3265 bool isStackAligned,
3272 unsigned SrcReg,
bool isKill,
int FrameIdx,
3277 "Stack slot too small for store");
3278 unsigned Alignment = std::max<uint32_t>(TRI->
getSpillSize(*RC), 16);
3280 (Subtarget.getFrameLowering()->getStackAlignment() >= Alignment) ||
3281 RI.canRealignStack(MF);
3293 unsigned Alignment = std::max<uint32_t>(TRI.
getSpillSize(*RC), 16);
3298 for (
unsigned i = 0, e = Addr.
size(); i != e; ++i)
3308 unsigned DestReg,
int FrameIdx,
3312 unsigned Alignment = std::max<uint32_t>(TRI->
getSpillSize(*RC), 16);
3314 (Subtarget.getFrameLowering()->getStackAlignment() >= Alignment) ||
3315 RI.canRealignStack(MF);
3326 unsigned Alignment = std::max<uint32_t>(TRI.
getSpillSize(*RC), 16);
3331 for (
unsigned i = 0, e = Addr.
size(); i != e; ++i)
3338 unsigned &SrcReg2,
int &CmpMask,
3339 int &CmpValue)
const {
3342 case X86::CMP64ri32:
3355 CmpMask = CmpValue = 0;
3377 case X86::SUB64ri32:
3390 CmpMask = CmpValue = 0;
3425 unsigned SrcReg,
unsigned SrcReg2,
3439 ((FlagI.
getOpcode() == X86::CMP64ri32 &&
3462 default:
return false;
3466 case X86::SAR8ri:
case X86::SAR16ri:
case X86::SAR32ri:
case X86::SAR64ri:
3467 case X86::SHR8ri:
case X86::SHR16ri:
case X86::SHR32ri:
case X86::SHR64ri:
3472 case X86::SHL8ri:
case X86::SHL16ri:
case X86::SHL32ri:
case X86::SHL64ri:{
3478 case X86::SHRD16rri8:
case X86::SHRD32rri8:
case X86::SHRD64rri8:
3479 case X86::SHLD16rri8:
case X86::SHLD32rri8:
case X86::SHLD64rri8:
3482 case X86::SUB64ri32:
case X86::SUB64ri8:
case X86::SUB32ri:
3483 case X86::SUB32ri8:
case X86::SUB16ri:
case X86::SUB16ri8:
3484 case X86::SUB8ri:
case X86::SUB64rr:
case X86::SUB32rr:
3485 case X86::SUB16rr:
case X86::SUB8rr:
case X86::SUB64rm:
3486 case X86::SUB32rm:
case X86::SUB16rm:
case X86::SUB8rm:
3487 case X86::DEC64r:
case X86::DEC32r:
case X86::DEC16r:
case X86::DEC8r:
3488 case X86::ADD64ri32:
case X86::ADD64ri8:
case X86::ADD32ri:
3489 case X86::ADD32ri8:
case X86::ADD16ri:
case X86::ADD16ri8:
3490 case X86::ADD8ri:
case X86::ADD64rr:
case X86::ADD32rr:
3491 case X86::ADD16rr:
case X86::ADD8rr:
case X86::ADD64rm:
3492 case X86::ADD32rm:
case X86::ADD16rm:
case X86::ADD8rm:
3493 case X86::INC64r:
case X86::INC32r:
case X86::INC16r:
case X86::INC8r:
3494 case X86::AND64ri32:
case X86::AND64ri8:
case X86::AND32ri:
3495 case X86::AND32ri8:
case X86::AND16ri:
case X86::AND16ri8:
3496 case X86::AND8ri:
case X86::AND64rr:
case X86::AND32rr:
3497 case X86::AND16rr:
case X86::AND8rr:
case X86::AND64rm:
3498 case X86::AND32rm:
case X86::AND16rm:
case X86::AND8rm:
3499 case X86::XOR64ri32:
case X86::XOR64ri8:
case X86::XOR32ri:
3500 case X86::XOR32ri8:
case X86::XOR16ri:
case X86::XOR16ri8:
3501 case X86::XOR8ri:
case X86::XOR64rr:
case X86::XOR32rr:
3502 case X86::XOR16rr:
case X86::XOR8rr:
case X86::XOR64rm:
3503 case X86::XOR32rm:
case X86::XOR16rm:
case X86::XOR8rm:
3504 case X86::OR64ri32:
case X86::OR64ri8:
case X86::OR32ri:
3505 case X86::OR32ri8:
case X86::OR16ri:
case X86::OR16ri8:
3506 case X86::OR8ri:
case X86::OR64rr:
case X86::OR32rr:
3507 case X86::OR16rr:
case X86::OR8rr:
case X86::OR64rm:
3508 case X86::OR32rm:
case X86::OR16rm:
case X86::OR8rm:
3509 case X86::ADC64ri32:
case X86::ADC64ri8:
case X86::ADC32ri:
3510 case X86::ADC32ri8:
case X86::ADC16ri:
case X86::ADC16ri8:
3511 case X86::ADC8ri:
case X86::ADC64rr:
case X86::ADC32rr:
3512 case X86::ADC16rr:
case X86::ADC8rr:
case X86::ADC64rm:
3513 case X86::ADC32rm:
case X86::ADC16rm:
case X86::ADC8rm:
3514 case X86::SBB64ri32:
case X86::SBB64ri8:
case X86::SBB32ri:
3515 case X86::SBB32ri8:
case X86::SBB16ri:
case X86::SBB16ri8:
3516 case X86::SBB8ri:
case X86::SBB64rr:
case X86::SBB32rr:
3517 case X86::SBB16rr:
case X86::SBB8rr:
case X86::SBB64rm:
3518 case X86::SBB32rm:
case X86::SBB16rm:
case X86::SBB8rm:
3519 case X86::NEG8r:
case X86::NEG16r:
case X86::NEG32r:
case X86::NEG64r:
3520 case X86::SAR8r1:
case X86::SAR16r1:
case X86::SAR32r1:
case X86::SAR64r1:
3521 case X86::SHR8r1:
case X86::SHR16r1:
case X86::SHR32r1:
case X86::SHR64r1:
3522 case X86::SHL8r1:
case X86::SHL16r1:
case X86::SHL32r1:
case X86::SHL64r1:
3523 case X86::ANDN32rr:
case X86::ANDN32rm:
3524 case X86::ANDN64rr:
case X86::ANDN64rm:
3525 case X86::BLSI32rr:
case X86::BLSI32rm:
3526 case X86::BLSI64rr:
case X86::BLSI64rm:
3527 case X86::BLSMSK32rr:
case X86::BLSMSK32rm:
3528 case X86::BLSMSK64rr:
case X86::BLSMSK64rm:
3529 case X86::BLSR32rr:
case X86::BLSR32rm:
3530 case X86::BLSR64rr:
case X86::BLSR64rm:
3531 case X86::BZHI32rr:
case X86::BZHI32rm:
3532 case X86::BZHI64rr:
case X86::BZHI64rm:
3533 case X86::LZCNT16rr:
case X86::LZCNT16rm:
3534 case X86::LZCNT32rr:
case X86::LZCNT32rm:
3535 case X86::LZCNT64rr:
case X86::LZCNT64rm:
3536 case X86::POPCNT16rr:
case X86::POPCNT16rm:
3537 case X86::POPCNT32rr:
case X86::POPCNT32rm:
3538 case X86::POPCNT64rr:
case X86::POPCNT64rm:
3539 case X86::TZCNT16rr:
case X86::TZCNT16rm:
3540 case X86::TZCNT32rr:
case X86::TZCNT32rm:
3541 case X86::TZCNT64rr:
case X86::TZCNT64rm:
3542 case X86::BLCFILL32rr:
case X86::BLCFILL32rm:
3543 case X86::BLCFILL64rr:
case X86::BLCFILL64rm:
3544 case X86::BLCI32rr:
case X86::BLCI32rm:
3545 case X86::BLCI64rr:
case X86::BLCI64rm:
3546 case X86::BLCIC32rr:
case X86::BLCIC32rm:
3547 case X86::BLCIC64rr:
case X86::BLCIC64rm:
3548 case X86::BLCMSK32rr:
case X86::BLCMSK32rm:
3549 case X86::BLCMSK64rr:
case X86::BLCMSK64rm:
3550 case X86::BLCS32rr:
case X86::BLCS32rm:
3551 case X86::BLCS64rr:
case X86::BLCS64rm:
3552 case X86::BLSFILL32rr:
case X86::BLSFILL32rm:
3553 case X86::BLSFILL64rr:
case X86::BLSFILL64rm:
3554 case X86::BLSIC32rr:
case X86::BLSIC32rm:
3555 case X86::BLSIC64rr:
case X86::BLSIC64rm:
3556 case X86::T1MSKC32rr:
case X86::T1MSKC32rm:
3557 case X86::T1MSKC64rr:
case X86::T1MSKC64rm:
3558 case X86::TZMSK32rr:
case X86::TZMSK32rm:
3559 case X86::TZMSK64rr:
case X86::TZMSK64rm:
3561 case X86::BEXTR32rr:
case X86::BEXTR64rr:
3562 case X86::BEXTR32rm:
case X86::BEXTR64rm:
3563 case X86::BEXTRI32ri:
case X86::BEXTRI32mi:
3564 case X86::BEXTRI64ri:
case X86::BEXTRI64mi:
3575 case X86::LZCNT16rr:
case X86::LZCNT16rm:
3576 case X86::LZCNT32rr:
case X86::LZCNT32rm:
3577 case X86::LZCNT64rr:
case X86::LZCNT64rm:
3579 case X86::POPCNT16rr:
case X86::POPCNT16rm:
3580 case X86::POPCNT32rr:
case X86::POPCNT32rm:
3581 case X86::POPCNT64rr:
case X86::POPCNT64rm:
3583 case X86::TZCNT16rr:
case X86::TZCNT16rm:
3584 case X86::TZCNT32rr:
case X86::TZCNT32rm:
3585 case X86::TZCNT64rr:
case X86::TZCNT64rm:
3587 case X86::BSF16rr:
case X86::BSF16rm:
3588 case X86::BSF32rr:
case X86::BSF32rm:
3589 case X86::BSF64rr:
case X86::BSF64rm:
3590 case X86::BSR16rr:
case X86::BSR16rm:
3591 case X86::BSR32rr:
case X86::BSR32rm:
3592 case X86::BSR64rr:
case X86::BSR64rm:
3601 unsigned SrcReg2,
int CmpMask,
3605 unsigned NewOpcode = 0;
3608 case X86::SUB64ri32:
3628 case X86::SUB64rm: NewOpcode = X86::CMP64rm;
break;
3629 case X86::SUB32rm: NewOpcode = X86::CMP32rm;
break;
3630 case X86::SUB16rm: NewOpcode = X86::CMP16rm;
break;
3631 case X86::SUB8rm: NewOpcode = X86::CMP8rm;
break;
3632 case X86::SUB64rr: NewOpcode = X86::CMP64rr;
break;
3633 case X86::SUB32rr: NewOpcode = X86::CMP32rr;
break;
3634 case X86::SUB16rr: NewOpcode = X86::CMP16rr;
break;
3635 case X86::SUB8rr: NewOpcode = X86::CMP8rr;
break;
3636 case X86::SUB64ri32: NewOpcode = X86::CMP64ri32;
break;
3637 case X86::SUB64ri8: NewOpcode = X86::CMP64ri8;
break;
3638 case X86::SUB32ri: NewOpcode = X86::CMP32ri;
break;
3639 case X86::SUB32ri8: NewOpcode = X86::CMP32ri8;
break;
3640 case X86::SUB16ri: NewOpcode = X86::CMP16ri;
break;
3641 case X86::SUB16ri8: NewOpcode = X86::CMP16ri8;
break;
3642 case X86::SUB8ri: NewOpcode = X86::CMP8ri;
break;
3644 CmpInstr.
setDesc(
get(NewOpcode));
3647 if (NewOpcode == X86::CMP64rm || NewOpcode == X86::CMP32rm ||
3648 NewOpcode == X86::CMP16rm || NewOpcode == X86::CMP8rm)
3655 if (!MI)
return false;
3662 bool IsCmpZero = (CmpMask != 0 && CmpValue == 0);
3669 bool ShouldUpdateCC =
false;
3670 bool NoSignFlag =
false;
3679 J->getOperand(1).getReg() == SrcReg) {
3680 assert(J->definesRegister(X86::EFLAGS) &&
"Must be an EFLAGS def!");
3681 ShouldUpdateCC =
true;
3710 for (; RI != RE; ++RI) {
3726 if (!Movr0Inst && Instr.
getOpcode() == X86::MOV32r0 &&
3738 if (!IsCmpZero && !Sub)
3741 bool IsSwapped = (SrcReg2 != 0 && Sub->
getOperand(1).
getReg() == SrcReg2 &&
3748 bool IsSafe =
false;
3751 for (++I; I !=
E; ++
I) {
3752 const MachineInstr &Instr = *
I;
3756 if (!UseEFLAGS && ModifyEFLAGS) {
3761 if (!UseEFLAGS && !ModifyEFLAGS)
3766 bool OpcIsSET =
false;
3767 if (IsCmpZero || IsSwapped) {
3806 ReplacementCC = NewCC;
3812 }
else if (IsSwapped) {
3820 if ((ShouldUpdateCC || IsSwapped) && ReplacementCC != OldCC) {
3838 OpsToUpdate.push_back(std::make_pair(&*I, NewOpc));
3840 if (ModifyEFLAGS || Instr.
killsRegister(X86::EFLAGS, TRI)) {
3849 if ((IsCmpZero || IsSwapped) && !IsSafe) {
3857 Sub = IsCmpZero ?
MI : Sub;
3864 for (; InsertI != InsertE; ++InsertI) {
3865 MachineInstr *Instr = &*InsertI;
3874 if (InsertI == InsertE)
3880 for (; i != e; ++i) {
3887 assert(i != e &&
"Unable to locate a def EFLAGS operand");
3892 for (
auto &Op : OpsToUpdate)
3893 Op.first->setDesc(
get(Op.second));
3903 unsigned &FoldAsLoadDefReg,
3908 bool SawStore =
false;
3919 if (Reg != FoldAsLoadDefReg)
3926 if (SrcOperandIds.
empty())
3930 if (
MachineInstr *FoldMI = foldMemoryOperand(MI, SrcOperandIds, *DefMI)) {
3931 FoldAsLoadDefReg = 0;
3986 MIB->
setDesc(TII.
get(MinusOne ? X86::DEC32r : X86::INC32r));
3998 assert(Imm != 0 &&
"Using push/pop for 0 is not efficient.");
4005 MIB->
getOpcode() == X86::MOV32ImmSExti8);
4010 if (X86FI->getUsesRedZone()) {
4012 X86::MOV32ImmSExti8 ? X86::MOV32ri : X86::MOV64ri));
4018 StackAdjustment = 8;
4019 BuildMI(MBB, I, DL, TII.
get(X86::PUSH64i8)).addImm(Imm);
4025 StackAdjustment = 4;
4026 BuildMI(MBB, I, DL, TII.
get(X86::PUSH32i8)).addImm(Imm);
4034 bool NeedsDwarfCFI =
4037 bool EmitCFI = !TFL->
hasFP(MF) && NeedsDwarfCFI;
4041 TFL->
BuildCFI(MBB, std::next(I), DL,
4078 MIB->
getOpcode() == X86::XOR64_FP ? X86::XOR64rr : X86::XOR32rr;
4132 bool HasAVX = Subtarget.hasAVX();
4141 case X86::MOV32ImmSExti8:
4142 case X86::MOV64ImmSExti8:
4146 case X86::SETB_C16r:
4148 case X86::SETB_C32r:
4150 case X86::SETB_C64r:
4158 case X86::AVX_SET0: {
4159 assert(HasAVX &&
"AVX not supported");
4161 unsigned SrcReg = MIB->getOperand(0).getReg();
4162 unsigned XReg = TRI->
getSubReg(SrcReg, X86::sub_xmm);
4163 MIB->getOperand(0).setReg(XReg);
4168 case X86::AVX512_128_SET0:
4169 case X86::AVX512_FsFLD0SS:
4170 case X86::AVX512_FsFLD0SD: {
4171 bool HasVLX = Subtarget.hasVLX();
4172 unsigned SrcReg = MIB->getOperand(0).getReg();
4176 get(HasVLX ? X86::VPXORDZ128rr : X86::VXORPSrr));
4180 MIB->getOperand(0).setReg(SrcReg);
4183 case X86::AVX512_256_SET0:
4184 case X86::AVX512_512_SET0: {
4185 bool HasVLX = Subtarget.hasVLX();
4186 unsigned SrcReg = MIB->getOperand(0).getReg();
4189 unsigned XReg = TRI->
getSubReg(SrcReg, X86::sub_xmm);
4190 MIB->getOperand(0).setReg(XReg);
4192 get(HasVLX ? X86::VPXORDZ128rr : X86::VXORPSrr));
4198 case X86::V_SETALLONES:
4199 return Expand2AddrUndef(MIB,
get(HasAVX ? X86::VPCMPEQDrr : X86::PCMPEQDrr));
4200 case X86::AVX2_SETALLONES:
4202 case X86::AVX1_SETALLONES: {
4203 unsigned Reg = MIB->getOperand(0).getReg();
4205 MIB->setDesc(
get(X86::VCMPPSYrri));
4209 case X86::AVX512_512_SETALLONES: {
4210 unsigned Reg = MIB->getOperand(0).getReg();
4211 MIB->setDesc(
get(X86::VPTERNLOGDZrri));
4218 case X86::AVX512_512_SEXT_MASK_32:
4219 case X86::AVX512_512_SEXT_MASK_64: {
4220 unsigned Reg = MIB->getOperand(0).getReg();
4221 unsigned MaskReg = MIB->getOperand(1).getReg();
4222 unsigned MaskState =
getRegState(MIB->getOperand(1));
4223 unsigned Opc = (MI.
getOpcode() == X86::AVX512_512_SEXT_MASK_64) ?
4224 X86::VPTERNLOGQZrrikz : X86::VPTERNLOGDZrrikz;
4226 MIB->setDesc(
get(Opc));
4233 case X86::VMOVAPSZ128rm_NOVLX:
4235 get(X86::VBROADCASTF32X4rm), X86::sub_xmm);
4236 case X86::VMOVUPSZ128rm_NOVLX:
4238 get(X86::VBROADCASTF32X4rm), X86::sub_xmm);
4239 case X86::VMOVAPSZ256rm_NOVLX:
4241 get(X86::VBROADCASTF64X4rm), X86::sub_ymm);
4242 case X86::VMOVUPSZ256rm_NOVLX:
4244 get(X86::VBROADCASTF64X4rm), X86::sub_ymm);
4245 case X86::VMOVAPSZ128mr_NOVLX:
4247 get(X86::VEXTRACTF32x4Zmr), X86::sub_xmm);
4248 case X86::VMOVUPSZ128mr_NOVLX:
4250 get(X86::VEXTRACTF32x4Zmr), X86::sub_xmm);
4251 case X86::VMOVAPSZ256mr_NOVLX:
4253 get(X86::VEXTRACTF64x4Zmr), X86::sub_ymm);
4254 case X86::VMOVUPSZ256mr_NOVLX:
4256 get(X86::VEXTRACTF64x4Zmr), X86::sub_ymm);
4257 case X86::MOV32ri64: {
4258 unsigned Reg = MIB->getOperand(0).getReg();
4259 unsigned Reg32 = RI.getSubReg(Reg, X86::sub_32bit);
4260 MI.
setDesc(
get(X86::MOV32ri));
4261 MIB->getOperand(0).setReg(Reg32);
4273 case X86::KSET0W:
return Expand2AddrKreg(MIB,
get(X86::KXORWrr), X86::K0);
4274 case X86::KSET0D:
return Expand2AddrKreg(MIB,
get(X86::KXORDrr), X86::K0);
4275 case X86::KSET0Q:
return Expand2AddrKreg(MIB,
get(X86::KXORQrr), X86::K0);
4276 case X86::KSET1W:
return Expand2AddrKreg(MIB,
get(X86::KXNORWrr), X86::K0);
4277 case X86::KSET1D:
return Expand2AddrKreg(MIB,
get(X86::KXNORDrr), X86::K0);
4278 case X86::KSET1Q:
return Expand2AddrKreg(MIB,
get(X86::KXNORQrr), X86::K0);
4279 case TargetOpcode::LOAD_STACK_GUARD:
4308 case X86::CVTSI2SSrr:
4309 case X86::CVTSI2SSrm:
4310 case X86::CVTSI642SSrr:
4311 case X86::CVTSI642SSrm:
4312 case X86::CVTSI2SDrr:
4313 case X86::CVTSI2SDrm:
4314 case X86::CVTSI642SDrr:
4315 case X86::CVTSI642SDrm:
4316 case X86::CVTSD2SSrr:
4317 case X86::CVTSD2SSrm:
4318 case X86::CVTSS2SDrr:
4319 case X86::CVTSS2SDrm:
4326 case X86::RCPSSr_Int:
4327 case X86::RCPSSm_Int:
4334 case X86::RSQRTSSr_Int:
4335 case X86::RSQRTSSm_Int:
4338 case X86::SQRTSSr_Int:
4339 case X86::SQRTSSm_Int:
4342 case X86::SQRTSDr_Int:
4343 case X86::SQRTSDm_Int:
4346 case X86::POPCNT32rm:
4347 case X86::POPCNT32rr:
4348 case X86::POPCNT64rm:
4349 case X86::POPCNT64rr:
4351 case X86::LZCNT32rm:
4352 case X86::LZCNT32rr:
4353 case X86::LZCNT64rm:
4354 case X86::LZCNT64rr:
4355 case X86::TZCNT32rm:
4356 case X86::TZCNT32rr:
4357 case X86::TZCNT64rm:
4358 case X86::TZCNT64rr:
4394 case X86::VCVTSI2SSrr:
4395 case X86::VCVTSI2SSrm:
4396 case X86::VCVTSI2SSrr_Int:
4397 case X86::VCVTSI2SSrm_Int:
4398 case X86::VCVTSI642SSrr:
4399 case X86::VCVTSI642SSrm:
4400 case X86::VCVTSI642SSrr_Int:
4401 case X86::VCVTSI642SSrm_Int:
4402 case X86::VCVTSI2SDrr:
4403 case X86::VCVTSI2SDrm:
4404 case X86::VCVTSI2SDrr_Int:
4405 case X86::VCVTSI2SDrm_Int:
4406 case X86::VCVTSI642SDrr:
4407 case X86::VCVTSI642SDrm:
4408 case X86::VCVTSI642SDrr_Int:
4409 case X86::VCVTSI642SDrm_Int:
4410 case X86::VCVTSD2SSrr:
4411 case X86::VCVTSD2SSrm:
4412 case X86::VCVTSD2SSrr_Int:
4413 case X86::VCVTSD2SSrm_Int:
4414 case X86::VCVTSS2SDrr:
4415 case X86::VCVTSS2SDrm:
4416 case X86::VCVTSS2SDrr_Int:
4417 case X86::VCVTSS2SDrm_Int:
4419 case X86::VRCPSSr_Int:
4421 case X86::VRCPSSm_Int:
4422 case X86::VROUNDSDr:
4423 case X86::VROUNDSDm:
4424 case X86::VROUNDSDr_Int:
4425 case X86::VROUNDSDm_Int:
4426 case X86::VROUNDSSr:
4427 case X86::VROUNDSSm:
4428 case X86::VROUNDSSr_Int:
4429 case X86::VROUNDSSm_Int:
4430 case X86::VRSQRTSSr:
4431 case X86::VRSQRTSSr_Int:
4432 case X86::VRSQRTSSm:
4433 case X86::VRSQRTSSm_Int:
4435 case X86::VSQRTSSr_Int:
4437 case X86::VSQRTSSm_Int:
4439 case X86::VSQRTSDr_Int:
4441 case X86::VSQRTSDm_Int:
4443 case X86::VCVTSI2SSZrr:
4444 case X86::VCVTSI2SSZrm:
4445 case X86::VCVTSI2SSZrr_Int:
4446 case X86::VCVTSI2SSZrrb_Int:
4447 case X86::VCVTSI2SSZrm_Int:
4448 case X86::VCVTSI642SSZrr:
4449 case X86::VCVTSI642SSZrm:
4450 case X86::VCVTSI642SSZrr_Int:
4451 case X86::VCVTSI642SSZrrb_Int:
4452 case X86::VCVTSI642SSZrm_Int:
4453 case X86::VCVTSI2SDZrr:
4454 case X86::VCVTSI2SDZrm:
4455 case X86::VCVTSI2SDZrr_Int:
4456 case X86::VCVTSI2SDZrrb_Int:
4457 case X86::VCVTSI2SDZrm_Int:
4458 case X86::VCVTSI642SDZrr:
4459 case X86::VCVTSI642SDZrm:
4460 case X86::VCVTSI642SDZrr_Int:
4461 case X86::VCVTSI642SDZrrb_Int:
4462 case X86::VCVTSI642SDZrm_Int:
4463 case X86::VCVTUSI2SSZrr:
4464 case X86::VCVTUSI2SSZrm:
4465 case X86::VCVTUSI2SSZrr_Int:
4466 case X86::VCVTUSI2SSZrrb_Int:
4467 case X86::VCVTUSI2SSZrm_Int:
4468 case X86::VCVTUSI642SSZrr:
4469 case X86::VCVTUSI642SSZrm:
4470 case X86::VCVTUSI642SSZrr_Int:
4471 case X86::VCVTUSI642SSZrrb_Int:
4472 case X86::VCVTUSI642SSZrm_Int:
4473 case X86::VCVTUSI2SDZrr:
4474 case X86::VCVTUSI2SDZrm:
4475 case X86::VCVTUSI2SDZrr_Int:
4476 case X86::VCVTUSI2SDZrm_Int:
4477 case X86::VCVTUSI642SDZrr:
4478 case X86::VCVTUSI642SDZrm:
4479 case X86::VCVTUSI642SDZrr_Int:
4480 case X86::VCVTUSI642SDZrrb_Int:
4481 case X86::VCVTUSI642SDZrm_Int:
4482 case X86::VCVTSD2SSZrr:
4483 case X86::VCVTSD2SSZrr_Int:
4484 case X86::VCVTSD2SSZrrb_Int:
4485 case X86::VCVTSD2SSZrm:
4486 case X86::VCVTSD2SSZrm_Int:
4487 case X86::VCVTSS2SDZrr:
4488 case X86::VCVTSS2SDZrr_Int:
4489 case X86::VCVTSS2SDZrrb_Int:
4490 case X86::VCVTSS2SDZrm:
4491 case X86::VCVTSS2SDZrm_Int:
4492 case X86::VGETEXPSDZr:
4493 case X86::VGETEXPSDZrb:
4494 case X86::VGETEXPSDZm:
4495 case X86::VGETEXPSSZr:
4496 case X86::VGETEXPSSZrb:
4497 case X86::VGETEXPSSZm:
4498 case X86::VGETMANTSDZrri:
4499 case X86::VGETMANTSDZrrib:
4500 case X86::VGETMANTSDZrmi:
4501 case X86::VGETMANTSSZrri:
4502 case X86::VGETMANTSSZrrib:
4503 case X86::VGETMANTSSZrmi:
4504 case X86::VRNDSCALESDZr:
4505 case X86::VRNDSCALESDZr_Int:
4506 case X86::VRNDSCALESDZrb_Int:
4507 case X86::VRNDSCALESDZm:
4508 case X86::VRNDSCALESDZm_Int:
4509 case X86::VRNDSCALESSZr:
4510 case X86::VRNDSCALESSZr_Int:
4511 case X86::VRNDSCALESSZrb_Int:
4512 case X86::VRNDSCALESSZm:
4513 case X86::VRNDSCALESSZm_Int:
4514 case X86::VRCP14SDZrr:
4515 case X86::VRCP14SDZrm:
4516 case X86::VRCP14SSZrr:
4517 case X86::VRCP14SSZrm:
4518 case X86::VRCP28SDZr:
4519 case X86::VRCP28SDZrb:
4520 case X86::VRCP28SDZm:
4521 case X86::VRCP28SSZr:
4522 case X86::VRCP28SSZrb:
4523 case X86::VRCP28SSZm:
4524 case X86::VREDUCESSZrmi:
4525 case X86::VREDUCESSZrri:
4526 case X86::VREDUCESSZrrib:
4527 case X86::VRSQRT14SDZrr:
4528 case X86::VRSQRT14SDZrm:
4529 case X86::VRSQRT14SSZrr:
4530 case X86::VRSQRT14SSZrm:
4531 case X86::VRSQRT28SDZr:
4532 case X86::VRSQRT28SDZrb:
4533 case X86::VRSQRT28SDZm:
4534 case X86::VRSQRT28SSZr:
4535 case X86::VRSQRT28SSZrb:
4536 case X86::VRSQRT28SSZm:
4537 case X86::VSQRTSSZr:
4538 case X86::VSQRTSSZr_Int:
4539 case X86::VSQRTSSZrb_Int:
4540 case X86::VSQRTSSZm:
4541 case X86::VSQRTSSZm_Int:
4542 case X86::VSQRTSDZr:
4543 case X86::VSQRTSDZr_Int:
4544 case X86::VSQRTSDZrb_Int:
4545 case X86::VSQRTSDZm:
4546 case X86::VSQRTSDZm_Int:
4590 if (X86::VR128RegClass.
contains(Reg)) {
4593 unsigned Opc = Subtarget.hasAVX() ? X86::VXORPSrr : X86::XORPSrr;
4598 }
else if (X86::VR256RegClass.
contains(Reg)) {
4601 unsigned XReg = TRI->
getSubReg(Reg, X86::sub_xmm);
4607 }
else if (X86::GR64RegClass.
contains(Reg)) {
4610 unsigned XReg = TRI->
getSubReg(Reg, X86::sub_32bit);
4616 }
else if (X86::GR32RegClass.
contains(Reg)) {
4625 int PtrOffset = 0) {
4626 unsigned NumAddrOps = MOs.
size();
4628 if (NumAddrOps < 4) {
4630 for (
unsigned i = 0; i != NumAddrOps; ++i)
4636 assert(MOs.
size() == 5 &&
"Unexpected memory operand list length");
4637 for (
unsigned i = 0; i != NumAddrOps; ++i) {
4639 if (i == 3 && PtrOffset != 0) {
4667 dbgs() <<
"WARNING: Unable to update register constraint for operand " 4668 << Idx <<
" of instruction:\n";
4688 for (
unsigned i = 0; i != NumOps; ++i) {
4692 for (
unsigned i = NumOps + 2, e = MI.
getNumOperands(); i != e; ++i) {
4700 MBB->
insert(InsertPt, NewMI);
4709 int PtrOffset = 0) {
4718 assert(MO.
isReg() &&
"Expected to fold into reg operand!");
4728 MBB->
insert(InsertPt, NewMI);
4748 case X86::INSERTPSrr:
4749 case X86::VINSERTPSrr:
4750 case X86::VINSERTPSZrr:
4755 unsigned ZMask = Imm & 15;
4756 unsigned DstIdx = (Imm >> 4) & 3;
4757 unsigned SrcIdx = (Imm >> 6) & 3;
4762 if (Size <= RCSize && 4 <= Align) {
4763 int PtrOffset = SrcIdx * 4;
4764 unsigned NewImm = (DstIdx << 4) | ZMask;
4765 unsigned NewOpCode =
4766 (MI.
getOpcode() == X86::VINSERTPSZrr) ? X86::VINSERTPSZrm :
4767 (MI.
getOpcode() == X86::VINSERTPSrr) ? X86::VINSERTPSrm :
4770 FuseInst(MF, NewOpCode, OpNum, MOs, InsertPt, MI, *
this, PtrOffset);
4776 case X86::MOVHLPSrr:
4777 case X86::VMOVHLPSrr:
4778 case X86::VMOVHLPSZrr:
4786 if (Size <= RCSize && 8 <= Align) {
4787 unsigned NewOpCode =
4788 (MI.
getOpcode() == X86::VMOVHLPSZrr) ? X86::VMOVLPSZ128rm :
4789 (MI.
getOpcode() == X86::VMOVHLPSrr) ? X86::VMOVLPSrm :
4792 FuseInst(MF, NewOpCode, OpNum, MOs, InsertPt, MI, *
this, 8);
4824 unsigned Size,
unsigned Align,
bool AllowCommute)
const {
4825 bool isSlowTwoMemOps = Subtarget.slowTwoMemOps();
4826 bool isTwoAddrFold =
false;
4865 foldMemoryOperandCustom(MF, MI, OpNum, MOs, InsertPt, Size, Align))
4873 if (isTwoAddr && NumOps >= 2 && OpNum < 2 && MI.
getOperand(0).
isReg() &&
4877 isTwoAddrFold =
true;
4881 NewMI =
MakeM0Inst(*
this, X86::MOV32mi, MOs, InsertPt, MI);
4891 unsigned Opcode = I->
DstOp;
4893 if (Align < MinAlign)
4895 bool NarrowToMOV32rm =
false;
4901 if (Size < RCSize) {
4904 if (Opcode != X86::MOV64rm || RCSize != 8 || Size != 4)
4911 Opcode = X86::MOV32rm;
4912 NarrowToMOV32rm =
true;
4919 NewMI =
FuseInst(MF, Opcode, OpNum, MOs, InsertPt, MI, *
this);
4921 if (NarrowToMOV32rm) {
4937 unsigned CommuteOpIdx1 = OpNum, CommuteOpIdx2 = CommuteAnyOperandIndex;
4950 if ((HasDef && Reg0 == Reg1 && Tied1) ||
4951 (HasDef && Reg0 == Reg2 && Tied2))
4955 commuteInstruction(MI,
false, CommuteOpIdx1, CommuteOpIdx2);
4960 if (CommutedMI != &MI) {
4968 Size, Align,
false);
4974 commuteInstruction(MI,
false, CommuteOpIdx1, CommuteOpIdx2);
4975 if (!UncommutedMI) {
4979 if (UncommutedMI != &MI) {
4992 dbgs() <<
"We failed to fuse operand " << OpNum <<
" in " <<
MI;
5012 for (
auto Op : Ops) {
5024 if (!RI.needsStackRealignment(MF))
5026 std::min(Alignment, Subtarget.getFrameLowering()->getStackAlignment());
5027 if (Ops.size() == 2 && Ops[0] == 0 && Ops[1] == 1) {
5028 unsigned NewOpc = 0;
5029 unsigned RCSize = 0;
5031 default:
return nullptr;
5032 case X86::TEST8rr: NewOpc = X86::CMP8ri; RCSize = 1;
break;
5033 case X86::TEST16rr: NewOpc = X86::CMP16ri8; RCSize = 2;
break;
5034 case X86::TEST32rr: NewOpc = X86::CMP32ri8; RCSize = 4;
break;
5035 case X86::TEST64rr: NewOpc = X86::CMP64ri8; RCSize = 8;
break;
5044 }
else if (Ops.size() != 1)
5049 Size, Alignment,
true);
5076 if ((Opc == X86::MOVSSrm || Opc == X86::VMOVSSrm || Opc == X86::VMOVSSZrm) &&
5082 case X86::ADDSSrr_Int:
case X86::VADDSSrr_Int:
case X86::VADDSSZrr_Int:
5083 case X86::CMPSSrr_Int:
case X86::VCMPSSrr_Int:
case X86::VCMPSSZrr_Int:
5084 case X86::DIVSSrr_Int:
case X86::VDIVSSrr_Int:
case X86::VDIVSSZrr_Int:
5085 case X86::MAXSSrr_Int:
case X86::VMAXSSrr_Int:
case X86::VMAXSSZrr_Int:
5086 case X86::MINSSrr_Int:
case X86::VMINSSrr_Int:
case X86::VMINSSZrr_Int:
5087 case X86::MULSSrr_Int:
case X86::VMULSSrr_Int:
case X86::VMULSSZrr_Int:
5088 case X86::SUBSSrr_Int:
case X86::VSUBSSrr_Int:
case X86::VSUBSSZrr_Int:
5089 case X86::VADDSSZrr_Intk:
case X86::VADDSSZrr_Intkz:
5090 case X86::VDIVSSZrr_Intk:
case X86::VDIVSSZrr_Intkz:
5091 case X86::VMAXSSZrr_Intk:
case X86::VMAXSSZrr_Intkz:
5092 case X86::VMINSSZrr_Intk:
case X86::VMINSSZrr_Intkz:
5093 case X86::VMULSSZrr_Intk:
case X86::VMULSSZrr_Intkz:
5094 case X86::VSUBSSZrr_Intk:
case X86::VSUBSSZrr_Intkz:
5095 case X86::VFMADDSS4rr_Int:
case X86::VFNMADDSS4rr_Int:
5096 case X86::VFMSUBSS4rr_Int:
case X86::VFNMSUBSS4rr_Int:
5097 case X86::VFMADD132SSr_Int:
case X86::VFNMADD132SSr_Int:
5098 case X86::VFMADD213SSr_Int:
case X86::VFNMADD213SSr_Int:
5099 case X86::VFMADD231SSr_Int:
case X86::VFNMADD231SSr_Int:
5100 case X86::VFMSUB132SSr_Int:
case X86::VFNMSUB132SSr_Int:
5101 case X86::VFMSUB213SSr_Int:
case X86::VFNMSUB213SSr_Int:
5102 case X86::VFMSUB231SSr_Int:
case X86::VFNMSUB231SSr_Int:
5103 case X86::VFMADD132SSZr_Int:
case X86::VFNMADD132SSZr_Int:
5104 case X86::VFMADD213SSZr_Int:
case X86::VFNMADD213SSZr_Int:
5105 case X86::VFMADD231SSZr_Int:
case X86::VFNMADD231SSZr_Int:
5106 case X86::VFMSUB132SSZr_Int:
case X86::VFNMSUB132SSZr_Int:
5107 case X86::VFMSUB213SSZr_Int:
case X86::VFNMSUB213SSZr_Int:
5108 case X86::VFMSUB231SSZr_Int:
case X86::VFNMSUB231SSZr_Int:
5109 case X86::VFMADD132SSZr_Intk:
case X86::VFNMADD132SSZr_Intk:
5110 case X86::VFMADD213SSZr_Intk:
case X86::VFNMADD213SSZr_Intk:
5111 case X86::VFMADD231SSZr_Intk:
case X86::VFNMADD231SSZr_Intk:
5112 case X86::VFMSUB132SSZr_Intk:
case X86::VFNMSUB132SSZr_Intk:
5113 case X86::VFMSUB213SSZr_Intk:
case X86::VFNMSUB213SSZr_Intk:
5114 case X86::VFMSUB231SSZr_Intk:
case X86::VFNMSUB231SSZr_Intk:
5115 case X86::VFMADD132SSZr_Intkz:
case X86::VFNMADD132SSZr_Intkz:
5116 case X86::VFMADD213SSZr_Intkz:
case X86::VFNMADD213SSZr_Intkz:
5117 case X86::VFMADD231SSZr_Intkz:
case X86::VFNMADD231SSZr_Intkz:
5118 case X86::VFMSUB132SSZr_Intkz:
case X86::VFNMSUB132SSZr_Intkz:
5119 case X86::VFMSUB213SSZr_Intkz:
case X86::VFNMSUB213SSZr_Intkz:
5120 case X86::VFMSUB231SSZr_Intkz:
case X86::VFNMSUB231SSZr_Intkz:
5127 if ((Opc == X86::MOVSDrm || Opc == X86::VMOVSDrm || Opc == X86::VMOVSDZrm) &&
5133 case X86::ADDSDrr_Int:
case X86::VADDSDrr_Int:
case X86::VADDSDZrr_Int:
5134 case X86::CMPSDrr_Int:
case X86::VCMPSDrr_Int:
case X86::VCMPSDZrr_Int:
5135 case X86::DIVSDrr_Int:
case X86::VDIVSDrr_Int:
case X86::VDIVSDZrr_Int:
5136 case X86::MAXSDrr_Int:
case X86::VMAXSDrr_Int:
case X86::VMAXSDZrr_Int:
5137 case X86::MINSDrr_Int:
case X86::VMINSDrr_Int:
case X86::VMINSDZrr_Int:
5138 case X86::MULSDrr_Int:
case X86::VMULSDrr_Int:
case X86::VMULSDZrr_Int:
5139 case X86::SUBSDrr_Int:
case X86::VSUBSDrr_Int:
case X86::VSUBSDZrr_Int:
5140 case X86::VADDSDZrr_Intk:
case X86::VADDSDZrr_Intkz:
5141 case X86::VDIVSDZrr_Intk:
case X86::VDIVSDZrr_Intkz:
5142 case X86::VMAXSDZrr_Intk:
case X86::VMAXSDZrr_Intkz:
5143 case X86::VMINSDZrr_Intk:
case X86::VMINSDZrr_Intkz:
5144 case X86::VMULSDZrr_Intk:
case X86::VMULSDZrr_Intkz:
5145 case X86::VSUBSDZrr_Intk:
case X86::VSUBSDZrr_Intkz:
5146 case X86::VFMADDSD4rr_Int:
case X86::VFNMADDSD4rr_Int:
5147 case X86::VFMSUBSD4rr_Int:
case X86::VFNMSUBSD4rr_Int:
5148 case X86::VFMADD132SDr_Int:
case X86::VFNMADD132SDr_Int:
5149 case X86::VFMADD213SDr_Int:
case X86::VFNMADD213SDr_Int:
5150 case X86::VFMADD231SDr_Int:
case X86::VFNMADD231SDr_Int:
5151 case X86::VFMSUB132SDr_Int:
case X86::VFNMSUB132SDr_Int:
5152 case X86::VFMSUB213SDr_Int:
case X86::VFNMSUB213SDr_Int:
5153 case X86::VFMSUB231SDr_Int:
case X86::VFNMSUB231SDr_Int:
5154 case X86::VFMADD132SDZr_Int:
case X86::VFNMADD132SDZr_Int:
5155 case X86::VFMADD213SDZr_Int:
case X86::VFNMADD213SDZr_Int:
5156 case X86::VFMADD231SDZr_Int:
case X86::VFNMADD231SDZr_Int:
5157 case X86::VFMSUB132SDZr_Int:
case X86::VFNMSUB132SDZr_Int:
5158 case X86::VFMSUB213SDZr_Int:
case X86::VFNMSUB213SDZr_Int:
5159 case X86::VFMSUB231SDZr_Int:
case X86::VFNMSUB231SDZr_Int:
5160 case X86::VFMADD132SDZr_Intk:
case X86::VFNMADD132SDZr_Intk:
5161 case X86::VFMADD213SDZr_Intk:
case X86::VFNMADD213SDZr_Intk:
5162 case X86::VFMADD231SDZr_Intk:
case X86::VFNMADD231SDZr_Intk:
5163 case X86::VFMSUB132SDZr_Intk:
case X86::VFNMSUB132SDZr_Intk:
5164 case X86::VFMSUB213SDZr_Intk:
case X86::VFNMSUB213SDZr_Intk:
5165 case X86::VFMSUB231SDZr_Intk:
case X86::VFNMSUB231SDZr_Intk:
5166 case X86::VFMADD132SDZr_Intkz:
case X86::VFNMADD132SDZr_Intkz:
5167 case X86::VFMADD213SDZr_Intkz:
case X86::VFNMADD213SDZr_Intkz:
5168 case X86::VFMADD231SDZr_Intkz:
case X86::VFNMADD231SDZr_Intkz:
5169 case X86::VFMSUB132SDZr_Intkz:
case X86::VFNMSUB132SDZr_Intkz:
5170 case X86::VFMSUB213SDZr_Intkz:
case X86::VFNMSUB213SDZr_Intkz:
5171 case X86::VFMSUB231SDZr_Intkz:
case X86::VFNMSUB231SDZr_Intkz:
5188 for (
auto Op : Ops) {
5212 unsigned Alignment = 0;
5217 case X86::AVX512_512_SET0:
5218 case X86::AVX512_512_SETALLONES:
5221 case X86::AVX2_SETALLONES:
5222 case X86::AVX1_SETALLONES:
5224 case X86::AVX512_256_SET0:
5228 case X86::V_SETALLONES:
5229 case X86::AVX512_128_SET0:
5234 case X86::AVX512_FsFLD0SD:
5238 case X86::AVX512_FsFLD0SS:
5244 if (Ops.size() == 2 && Ops[0] == 0 && Ops[1] == 1) {
5245 unsigned NewOpc = 0;
5247 default:
return nullptr;
5248 case X86::TEST8rr: NewOpc = X86::CMP8ri;
break;
5249 case X86::TEST16rr: NewOpc = X86::CMP16ri8;
break;
5250 case X86::TEST32rr: NewOpc = X86::CMP32ri8;
break;
5251 case X86::TEST64rr: NewOpc = X86::CMP64ri8;
break;
5256 }
else if (Ops.size() != 1)
5268 case X86::V_SETALLONES:
5269 case X86::AVX2_SETALLONES:
5270 case X86::AVX1_SETALLONES:
5272 case X86::AVX512_128_SET0:
5273 case X86::AVX512_256_SET0:
5274 case X86::AVX512_512_SET0:
5275 case X86::AVX512_512_SETALLONES:
5277 case X86::AVX512_FsFLD0SD:
5279 case X86::AVX512_FsFLD0SS: {
5289 unsigned PICBase = 0;
5291 if (Subtarget.is64Bit())
5305 if (Opc == X86::FsFLD0SS || Opc == X86::AVX512_FsFLD0SS)
5307 else if (Opc == X86::FsFLD0SD || Opc == X86::AVX512_FsFLD0SD)
5309 else if (Opc == X86::AVX512_512_SET0 || Opc == X86::AVX512_512_SETALLONES)
5311 else if (Opc == X86::AVX2_SETALLONES || Opc == X86::AVX_SET0 ||
5312 Opc == X86::AVX512_256_SET0 || Opc == X86::AVX1_SETALLONES)
5314 else if (Opc == X86::MMX_SET0)
5319 bool IsAllOnes = (Opc == X86::V_SETALLONES || Opc == X86::AVX2_SETALLONES ||
5320 Opc == X86::AVX512_512_SETALLONES ||
5321 Opc == X86::AVX1_SETALLONES);
5345 0, Alignment,
true);
5356 if (!MMO->isStore()) {
5363 MMO->
getSize(), MMO->getBaseAlignment(), MMO->getAAInfo(),
nullptr,
5364 MMO->getSyncScopeID(), MMO->getOrdering(),
5365 MMO->getFailureOrdering()));
5377 if (!MMO->isStore())
5380 if (!MMO->isLoad()) {
5387 MMO->
getSize(), MMO->getBaseAlignment(), MMO->getAAInfo(),
nullptr,
5388 MMO->getSyncScopeID(), MMO->getOrdering(),
5389 MMO->getFailureOrdering()));
5402 unsigned Opc = I->
DstOp;
5406 if (UnfoldLoad && !FoldedLoad)
5408 UnfoldLoad &= FoldedLoad;
5409 if (UnfoldStore && !FoldedStore)
5411 UnfoldStore &= FoldedStore;
5417 Subtarget.isUnalignedMem16Slow())
5465 MIB.
addReg(ImpOp.getReg(),
5475 case X86::CMP64ri32:
5489 case X86::CMP64ri32: NewOpc = X86::TEST64rr;
break;
5491 case X86::CMP32ri: NewOpc = X86::TEST32rr;
break;
5493 case X86::CMP16ri: NewOpc = X86::TEST16rr;
break;
5494 case X86::CMP8ri: NewOpc = X86::TEST8rr;
break;
5522 unsigned Opc = I->
DstOp;
5530 unsigned NumDefs = MCID.
NumDefs;
5531 std::vector<SDValue> AddrOps;
5532 std::vector<SDValue> BeforeOps;
5533 std::vector<SDValue> AfterOps;
5536 for (
unsigned i = 0; i != NumOps-1; ++i) {
5539 AddrOps.push_back(Op);
5540 else if (i < Index-NumDefs)
5541 BeforeOps.push_back(Op);
5542 else if (i > Index-NumDefs)
5543 AfterOps.push_back(Op);
5546 AddrOps.push_back(Chain);
5552 auto MMOs =
extractLoadMMOs(cast<MachineSDNode>(N)->memoperands(), MF);
5553 if (MMOs.empty() && RC == &X86::VR128RegClass &&
5554 Subtarget.isUnalignedMem16Slow())
5559 unsigned Alignment = std::max<uint32_t>(TRI.
getSpillSize(*RC), 16);
5560 bool isAligned = !MMOs.empty() && MMOs.front()->getAlignment() >= Alignment;
5570 std::vector<EVT> VTs;
5576 for (
unsigned i = 0, e = N->
getNumValues(); i != e; ++i) {
5582 BeforeOps.push_back(
SDValue(Load, 0));
5583 BeforeOps.insert(BeforeOps.end(), AfterOps.begin(), AfterOps.end());
5587 case X86::CMP64ri32:
5598 case X86::CMP64ri32: Opc = X86::TEST64rr;
break;
5600 case X86::CMP32ri: Opc = X86::TEST32rr;
break;
5602 case X86::CMP16ri: Opc = X86::TEST16rr;
break;
5603 case X86::CMP8ri: Opc = X86::TEST8rr;
break;
5605 BeforeOps[1] = BeforeOps[0];
5614 AddrOps.push_back(
SDValue(NewNode, 0));
5615 AddrOps.push_back(Chain);
5617 if (MMOs.empty() && RC == &X86::VR128RegClass &&
5618 Subtarget.isUnalignedMem16Slow())
5623 unsigned Alignment = std::max<uint32_t>(TRI.
getSpillSize(*RC), 16);
5624 bool isAligned = !MMOs.empty() && MMOs.front()->getAlignment() >= Alignment;
5638 bool UnfoldLoad,
bool UnfoldStore,
5639 unsigned *LoadRegIndex)
const {
5645 if (UnfoldLoad && !FoldedLoad)
5647 if (UnfoldStore && !FoldedStore)
5656 int64_t &Offset1, int64_t &Offset2)
const {
5662 default:
return false;
5672 case X86::MMX_MOVD64rm:
5673 case X86::MMX_MOVQ64rm:
5683 case X86::VMOVAPSrm:
5684 case X86::VMOVUPSrm:
5685 case X86::VMOVAPDrm:
5686 case X86::VMOVUPDrm:
5687 case X86::VMOVDQArm:
5688 case X86::VMOVDQUrm:
5689 case X86::VMOVAPSYrm:
5690 case X86::VMOVUPSYrm:
5691 case X86::VMOVAPDYrm:
5692 case X86::VMOVUPDYrm:
5693 case X86::VMOVDQAYrm:
5694 case X86::VMOVDQUYrm:
5696 case X86::VMOVSSZrm:
5697 case X86::VMOVSDZrm:
5698 case X86::VMOVAPSZ128rm:
5699 case X86::VMOVUPSZ128rm:
5700 case X86::VMOVAPSZ128rm_NOVLX:
5701 case X86::VMOVUPSZ128rm_NOVLX:
5702 case X86::VMOVAPDZ128rm:
5703 case X86::VMOVUPDZ128rm:
5704 case X86::VMOVDQU8Z128rm:
5705 case X86::VMOVDQU16Z128rm:
5706 case X86::VMOVDQA32Z128rm:
5707 case X86::VMOVDQU32Z128rm:
5708 case X86::VMOVDQA64Z128rm:
5709 case X86::VMOVDQU64Z128rm:
5710 case X86::VMOVAPSZ256rm:
5711 case X86::VMOVUPSZ256rm:
5712 case X86::VMOVAPSZ256rm_NOVLX:
5713 case X86::VMOVUPSZ256rm_NOVLX:
5714 case X86::VMOVAPDZ256rm:
5715 case X86::VMOVUPDZ256rm:
5716 case X86::VMOVDQU8Z256rm:
5717 case X86::VMOVDQU16Z256rm:
5718 case X86::VMOVDQA32Z256rm:
5719 case X86::VMOVDQU32Z256rm:
5720 case X86::VMOVDQA64Z256rm:
5721 case X86::VMOVDQU64Z256rm:
5722 case X86::VMOVAPSZrm:
5723 case X86::VMOVUPSZrm:
5724 case X86::VMOVAPDZrm:
5725 case X86::VMOVUPDZrm:
5726 case X86::VMOVDQU8Zrm:
5727 case X86::VMOVDQU16Zrm:
5728 case X86::VMOVDQA32Zrm:
5729 case X86::VMOVDQU32Zrm:
5730 case X86::VMOVDQA64Zrm:
5731 case X86::VMOVDQU64Zrm:
5739 default:
return false;
5749 case X86::MMX_MOVD64rm:
5750 case X86::MMX_MOVQ64rm:
5760 case X86::VMOVAPSrm:
5761 case X86::VMOVUPSrm:
5762 case X86::VMOVAPDrm:
5763 case X86::VMOVUPDrm:
5764 case X86::VMOVDQArm:
5765 case X86::VMOVDQUrm:
5766 case X86::VMOVAPSYrm:
5767 case X86::VMOVUPSYrm:
5768 case X86::VMOVAPDYrm:
5769 case X86::VMOVUPDYrm:
5770 case X86::VMOVDQAYrm:
5771 case X86::VMOVDQUYrm:
5773 case X86::VMOVSSZrm:
5774 case X86::VMOVSDZrm:
5775 case X86::VMOVAPSZ128rm:
5776 case X86::VMOVUPSZ128rm:
5777 case X86::VMOVAPSZ128rm_NOVLX:
5778 case X86::VMOVUPSZ128rm_NOVLX:
5779 case X86::VMOVAPDZ128rm:
5780 case X86::VMOVUPDZ128rm:
5781 case X86::VMOVDQU8Z128rm:
5782 case X86::VMOVDQU16Z128rm:
5783 case X86::VMOVDQA32Z128rm:
5784 case X86::VMOVDQU32Z128rm:
5785 case X86::VMOVDQA64Z128rm:
5786 case X86::VMOVDQU64Z128rm:
5787 case X86::VMOVAPSZ256rm:
5788 case X86::VMOVUPSZ256rm:
5789 case X86::VMOVAPSZ256rm_NOVLX:
5790 case X86::VMOVUPSZ256rm_NOVLX:
5791 case X86::VMOVAPDZ256rm:
5792 case X86::VMOVUPDZ256rm:
5793 case X86::VMOVDQU8Z256rm:
5794 case X86::VMOVDQU16Z256rm:
5795 case X86::VMOVDQA32Z256rm:
5796 case X86::VMOVDQU32Z256rm:
5797 case X86::VMOVDQA64Z256rm:
5798 case X86::VMOVDQU64Z256rm:
5799 case X86::VMOVAPSZrm:
5800 case X86::VMOVUPSZrm:
5801 case X86::VMOVAPDZrm:
5802 case X86::VMOVUPDZrm:
5803 case X86::VMOVDQU8Zrm:
5804 case X86::VMOVDQU16Zrm:
5805 case X86::VMOVDQA32Zrm:
5806 case X86::VMOVDQU32Zrm:
5807 case X86::VMOVDQA64Zrm:
5808 case X86::VMOVDQU64Zrm:
5817 auto HasSameOp = [&](
int I) {
5833 if (!Disp1 || !Disp2)
5837 Offset2 = Disp2->getSExtValue();
5842 int64_t Offset1, int64_t Offset2,
5843 unsigned NumLoads)
const {
5844 assert(Offset2 > Offset1);
5845 if ((Offset2 - Offset1) / 8 > 64)
5858 case X86::MMX_MOVD64rm:
5859 case X86::MMX_MOVQ64rm:
5868 if (Subtarget.is64Bit()) {
5871 }
else if (NumLoads) {
5891 assert(Cond.
size() == 1 &&
"Invalid X86 branch condition!");
5901 return !(RC == &X86::CCRRegClass || RC == &X86::DFCCRRegClass ||
5902 RC == &X86::RFP32RegClass || RC == &X86::RFP64RegClass ||
5903 RC == &X86::RFP80RegClass);
5913 assert((!Subtarget.is64Bit() ||
5916 "X86-64 PIC uses RIP relative addressing");
5920 if (GlobalBaseReg != 0)
5927 Subtarget.is64Bit() ? &X86::GR64_NOSPRegClass : &X86::GR32_NOSPRegClass);
5937 { X86::MOVAPSmr, X86::MOVAPDmr, X86::MOVDQAmr },
5938 { X86::MOVAPSrm, X86::MOVAPDrm, X86::MOVDQArm },
5939 { X86::MOVAPSrr, X86::MOVAPDrr, X86::MOVDQArr },
5940 { X86::MOVUPSmr, X86::MOVUPDmr, X86::MOVDQUmr },
5941 { X86::MOVUPSrm, X86::MOVUPDrm, X86::MOVDQUrm },
5942 { X86::MOVLPSmr, X86::MOVLPDmr, X86::MOVPQI2QImr },
5943 { X86::MOVSDmr, X86::MOVSDmr, X86::MOVPQI2QImr },
5944 { X86::MOVSSmr, X86::MOVSSmr, X86::MOVPDI2DImr },
5945 { X86::MOVSDrm, X86::MOVSDrm, X86::MOVQI2PQIrm },
5946 { X86::MOVSSrm, X86::MOVSSrm, X86::MOVDI2PDIrm },
5947 { X86::MOVNTPSmr, X86::MOVNTPDmr, X86::MOVNTDQmr },
5948 { X86::ANDNPSrm, X86::ANDNPDrm, X86::PANDNrm },
5949 { X86::ANDNPSrr, X86::ANDNPDrr, X86::PANDNrr },
5950 { X86::ANDPSrm, X86::ANDPDrm, X86::PANDrm },
5951 { X86::ANDPSrr, X86::ANDPDrr, X86::PANDrr },
5952 { X86::ORPSrm, X86::ORPDrm, X86::PORrm },
5953 { X86::ORPSrr, X86::ORPDrr, X86::PORrr },
5954 { X86::XORPSrm, X86::XORPDrm, X86::PXORrm },
5955 { X86::XORPSrr, X86::XORPDrr, X86::PXORrr },
5956 { X86::UNPCKLPDrm, X86::UNPCKLPDrm, X86::PUNPCKLQDQrm },
5957 { X86::MOVLHPSrr, X86::UNPCKLPDrr, X86::PUNPCKLQDQrr },
5958 { X86::UNPCKHPDrm, X86::UNPCKHPDrm, X86::PUNPCKHQDQrm },
5959 { X86::UNPCKHPDrr, X86::UNPCKHPDrr, X86::PUNPCKHQDQrr },
5960 { X86::UNPCKLPSrm, X86::UNPCKLPSrm, X86::PUNPCKLDQrm },
5961 { X86::UNPCKLPSrr, X86::UNPCKLPSrr, X86::PUNPCKLDQrr },
5962 { X86::UNPCKHPSrm, X86::UNPCKHPSrm, X86::PUNPCKHDQrm },
5963 { X86::UNPCKHPSrr, X86::UNPCKHPSrr, X86::PUNPCKHDQrr },
5964 { X86::EXTRACTPSmr, X86::EXTRACTPSmr, X86::PEXTRDmr },
5965 { X86::EXTRACTPSrr, X86::EXTRACTPSrr, X86::PEXTRDrr },
5967 { X86::VMOVAPSmr, X86::VMOVAPDmr, X86::VMOVDQAmr },
5968 { X86::VMOVAPSrm, X86::VMOVAPDrm, X86::VMOVDQArm },
5969 { X86::VMOVAPSrr, X86::VMOVAPDrr, X86::VMOVDQArr },
5970 { X86::VMOVUPSmr, X86::VMOVUPDmr, X86::VMOVDQUmr },
5971 { X86::VMOVUPSrm, X86::VMOVUPDrm, X86::VMOVDQUrm },
5972 { X86::VMOVLPSmr, X86::VMOVLPDmr, X86::VMOVPQI2QImr },
5973 { X86::VMOVSDmr, X86::VMOVSDmr, X86::VMOVPQI2QImr },
5974 { X86::VMOVSSmr, X86::VMOVSSmr, X86::VMOVPDI2DImr },
5975 { X86::VMOVSDrm, X86::VMOVSDrm, X86::VMOVQI2PQIrm },
5976 { X86::VMOVSSrm, X86::VMOVSSrm, X86::VMOVDI2PDIrm },
5977 { X86::VMOVNTPSmr, X86::VMOVNTPDmr, X86::VMOVNTDQmr },
5978 { X86::VANDNPSrm, X86::VANDNPDrm, X86::VPANDNrm },
5979 { X86::VANDNPSrr, X86::VANDNPDrr, X86::VPANDNrr },
5980 { X86::VANDPSrm, X86::VANDPDrm, X86::VPANDrm },
5981 { X86::VANDPSrr, X86::VANDPDrr, X86::VPANDrr },
5982 { X86::VORPSrm, X86::VORPDrm, X86::VPORrm },
5983 { X86::VORPSrr, X86::VORPDrr, X86::VPORrr },
5984 { X86::VXORPSrm, X86::VXORPDrm, X86::VPXORrm },
5985 { X86::VXORPSrr, X86::VXORPDrr, X86::VPXORrr },
5986 { X86::VUNPCKLPDrm, X86::VUNPCKLPDrm, X86::VPUNPCKLQDQrm },
5987 { X86::VMOVLHPSrr, X86::VUNPCKLPDrr, X86::VPUNPCKLQDQrr },
5988 { X86::VUNPCKHPDrm, X86::VUNPCKHPDrm, X86::VPUNPCKHQDQrm },
5989 { X86::VUNPCKHPDrr, X86::VUNPCKHPDrr, X86::VPUNPCKHQDQrr },
5990 { X86::VUNPCKLPSrm, X86::VUNPCKLPSrm, X86::VPUNPCKLDQrm },
5991 { X86::VUNPCKLPSrr, X86::VUNPCKLPSrr, X86::VPUNPCKLDQrr },
5992 { X86::VUNPCKHPSrm, X86::VUNPCKHPSrm, X86::VPUNPCKHDQrm },
5993 { X86::VUNPCKHPSrr, X86::VUNPCKHPSrr, X86::VPUNPCKHDQrr },
5994 { X86::VEXTRACTPSmr, X86::VEXTRACTPSmr, X86::VPEXTRDmr },
5995 { X86::VEXTRACTPSrr, X86::VEXTRACTPSrr, X86::VPEXTRDrr },
5997 { X86::VMOVAPSYmr, X86::VMOVAPDYmr, X86::VMOVDQAYmr },
5998 { X86::VMOVAPSYrm, X86::VMOVAPDYrm, X86::VMOVDQAYrm },
5999 { X86::VMOVAPSYrr, X86::VMOVAPDYrr, X86::VMOVDQAYrr },
6000 { X86::VMOVUPSYmr, X86::VMOVUPDYmr, X86::VMOVDQUYmr },
6001 { X86::VMOVUPSYrm, X86::VMOVUPDYrm, X86::VMOVDQUYrm },
6002 { X86::VMOVNTPSYmr, X86::VMOVNTPDYmr, X86::VMOVNTDQYmr },
6003 { X86::VPERMPSYrm, X86::VPERMPSYrm, X86::VPERMDYrm },
6004 { X86::VPERMPSYrr, X86::VPERMPSYrr, X86::VPERMDYrr },
6005 { X86::VPERMPDYmi, X86::VPERMPDYmi, X86::VPERMQYmi },
6006 { X86::VPERMPDYri, X86::VPERMPDYri, X86::VPERMQYri },
6008 { X86::VMOVLPSZ128mr, X86::VMOVLPDZ128mr, X86::VMOVPQI2QIZmr },
6009 { X86::VMOVNTPSZ128mr, X86::VMOVNTPDZ128mr, X86::VMOVNTDQZ128mr },
6010 { X86::VMOVNTPSZ256mr, X86::VMOVNTPDZ256mr, X86::VMOVNTDQZ256mr },
6011 { X86::VMOVNTPSZmr, X86::VMOVNTPDZmr, X86::VMOVNTDQZmr },
6012 { X86::VMOVSDZmr, X86::VMOVSDZmr, X86::VMOVPQI2QIZmr },
6013 { X86::VMOVSSZmr, X86::VMOVSSZmr, X86::VMOVPDI2DIZmr },
6014 { X86::VMOVSDZrm, X86::VMOVSDZrm, X86::VMOVQI2PQIZrm },
6015 { X86::VMOVSSZrm, X86::VMOVSSZrm, X86::VMOVDI2PDIZrm },
6016 { X86::VBROADCASTSSZ128r, X86::VBROADCASTSSZ128r, X86::VPBROADCASTDZ128r },
6017 { X86::VBROADCASTSSZ128m, X86::VBROADCASTSSZ128m, X86::VPBROADCASTDZ128m },
6018 { X86::VBROADCASTSSZ256r, X86::VBROADCASTSSZ256r, X86::VPBROADCASTDZ256r },
6019 { X86::VBROADCASTSSZ256m, X86::VBROADCASTSSZ256m, X86::VPBROADCASTDZ256m },
6020 { X86::VBROADCASTSSZr, X86::VBROADCASTSSZr, X86::VPBROADCASTDZr },
6021 { X86::VBROADCASTSSZm, X86::VBROADCASTSSZm, X86::VPBROADCASTDZm },
6022 { X86::VBROADCASTSDZ256r, X86::VBROADCASTSDZ256r, X86::VPBROADCASTQZ256r },
6023 { X86::VBROADCASTSDZ256m, X86::VBROADCASTSDZ256m, X86::VPBROADCASTQZ256m },
6024 { X86::VBROADCASTSDZr, X86::VBROADCASTSDZr, X86::VPBROADCASTQZr },
6025 { X86::VBROADCASTSDZm, X86::VBROADCASTSDZm, X86::VPBROADCASTQZm },
6026 { X86::VINSERTF32x4Zrr, X86::VINSERTF32x4Zrr, X86::VINSERTI32x4Zrr },
6027 { X86::VINSERTF32x4Zrm, X86::VINSERTF32x4Zrm, X86::VINSERTI32x4Zrm },
6028 { X86::VINSERTF32x8Zrr, X86::VINSERTF32x8Zrr, X86::VINSERTI32x8Zrr },
6029 { X86::VINSERTF32x8Zrm, X86::VINSERTF32x8Zrm, X86::VINSERTI32x8Zrm },
6030 { X86::VINSERTF64x2Zrr, X86::VINSERTF64x2Zrr, X86::VINSERTI64x2Zrr },
6031 { X86::VINSERTF64x2Zrm, X86::VINSERTF64x2Zrm, X86::VINSERTI64x2Zrm },
6032 { X86::VINSERTF64x4Zrr, X86::VINSERTF64x4Zrr, X86::VINSERTI64x4Zrr },
6033 { X86::VINSERTF64x4Zrm, X86::VINSERTF64x4Zrm, X86::VINSERTI64x4Zrm },
6034 { X86::VINSERTF32x4Z256rr,X86::VINSERTF32x4Z256rr,X86::VINSERTI32x4Z256rr },
6035 { X86::VINSERTF32x4Z256rm,X86::VINSERTF32x4Z256rm,X86::VINSERTI32x4Z256rm },
6036 { X86::VINSERTF64x2Z256rr,X86::VINSERTF64x2Z256rr,X86::VINSERTI64x2Z256rr },
6037 { X86::VINSERTF64x2Z256rm,X86::VINSERTF64x2Z256rm,X86::VINSERTI64x2Z256rm },
6038 { X86::VEXTRACTF32x4Zrr, X86::VEXTRACTF32x4Zrr, X86::VEXTRACTI32x4Zrr },
6039 { X86::VEXTRACTF32x4Zmr, X86::VEXTRACTF32x4Zmr, X86::VEXTRACTI32x4Zmr },
6040 { X86::VEXTRACTF32x8Zrr, X86::VEXTRACTF32x8Zrr, X86::VEXTRACTI32x8Zrr },
6041 { X86::VEXTRACTF32x8Zmr, X86::VEXTRACTF32x8Zmr, X86::VEXTRACTI32x8Zmr },
6042 { X86::VEXTRACTF64x2Zrr, X86::VEXTRACTF64x2Zrr, X86::VEXTRACTI64x2Zrr },
6043 { X86::VEXTRACTF64x2Zmr, X86::VEXTRACTF64x2Zmr, X86::VEXTRACTI64x2Zmr },
6044 { X86::VEXTRACTF64x4Zrr, X86::VEXTRACTF64x4Zrr, X86::VEXTRACTI64x4Zrr },
6045 { X86::VEXTRACTF64x4Zmr, X86::VEXTRACTF64x4Zmr, X86::VEXTRACTI64x4Zmr },
6046 { X86::VEXTRACTF32x4Z256rr,X86::VEXTRACTF32x4Z256rr,X86::VEXTRACTI32x4Z256rr },
6047 { X86::VEXTRACTF32x4Z256mr,X86::VEXTRACTF32x4Z256mr,X86::VEXTRACTI32x4Z256mr },
6048 { X86::VEXTRACTF64x2Z256rr,X86::VEXTRACTF64x2Z256rr,X86::VEXTRACTI64x2Z256rr },
6049 { X86::VEXTRACTF64x2Z256mr,X86::VEXTRACTF64x2Z256mr,X86::VEXTRACTI64x2Z256mr },
6050 { X86::VPERMILPSmi, X86::VPERMILPSmi, X86::VPSHUFDmi },
6051 { X86::VPERMILPSri, X86::VPERMILPSri, X86::VPSHUFDri },
6052 { X86::VPERMILPSZ128mi, X86::VPERMILPSZ128mi, X86::VPSHUFDZ128mi },
6053 { X86::VPERMILPSZ128ri, X86::VPERMILPSZ128ri, X86::VPSHUFDZ128ri },
6054 { X86::VPERMILPSZ256mi, X86::VPERMILPSZ256mi, X86::VPSHUFDZ256mi },
6055 { X86::VPERMILPSZ256ri, X86::VPERMILPSZ256ri, X86::VPSHUFDZ256ri },
6056 { X86::VPERMILPSZmi, X86::VPERMILPSZmi, X86::VPSHUFDZmi },
6057 { X86::VPERMILPSZri, X86::VPERMILPSZri, X86::VPSHUFDZri },
6058 { X86::VPERMPSZ256rm, X86::VPERMPSZ256rm, X86::VPERMDZ256rm },
6059 { X86::VPERMPSZ256rr, X86::VPERMPSZ256rr, X86::VPERMDZ256rr },
6060 { X86::VPERMPDZ256mi, X86::VPERMPDZ256mi, X86::VPERMQZ256mi },
6061 { X86::VPERMPDZ256ri, X86::VPERMPDZ256ri, X86::VPERMQZ256ri },
6062 { X86::VPERMPDZ256rm, X86::VPERMPDZ256rm, X86::VPERMQZ256rm },
6063 { X86::VPERMPDZ256rr, X86::VPERMPDZ256rr, X86::VPERMQZ256rr },
6064 { X86::VPERMPSZrm, X86::VPERMPSZrm, X86::VPERMDZrm },
6065 { X86::VPERMPSZrr, X86::VPERMPSZrr, X86::VPERMDZrr },
6066 { X86::VPERMPDZmi, X86::VPERMPDZmi, X86::VPERMQZmi },
6067 { X86::VPERMPDZri, X86::VPERMPDZri, X86::VPERMQZri },
6068 { X86::VPERMPDZrm, X86::VPERMPDZrm, X86::VPERMQZrm },
6069 { X86::VPERMPDZrr, X86::VPERMPDZrr, X86::VPERMQZrr },
6070 { X86::VUNPCKLPDZ256rm, X86::VUNPCKLPDZ256rm, X86::VPUNPCKLQDQZ256rm },
6071 { X86::VUNPCKLPDZ256rr, X86::VUNPCKLPDZ256rr, X86::VPUNPCKLQDQZ256rr },
6072 { X86::VUNPCKHPDZ256rm, X86::VUNPCKHPDZ256rm, X86::VPUNPCKHQDQZ256rm },
6073 { X86::VUNPCKHPDZ256rr, X86::VUNPCKHPDZ256rr, X86::VPUNPCKHQDQZ256rr },
6074 { X86::VUNPCKLPSZ256rm, X86::VUNPCKLPSZ256rm, X86::VPUNPCKLDQZ256rm },
6075 { X86::VUNPCKLPSZ256rr, X86::VUNPCKLPSZ256rr, X86::VPUNPCKLDQZ256rr },
6076 { X86::VUNPCKHPSZ256rm, X86::VUNPCKHPSZ256rm, X86::VPUNPCKHDQZ256rm },
6077 { X86::VUNPCKHPSZ256rr, X86::VUNPCKHPSZ256rr, X86::VPUNPCKHDQZ256rr },
6078 { X86::VUNPCKLPDZ128rm, X86::VUNPCKLPDZ128rm, X86::VPUNPCKLQDQZ128rm },
6079 { X86::VMOVLHPSZrr, X86::VUNPCKLPDZ128rr, X86::VPUNPCKLQDQZ128rr },
6080 { X86::VUNPCKHPDZ128rm, X86::VUNPCKHPDZ128rm, X86::VPUNPCKHQDQZ128rm },
6081 { X86::VUNPCKHPDZ128rr, X86::VUNPCKHPDZ128rr, X86::VPUNPCKHQDQZ128rr },
6082 { X86::VUNPCKLPSZ128rm, X86::VUNPCKLPSZ128rm, X86::VPUNPCKLDQZ128rm },
6083 { X86::VUNPCKLPSZ128rr, X86::VUNPCKLPSZ128rr, X86::VPUNPCKLDQZ128rr },
6084 { X86::VUNPCKHPSZ128rm, X86::VUNPCKHPSZ128rm, X86::VPUNPCKHDQZ128rm },
6085 { X86::VUNPCKHPSZ128rr, X86::VUNPCKHPSZ128rr, X86::VPUNPCKHDQZ128rr },
6086 { X86::VUNPCKLPDZrm, X86::VUNPCKLPDZrm, X86::VPUNPCKLQDQZrm },
6087 { X86::VUNPCKLPDZrr, X86::VUNPCKLPDZrr, X86::VPUNPCKLQDQZrr },
6088 { X86::VUNPCKHPDZrm, X86::VUNPCKHPDZrm, X86::VPUNPCKHQDQZrm },
6089 { X86::VUNPCKHPDZrr, X86::VUNPCKHPDZrr, X86::VPUNPCKHQDQZrr },
6090 { X86::VUNPCKLPSZrm, X86::VUNPCKLPSZrm, X86::VPUNPCKLDQZrm },
6091 { X86::VUNPCKLPSZrr, X86::VUNPCKLPSZrr, X86::VPUNPCKLDQZrr },
6092 { X86::VUNPCKHPSZrm, X86::VUNPCKHPSZrm, X86::VPUNPCKHDQZrm },
6093 { X86::VUNPCKHPSZrr, X86::VUNPCKHPSZrr, X86::VPUNPCKHDQZrr },
6094 { X86::VEXTRACTPSZmr, X86::VEXTRACTPSZmr, X86::VPEXTRDZmr },
6095 { X86::VEXTRACTPSZrr, X86::VEXTRACTPSZrr, X86::VPEXTRDZrr },
6100 { X86::VANDNPSYrm, X86::VANDNPDYrm, X86::VPANDNYrm },
6101 { X86::VANDNPSYrr, X86::VANDNPDYrr, X86::VPANDNYrr },
6102 { X86::VANDPSYrm, X86::VANDPDYrm, X86::VPANDYrm },
6103 { X86::VANDPSYrr, X86::VANDPDYrr, X86::VPANDYrr },
6104 { X86::VORPSYrm, X86::VORPDYrm, X86::VPORYrm },
6105 { X86::VORPSYrr, X86::VORPDYrr, X86::VPORYrr },
6106 { X86::VXORPSYrm, X86::VXORPDYrm, X86::VPXORYrm },
6107 { X86::VXORPSYrr, X86::VXORPDYrr, X86::VPXORYrr },
6108 { X86::VPERM2F128rm, X86::VPERM2F128rm, X86::VPERM2I128rm },
6109 { X86::VPERM2F128rr, X86::VPERM2F128rr, X86::VPERM2I128rr },
6110 { X86::VBROADCASTSSrm, X86::VBROADCASTSSrm, X86::VPBROADCASTDrm},
6111 { X86::VBROADCASTSSrr, X86::VBROADCASTSSrr, X86::VPBROADCASTDrr},
6112 { X86::VBROADCASTSSYrr, X86::VBROADCASTSSYrr, X86::VPBROADCASTDYrr},
6113 { X86::VBROADCASTSSYrm, X86::VBROADCASTSSYrm, X86::VPBROADCASTDYrm},
6114 { X86::VBROADCASTSDYrr, X86::VBROADCASTSDYrr, X86::VPBROADCASTQYrr},
6115 { X86::VBROADCASTSDYrm, X86::VBROADCASTSDYrm, X86::VPBROADCASTQYrm},
6116 { X86::VBROADCASTF128, X86::VBROADCASTF128, X86::VBROADCASTI128 },
6117 { X86::VBLENDPSYrri, X86::VBLENDPSYrri, X86::VPBLENDDYrri },
6118 { X86::VBLENDPSYrmi, X86::VBLENDPSYrmi, X86::VPBLENDDYrmi },
6119 { X86::VPERMILPSYmi, X86::VPERMILPSYmi, X86::VPSHUFDYmi },
6120 { X86::VPERMILPSYri, X86::VPERMILPSYri, X86::VPSHUFDYri },
6121 { X86::VUNPCKLPDYrm, X86::VUNPCKLPDYrm, X86::VPUNPCKLQDQYrm },
6122 { X86::VUNPCKLPDYrr, X86::VUNPCKLPDYrr, X86::VPUNPCKLQDQYrr },
6123 { X86::VUNPCKHPDYrm, X86::VUNPCKHPDYrm, X86::VPUNPCKHQDQYrm },
6124 { X86::VUNPCKHPDYrr, X86::VUNPCKHPDYrr, X86::VPUNPCKHQDQYrr },
6125 { X86::VUNPCKLPSYrm, X86::VUNPCKLPSYrm, X86::VPUNPCKLDQYrm },
6126 { X86::VUNPCKLPSYrr, X86::VUNPCKLPSYrr, X86::VPUNPCKLDQYrr },
6127 { X86::VUNPCKHPSYrm, X86::VUNPCKHPSYrm, X86::VPUNPCKHDQYrm },
6128 { X86::VUNPCKHPSYrr, X86::VUNPCKHPSYrr, X86::VPUNPCKHDQYrr },
6133 { X86::VEXTRACTF128mr, X86::VEXTRACTF128mr, X86::VEXTRACTI128mr },
6134 { X86::VEXTRACTF128rr, X86::VEXTRACTF128rr, X86::VEXTRACTI128rr },
6135 { X86::VINSERTF128rm, X86::VINSERTF128rm, X86::VINSERTI128rm },
6136 { X86::VINSERTF128rr, X86::VINSERTF128rr, X86::VINSERTI128rr },
6142 { X86::VMOVAPSZ128mr, X86::VMOVAPDZ128mr, X86::VMOVDQA64Z128mr, X86::VMOVDQA32Z128mr },
6143 { X86::VMOVAPSZ128rm, X86::VMOVAPDZ128rm, X86::VMOVDQA64Z128rm, X86::VMOVDQA32Z128rm },
6144 { X86::VMOVAPSZ128rr, X86::VMOVAPDZ128rr, X86::VMOVDQA64Z128rr, X86::VMOVDQA32Z128rr },
6145 { X86::VMOVUPSZ128mr, X86::VMOVUPDZ128mr, X86::VMOVDQU64Z128mr, X86::VMOVDQU32Z128mr },
6146 { X86::VMOVUPSZ128rm, X86::VMOVUPDZ128rm, X86::VMOVDQU64Z128rm, X86::VMOVDQU32Z128rm },
6147 { X86::VMOVAPSZ256mr, X86::VMOVAPDZ256mr, X86::VMOVDQA64Z256mr, X86::VMOVDQA32Z256mr },
6148 { X86::VMOVAPSZ256rm, X86::VMOVAPDZ256rm, X86::VMOVDQA64Z256rm, X86::VMOVDQA32Z256rm },
6149 { X86::VMOVAPSZ256rr, X86::VMOVAPDZ256rr, X86::VMOVDQA64Z256rr, X86::VMOVDQA32Z256rr },
6150 { X86::VMOVUPSZ256mr, X86::VMOVUPDZ256mr, X86::VMOVDQU64Z256mr, X86::VMOVDQU32Z256mr },
6151 { X86::VMOVUPSZ256rm, X86::VMOVUPDZ256rm, X86::VMOVDQU64Z256rm, X86::VMOVDQU32Z256rm },
6152 { X86::VMOVAPSZmr, X86::VMOVAPDZmr, X86::VMOVDQA64Zmr, X86::VMOVDQA32Zmr },
6153 { X86::VMOVAPSZrm, X86::VMOVAPDZrm, X86::VMOVDQA64Zrm, X86::VMOVDQA32Zrm },
6154 { X86::VMOVAPSZrr, X86::VMOVAPDZrr, X86::VMOVDQA64Zrr, X86::VMOVDQA32Zrr },
6155 { X86::VMOVUPSZmr, X86::VMOVUPDZmr, X86::VMOVDQU64Zmr, X86::VMOVDQU32Zmr },
6156 { X86::VMOVUPSZrm, X86::VMOVUPDZrm, X86::VMOVDQU64Zrm, X86::VMOVDQU32Zrm },
6162 { X86::VANDNPSZ128rm, X86::VANDNPDZ128rm, X86::VPANDNQZ128rm, X86::VPANDNDZ128rm },
6163 { X86::VANDNPSZ128rr, X86::VANDNPDZ128rr, X86::VPANDNQZ128rr, X86::VPANDNDZ128rr },
6164 { X86::VANDPSZ128rm, X86::VANDPDZ128rm, X86::VPANDQZ128rm, X86::VPANDDZ128rm },
6165 { X86::VANDPSZ128rr, X86::VANDPDZ128rr, X86::VPANDQZ128rr, X86::VPANDDZ128rr },
6166 { X86::VORPSZ128rm, X86::VORPDZ128rm, X86::VPORQZ128rm, X86::VPORDZ128rm },
6167 { X86::VORPSZ128rr, X86::VORPDZ128rr, X86::VPORQZ128rr, X86::VPORDZ128rr },
6168 { X86::VXORPSZ128rm, X86::VXORPDZ128rm, X86::VPXORQZ128rm, X86::VPXORDZ128rm },
6169 { X86::VXORPSZ128rr, X86::VXORPDZ128rr, X86::VPXORQZ128rr, X86::VPXORDZ128rr },
6170 { X86::VANDNPSZ256rm, X86::VANDNPDZ256rm, X86::VPANDNQZ256rm, X86::VPANDNDZ256rm },
6171 { X86::VANDNPSZ256rr, X86::VANDNPDZ256rr, X86::VPANDNQZ256rr, X86::VPANDNDZ256rr },
6172 { X86::VANDPSZ256rm, X86::VANDPDZ256rm, X86::VPANDQZ256rm, X86::VPANDDZ256rm },
6173 { X86::VANDPSZ256rr, X86::VANDPDZ256rr, X86::VPANDQZ256rr, X86::VPANDDZ256rr },
6174 { X86::VORPSZ256rm, X86::VORPDZ256rm, X86::VPORQZ256rm, X86::VPORDZ256rm },
6175 { X86::VORPSZ256rr, X86::VORPDZ256rr, X86::VPORQZ256rr, X86::VPORDZ256rr },
6176 { X86::VXORPSZ256rm, X86::VXORPDZ256rm, X86::VPXORQZ256rm, X86::VPXORDZ256rm },
6177 { X86::VXORPSZ256rr, X86::VXORPDZ256rr, X86::VPXORQZ256rr, X86::VPXORDZ256rr },
6178 { X86::VANDNPSZrm, X86::VANDNPDZrm, X86::VPANDNQZrm, X86::VPANDNDZrm },
6179 { X86::VANDNPSZrr, X86::VANDNPDZrr, X86::VPANDNQZrr, X86::VPANDNDZrr },
6180 { X86::VANDPSZrm, X86::VANDPDZrm, X86::VPANDQZrm, X86::VPANDDZrm },
6181 { X86::VANDPSZrr, X86::VANDPDZrr, X86::VPANDQZrr, X86::VPANDDZrr },
6182 { X86::VORPSZrm, X86::VORPDZrm, X86::VPORQZrm, X86::VPORDZrm },
6183 { X86::VORPSZrr, X86::VORPDZrr, X86::VPORQZrr, X86::VPORDZrr },
6184 { X86::VXORPSZrm, X86::VXORPDZrm, X86::VPXORQZrm, X86::VPXORDZrm },
6185 { X86::VXORPSZrr, X86::VXORPDZrr, X86::VPXORQZrr, X86::VPXORDZrr },
6192 { X86::VANDNPSZ128rmk, X86::VANDNPDZ128rmk,
6193 X86::VPANDNQZ128rmk, X86::VPANDNDZ128rmk },
6194 { X86::VANDNPSZ128rmkz, X86::VANDNPDZ128rmkz,
6195 X86::VPANDNQZ128rmkz, X86::VPANDNDZ128rmkz },
6196 { X86::VANDNPSZ128rrk, X86::VANDNPDZ128rrk,
6197 X86::VPANDNQZ128rrk, X86::VPANDNDZ128rrk },
6198 { X86::VANDNPSZ128rrkz, X86::VANDNPDZ128rrkz,
6199 X86::VPANDNQZ128rrkz, X86::VPANDNDZ128rrkz },
6200 { X86::VANDPSZ128rmk, X86::VANDPDZ128rmk,
6201 X86::VPANDQZ128rmk, X86::VPANDDZ128rmk },
6202 { X86::VANDPSZ128rmkz, X86::VANDPDZ128rmkz,
6203 X86::VPANDQZ128rmkz, X86::VPANDDZ128rmkz },
6204 { X86::VANDPSZ128rrk, X86::VANDPDZ128rrk,
6205 X86::VPANDQZ128rrk, X86::VPANDDZ128rrk },
6206 { X86::VANDPSZ128rrkz, X86::VANDPDZ128rrkz,
6207 X86::VPANDQZ128rrkz, X86::VPANDDZ128rrkz },
6208 { X86::VORPSZ128rmk, X86::VORPDZ128rmk,
6209 X86::VPORQZ128rmk, X86::VPORDZ128rmk },
6210 { X86::VORPSZ128rmkz, X86::VORPDZ128rmkz,
6211 X86::VPORQZ128rmkz, X86::VPORDZ128rmkz },
6212 { X86::VORPSZ128rrk, X86::VORPDZ128rrk,
6213 X86::VPORQZ128rrk, X86::VPORDZ128rrk },
6214 { X86::VORPSZ128rrkz, X86::VORPDZ128rrkz,
6215 X86::VPORQZ128rrkz, X86::VPORDZ128rrkz },
6216 { X86::VXORPSZ128rmk, X86::VXORPDZ128rmk,
6217 X86::VPXORQZ128rmk, X86::VPXORDZ128rmk },
6218 { X86::VXORPSZ128rmkz, X86::VXORPDZ128rmkz,
6219 X86::VPXORQZ128rmkz, X86::VPXORDZ128rmkz },
6220 { X86::VXORPSZ128rrk, X86::VXORPDZ128rrk,
6221 X86::VPXORQZ128rrk, X86::VPXORDZ128rrk },
6222 { X86::VXORPSZ128rrkz, X86::VXORPDZ128rrkz,
6223 X86::VPXORQZ128rrkz, X86::VPXORDZ128rrkz },
6224 { X86::VANDNPSZ256rmk, X86::VANDNPDZ256rmk,
6225 X86::VPANDNQZ256rmk, X86::VPANDNDZ256rmk },
6226 { X86::VANDNPSZ256rmkz, X86::VANDNPDZ256rmkz,
6227 X86::VPANDNQZ256rmkz, X86::VPANDNDZ256rmkz },
6228 { X86::VANDNPSZ256rrk, X86::VANDNPDZ256rrk,
6229 X86::VPANDNQZ256rrk, X86::VPANDNDZ256rrk },
6230 { X86::VANDNPSZ256rrkz, X86::VANDNPDZ256rrkz,
6231 X86::VPANDNQZ256rrkz, X86::VPANDNDZ256rrkz },
6232 { X86::VANDPSZ256rmk, X86::VANDPDZ256rmk,
6233 X86::VPANDQZ256rmk, X86::VPANDDZ256rmk },
6234 { X86::VANDPSZ256rmkz, X86::VANDPDZ256rmkz,
6235 X86::VPANDQZ256rmkz, X86::VPANDDZ256rmkz },
6236 { X86::VANDPSZ256rrk, X86::VANDPDZ256rrk,
6237 X86::VPANDQZ256rrk, X86::VPANDDZ256rrk },
6238 { X86::VANDPSZ256rrkz, X86::VANDPDZ256rrkz,
6239 X86::VPANDQZ256rrkz, X86::VPANDDZ256rrkz },
6240 { X86::VORPSZ256rmk, X86::VORPDZ256rmk,
6241 X86::VPORQZ256rmk, X86::VPORDZ256rmk },
6242 { X86::VORPSZ256rmkz, X86::VORPDZ256rmkz,
6243 X86::VPORQZ256rmkz, X86::VPORDZ256rmkz },
6244 { X86::VORPSZ256rrk, X86::VORPDZ256rrk,
6245 X86::VPORQZ256rrk, X86::VPORDZ256rrk },
6246 { X86::VORPSZ256rrkz, X86::VORPDZ256rrkz,
6247 X86::VPORQZ256rrkz, X86::VPORDZ256rrkz },
6248 { X86::VXORPSZ256rmk, X86::VXORPDZ256rmk,
6249 X86::VPXORQZ256rmk, X86::VPXORDZ256rmk },
6250 { X86::VXORPSZ256rmkz, X86::VXORPDZ256rmkz,
6251 X86::VPXORQZ256rmkz, X86::VPXORDZ256rmkz },
6252 { X86::VXORPSZ256rrk, X86::VXORPDZ256rrk,
6253 X86::VPXORQZ256rrk, X86::VPXORDZ256rrk },
6254 { X86::VXORPSZ256rrkz, X86::VXORPDZ256rrkz,
6255 X86::VPXORQZ256rrkz, X86::VPXORDZ256rrkz },
6256 { X86::VANDNPSZrmk, X86::VANDNPDZrmk,
6257 X86::VPANDNQZrmk, X86::VPANDNDZrmk },
6258 { X86::VANDNPSZrmkz, X86::VANDNPDZrmkz,
6259 X86::VPANDNQZrmkz, X86::VPANDNDZrmkz },
6260 { X86::VANDNPSZrrk, X86::VANDNPDZrrk,
6261 X86::VPANDNQZrrk, X86::VPANDNDZrrk },
6262 { X86::VANDNPSZrrkz, X86::VANDNPDZrrkz,
6263 X86::VPANDNQZrrkz, X86::VPANDNDZrrkz },
6264 { X86::VANDPSZrmk, X86::VANDPDZrmk,
6265 X86::VPANDQZrmk, X86::VPANDDZrmk },
6266 { X86::VANDPSZrmkz, X86::VANDPDZrmkz,
6267 X86::VPANDQZrmkz, X86::VPANDDZrmkz },
6268 { X86::VANDPSZrrk, X86::VANDPDZrrk,
6269 X86::VPANDQZrrk, X86::VPANDDZrrk },
6270 { X86::VANDPSZrrkz, X86::VANDPDZrrkz,
6271 X86::VPANDQZrrkz, X86::VPANDDZrrkz },
6272 { X86::VORPSZrmk, X86::VORPDZrmk,
6273 X86::VPORQZrmk, X86::VPORDZrmk },
6274 { X86::VORPSZrmkz, X86::VORPDZrmkz,
6275 X86::VPORQZrmkz, X86::VPORDZrmkz },
6276 { X86::VORPSZrrk, X86::VORPDZrrk,
6277 X86::VPORQZrrk, X86::VPORDZrrk },
6278 { X86::VORPSZrrkz, X86::VORPDZrrkz,
6279 X86::VPORQZrrkz, X86::VPORDZrrkz },
6280 { X86::VXORPSZrmk, X86::VXORPDZrmk,
6281 X86::VPXORQZrmk, X86::VPXORDZrmk },
6282 { X86::VXORPSZrmkz, X86::VXORPDZrmkz,
6283 X86::VPXORQZrmkz, X86::VPXORDZrmkz },
6284 { X86::VXORPSZrrk, X86::VXORPDZrrk,
6285 X86::VPXORQZrrk, X86::VPXORDZrrk },
6286 { X86::VXORPSZrrkz, X86::VXORPDZrrkz,
6287 X86::VPXORQZrrkz, X86::VPXORDZrrkz },
6290 { X86::VANDNPSZ128rmb, X86::VANDNPDZ128rmb,
6291 X86::VPANDNQZ128rmb, X86::VPANDNDZ128rmb },
6292 { X86::VANDPSZ128rmb, X86::VANDPDZ128rmb,
6293 X86::VPANDQZ128rmb, X86::VPANDDZ128rmb },
6294 { X86::VORPSZ128rmb, X86::VORPDZ128rmb,
6295 X86::VPORQZ128rmb, X86::VPORDZ128rmb },
6296 { X86::VXORPSZ128rmb, X86::VXORPDZ128rmb,
6297 X86::VPXORQZ128rmb, X86::VPXORDZ128rmb },
6298 { X86::VANDNPSZ256rmb, X86::VANDNPDZ256rmb,
6299 X86::VPANDNQZ256rmb, X86::VPANDNDZ256rmb },
6300 { X86::VANDPSZ256rmb, X86::VANDPDZ256rmb,
6301 X86::VPANDQZ256rmb, X86::VPANDDZ256rmb },
6302 { X86::VORPSZ256rmb, X86::VORPDZ256rmb,
6303 X86::VPORQZ256rmb, X86::VPORDZ256rmb },
6304 { X86::VXORPSZ256rmb, X86::VXORPDZ256rmb,
6305 X86::VPXORQZ256rmb, X86::VPXORDZ256rmb },
6306 { X86::VANDNPSZrmb, X86::VANDNPDZrmb,
6307 X86::VPANDNQZrmb, X86::VPANDNDZrmb },
6308 { X86::VANDPSZrmb, X86::VANDPDZrmb,
6309 X86::VPANDQZrmb, X86::VPANDDZrmb },
6310 { X86::VANDPSZrmb, X86::VANDPDZrmb,
6311 X86::VPANDQZrmb, X86::VPANDDZrmb },
6312 { X86::VORPSZrmb, X86::VORPDZrmb,
6313 X86::VPORQZrmb, X86::VPORDZrmb },
6314 { X86::VXORPSZrmb, X86::VXORPDZrmb,
6315 X86::VPXORQZrmb, X86::VPXORDZrmb },
6316 { X86::VANDNPSZ128rmbk, X86::VANDNPDZ128rmbk,
6317 X86::VPANDNQZ128rmbk, X86::VPANDNDZ128rmbk },
6318 { X86::VANDPSZ128rmbk, X86::VANDPDZ128rmbk,
6319 X86::VPANDQZ128rmbk, X86::VPANDDZ128rmbk },
6320 { X86::VORPSZ128rmbk, X86::VORPDZ128rmbk,
6321 X86::VPORQZ128rmbk, X86::VPORDZ128rmbk },
6322 { X86::VXORPSZ128rmbk, X86::VXORPDZ128rmbk,
6323 X86::VPXORQZ128rmbk, X86::VPXORDZ128rmbk },
6324 { X86::VANDNPSZ256rmbk, X86::VANDNPDZ256rmbk,
6325 X86::VPANDNQZ256rmbk, X86::VPANDNDZ256rmbk },
6326 { X86::VANDPSZ256rmbk, X86::VANDPDZ256rmbk,
6327 X86::VPANDQZ256rmbk, X86::VPANDDZ256rmbk },
6328 { X86::VORPSZ256rmbk, X86::VORPDZ256rmbk,
6329 X86::VPORQZ256rmbk, X86::VPORDZ256rmbk },
6330 { X86::VXORPSZ256rmbk, X86::VXORPDZ256rmbk,
6331 X86::VPXORQZ256rmbk, X86::VPXORDZ256rmbk },
6332 { X86::VANDNPSZrmbk, X86::VANDNPDZrmbk,
6333 X86::VPANDNQZrmbk, X86::VPANDNDZrmbk },
6334 { X86::VANDPSZrmbk, X86::VANDPDZrmbk,
6335 X86::VPANDQZrmbk, X86::VPANDDZrmbk },
6336 { X86::VANDPSZrmbk, X86::VANDPDZrmbk,
6337 X86::VPANDQZrmbk, X86::VPANDDZrmbk },
6338 { X86::VORPSZrmbk, X86::VORPDZrmbk,
6339 X86::VPORQZrmbk, X86::VPORDZrmbk },
6340 { X86::VXORPSZrmbk, X86::VXORPDZrmbk,
6341 X86::VPXORQZrmbk, X86::VPXORDZrmbk },
6342 { X86::VANDNPSZ128rmbkz,X86::VANDNPDZ128rmbkz,
6343 X86::VPANDNQZ128rmbkz,X86::VPANDNDZ128rmbkz},
6344 { X86::VANDPSZ128rmbkz, X86::VANDPDZ128rmbkz,
6345 X86::VPANDQZ128rmbkz, X86::VPANDDZ128rmbkz },
6346 { X86::VORPSZ128rmbkz, X86::VORPDZ128rmbkz,
6347 X86::VPORQZ128rmbkz, X86::VPORDZ128rmbkz },
6348 { X86::VXORPSZ128rmbkz, X86::VXORPDZ128rmbkz,
6349 X86::VPXORQZ128rmbkz, X86::VPXORDZ128rmbkz },
6350 { X86::VANDNPSZ256rmbkz,X86::VANDNPDZ256rmbkz,
6351 X86::VPANDNQZ256rmbkz,X86::VPANDNDZ256rmbkz},
6352 { X86::VANDPSZ256rmbkz, X86::VANDPDZ256rmbkz,
6353 X86::VPANDQZ256rmbkz, X86::VPANDDZ256rmbkz },
6354 { X86::VORPSZ256rmbkz, X86::VORPDZ256rmbkz,
6355 X86::VPORQZ256rmbkz, X86::VPORDZ256rmbkz },
6356 { X86::VXORPSZ256rmbkz, X86::VXORPDZ256rmbkz,
6357 X86::VPXORQZ256rmbkz, X86::VPXORDZ256rmbkz },
6358 { X86::VANDNPSZrmbkz, X86::VANDNPDZrmbkz,
6359 X86::VPANDNQZrmbkz, X86::VPANDNDZrmbkz },
6360 { X86::VANDPSZrmbkz, X86::VANDPDZrmbkz,
6361 X86::VPANDQZrmbkz, X86::VPANDDZrmbkz },
6362 { X86::VANDPSZrmbkz, X86::VANDPDZrmbkz,
6363 X86::VPANDQZrmbkz, X86::VPANDDZrmbkz },
6364 { X86::VORPSZrmbkz, X86::VORPDZrmbkz,
6365 X86::VPORQZrmbkz, X86::VPORDZrmbkz },
6366 { X86::VXORPSZrmbkz, X86::VXORPDZrmbkz,
6367 X86::VPXORQZrmbkz, X86::VPXORDZrmbkz },
6373 { X86::BLENDPSrmi, X86::BLENDPDrmi, X86::PBLENDWrmi },
6374 { X86::BLENDPSrri, X86::BLENDPDrri, X86::PBLENDWrri },
6375 { X86::VBLENDPSrmi, X86::VBLENDPDrmi, X86::VPBLENDWrmi },
6376 { X86::VBLENDPSrri, X86::VBLENDPDrri, X86::VPBLENDWrri },
6377 { X86::VBLENDPSYrmi, X86::VBLENDPDYrmi, X86::VPBLENDWYrmi },
6378 { X86::VBLENDPSYrri, X86::VBLENDPDYrri, X86::VPBLENDWYrri },
6382 { X86::VBLENDPSrmi, X86::VBLENDPDrmi, X86::VPBLENDDrmi },
6383 { X86::VBLENDPSrri, X86::VBLENDPDrri, X86::VPBLENDDrri },
6384 { X86::VBLENDPSYrmi, X86::VBLENDPDYrmi, X86::VPBLENDDYrmi },
6385 { X86::VBLENDPSYrri, X86::VBLENDPDYrri, X86::VPBLENDDYrri },
6393 { X86::VANDNPSrm, X86::VANDNPDrm, X86::VPANDNQZ128rm, X86::VPANDNDZ128rm },
6394 { X86::VANDNPSrr, X86::VANDNPDrr, X86::VPANDNQZ128rr, X86::VPANDNDZ128rr },
6395 { X86::VANDPSrm, X86::VANDPDrm, X86::VPANDQZ128rm, X86::VPANDDZ128rm },
6396 { X86::VANDPSrr, X86::VANDPDrr, X86::VPANDQZ128rr, X86::VPANDDZ128rr },
6397 { X86::VORPSrm, X86::VORPDrm, X86::VPORQZ128rm, X86::VPORDZ128rm },
6398 { X86::VORPSrr, X86::VORPDrr, X86::VPORQZ128rr, X86::VPORDZ128rr },
6399 { X86::VXORPSrm, X86::VXORPDrm, X86::VPXORQZ128rm, X86::VPXORDZ128rm },
6400 { X86::VXORPSrr, X86::VXORPDrr, X86::VPXORQZ128rr, X86::VPXORDZ128rr },
6401 { X86::VANDNPSYrm, X86::VANDNPDYrm, X86::VPANDNQZ256rm, X86::VPANDNDZ256rm },
6402 { X86::VANDNPSYrr, X86::VANDNPDYrr, X86::VPANDNQZ256rr, X86::VPANDNDZ256rr },
6403 { X86::VANDPSYrm, X86::VANDPDYrm, X86::VPANDQZ256rm, X86::VPANDDZ256rm },
6404 { X86::VANDPSYrr, X86::VANDPDYrr, X86::VPANDQZ256rr, X86::VPANDDZ256rr },
6405 { X86::VORPSYrm, X86::VORPDYrm, X86::VPORQZ256rm, X86::VPORDZ256rm },
6406 { X86::VORPSYrr, X86::VORPDYrr, X86::VPORQZ256rr, X86::VPORDZ256rr },
6407 { X86::VXORPSYrm, X86::VXORPDYrm, X86::VPXORQZ256rm, X86::VPXORDZ256rm },
6408 { X86::VXORPSYrr, X86::VXORPDYrr, X86::VPXORQZ256rr, X86::VPXORDZ256rr },
6414 static const uint16_t *
lookup(
unsigned opcode,
unsigned domain,
6416 for (
const uint16_t (&Row)[3] : Table)
6417 if (Row[domain-1] == opcode)
6425 for (
const uint16_t (&Row)[4] : Table)
6426 if (Row[domain-1] == opcode || (domain == 3 && Row[3] == opcode))
6433 unsigned NewWidth,
unsigned *pNewMask =
nullptr) {
6434 assert(((OldWidth % NewWidth) == 0 || (NewWidth % OldWidth) == 0) &&
6435 "Illegal blend mask scale");
6436 unsigned NewMask = 0;
6438 if ((OldWidth % NewWidth) == 0) {
6439 unsigned Scale = OldWidth / NewWidth;
6440 unsigned SubMask = (1u << Scale) - 1;
6441 for (
unsigned i = 0; i != NewWidth; ++i) {
6442 unsigned Sub = (OldMask >> (i * Scale)) & SubMask;
6444 NewMask |= (1u << i);
6445 else if (Sub != 0x0)
6449 unsigned Scale = NewWidth / OldWidth;
6450 unsigned SubMask = (1u << Scale) - 1;
6451 for (
unsigned i = 0; i != OldWidth; ++i) {
6452 if (OldMask & (1 << i)) {
6453 NewMask |= (SubMask << (i * Scale));
6459 *pNewMask = NewMask;
6467 auto GetBlendDomains = [&](
unsigned ImmWidth,
bool Is256) {
6468 uint16_t validDomains = 0;
6472 validDomains |= 0x2;
6474 validDomains |= 0x4;
6475 if (!Is256 || Subtarget.hasAVX2())
6476 validDomains |= 0x8;
6478 return validDomains;
6482 case X86::BLENDPDrmi:
6483 case X86::BLENDPDrri:
6484 case X86::VBLENDPDrmi:
6485 case X86::VBLENDPDrri:
6486 return GetBlendDomains(2,
false);
6487 case X86::VBLENDPDYrmi:
6488 case X86::VBLENDPDYrri:
6489 return GetBlendDomains(4,
true);
6490 case X86::BLENDPSrmi:
6491 case X86::BLENDPSrri:
6492 case X86::VBLENDPSrmi:
6493 case X86::VBLENDPSrri:
6494 case X86::VPBLENDDrmi:
6495 case X86::VPBLENDDrri:
6496 return GetBlendDomains(4,
false);
6497 case X86::VBLENDPSYrmi:
6498 case X86::VBLENDPSYrri:
6499 case X86::VPBLENDDYrmi:
6500 case X86::VPBLENDDYrri:
6501 return GetBlendDomains(8,
true);
6502 case X86::PBLENDWrmi:
6503 case X86::PBLENDWrri:
6504 case X86::VPBLENDWrmi:
6505 case X86::VPBLENDWrri:
6507 case X86::VPBLENDWYrmi:
6508 case X86::VPBLENDWYrri:
6509 return GetBlendDomains(8,
false);
6510 case X86::VPANDDZ128rr:
case X86::VPANDDZ128rm:
6511 case X86::VPANDDZ256rr:
case X86::VPANDDZ256rm:
6512 case X86::VPANDQZ128rr:
case X86::VPANDQZ128rm:
6513 case X86::VPANDQZ256rr:
case X86::VPANDQZ256rm:
6514 case X86::VPANDNDZ128rr:
case X86::VPANDNDZ128rm:
6515 case X86::VPANDNDZ256rr:
case X86::VPANDNDZ256rm:
6516 case X86::VPANDNQZ128rr:
case X86::VPANDNQZ128rm:
6517 case X86::VPANDNQZ256rr:
case X86::VPANDNQZ256rm:
6518 case X86::VPORDZ128rr:
case X86::VPORDZ128rm:
6519 case X86::VPORDZ256rr:
case X86::VPORDZ256rm:
6520 case X86::VPORQZ128rr:
case X86::VPORQZ128rm:
6521 case X86::VPORQZ256rr:
case X86::VPORQZ256rm:
6522 case X86::VPXORDZ128rr:
case X86::VPXORDZ128rm:
6523 case X86::VPXORDZ256rr:
case X86::VPXORDZ256rm:
6524 case X86::VPXORQZ128rr:
case X86::VPXORQZ128rm:
6525 case X86::VPXORQZ256rr:
case X86::VPXORQZ256rm:
6528 if (Subtarget.hasDQI())
6536 if (NumOperands == 3 &&
6542 case X86::MOVHLPSrr:
6560 unsigned Domain)
const {
6561 assert(Domain > 0 && Domain < 4 &&
"Invalid execution domain");
6563 assert(dom &&
"Not an SSE instruction");
6568 auto SetBlendDomain = [&](
unsigned ImmWidth,
bool Is256) {
6571 Imm = (ImmWidth == 16 ? ((Imm << 8) | Imm) : Imm);
6572 unsigned NewImm = Imm;
6574 const uint16_t *table =
lookup(Opcode, dom, ReplaceableCustomInstrs);
6576 table =
lookup(Opcode, dom, ReplaceableCustomAVX2Instrs);
6580 }
else if (Domain == 2) {
6582 }
else if (Domain == 3) {
6583 if (Subtarget.hasAVX2()) {
6585 if ((ImmWidth / (Is256 ? 2 : 1)) != 8) {
6586 table =
lookup(Opcode, dom, ReplaceableCustomAVX2Instrs);
6590 assert(!Is256 &&
"128-bit vector expected");
6595 assert(table && table[Domain - 1] &&
"Unknown domain op");
6596 MI.
setDesc(
get(table[Domain - 1]));
6603 case X86::BLENDPDrmi:
6604 case X86::BLENDPDrri:
6605 case X86::VBLENDPDrmi:
6606 case X86::VBLENDPDrri:
6607 return SetBlendDomain(2,
false);
6608 case X86::VBLENDPDYrmi:
6609 case X86::VBLENDPDYrri:
6610 return SetBlendDomain(4,
true);
6611 case X86::BLENDPSrmi:
6612 case X86::BLENDPSrri:
6613 case X86::VBLENDPSrmi:
6614 case X86::VBLENDPSrri:
6615 case X86::VPBLENDDrmi:
6616 case X86::VPBLENDDrri:
6617 return SetBlendDomain(4,
false);
6618 case X86::VBLENDPSYrmi:
6619 case X86::VBLENDPSYrri:
6620 case X86::VPBLENDDYrmi:
6621 case X86::VPBLENDDYrri:
6622 return SetBlendDomain(8,
true);
6623 case X86::PBLENDWrmi:
6624 case X86::PBLENDWrri:
6625 case X86::VPBLENDWrmi:
6626 case X86::VPBLENDWrri:
6627 return SetBlendDomain(8,
false);
6628 case X86::VPBLENDWYrmi:
6629 case X86::VPBLENDWYrri:
6630 return SetBlendDomain(16,
true);
6631 case X86::VPANDDZ128rr:
case X86::VPANDDZ128rm:
6632 case X86::VPANDDZ256rr:
case X86::VPANDDZ256rm:
6633 case X86::VPANDQZ128rr:
case X86::VPANDQZ128rm:
6634 case X86::VPANDQZ256rr:
case X86::VPANDQZ256rm:
6635 case X86::VPANDNDZ128rr:
case X86::VPANDNDZ128rm:
6636 case X86::VPANDNDZ256rr:
case X86::VPANDNDZ256rm:
6637 case X86::VPANDNQZ128rr:
case X86::VPANDNQZ128rm:
6638 case X86::VPANDNQZ256rr:
case X86::VPANDNQZ256rm:
6639 case X86::VPORDZ128rr:
case X86::VPORDZ128rm:
6640 case X86::VPORDZ256rr:
case X86::VPORDZ256rm:
6641 case X86::VPORQZ128rr:
case X86::VPORQZ128rm:
6642 case X86::VPORQZ256rr:
case X86::VPORQZ256rm:
6643 case X86::VPXORDZ128rr:
case X86::VPXORDZ128rm:
6644 case X86::VPXORDZ256rr:
case X86::VPXORDZ256rm:
6645 case X86::VPXORQZ128rr:
case X86::VPXORQZ128rm:
6646 case X86::VPXORQZ256rr:
case X86::VPXORQZ256rm: {
6648 if (Subtarget.hasDQI())
6653 assert(table &&
"Instruction not found in table?");
6656 if (Domain == 3 && (dom == 1 || table[3] == MI.
getOpcode()))
6658 MI.
setDesc(
get(table[Domain - 1]));
6661 case X86::UNPCKHPDrr:
6662 case X86::MOVHLPSrr:
6664 if (Domain != dom && Domain != 3 &&
6669 commuteInstruction(MI,
false);
6673 if (Opcode == X86::MOVHLPSrr)
6679 std::pair<uint16_t, uint16_t>
6683 uint16_t validDomains = 0;
6688 return std::make_pair(domain, validDomains);
6690 if (
lookup(opcode, domain, ReplaceableInstrs)) {
6692 }
else if (
lookup(opcode, domain, ReplaceableInstrsAVX2)) {
6693 validDomains = Subtarget.hasAVX2() ? 0xe : 0x6;
6694 }
else if (
lookup(opcode, domain, ReplaceableInstrsAVX2InsertExtract)) {
6697 if (!Subtarget.hasAVX2())
6698 return std::make_pair(0, 0);
6700 }
else if (
lookupAVX512(opcode, domain, ReplaceableInstrsAVX512)) {
6702 }
else if (Subtarget.hasDQI() &&
lookupAVX512(opcode, domain,
6703 ReplaceableInstrsAVX512DQ)) {
6705 }
else if (Subtarget.hasDQI()) {
6706 if (
const uint16_t *table =
lookupAVX512(opcode, domain,
6707 ReplaceableInstrsAVX512DQMasked)) {
6708 if (domain == 1 || (domain == 3 && table[3] == opcode))
6715 return std::make_pair(domain, validDomains);
6719 assert(Domain>0 && Domain<4 &&
"Invalid execution domain");
6721 assert(dom &&
"Not an SSE instruction");
6729 assert((Subtarget.hasAVX2() || Domain < 3) &&
6730 "256-bit vector operations only available in AVX2");
6734 assert(Subtarget.hasAVX2() &&
6735 "256-bit insert/extract only available in AVX2");
6739 assert(Subtarget.hasAVX512() &&
"Requires AVX-512");
6742 if (table && Domain == 3 && table[3] == MI.
getOpcode())
6746 assert((Subtarget.hasDQI() || Domain >= 3) &&
"Requires AVX-512DQ");
6750 if (table && Domain == 3 && (dom == 1 || table[3] == MI.
getOpcode()))
6754 assert((Subtarget.hasDQI() || Domain >= 3) &&
"Requires AVX-512DQ");
6756 if (table && Domain == 3 && (dom == 1 || table[3] == MI.
getOpcode()))
6759 assert(table &&
"Cannot change domain");
6760 MI.
setDesc(
get(table[Domain - 1]));
6770 default:
return false;
6776 case X86::DIVSDrm_Int:
6778 case X86::DIVSDrr_Int:
6780 case X86::DIVSSrm_Int:
6782 case X86::DIVSSrr_Int:
6788 case X86::SQRTSDm_Int:
6790 case X86::SQRTSDr_Int:
6792 case X86::SQRTSSm_Int:
6794 case X86::SQRTSSr_Int:
6798 case X86::VDIVPDYrm:
6799 case X86::VDIVPDYrr:
6802 case X86::VDIVPSYrm:
6803 case X86::VDIVPSYrr:
6805 case X86::VDIVSDrm_Int:
6807 case X86::VDIVSDrr_Int:
6809 case X86::VDIVSSrm_Int:
6811 case X86::VDIVSSrr_Int:
6814 case X86::VSQRTPDYm:
6815 case X86::VSQRTPDYr:
6818 case X86::VSQRTPSYm:
6819 case X86::VSQRTPSYr:
6821 case X86::VSQRTSDm_Int:
6823 case X86::VSQRTSDr_Int:
6825 case X86::VSQRTSSm_Int:
6827 case X86::VSQRTSSr_Int:
6829 case X86::VDIVPDZ128rm:
6830 case X86::VDIVPDZ128rmb:
6831 case X86::VDIVPDZ128rmbk:
6832 case X86::VDIVPDZ128rmbkz:
6833 case X86::VDIVPDZ128rmk:
6834 case X86::VDIVPDZ128rmkz:
6835 case X86::VDIVPDZ128rr:
6836 case X86::VDIVPDZ128rrk:
6837 case X86::VDIVPDZ128rrkz:
6838 case X86::VDIVPDZ256rm:
6839 case X86::VDIVPDZ256rmb:
6840 case X86::VDIVPDZ256rmbk:
6841 case X86::VDIVPDZ256rmbkz:
6842 case X86::VDIVPDZ256rmk:
6843 case X86::VDIVPDZ256rmkz:
6844 case X86::VDIVPDZ256rr:
6845 case X86::VDIVPDZ256rrk:
6846 case X86::VDIVPDZ256rrkz:
6847 case X86::VDIVPDZrrb:
6848 case X86::VDIVPDZrrbk:
6849 case X86::VDIVPDZrrbkz:
6850 case X86::VDIVPDZrm:
6851 case X86::VDIVPDZrmb:
6852 case X86::VDIVPDZrmbk:
6853 case X86::VDIVPDZrmbkz:
6854 case X86::VDIVPDZrmk:
6855 case X86::VDIVPDZrmkz:
6856 case X86::VDIVPDZrr:
6857 case X86::VDIVPDZrrk:
6858 case X86::VDIVPDZrrkz:
6859 case X86::VDIVPSZ128rm:
6860 case X86::VDIVPSZ128rmb:
6861 case X86::VDIVPSZ128rmbk:
6862 case X86::VDIVPSZ128rmbkz:
6863 case X86::VDIVPSZ128rmk:
6864 case X86::VDIVPSZ128rmkz:
6865 case X86::VDIVPSZ128rr:
6866 case X86::VDIVPSZ128rrk:
6867 case X86::VDIVPSZ128rrkz:
6868 case X86::VDIVPSZ256rm:
6869 case X86::VDIVPSZ256rmb:
6870 case X86::VDIVPSZ256rmbk:
6871 case X86::VDIVPSZ256rmbkz:
6872 case X86::VDIVPSZ256rmk:
6873 case X86::VDIVPSZ256rmkz:
6874 case X86::VDIVPSZ256rr:
6875 case X86::VDIVPSZ256rrk:
6876 case X86::VDIVPSZ256rrkz:
6877 case X86::VDIVPSZrrb:
6878 case X86::VDIVPSZrrbk:
6879 case X86::VDIVPSZrrbkz:
6880 case X86::VDIVPSZrm:
6881 case X86::VDIVPSZrmb:
6882 case X86::VDIVPSZrmbk:
6883 case X86::VDIVPSZrmbkz:
6884 case X86::VDIVPSZrmk:
6885 case X86::VDIVPSZrmkz:
6886 case X86::VDIVPSZrr:
6887 case X86::VDIVPSZrrk:
6888 case X86::VDIVPSZrrkz:
6889 case X86::VDIVSDZrm:
6890 case X86::VDIVSDZrr:
6891 case X86::VDIVSDZrm_Int:
6892 case X86::VDIVSDZrm_Intk:
6893 case X86::VDIVSDZrm_Intkz:
6894 case X86::VDIVSDZrr_Int:
6895 case X86::VDIVSDZrr_Intk:
6896 case X86::VDIVSDZrr_Intkz:
6897 case X86::VDIVSDZrrb_Int:
6898 case X86::VDIVSDZrrb_Intk:
6899 case X86::VDIVSDZrrb_Intkz:
6900 case X86::VDIVSSZrm:
6901 case X86::VDIVSSZrr:
6902 case X86::VDIVSSZrm_Int:
6903 case X86::VDIVSSZrm_Intk:
6904 case X86::VDIVSSZrm_Intkz:
6905 case X86::VDIVSSZrr_Int:
6906 case X86::VDIVSSZrr_Intk:
6907 case X86::VDIVSSZrr_Intkz:
6908 case X86::VDIVSSZrrb_Int:
6909 case X86::VDIVSSZrrb_Intk:
6910 case X86::VDIVSSZrrb_Intkz:
6911 case X86::VSQRTPDZ128m:
6912 case X86::VSQRTPDZ128mb:
6913 case X86::VSQRTPDZ128mbk:
6914 case X86::VSQRTPDZ128mbkz:
6915 case X86::VSQRTPDZ128mk:
6916 case X86::VSQRTPDZ128mkz:
6917 case X86::VSQRTPDZ128r:
6918 case X86::VSQRTPDZ128rk:
6919 case X86::VSQRTPDZ128rkz:
6920 case X86::VSQRTPDZ256m:
6921 case X86::VSQRTPDZ256mb:
6922 case X86::VSQRTPDZ256mbk:
6923 case X86::VSQRTPDZ256mbkz:
6924 case X86::VSQRTPDZ256mk:
6925 case X86::VSQRTPDZ256mkz:
6926 case X86::VSQRTPDZ256r:
6927 case X86::VSQRTPDZ256rk:
6928 case X86::VSQRTPDZ256rkz:
6929 case X86::VSQRTPDZm:
6930 case X86::VSQRTPDZmb:
6931 case X86::VSQRTPDZmbk:
6932 case X86::VSQRTPDZmbkz:
6933 case X86::VSQRTPDZmk:
6934 case X86::VSQRTPDZmkz:
6935 case X86::VSQRTPDZr:
6936 case X86::VSQRTPDZrb:
6937 case X86::VSQRTPDZrbk:
6938 case X86::VSQRTPDZrbkz:
6939 case X86::VSQRTPDZrk:
6940 case X86::VSQRTPDZrkz:
6941 case X86::VSQRTPSZ128m:
6942 case X86::VSQRTPSZ128mb:
6943 case X86::VSQRTPSZ128mbk:
6944 case X86::VSQRTPSZ128mbkz:
6945 case X86::VSQRTPSZ128mk:
6946 case X86::VSQRTPSZ128mkz:
6947 case X86::VSQRTPSZ128r:
6948 case X86::VSQRTPSZ128rk:
6949 case X86::VSQRTPSZ128rkz:
6950 case X86::VSQRTPSZ256m:
6951 case X86::VSQRTPSZ256mb:
6952 case X86::VSQRTPSZ256mbk:
6953 case X86::VSQRTPSZ256mbkz:
6954 case X86::VSQRTPSZ256mk:
6955 case X86::VSQRTPSZ256mkz:
6956 case X86::VSQRTPSZ256r:
6957 case X86::VSQRTPSZ256rk:
6958 case X86::VSQRTPSZ256rkz:
6959 case X86::VSQRTPSZm:
6960 case X86::VSQRTPSZmb:
6961 case X86::VSQRTPSZmbk:
6962 case X86::VSQRTPSZmbkz:
6963 case X86::VSQRTPSZmk:
6964 case X86::VSQRTPSZmkz:
6965 case X86::VSQRTPSZr:
6966 case X86::VSQRTPSZrb:
6967 case X86::VSQRTPSZrbk:
6968 case X86::VSQRTPSZrbkz:
6969 case X86::VSQRTPSZrk:
6970 case X86::VSQRTPSZrkz:
6971 case X86::VSQRTSDZm:
6972 case X86::VSQRTSDZm_Int:
6973 case X86::VSQRTSDZm_Intk:
6974 case X86::VSQRTSDZm_Intkz:
6975 case X86::VSQRTSDZr:
6976 case X86::VSQRTSDZr_Int:
6977 case X86::VSQRTSDZr_Intk:
6978 case X86::VSQRTSDZr_Intkz:
6979 case X86::VSQRTSDZrb_Int:
6980 case X86::VSQRTSDZrb_Intk:
6981 case X86::VSQRTSDZrb_Intkz:
6982 case X86::VSQRTSSZm:
6983 case X86::VSQRTSSZm_Int:
6984 case X86::VSQRTSSZm_Intk:
6985 case X86::VSQRTSSZm_Intkz:
6986 case X86::VSQRTSSZr:
6987 case X86::VSQRTSSZr_Int:
6988 case X86::VSQRTSSZr_Intk:
6989 case X86::VSQRTSSZr_Intkz:
6990 case X86::VSQRTSSZrb_Int:
6991 case X86::VSQRTSSZrb_Intk:
6992 case X86::VSQRTSSZrb_Intkz:
6994 case X86::VGATHERDPDYrm:
6995 case X86::VGATHERDPDZ128rm:
6996 case X86::VGATHERDPDZ256rm:
6997 case X86::VGATHERDPDZrm:
6998 case X86::VGATHERDPDrm:
6999 case X86::VGATHERDPSYrm:
7000 case X86::VGATHERDPSZ128rm:
7001 case X86::VGATHERDPSZ256rm:
7002 case X86::VGATHERDPSZrm:
7003 case X86::VGATHERDPSrm:
7004 case X86::VGATHERPF0DPDm:
7005 case X86::VGATHERPF0DPSm:
7006 case X86::VGATHERPF0QPDm:
7007 case X86::VGATHERPF0QPSm:
7008 case X86::VGATHERPF1DPDm:
7009 case X86::VGATHERPF1DPSm:
7010 case X86::VGATHERPF1QPDm:
7011 case X86::VGATHERPF1QPSm:
7012 case X86::VGATHERQPDYrm:
7013 case X86::VGATHERQPDZ128rm:
7014 case X86::VGATHERQPDZ256rm:
7015 case X86::VGATHERQPDZrm:
7016 case X86::VGATHERQPDrm:
7017 case X86::VGATHERQPSYrm:
7018 case X86::VGATHERQPSZ128rm:
7019 case X86::VGATHERQPSZ256rm:
7020 case X86::VGATHERQPSZrm:
7021 case X86::VGATHERQPSrm:
7022 case X86::VPGATHERDDYrm:
7023 case X86::VPGATHERDDZ128rm:
7024 case X86::VPGATHERDDZ256rm:
7025 case X86::VPGATHERDDZrm:
7026 case X86::VPGATHERDDrm:
7027 case X86::VPGATHERDQYrm:
7028 case X86::VPGATHERDQZ128rm:
7029 case X86::VPGATHERDQZ256rm:
7030 case X86::VPGATHERDQZrm:
7031 case X86::VPGATHERDQrm:
7032 case X86::VPGATHERQDYrm:
7033 case X86::VPGATHERQDZ128rm:
7034 case X86::VPGATHERQDZ256rm:
7035 case X86::VPGATHERQDZrm:
7036 case X86::VPGATHERQDrm:
7037 case X86::VPGATHERQQYrm:
7038 case X86::VPGATHERQQZ128rm:
7039 case X86::VPGATHERQQZ256rm:
7040 case X86::VPGATHERQQZrm:
7041 case X86::VPGATHERQQrm:
7042 case X86::VSCATTERDPDZ128mr:
7043 case X86::VSCATTERDPDZ256mr:
7044 case X86::VSCATTERDPDZmr:
7045 case X86::VSCATTERDPSZ128mr:
7046 case X86::VSCATTERDPSZ256mr:
7047 case X86::VSCATTERDPSZmr:
7048 case X86::VSCATTERPF0DPDm:
7049 case X86::VSCATTERPF0DPSm:
7050 case X86::VSCATTERPF0QPDm:
7051 case X86::VSCATTERPF0QPSm:
7052 case X86::VSCATTERPF1DPDm:
7053 case X86::VSCATTERPF1DPSm:
7054 case X86::VSCATTERPF1QPDm:
7055 case X86::VSCATTERPF1QPSm:
7056 case X86::VSCATTERQPDZ128mr:
7057 case X86::VSCATTERQPDZ256mr:
7058 case X86::VSCATTERQPDZmr:
7059 case X86::VSCATTERQPSZ128mr:
7060 case X86::VSCATTERQPSZ256mr:
7061 case X86::VSCATTERQPSZmr:
7062 case X86::VPSCATTERDDZ128mr:
7063 case X86::VPSCATTERDDZ256mr:
7064 case X86::VPSCATTERDDZmr:
7065 case X86::VPSCATTERDQZ128mr:
7066 case X86::VPSCATTERDQZ256mr:
7067 case X86::VPSCATTERDQZmr:
7068 case X86::VPSCATTERQDZ128mr:
7069 case X86::VPSCATTERQDZ256mr:
7070 case X86::VPSCATTERQDZmr:
7071 case X86::VPSCATTERQQZ128mr:
7072 case X86::VPSCATTERQQZ256mr:
7073 case X86::VPSCATTERQQZmr:
7083 unsigned UseIdx)
const {
7090 "Reassociation needs binary operators");
7101 "Unexpected operand in reassociable instruction");
7145 case X86::VPANDDZ128rr:
7146 case X86::VPANDDZ256rr:
7147 case X86::VPANDDZrr:
7148 case X86::VPANDQZ128rr:
7149 case X86::VPANDQZ256rr:
7150 case X86::VPANDQZrr:
7153 case X86::VPORDZ128rr:
7154 case X86::VPORDZ256rr:
7156 case X86::VPORQZ128rr:
7157 case X86::VPORQZ256rr:
7161 case X86::VPXORDZ128rr:
7162 case X86::VPXORDZ256rr:
7163 case X86::VPXORDZrr:
7164 case X86::VPXORQZ128rr:
7165 case X86::VPXORQZ256rr:
7166 case X86::VPXORQZrr:
7169 case X86::VANDPDYrr:
7170 case X86::VANDPSYrr:
7171 case X86::VANDPDZ128rr:
7172 case X86::VANDPSZ128rr:
7173 case X86::VANDPDZ256rr:
7174 case X86::VANDPSZ256rr:
7175 case X86::VANDPDZrr:
7176 case X86::VANDPSZrr:
7181 case X86::VORPDZ128rr:
7182 case X86::VORPSZ128rr:
7183 case X86::VORPDZ256rr:
7184 case X86::VORPSZ256rr:
7189 case X86::VXORPDYrr:
7190 case X86::VXORPSYrr:
7191 case X86::VXORPDZ128rr:
7192 case X86::VXORPSZ128rr:
7193 case X86::VXORPDZ256rr:
7194 case X86::VXORPSZ256rr:
7195 case X86::VXORPDZrr:
7196 case X86::VXORPSZrr:
7217 case X86::VPADDBYrr:
7218 case X86::VPADDWYrr:
7219 case X86::VPADDDYrr:
7220 case X86::VPADDQYrr:
7221 case X86::VPADDBZ128rr:
7222 case X86::VPADDWZ128rr:
7223 case X86::VPADDDZ128rr:
7224 case X86::VPADDQZ128rr:
7225 case X86::VPADDBZ256rr:
7226 case X86::VPADDWZ256rr:
7227 case X86::VPADDDZ256rr:
7228 case X86::VPADDQZ256rr:
7229 case X86::VPADDBZrr:
7230 case X86::VPADDWZrr:
7231 case X86::VPADDDZrr:
7232 case X86::VPADDQZrr:
7233 case X86::VPMULLWrr:
7234 case X86::VPMULLWYrr:
7235 case X86::VPMULLWZ128rr:
7236 case X86::VPMULLWZ256rr:
7237 case X86::VPMULLWZrr:
7238 case X86::VPMULLDrr:
7239 case X86::VPMULLDYrr:
7240 case X86::VPMULLDZ128rr:
7241 case X86::VPMULLDZ256rr:
7242 case X86::VPMULLDZrr:
7243 case X86::VPMULLQZ128rr:
7244 case X86::VPMULLQZ256rr:
7245 case X86::VPMULLQZrr:
7257 case X86::VMAXCPDrr:
7258 case X86::VMAXCPSrr:
7259 case X86::VMAXCPDYrr:
7260 case X86::VMAXCPSYrr:
7261 case X86::VMAXCPDZ128rr:
7262 case X86::VMAXCPSZ128rr:
7263 case X86::VMAXCPDZ256rr:
7264 case X86::VMAXCPSZ256rr:
7265 case X86::VMAXCPDZrr:
7266 case X86::VMAXCPSZrr:
7267 case X86::VMAXCSDrr:
7268 case X86::VMAXCSSrr:
7269 case X86::VMAXCSDZrr:
7270 case X86::VMAXCSSZrr:
7271 case X86::VMINCPDrr:
7272 case X86::VMINCPSrr:
7273 case X86::VMINCPDYrr:
7274 case X86::VMINCPSYrr:
7275 case X86::VMINCPDZ128rr:
7276 case X86::VMINCPSZ128rr:
7277 case X86::VMINCPDZ256rr:
7278 case X86::VMINCPSZ256rr:
7279 case X86::VMINCPDZrr:
7280 case X86::VMINCPSZrr:
7281 case X86::VMINCSDrr:
7282 case X86::VMINCSSrr:
7283 case X86::VMINCSDZrr:
7284 case X86::VMINCSSZrr:
7296 case X86::VADDPDYrr:
7297 case X86::VADDPSYrr:
7298 case X86::VADDPDZ128rr:
7299 case X86::VADDPSZ128rr:
7300 case X86::VADDPDZ256rr:
7301 case X86::VADDPSZ256rr:
7302 case X86::VADDPDZrr:
7303 case X86::VADDPSZrr:
7306 case X86::VADDSDZrr:
7307 case X86::VADDSSZrr:
7310 case X86::VMULPDYrr:
7311 case X86::VMULPSYrr:
7312 case X86::VMULPDZ128rr:
7313 case X86::VMULPSZ128rr:
7314 case X86::VMULPDZ256rr:
7315 case X86::VMULPSZ256rr:
7316 case X86::VMULPDZrr:
7317 case X86::VMULPSZrr:
7320 case X86::VMULSDZrr:
7321 case X86::VMULSSZrr:
7340 "Unexpected instruction type for reassociation");
7347 assert(OldOp1.isReg() && OldOp1.getReg() == X86::EFLAGS && OldOp1.isDead() &&
7348 "Must have dead EFLAGS operand in reassociable instruction");
7350 "Must have dead EFLAGS operand in reassociable instruction");
7356 "Unexpected operand in reassociable instruction");
7358 "Unexpected operand in reassociable instruction");
7368 std::pair<unsigned, unsigned>
7370 return std::make_pair(TF, 0u);
7375 using namespace X86II;
7376 static const std::pair<unsigned, const char *>
TargetFlags[] = {
7428 if (GlobalBaseReg == 0)
7448 BuildMI(FirstMBB, MBBI, DL, TII->get(X86::LEA64r), PC)
7464 BuildMI(FirstMBB, MBBI, DL, TII->get(X86::LEA64r), PBReg)
7471 BuildMI(FirstMBB, MBBI, DL, TII->get(X86::MOV64ri), GOTReg)
7472 .addExternalSymbol(
"_GLOBAL_OFFSET_TABLE_",
7474 BuildMI(FirstMBB, MBBI, DL, TII->get(X86::ADD64rr), PC)
7483 BuildMI(FirstMBB, MBBI, DL, TII->get(X86::MOVPC32r), PC).addImm(0);
7500 StringRef getPassName()
const override {
7501 return "X86 PIC Global Base Reg Initialization";
7541 bool Changed =
false;
7546 switch (
I->getOpcode()) {
7547 case X86::TLS_base_addr32:
7548 case X86::TLS_base_addr64:
7550 I = ReplaceTLSBaseAddrCall(*
I, TLSBaseAddrReg);
7552 I = SetRegister(*
I, &TLSBaseAddrReg);
7563 Changed |= VisitNode(*
I, TLSBaseAddrReg);
7572 unsigned TLSBaseAddrReg) {
7581 TII->get(TargetOpcode::COPY), is64Bit ? X86::RAX :
X86::EAX)
7582 .addReg(TLSBaseAddrReg);
7601 ? &X86::GR64RegClass
7602 : &X86::GR32RegClass);
7608 TII->get(TargetOpcode::COPY), *TLSBaseAddrReg)
7609 .addReg(is64Bit ? X86::RAX :
X86::EAX);
7614 StringRef getPassName()
const override {
7615 return "Local Dynamic TLS Access Clean-up";
7664 std::vector<outliner::Candidate> &RepeatedSequenceLocs)
const {
7665 unsigned SequenceSize =
7666 std::accumulate(RepeatedSequenceLocs[0].front(),
7667 std::next(RepeatedSequenceLocs[0].back()), 0,
7678 if (RepeatedSequenceLocs[0].back()->isTerminator()) {
7696 bool OutlineFromLinkOnceODRs)
const {
7770 if (MOP.isCPI() || MOP.isJTI() || MOP.isCFIIndex() || MOP.isFI() ||
7771 MOP.isTargetIndex())
7812 #define GET_INSTRINFO_HELPERS 7813 #include "X86GenInstrInfo.inc" unsigned getTargetFlags() const
const T & front() const
front - Get the first element.
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
unsigned GetCondBranchFromCond(CondCode CC)
const MachineInstrBuilder & setMemRefs(ArrayRef< MachineMemOperand *> MMOs) const
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
This routine provides some synthesis utilities to produce sequences of values.
const MachineInstrBuilder & add(const MachineOperand &MO) const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool usesWindowsCFI() const
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
static bool hasUndefRegUpdate(unsigned Opcode)
static cl::opt< bool > NoFusing("disable-spill-fusing", cl::desc("Disable fusing of spill code into instructions"), cl::Hidden)
static bool Expand2AddrKreg(MachineInstrBuilder &MIB, const MCInstrDesc &Desc, unsigned Reg)
Expand a single-def pseudo instruction to a two-addr instruction with two k0 reads.
bool canMakeTailCallConditional(SmallVectorImpl< MachineOperand > &Cond, const MachineInstr &TailCall) const override
bool optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg, unsigned SrcReg2, int CmpMask, int CmpValue, const MachineRegisterInfo *MRI) const override
optimizeCompareInstr - Check if there exists an earlier instruction that operates on the same source ...
static Type * getDoubleTy(LLVMContext &C)
uint16_t getExecutionDomainCustom(const MachineInstr &MI) const
bool modifiesRegister(unsigned Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr modifies (fully define or partially define) the specified register...
bool use_nodbg_empty(unsigned RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register...
const X86MemoryFoldTableEntry * lookupUnfoldTable(unsigned MemOp)
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
bool isCall(QueryType Type=AnyInBundle) const
static bool regIsPICBase(unsigned BaseReg, const MachineRegisterInfo &MRI)
Return true if register is PIC base; i.e.g defined by X86::MOVPC32r.
bool hasDebugInfo() const
Returns true if valid debug info is present.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
bool expandPostRAPseudo(MachineInstr &MI) const override
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
unsigned getRegState(const MachineOperand &RegOp)
Get all register state flags from machine operand RegOp.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
bool setExecutionDomainCustom(MachineInstr &MI, unsigned Domain) const
MO_TLSLDM - Represents the offset into the global offset table at which.
static unsigned CopyToFromAsymmetricReg(unsigned DestReg, unsigned SrcReg, const X86Subtarget &Subtarget)
bool isUnconditionalTailCall(const MachineInstr &MI) const override
void ChangeToRegister(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value...
A Module instance is used to store all the information related to an LLVM module. ...
This class is used to group {132, 213, 231} forms of FMA opcodes together.
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
MO_TLSLD - On a symbol operand this indicates that the immediate is the offset of the GOT entry with ...
bool isCommutable() const
Return true if this may be a 2- or 3-address instruction (of the form "X = op Y, Z, ..."), which produces the same result if Y and Z are exchanged.
static bool expandXorFP(MachineInstrBuilder &MIB, const TargetInstrInfo &TII)
MO_TLVP_PIC_BASE - On a symbol operand this indicates that the immediate is some TLS offset from the ...
bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, int64_t &Offset1, int64_t &Offset2) const override
areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler to determine if two loads are lo...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
const X86InstrInfo * getInstrInfo() const override
const X86MemoryFoldTableEntry * lookupFoldTable(unsigned RegOp, unsigned OpNum)
CondCode getCondFromCMovOpc(unsigned Opc)
Return condition code of a CMov opcode.
void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, SmallVectorImpl< MachineOperand > &Addr, const TargetRegisterClass *RC, ArrayRef< MachineMemOperand *> MMOs, SmallVectorImpl< MachineInstr *> &NewMIs) const
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const X86FrameLowering * getFrameLowering() const override
MO_TLSGD - Represents the offset into the global offset table at which.
static bool isFrameStoreOpcode(int Opcode, unsigned &MemBytes)
Describe properties that are true of each instruction in the target description file.
unsigned getReg() const
getReg - Returns the register number.
bool isHighLatencyDef(int opc) const override
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
CondCode getCondFromSETOpc(unsigned Opc)
Return condition code of a SET opcode.
unsigned getSubReg() const
virtual bool hasReassociableOperands(const MachineInstr &Inst, const MachineBasicBlock *MBB) const
Return true when Inst has reassociable operands in the same MBB.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
unsigned getPartialRegUpdateClearance(const MachineInstr &MI, unsigned OpNum, const TargetRegisterInfo *TRI) const override
Inform the BreakFalseDeps pass how many idle instructions we would like before a partial register upd...
bool isPredicable(QueryType Type=AllInBundle) const
Return true if this instruction has a predicate operand that controls execution.
static cl::opt< bool > ReMatPICStubLoad("remat-pic-stub-load", cl::desc("Re-materialize load from stub in PIC mode"), cl::init(false), cl::Hidden)
0 1 0 0 True if ordered and less than
static unsigned getLoadRegOpcode(unsigned DestReg, const TargetRegisterClass *RC, bool isStackAligned, const X86Subtarget &STI)
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
AddrNumOperands - Total number of operands in a memory reference.
uint64_t getSize() const
Return the size in bytes of the memory reference.
1 1 1 0 True if unordered or not equal
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
unsigned getUndefRegClearance(const MachineInstr &MI, unsigned &OpNum, const TargetRegisterInfo *TRI) const override
Inform the BreakFalseDeps pass how many idle instructions we would like before certain undef register...
static MachineInstr * FuseTwoAddrInst(MachineFunction &MF, unsigned Opcode, ArrayRef< MachineOperand > MOs, MachineBasicBlock::iterator InsertPt, MachineInstr &MI, const TargetInstrInfo &TII)
unsigned get213Opcode() const
Returns the 213 form of FMA opcode.
unsigned const TargetRegisterInfo * TRI
void setIsDead(bool Val=true)
MachineModuleInfo & getMMI() const
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
MachineInstrBundleIterator< const MachineInstr > const_iterator
MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...
MO_DTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry with...
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned char TargetFlags=0) const
void breakPartialRegDependency(MachineInstr &MI, unsigned OpNum, const TargetRegisterInfo *TRI) const override
std::pair< uint16_t, uint16_t > getExecutionDomain(const MachineInstr &MI) const override
iterator_range< mop_iterator > operands()
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL, bool NoImp=false)
CreateMachineInstr - Allocate a new MachineInstr.
static bool isAligned(const Value *Base, const APInt &Offset, unsigned Align, const DataLayout &DL)
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment)
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
unsigned getSpillSize(const TargetRegisterClass &RC) const
Return the size in bytes of the stack slot allocated to hold a spilled copy of a register from class ...
An individual sequence of instructions to be replaced with a call to an outlined function.
unsigned isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
isLoadFromStackSlotPostFE - Check for post-frame ptr elimination stack locations as well...
static bool expandNOVLXStore(MachineInstrBuilder &MIB, const TargetRegisterInfo *TRI, const MCInstrDesc &StoreDesc, const MCInstrDesc &ExtractDesc, unsigned SubIdx)
return AArch64::GPR64RegClass contains(Reg)
iterator_range< succ_iterator > successors()
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
GlobalBaseReg - On Darwin, this node represents the result of the mflr at function entry...
X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...
MachineInstr * convertToThreeAddress(MachineFunction::iterator &MFI, MachineInstr &MI, LiveVariables *LV) const override
convertToThreeAddress - This method must be implemented by targets that set the M_CONVERTIBLE_TO_3_AD...
static MachineInstr * MakeM0Inst(const TargetInstrInfo &TII, unsigned Opcode, ArrayRef< MachineOperand > MOs, MachineBasicBlock::iterator InsertPt, MachineInstr &MI)
1 0 0 1 True if unordered or equal
AnalysisUsage & addRequired()
static X86::CondCode isUseDefConvertible(const MachineInstr &MI)
Check whether the use can be converted to remove a comparison against zero.
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
static uint32_t getAlignment(const MCSectionCOFF &Sec)
MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...
A description of a memory reference used in the backend.
static SmallVector< MachineMemOperand *, 2 > extractStoreMMOs(ArrayRef< MachineMemOperand *> MMOs, MachineFunction &MF)
static unsigned getLoadStoreRegOpcode(unsigned Reg, const TargetRegisterClass *RC, bool isStackAligned, const X86Subtarget &STI, bool load)
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
Provide an instruction scheduling machine model to CodeGen passes.
const HexagonInstrInfo * TII
static Type * getFloatTy(LLVMContext &C)
bool getMemOperandWithOffset(MachineInstr &LdSt, MachineOperand *&BaseOp, int64_t &Offset, const TargetRegisterInfo *TRI) const override
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
unsigned getNumOperands() const
Retuns the total number of operands.
const TargetRegisterClass * getRegClass(const MCInstrDesc &MCID, unsigned OpNum, const TargetRegisterInfo *TRI, const MachineFunction &MF) const
Given a machine instruction descriptor, returns the register class constraint for OpNum...
MachineInstr * optimizeLoadInstr(MachineInstr &MI, const MachineRegisterInfo *MRI, unsigned &FoldAsLoadDefReg, MachineInstr *&DefMI) const override
optimizeLoadInstr - Try to remove the load by folding it to a register operand at the use...
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s), MachineInstr opcode, and operands.
void setExecutionDomain(MachineInstr &MI, unsigned Domain) const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void setImplicit(bool Val=true)
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
MachineOutlinerClass
Constants defining how certain sequences should be outlined.
CondCode getCondFromBranchOpc(unsigned Opc)
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
0 1 0 1 True if ordered and less than or equal
static int getRegClass(RegisterKind Is, unsigned RegWidth)
static bool hasPartialRegUpdate(unsigned Opcode, const X86Subtarget &Subtarget)
Return true for all instructions that only update the first 32 or 64-bits of the destination register...
void setSpecialOperandAttr(MachineInstr &OldMI1, MachineInstr &OldMI2, MachineInstr &NewMI1, MachineInstr &NewMI2) const override
This is an architecture-specific helper function of reassociateOps.
unsigned FrameConstructionID
Target-defined identifier for constructing a frame for this function.
The memory access is dereferenceable (i.e., doesn't trap).
bool isReallyTriviallyReMaterializable(const MachineInstr &MI, AliasAnalysis *AA) const override
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned getGlobalBaseReg(MachineFunction *MF) const
getGlobalBaseReg - Return a virtual register initialized with the the global base register value...
unsigned getSwappedVPCMPImm(unsigned Imm)
Get the VPCMP immediate if the opcodes are swapped.
bool isCoalescableExtInstr(const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg, unsigned &SubIdx) const override
isCoalescableExtInstr - Return true if the instruction is a "coalescable" extension instruction...
bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const override
isSafeToMoveRegClassDefs - Return true if it's safe to move a machine instruction that defines the sp...
static const uint16_t * lookup(unsigned opcode, unsigned domain, ArrayRef< uint16_t[3]> Table)
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
static bool isMem(const MachineInstr &MI, unsigned Op)
static const uint16_t ReplaceableInstrsAVX512DQMasked[][4]
MachineInstr * getVRegDef(unsigned Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
defusechain_iterator - This class provides iterator support for machine operands in the function that...
bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, unsigned &SrcReg2, int &CmpMask, int &CmpValue) const override
analyzeCompare - For a comparison instruction, return the source registers in SrcReg and SrcReg2 if h...
int64_t getSExtValue() const
int getTCReturnAddrDelta() const
uint16_t StackAdjustment(const RuntimeFunction &RF)
StackAdjustment - calculated stack adjustment in words.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
MachineFunction & getMachineFunction() const
MO_GOT - This flag indicates that a symbol operand represents the address of the GOT entry for the sy...
bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, int64_t Offset1, int64_t Offset2, unsigned NumLoads) const override
shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to determine (in conjunction w...
static def_instr_iterator def_instr_end()
unsigned getSwappedVPCOMImm(unsigned Imm)
Get the VPCOM immediate if the opcodes are swapped.
MO_GOTTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry wi...
static void updateOperandRegConstraints(MachineFunction &MF, MachineInstr &NewMI, const TargetInstrInfo &TII)
static const uint16_t ReplaceableInstrsAVX512DQ[][4]
GlobalValue * getNamedValue(StringRef Name) const
Return the global value in the module with the specified name, of arbitrary type. ...
Base class for the actual dominator tree node.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
unsigned get231Opcode() const
Returns the 231 form of FMA opcode.
static const uint16_t ReplaceableCustomInstrs[][3]
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
bool isUnpredicatedTerminator(const MachineInstr &MI) const override
bool isIntrinsic() const
Returns true iff the group of FMA opcodes holds intrinsic opcodes.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
unsigned getUndefRegState(bool B)
MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...
void BuildCFI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, const MCCFIInstruction &CFIInst) const
Wraps up getting a CFI index and building a MachineInstr for it.
static bool ExpandMOVImmSExti8(MachineInstrBuilder &MIB, const TargetInstrInfo &TII, const X86Subtarget &Subtarget)
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
const X86InstrFMA3Group * getFMA3Group(unsigned Opcode, uint64_t TSFlags)
Returns a reference to a group of FMA3 opcodes to where the given Opcode is included.
bool isDereferenceableInvariantLoad(AliasAnalysis *AA) const
Return true if this load instruction never traps and points to a memory location whose value doesn't ...
const TargetRegisterClass * constrainRegClass(unsigned Reg, const TargetRegisterClass *RC, unsigned MinNumRegs=0)
constrainRegClass - Constrain the register class of the specified virtual register to be a common sub...
reverse_iterator rbegin()
bool isBranch(QueryType Type=AnyInBundle) const
Returns true if this is a conditional, unconditional, or indirect branch.
Instances of this class represent a single low-level machine instruction.
BasicBlockListType::iterator iterator
unsigned getKillRegState(bool B)
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
bool classifyLEAReg(MachineInstr &MI, const MachineOperand &Src, unsigned LEAOpcode, bool AllowSP, unsigned &NewSrc, bool &isKill, MachineOperand &ImplicitOp, LiveVariables *LV) const
Given an operand within a MachineInstr, insert preceding code to put it into the right format for a p...
static ARCCC::CondCode GetOppositeBranchCondition(ARCCC::CondCode CC)
Return the inverse of passed condition, i.e. turning COND_E to COND_NE.
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
TargetInstrInfo - Interface to description of machine instruction set.
bool isReturn(QueryType Type=AnyInBundle) const
bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
unsigned getDeadRegState(bool B)
static cl::opt< bool > PrintFailedFusing("print-failed-fuse-candidates", cl::desc("Print instructions that the allocator wants to" " fuse, but the X86 backend currently can't"), cl::Hidden)
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SubIdx, const MachineInstr &Orig, const TargetRegisterInfo &TRI) const override
unsigned getDefRegState(bool B)
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
bool hasLinkOnceODRLinkage() const
MO_SECREL - On a symbol operand this indicates that the immediate is the offset from beginning of sec...
virtual MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const
This method commutes the operands of the given machine instruction MI.
static unsigned getCommutedVPERMV3Opcode(unsigned Opcode)
initializer< Ty > init(const Ty &Val)
std::pair< CondCode, bool > getX86ConditionCode(CmpInst::Predicate Predicate)
Return a pair of condition code for the given predicate and whether the instruction operands should b...
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
const TargetRegisterInfo * getTargetRegisterInfo() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
int getSPAdjust(const MachineInstr &MI) const override
getSPAdjust - This returns the stack pointer adjustment made by this instruction. ...
unsigned const MachineRegisterInfo * MRI
static bool isTruncatedShiftCountForLEA(unsigned ShAmt)
Check whether the given shift count is appropriate can be represented by a LEA instruction.
MO_GOT_ABSOLUTE_ADDRESS - On a symbol operand, this represents a relocation of: SYMBOL_LABEL + [...
static MachineOperand CreateCPI(unsigned Idx, int Offset, unsigned char TargetFlags=0)
ArrayRef< MachineMemOperand * > memoperands() const
Access to memory operands of the instruction.
bool isSafeToClobberEFLAGS(MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
isSafeToClobberEFLAGS - Return true if it's safe insert an instruction tha would clobber the EFLAGS c...
InstrType
Represents how an instruction should be mapped by the outliner.
static bool isRedundantFlagInstr(const MachineInstr &FlagI, unsigned SrcReg, unsigned SrcReg2, int ImmMask, int ImmValue, const MachineInstr &OI)
Check whether the first instruction, whose only purpose is to update flags, can be made redundant...
The instances of the Type class are immutable: once they are created, they are never changed...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
static bool isFrameLoadOpcode(int Opcode, unsigned &MemBytes)
static const uint16_t ReplaceableInstrs[][3]
bool readsVirtualRegister(unsigned Reg) const
Return true if the MachineInstr reads the specified virtual register.
FunctionPass * createX86GlobalBaseRegPass()
This pass initializes a global base register for PIC on x86-32.
bool registerDefIsDead(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Returns true if the register is dead in this machine instruction.
unsigned CallConstructionID
Identifier denoting the instructions to emit to call an outlined function from this point...
MO_GOTNTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry w...
MO_TLVP - On a symbol operand this indicates that the immediate is some TLS offset.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineInstrBuilder & UseMI
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
The information necessary to create an outlined function for some class of candidate.
void addLiveOuts(const MachineBasicBlock &MBB)
Adds all live-out registers of basic block MBB.
static void expandLoadStackGuard(MachineInstrBuilder &MIB, const TargetInstrInfo &TII)
const SDValue & getOperand(unsigned Num) const
static bool is64Bit(const char *name)
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE and DBG_LABEL instructions...
void setGlobalBaseReg(unsigned Reg)
static bool expandNOVLXLoad(MachineInstrBuilder &MIB, const TargetRegisterInfo *TRI, const MCInstrDesc &LoadDesc, const MCInstrDesc &BroadcastDesc, unsigned SubIdx)
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
void getNoop(MCInst &NopInst) const override
Return the noop instruction to use for a noop.
unsigned getSubReg(unsigned Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
unsigned getVPCMPImmForCond(ISD::CondCode CC)
Get the VPCMP immediate for the given condition.
Represent the analysis usage information of a pass.
static const MachineInstrBuilder & addRegOffset(const MachineInstrBuilder &MIB, unsigned Reg, bool isKill, int Offset)
addRegOffset - This function is used to add a memory reference of the form [Reg + Offset]...
X86InstrInfo(X86Subtarget &STI)
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
bool optForSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
const PseudoSourceValue * getPseudoValue() const
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setImm(int64_t immVal)
static void addOperands(MachineInstrBuilder &MIB, ArrayRef< MachineOperand > MOs, int PtrOffset=0)
FunctionPass class - This class is used to implement most global optimizations.
0 1 1 1 True if ordered (no nans)
MO_NTPOFF - On a symbol operand this indicates that the immediate is the negative thread-pointer offs...
#define VPERM_CASES(Suffix)
unsigned getOperandBias(const MCInstrDesc &Desc)
getOperandBias - compute whether all of the def operands are repeated in the uses and therefore shoul...
self_iterator getIterator()
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
static Constant * getAllOnesValue(Type *Ty)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned CommuteOpIdx1, unsigned CommuteOpIdx2) const override
Commutes the operands in the given instruction by changing the operands order and/or changing the ins...
static unsigned GetCondBranchFromCond(XCore::CondCode CC)
GetCondBranchFromCond - Return the Branch instruction opcode that matches the cc. ...
succ_iterator succ_begin()
unsigned getSETFromCond(CondCode CC, bool HasMemoryOperand=false)
Return a set opcode for the given condition and whether it has a memory operand.
static unsigned getThreeSrcCommuteCase(uint64_t TSFlags, unsigned SrcOpIdx1, unsigned SrcOpIdx2)
This determines which of three possible cases of a three source commute the source indexes correspond...
bool isImplicitDef() const
VarInfo & getVarInfo(unsigned RegIdx)
getVarInfo - Return the VarInfo structure for the specified VIRTUAL register.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const MachineBasicBlock & front() const
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DstReg, ArrayRef< MachineOperand > Cond, unsigned TrueReg, unsigned FalseReg) const override
bool isTargetWin64() const
bool isDebugInstr() const
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
1 1 0 1 True if unordered, less than, or equal
unsigned getNumOperands() const
Return the number of values used by this operation.
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
uint64_t getAlignment() const
Return the minimum known alignment in bytes of the actual memory reference.
static const uint16_t * lookupAVX512(unsigned opcode, unsigned domain, ArrayRef< uint16_t[4]> Table)
static bool isHReg(unsigned Reg)
Test if the given register is a physical h register.
const X86MemoryFoldTableEntry * lookupTwoAddrFoldTable(unsigned RegOp)
void setIsKill(bool Val=true)
static const MachineInstrBuilder & addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset=0, bool mem=true)
addFrameReference - This function is used to add a reference to the base of an abstract object on the...
static bool AdjustBlendMask(unsigned OldMask, unsigned OldWidth, unsigned NewWidth, unsigned *pNewMask=nullptr)
const X86RegisterInfo * getRegisterInfo() const override
std::vector< MachineInstr * > Kills
Kills - List of MachineInstruction's which are the last use of this virtual register (kill it) in the...
MO_TPOFF - On a symbol operand this indicates that the immediate is the thread-pointer offset for the...
0 0 1 0 True if ordered and greater than
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
bool analyzeBranchPredicate(MachineBasicBlock &MBB, TargetInstrInfo::MachineBranchPredicate &MBP, bool AllowModify=false) const override
bool isPICStyleGOT() const
#define VPERM_CASES_BROADCAST(Suffix)
static bool isDefConvertible(const MachineInstr &MI, bool &NoSignFlag)
Check whether the definition can be converted to remove a comparison against zero.
void replaceKillInstruction(unsigned Reg, MachineInstr &OldMI, MachineInstr &NewMI)
replaceKillInstruction - Update register kill info by replacing a kill instruction with a new one...
void setOpcode(unsigned Op)
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
void substituteRegister(unsigned FromReg, unsigned ToReg, unsigned SubIdx, const TargetRegisterInfo &RegInfo)
Replace all occurrences of FromReg with ToReg:SubIdx, properly composing subreg indices where necessa...
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
unsigned isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
isStoreToStackSlotPostFE - Check for post-frame ptr elimination stack locations as well...
MachineDomTreeNode * getRootNode() const
bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr &MI, unsigned Reg, bool UnfoldLoad, bool UnfoldStore, SmallVectorImpl< MachineInstr *> &NewMIs) const override
unfoldMemoryOperand - Separate a single instruction which folded a load or a store or a load and a st...
bool hasLiveCondCodeDef(MachineInstr &MI) const
True if MI has a condition code def, e.g.
MachineOperand class - Representation of each machine instruction operand.
static bool expandMOV32r1(MachineInstrBuilder &MIB, const TargetInstrInfo &TII, bool MinusOne)
1 1 0 0 True if unordered or less than
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
CondCode GetOppositeBranchCondition(CondCode CC)
GetOppositeBranchCondition - Return the inverse of the specified cond, e.g.
MachineInstrBuilder MachineInstrBuilder & DefMI
static const MachineInstrBuilder & addRegReg(const MachineInstrBuilder &MIB, unsigned Reg1, bool isKill1, unsigned Reg2, bool isKill2)
addRegReg - This function is used to add a memory reference of the form: [Reg + Reg].
Information about stack frame layout on the target.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
unsigned getNumLocalDynamicTLSAccesses() const
static void commuteVPTERNLOG(MachineInstr &MI, unsigned SrcOpIdx1, unsigned SrcOpIdx2)
int64_t getFrameAdjustment(const MachineInstr &I) const
Returns the stack pointer adjustment that happens inside the frame setup..destroy sequence (e...
const MachineInstrBuilder & addDisp(const MachineOperand &Disp, int64_t off, unsigned char TargetFlags=0) const
const X86RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly. ...
void setPreservesCFG()
This function should be called by the pass, iff they do not:
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
Represents one node in the SelectionDAG.
bool isKMergeMasked(uint64_t TSFlags)
isKMergedMasked - Is this a merge masked instruction.
MachineInstr * remove(MachineInstr *I)
Remove the unbundled instruction from the instruction list without deleting it.
bool isLayoutSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB will be emitted immediately after this block, such that if this bloc...
MachineInstr * getUniqueVRegDef(unsigned Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
virtual bool findCommutedOpIndices(MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const
Returns true iff the routine could find two commutable operands in the given machine instruction...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
unsigned getX86SubSuperRegister(unsigned, unsigned, bool High=false)
Returns the sub or super register of a specific X86 register.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
bool isLiveIn(MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
Return true if the specified register is in the live in set.
bool getUsesRedZone() const
static SmallVector< MachineMemOperand *, 2 > extractLoadMMOs(ArrayRef< MachineMemOperand *> MMOs, MachineFunction &MF)
CodeModel::Model getCodeModel() const
Returns the code model.
bool hasPOPCNTFalseDeps() const
void setDebugLoc(DebugLoc dl)
Replace current source information with new such.
static bool isNonFoldablePartialRegisterLoad(const MachineInstr &LoadMI, const MachineInstr &UserMI, const MachineFunction &MF)
Check if LoadMI is a partial register load that we can't fold into MI because the latter uses content...
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
unsigned getCMovFromCond(CondCode CC, unsigned RegBytes, bool HasMemoryOperand=false)
Return a cmov opcode for the given condition, register size in bytes, and operand type...
bool isPredicated(MCInstrInfo const &MCII, MCInst const &MCI)
static MachineBasicBlock * getFallThroughMBB(MachineBasicBlock *MBB, MachineBasicBlock *TBB)
def_instr_iterator def_instr_begin(unsigned RegNo) const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
CATCHRET - Represents a return from a catch block funclet.
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF, const outliner::OutlinedFunction &OF) const override
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
static const uint16_t ReplaceableInstrsAVX2InsertExtract[][3]
bool canInsertSelect(const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, unsigned, unsigned, int &, int &, int &) const override
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr) const override
foldMemoryOperand - If this target supports it, fold a load or store of the specified stack slot into...
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr kills the specified register.
bool isMoveReg(QueryType Type=IgnoreBundle) const
Return true if this instruction is a register move.
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
unsigned getGlobalBaseReg() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static IntegerType * getInt32Ty(LLVMContext &C)
A set of physical registers with utility functions to track liveness when walking backward/forward th...
static cl::opt< unsigned > UndefRegClearance("undef-reg-clearance", cl::desc("How many idle instructions we would like before " "certain undef register reads"), cl::init(128), cl::Hidden)
void setPreInstrSymbol(MachineFunction &MF, MCSymbol *Symbol)
Set a symbol that will be emitted just prior to the instruction itself.
static const MachineInstrBuilder & addOffset(const MachineInstrBuilder &MIB, int Offset)
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "...
LLVM_NODISCARD bool empty() const
unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx, const TargetRegisterClass *RC) const
Return a super-register of the specified register Reg so its sub-register of index SubIdx is Reg...
static unsigned getStoreRegOpcode(unsigned SrcReg, const TargetRegisterClass *RC, bool isStackAligned, const X86Subtarget &STI)
unsigned greater or equal
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
bool isPositionIndependent() const
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned char TargetFlags=0) const
void setReg(unsigned Reg)
Change the register this operand corresponds to.
static bool shouldPreventUndefRegUpdateMemFold(MachineFunction &MF, MachineInstr &MI)
static MachineOperand CreateImm(int64_t Val)
static MachineInstr * FuseInst(MachineFunction &MF, unsigned Opcode, unsigned OpNo, ArrayRef< MachineOperand > MOs, MachineBasicBlock::iterator InsertPt, MachineInstr &MI, const TargetInstrInfo &TII, int PtrOffset=0)
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
MachineBasicBlock::iterator insertOutlinedCall(Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It, MachineFunction &MF, const outliner::Candidate &C) const override
void setSubReg(unsigned subReg)
virtual const TargetFrameLowering * getFrameLowering() const
The memory access always returns the same value (or traps).
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
bool isKMasked(uint64_t TSFlags)
isKMasked - Is this a masked instruction.
0 1 1 0 True if ordered and operands are unequal
static cl::opt< unsigned > PartialRegUpdateClearance("partial-reg-update-clearance", cl::desc("Clearance between two register writes " "for inserting XOR to avoid partial " "register update"), cl::init(64), cl::Hidden)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void replaceBranchWithTailCall(MachineBasicBlock &MBB, SmallVectorImpl< MachineOperand > &Cond, const MachineInstr &TailCall) const override
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
virtual outliner::OutlinedFunction getOutliningCandidateInfo(std::vector< outliner::Candidate > &RepeatedSequenceLocs) const override
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
1 0 1 0 True if unordered or greater than
bool isAssociativeAndCommutative(const MachineInstr &Inst) const override
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isCopyInstrImpl(const MachineInstr &MI, const MachineOperand *&Source, const MachineOperand *&Destination) const override
If the specific machine instruction is a instruction that moves/copies value from one register to ano...
static const uint16_t ReplaceableCustomAVX2Instrs[][3]
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const uint16_t ReplaceableInstrsAVX2[][3]
void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, SmallVectorImpl< MachineOperand > &Addr, const TargetRegisterClass *RC, ArrayRef< MachineMemOperand *> MMOs, SmallVectorImpl< MachineInstr *> &NewMIs) const
bool hasImplicitUseOfPhysReg(unsigned Reg) const
Return true if this instruction implicitly uses the specified physical register.
bool hasReassociableOperands(const MachineInstr &Inst, const MachineBasicBlock *MBB) const override
static MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
0 0 0 1 True if ordered and equal
LLVM Value Representation.
mop_iterator operands_begin()
1 0 1 1 True if unordered, greater than, or equal
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
typename std::vector< DomTreeNodeBase * >::iterator iterator
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
bool isNullConstant(SDValue V)
Returns true if V is a constant integer zero.
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...
bool addRegisterKilled(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
bool isBarrier(QueryType Type=AnyInBundle) const
Returns true if the specified instruction stops control flow from executing the instruction immediate...
StringRef - Represent a constant reference to a string, i.e.
static const uint16_t ReplaceableInstrsAVX512[][4]
void RemoveOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
unsigned getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
AddrSegmentReg - The operand # of the segment in the memory operand.
unsigned getFMA3OpcodeToCommuteOperands(const MachineInstr &MI, unsigned SrcOpIdx1, unsigned SrcOpIdx2, const X86InstrFMA3Group &FMA3Group) const
Returns an adjusted FMA opcode that must be used in FMA instruction that performs the same computatio...
void stepForward(const MachineInstr &MI, SmallVectorImpl< std::pair< MCPhysReg, const MachineOperand *>> &Clobbers)
Simulates liveness when stepping forward over an instruction(bundle).
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
bool findCommutedOpIndices(MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const override
Returns true iff the routine could find two commutable operands in the given machine instruction...
static X86::CondCode getSwappedCondition(X86::CondCode CC)
Assuming the flags are set by MI(a,b), return the condition code if we modify the instructions such t...
unsigned get132Opcode() const
Returns the 132 form of FMA opcode.
bool hasImplicitDefOfPhysReg(unsigned Reg, const MCRegisterInfo *MRI=nullptr) const
Return true if this instruction implicitly defines the specified physical register.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand *> NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
0 0 1 1 True if ordered and greater than or equal
On a symbol operand "FOO", this indicates that the reference is actually to "FOO@plt".
bool isIndirectDebugValue() const
A DBG_VALUE is indirect iff the first operand is a register and the second operand is an immediate...
FunctionPass * createCleanupLocalDynamicTLSPass()
This pass combines multiple accesses to local-dynamic TLS variables so that the TLS base address for ...
static bool Expand2AddrUndef(MachineInstrBuilder &MIB, const MCInstrDesc &Desc)
Expand a single-def pseudo instruction to a two-addr instruction with two undef reads of the register...
unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, bool UnfoldLoad, bool UnfoldStore, unsigned *LoadRegIndex=nullptr) const override
getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new instruction after load / store ar...
static MachineOperand CreateFI(int Idx)
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
static bool isCommutableVPERMV3Instruction(unsigned Opcode)
The operation is expected to be selectable directly by the target, and no transformation is necessary...
outliner::InstrType getOutliningType(MachineBasicBlock::iterator &MIT, unsigned Flags) const override
bool isSafeToMove(AliasAnalysis *AA, bool &SawStore) const
Return true if it is safe to move this instruction.
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one...
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool hasHighOperandLatency(const TargetSchedModel &SchedModel, const MachineRegisterInfo *MRI, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
static const uint16_t ReplaceableCustomAVX512LogicInstrs[][4]
bool empty() const
empty - Check if the array is empty.
bool hasLZCNTFalseDeps() const
vt_iterator legalclasstypes_begin(const TargetRegisterClass &RC) const
Loop over all of the value types that can be represented by values in the given register class...
unsigned isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool isFunctionSafeToOutlineFrom(MachineFunction &MF, bool OutlineFromLinkOnceODRs) const override
int getMemoryOperandNo(uint64_t TSFlags)
getMemoryOperandNo - The function returns the MCInst operand # for the first field of the memory oper...
static unsigned getTruncatedShiftCount(const MachineInstr &MI, unsigned ShiftAmtOperandIdx)
Check whether the shift count for a machine operand is non-zero.