diff --git a/llvm/lib/Target/X86/X86ScheduleZnver2.td b/llvm/lib/Target/X86/X86ScheduleZnver2.td --- a/llvm/lib/Target/X86/X86ScheduleZnver2.td +++ b/llvm/lib/Target/X86/X86ScheduleZnver2.td @@ -187,7 +187,7 @@ defm : X86WriteRes; defm : X86WriteRes; -defm : X86WriteRes; +defm : X86WriteRes; defm : X86WriteRes; defm : X86WriteRes; @@ -216,7 +216,7 @@ // Bit counts. defm : Zn2WriteResPair; -defm : Zn2WriteResPair; +defm : Zn2WriteResPair; defm : Zn2WriteResPair; defm : Zn2WriteResPair; defm : Zn2WriteResPair; @@ -272,13 +272,13 @@ defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; @@ -314,8 +314,8 @@ defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; @@ -326,16 +326,16 @@ defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; @@ -381,7 +381,7 @@ defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; @@ -403,7 +403,7 @@ defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; defm : Zn2WriteResFpuPair; defm : Zn2WriteResFpuPair; @@ -425,8 +425,8 @@ defm : Zn2WriteResFpuPair; // Vector Shift Operations -defm : Zn2WriteResFpuPair; -defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; +defm : Zn2WriteResFpuPair; defm : X86WriteResPairUnsupported; // Vector insert/extract operations. @@ -470,6 +470,12 @@ def Zn2WriteMicrocoded : SchedWriteRes<[]> { let Latency = 100; } +defm : Zn2WriteResPair; +defm : Zn2WriteResPair; +defm : Zn2WriteResPair; +defm : Zn2WriteResPair; +defm : Zn2WriteResPair; +defm : Zn2WriteResPair; def : SchedAlias; def : SchedAlias; @@ -518,14 +524,14 @@ let NumMicroOps = 2; } -def : InstRW<[Zn2WriteXCHG], (instregex "XCHG(8|16|32|64)rr", "XCHG(16|32|64)ar")>; +def : InstRW<[Zn2WriteXCHG], (instregex "^XCHG(8|16|32|64)rr", "^XCHG(16|32|64)ar")>; // r,m. def Zn2WriteXCHGrm : SchedWriteRes<[Zn2AGU, Zn2ALU]> { let Latency = 5; let NumMicroOps = 2; } -def : InstRW<[Zn2WriteXCHGrm, ReadAfterLd], (instregex "XCHG(8|16|32|64)rm")>; +def : InstRW<[Zn2WriteXCHGrm, ReadAfterLd], (instregex "^XCHG(8|16|32|64)rm")>; def : InstRW<[WriteMicrocoded], (instrs XLAT)>; @@ -595,8 +601,11 @@ def Zn2WriteMul16 : SchedWriteRes<[Zn2ALU1, Zn2Multiplier]> { let Latency = 3; } +def Zn2WriteMul16Imm : SchedWriteRes<[Zn2ALU1, Zn2Multiplier]> { + let Latency = 4; +} def : SchedAlias; -def : SchedAlias; +def : SchedAlias; def : SchedAlias; // m16. @@ -1002,6 +1011,7 @@ // mm <- mm. def Zn2WriteFPU12 : SchedWriteRes<[Zn2FPU12]> ; def Zn2WriteFPU12Y : SchedWriteRes<[Zn2FPU12]> { + let Latency = 4; let NumMicroOps = 2; } def Zn2WriteFPU12m : SchedWriteRes<[Zn2AGU, Zn2FPU12]> ; @@ -1110,15 +1120,6 @@ //-- Arithmetic instructions --// -// HADD, HSUB PS/PD -// PHADD|PHSUB (S) W/D. -def : SchedAlias; -def : SchedAlias; -def : SchedAlias; -def : SchedAlias; -def : SchedAlias; -def : SchedAlias; - // PCMPGTQ. def Zn2WritePCMPGTQr : SchedWriteRes<[Zn2FPU03]>; def : InstRW<[Zn2WritePCMPGTQr], (instregex "(V?)PCMPGTQ(Y?)rr")>; @@ -1138,8 +1139,12 @@ // PSLL,PSRL,PSRA W/D/Q. // x,x / v,v,x. -def Zn2WritePShift : SchedWriteRes<[Zn2FPU2]> ; -def Zn2WritePShiftY : SchedWriteRes<[Zn2FPU2]> ; +def Zn2WritePShift : SchedWriteRes<[Zn2FPU2]> { + let Latency = 3; +} +def Zn2WritePShiftY : SchedWriteRes<[Zn2FPU2]> { + let Latency = 3; +} // PSLL,PSRL DQ. def : InstRW<[Zn2WritePShift], (instregex "(V?)PS(R|L)LDQri")>; @@ -1281,7 +1286,7 @@ } // CVTDQ2PD. // x,x. -def : InstRW<[Zn2WriteCVTDQ2PDr], (instregex "(V)?CVTDQ2PDrr")>; +def : InstRW<[Zn2WriteCVTDQ2PDr], (instregex "(V)?CVTDQ2P(D|S)rr")>; // Same as xmm // y,x. @@ -1291,9 +1296,9 @@ def Zn2WriteCVTPD2DQr: SchedWriteRes<[Zn2FPU12, Zn2FPU3]> { let Latency = 3; } -// CVT(T)PD2DQ. +// CVT(T)P(D|S)2DQ. // x,x. -def : InstRW<[Zn2WriteCVTPD2DQr], (instregex "(V?)CVT(T?)PD2DQrr")>; +def : InstRW<[Zn2WriteCVTPD2DQr], (instregex "(V?)CVT(T?)P(D|S)2DQrr")>; def Zn2WriteCVTPD2DQLd: SchedWriteRes<[Zn2AGU,Zn2FPU12,Zn2FPU3]> { let Latency = 10; @@ -1323,7 +1328,7 @@ def : InstRW<[Zn2WriteCVTPS2PIr], (instregex "MMX_CVT(T?)PD2PIirr")>; def Zn2WriteCVSTSI2SSr: SchedWriteRes<[Zn2FPU3]> { - let Latency = 4; + let Latency = 3; } // same as CVTPD2DQr @@ -1335,7 +1340,7 @@ def : InstRW<[Zn2WriteCVTPD2DQLd], (instregex "(V?)CVT(T?)SS2SI(64)?rm")>; def Zn2WriteCVSTSI2SDr: SchedWriteRes<[Zn2FPU013, Zn2FPU3]> { - let Latency = 4; + let Latency = 3; } // CVTSI2SD. // x,r32/64. @@ -1377,7 +1382,7 @@ //-- SSE4A instructions --// // EXTRQ def Zn2WriteEXTRQ: SchedWriteRes<[Zn2FPU12, Zn2FPU2]> { - let Latency = 2; + let Latency = 3; } def : InstRW<[Zn2WriteEXTRQ], (instregex "EXTRQ")>; @@ -1449,12 +1454,6 @@ //-- Arithmetic instructions --// -// HADD, HSUB PS/PD -def : SchedAlias; -def : SchedAlias; -def : SchedAlias; -def : SchedAlias; - // VDIVPS. // TODO - convert to Zn2WriteResFpuPair // y,y,y. @@ -1491,11 +1490,9 @@ // DPPS. // x,x,i / v,v,v,i. -def : SchedAlias; def : SchedAlias; // x,m,i / v,v,m,i. -def : SchedAlias; def : SchedAlias; // DPPD.