Index: lib/Target/AArch64/AArch64SchedA57.td =================================================================== --- lib/Target/AArch64/AArch64SchedA57.td +++ lib/Target/AArch64/AArch64SchedA57.td @@ -92,7 +92,7 @@ def : SchedAlias; def : SchedAlias; def : SchedAlias; -def : SchedAlias; +def : SchedAlias; def : SchedAlias; def : SchedAlias; def : SchedAlias; @@ -444,19 +444,19 @@ def : InstRW<[A57Write_5cyc_2V], (instregex "^[FVSU]CVT([AMNPZ][SU])?(_Int)?(v4f32|v2f64|v4i32|v2i64)")>; // ASIMD FP divide, D-form, F32 -def : InstRW<[A57Write_18cyc_1X], (instregex "FDIVv2f32")>; +def : InstRW<[A57Write_17cyc_1W], (instregex "FDIVv2f32")>; // ASIMD FP divide, Q-form, F32 -def : InstRW<[A57Write_36cyc_2X], (instregex "FDIVv4f32")>; +def : InstRW<[A57Write_34cyc_2W], (instregex "FDIVv4f32")>; // ASIMD FP divide, Q-form, F64 -def : InstRW<[A57Write_64cyc_2X], (instregex "FDIVv2f64")>; +def : InstRW<[A57Write_64cyc_2W], (instregex "FDIVv2f64")>; // Note: These were simply duplicated from ASIMD FDIV because of missing documentation // ASIMD FP square root, D-form, F32 -def : InstRW<[A57Write_18cyc_1X], (instregex "FSQRTv2f32")>; +def : InstRW<[A57Write_17cyc_1W], (instregex "FSQRTv2f32")>; // ASIMD FP square root, Q-form, F32 -def : InstRW<[A57Write_36cyc_2X], (instregex "FSQRTv4f32")>; +def : InstRW<[A57Write_34cyc_2W], (instregex "FSQRTv4f32")>; // ASIMD FP square root, Q-form, F64 -def : InstRW<[A57Write_64cyc_2X], (instregex "FSQRTv2f64")>; +def : InstRW<[A57Write_64cyc_2W], (instregex "FSQRTv2f64")>; // ASIMD FP max/min, normal, D-form def : InstRW<[A57Write_5cyc_1V], (instregex "^(FMAX|FMIN)(NM)?(v2f32)")>; @@ -551,15 +551,15 @@ def : InstRW<[A57Write_10cyc_1L_1V], (instregex "^[FSU]CVT[AMNPZ][SU](_Int)?[SU]?[XW]?[DS]?[rds]i?")>; def : InstRW<[A57Write_10cyc_1L_1V], (instregex "^[SU]CVTF")>; -def : InstRW<[A57Write_32cyc_1X], (instrs FDIVDrr)>; -def : InstRW<[A57Write_18cyc_1X], (instrs FDIVSrr)>; +def : InstRW<[A57Write_32cyc_1W], (instrs FDIVDrr)>; +def : InstRW<[A57Write_17cyc_1W], (instrs FDIVSrr)>; def : InstRW<[A57Write_5cyc_1V], (instregex "^F(MAX|MIN).+rr")>; def : InstRW<[A57Write_5cyc_1V], (instregex "^FRINT.+r")>; -def : InstRW<[A57Write_32cyc_1X], (instrs FSQRTDr)>; -def : InstRW<[A57Write_18cyc_1X], (instrs FSQRTSr)>; +def : InstRW<[A57Write_32cyc_1W], (instrs FSQRTDr)>; +def : InstRW<[A57Write_17cyc_1W], (instrs FSQRTSr)>; def : InstRW<[A57Write_5cyc_1L, WriteLDHi], (instrs LDNPDi)>; def : InstRW<[A57Write_6cyc_2L, WriteLDHi], (instrs LDNPQi)>; Index: lib/Target/AArch64/AArch64SchedA57WriteRes.td =================================================================== --- lib/Target/AArch64/AArch64SchedA57WriteRes.td +++ lib/Target/AArch64/AArch64SchedA57WriteRes.td @@ -28,15 +28,15 @@ def A57Write_5cyc_1V : SchedWriteRes<[A57UnitV]> { let Latency = 5; } def A57Write_5cyc_1W : SchedWriteRes<[A57UnitW]> { let Latency = 5; } def A57Write_10cyc_1V : SchedWriteRes<[A57UnitV]> { let Latency = 10; } -def A57Write_18cyc_1X : SchedWriteRes<[A57UnitX]> { let Latency = 18; - let ResourceCycles = [18]; } +def A57Write_17cyc_1W : SchedWriteRes<[A57UnitW]> { let Latency = 17; + let ResourceCycles = [17]; } def A57Write_19cyc_1M : SchedWriteRes<[A57UnitM]> { let Latency = 19; let ResourceCycles = [19]; } def A57Write_1cyc_1B : SchedWriteRes<[A57UnitB]> { let Latency = 1; } def A57Write_1cyc_1I : SchedWriteRes<[A57UnitI]> { let Latency = 1; } def A57Write_1cyc_1S : SchedWriteRes<[A57UnitS]> { let Latency = 1; } def A57Write_2cyc_1M : SchedWriteRes<[A57UnitM]> { let Latency = 2; } -def A57Write_32cyc_1X : SchedWriteRes<[A57UnitX]> { let Latency = 32; +def A57Write_32cyc_1W : SchedWriteRes<[A57UnitW]> { let Latency = 32; let ResourceCycles = [32]; } def A57Write_35cyc_1M : SchedWriteRes<[A57UnitM]> { let Latency = 35; let ResourceCycles = [35]; } @@ -54,7 +54,7 @@ //===----------------------------------------------------------------------===// // Define Generic 2 micro-op types -def A57Write_64cyc_2X : SchedWriteRes<[A57UnitX, A57UnitX]> { +def A57Write_64cyc_2W : SchedWriteRes<[A57UnitW, A57UnitW]> { let Latency = 64; let NumMicroOps = 2; let ResourceCycles = [32, 32]; @@ -139,10 +139,10 @@ let Latency = 2; let NumMicroOps = 2; } -def A57Write_36cyc_2X : SchedWriteRes<[A57UnitX, A57UnitX]> { - let Latency = 36; +def A57Write_34cyc_2W : SchedWriteRes<[A57UnitW, A57UnitW]> { + let Latency = 34; let NumMicroOps = 2; - let ResourceCycles = [18, 18]; + let ResourceCycles = [17, 17]; } def A57Write_3cyc_1I_1M : SchedWriteRes<[A57UnitI, A57UnitM]> { Index: test/CodeGen/AArch64/arm64-misched-A57-div-fix.ll =================================================================== --- test/CodeGen/AArch64/arm64-misched-A57-div-fix.ll +++ test/CodeGen/AArch64/arm64-misched-A57-div-fix.ll @@ -0,0 +1,18 @@ +; REQUIRES: asserts +; +; FDIV/FSQRT should use A57UnitW, not A57UnitX +; +; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a57 -enable-misched -verify-misched -debug-only=misched -o - 2>&1 > /dev/null | FileCheck %s +; +; CHECK-NOT: A57UnitX +; CHECK: picking next node +; CHECK: FDIVSrr +; CHECK: Critical: [[NUM:[0-9]+]]c, [[NUM]] A57UnitW +; CHECK-NEXT: ExpectedLatency: 18c + +define float @main(float %a, float %b) nounwind { +entry: + %div = fdiv float %a, %b + ret float %div +} +