| Chad Rosier | d34c26e | 2016-11-29 20:00:27 +0000 | [diff] [blame] | 1 | //==- AArch64SchedFalkor.td - Falkor Scheduling Definitions -*- tablegen -*-==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the machine model for Qualcomm Falkor to support |
| 11 | // instruction scheduling and other instruction cost heuristics. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | // Define the SchedMachineModel and provide basic properties for coarse grained |
| 17 | // instruction cost model. |
| 18 | |
| 19 | def FalkorModel : SchedMachineModel { |
| Balaram Makam | b4419f9 | 2017-04-08 03:30:15 +0000 | [diff] [blame^] | 20 | let IssueWidth = 8; // 8 uops are dispatched per cycle. |
| Chad Rosier | d34c26e | 2016-11-29 20:00:27 +0000 | [diff] [blame] | 21 | let MicroOpBufferSize = 128; // Out-of-order with temporary unified issue buffer. |
| 22 | let LoopMicroOpBufferSize = 16; |
| 23 | let LoadLatency = 3; // Optimistic load latency. |
| 24 | let MispredictPenalty = 11; // Minimum branch misprediction penalty. |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 25 | let CompleteModel = 1; |
| 26 | } |
| 27 | |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | // Define each kind of processor resource and number available on Falkor. |
| 30 | |
| 31 | let SchedModel = FalkorModel in { |
| 32 | |
| 33 | def FalkorUnitB : ProcResource<1>; // Branch |
| 34 | def FalkorUnitLD : ProcResource<1>; // Load pipe |
| 35 | def FalkorUnitSD : ProcResource<1>; // Store data |
| 36 | def FalkorUnitST : ProcResource<1>; // Store pipe |
| 37 | def FalkorUnitX : ProcResource<1>; // Complex arithmetic |
| 38 | def FalkorUnitY : ProcResource<1>; // Simple arithmetic |
| 39 | def FalkorUnitZ : ProcResource<1>; // Simple arithmetic |
| 40 | |
| 41 | def FalkorUnitVSD : ProcResource<1>; // Vector store data |
| 42 | def FalkorUnitVX : ProcResource<1>; // Vector X-pipe |
| 43 | def FalkorUnitVY : ProcResource<1>; // Vector Y-pipe |
| 44 | |
| Balaram Makam | 7b5c098 | 2017-04-04 18:42:14 +0000 | [diff] [blame] | 45 | def FalkorUnitGTOV : ProcResource<1>; // Scalar to Vector |
| 46 | def FalkorUnitVTOG : ProcResource<1>; // Vector to Scalar |
| 47 | |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 48 | // Define the resource groups. |
| Balaram Makam | 7b5c098 | 2017-04-04 18:42:14 +0000 | [diff] [blame] | 49 | def FalkorUnitXY : ProcResGroup<[FalkorUnitX, FalkorUnitY]>; |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 50 | def FalkorUnitXYZ : ProcResGroup<[FalkorUnitX, FalkorUnitY, FalkorUnitZ]>; |
| 51 | def FalkorUnitXYZB : ProcResGroup<[FalkorUnitX, FalkorUnitY, FalkorUnitZ, |
| 52 | FalkorUnitB]>; |
| 53 | def FalkorUnitZB : ProcResGroup<[FalkorUnitZ, FalkorUnitB]>; |
| 54 | def FalkorUnitVXVY : ProcResGroup<[FalkorUnitVX, FalkorUnitVY]>; |
| 55 | |
| 56 | } |
| 57 | |
| 58 | //===----------------------------------------------------------------------===// |
| 59 | // Map the target-defined scheduler read/write resources and latency for |
| 60 | // Falkor. |
| 61 | |
| 62 | let SchedModel = FalkorModel in { |
| 63 | |
| 64 | def : WriteRes<WriteImm, [FalkorUnitXYZ]> { let Latency = 1; } |
| 65 | def : WriteRes<WriteI, [FalkorUnitXYZ]> { let Latency = 1; } |
| 66 | def : WriteRes<WriteISReg, [FalkorUnitVXVY, FalkorUnitVXVY]> |
| 67 | { let Latency = 1; let NumMicroOps = 2; } |
| 68 | def : WriteRes<WriteIEReg, [FalkorUnitXYZ, FalkorUnitXYZ]> |
| 69 | { let Latency = 2; let NumMicroOps = 2; } |
| 70 | def : WriteRes<WriteExtr, [FalkorUnitXYZ, FalkorUnitXYZ]> |
| 71 | { let Latency = 2; let NumMicroOps = 2; } |
| 72 | def : WriteRes<WriteIS, [FalkorUnitXYZ]> { let Latency = 1; } |
| 73 | def : WriteRes<WriteID32, [FalkorUnitX, FalkorUnitZ]> |
| Balaram Makam | b4419f9 | 2017-04-08 03:30:15 +0000 | [diff] [blame^] | 74 | { let Latency = 8; let NumMicroOps = 2; } |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 75 | def : WriteRes<WriteID64, [FalkorUnitX, FalkorUnitZ]> |
| Balaram Makam | b4419f9 | 2017-04-08 03:30:15 +0000 | [diff] [blame^] | 76 | { let Latency = 16; let NumMicroOps = 2; } |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 77 | def : WriteRes<WriteIM32, [FalkorUnitX]> { let Latency = 4; } |
| Balaram Makam | b4419f9 | 2017-04-08 03:30:15 +0000 | [diff] [blame^] | 78 | def : WriteRes<WriteIM64, [FalkorUnitX]> { let Latency = 5; } |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 79 | def : WriteRes<WriteBr, [FalkorUnitB]> { let Latency = 1; } |
| 80 | def : WriteRes<WriteBrReg, [FalkorUnitB]> { let Latency = 1; } |
| 81 | def : WriteRes<WriteLD, [FalkorUnitLD]> { let Latency = 3; } |
| 82 | def : WriteRes<WriteST, [FalkorUnitLD, FalkorUnitST, FalkorUnitSD]> |
| 83 | { let Latency = 3; let NumMicroOps = 3; } |
| 84 | def : WriteRes<WriteSTP, [FalkorUnitST, FalkorUnitSD]> |
| Balaram Makam | 7b5c098 | 2017-04-04 18:42:14 +0000 | [diff] [blame] | 85 | { let Latency = 0; let NumMicroOps = 2; } |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 86 | def : WriteRes<WriteAdr, [FalkorUnitXYZ]> { let Latency = 5; } |
| 87 | def : WriteRes<WriteLDIdx, [FalkorUnitLD]> { let Latency = 5; } |
| 88 | def : WriteRes<WriteSTIdx, [FalkorUnitLD, FalkorUnitST, FalkorUnitSD]> |
| 89 | { let Latency = 4; let NumMicroOps = 3; } |
| 90 | def : WriteRes<WriteF, [FalkorUnitVXVY, FalkorUnitVXVY]> |
| 91 | { let Latency = 3; let NumMicroOps = 2; } |
| 92 | def : WriteRes<WriteFCmp, [FalkorUnitVXVY]> { let Latency = 2; } |
| 93 | def : WriteRes<WriteFCvt, [FalkorUnitVXVY]> { let Latency = 4; } |
| 94 | def : WriteRes<WriteFCopy, [FalkorUnitVXVY]> { let Latency = 4; } |
| 95 | def : WriteRes<WriteFImm, [FalkorUnitVXVY]> { let Latency = 4; } |
| 96 | def : WriteRes<WriteFMul, [FalkorUnitVXVY, FalkorUnitVXVY]> |
| 97 | { let Latency = 6; let NumMicroOps = 2; } |
| 98 | def : WriteRes<WriteFDiv, [FalkorUnitVXVY, FalkorUnitVXVY]> |
| 99 | { let Latency = 12; let NumMicroOps = 2; } // Fragent -1 / NoRSV +1 |
| 100 | def : WriteRes<WriteV, [FalkorUnitVXVY]> { let Latency = 6; } |
| 101 | def : WriteRes<WriteVLD, [FalkorUnitLD]> { let Latency = 3; } |
| Balaram Makam | 7b5c098 | 2017-04-04 18:42:14 +0000 | [diff] [blame] | 102 | def : WriteRes<WriteVST, [FalkorUnitST, FalkorUnitVSD]> |
| 103 | { let Latency = 0; let NumMicroOps = 2; } |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 104 | |
| 105 | def : WriteRes<WriteSys, []> { let Latency = 1; } |
| 106 | def : WriteRes<WriteBarrier, []> { let Latency = 1; } |
| 107 | def : WriteRes<WriteHint, []> { let Latency = 1; } |
| 108 | |
| 109 | def : WriteRes<WriteLDHi, []> { let Latency = 3; } |
| 110 | |
| 111 | def : WriteRes<WriteAtomic, []> { let Unsupported = 1; } |
| 112 | |
| 113 | // No forwarding logic is modelled yet. |
| 114 | def : ReadAdvance<ReadI, 0>; |
| 115 | def : ReadAdvance<ReadISReg, 0>; |
| 116 | def : ReadAdvance<ReadIEReg, 0>; |
| 117 | def : ReadAdvance<ReadIM, 0>; |
| 118 | def : ReadAdvance<ReadIMA, 0>; |
| 119 | def : ReadAdvance<ReadID, 0>; |
| 120 | def : ReadAdvance<ReadExtrHi, 0>; |
| 121 | def : ReadAdvance<ReadAdrBase, 0>; |
| 122 | def : ReadAdvance<ReadVLD, 0>; |
| 123 | |
| Balaram Makam | cf0e5e1 | 2017-03-25 04:02:39 +0000 | [diff] [blame] | 124 | // Detailed Refinements |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 125 | // ----------------------------------------------------------------------------- |
| Balaram Makam | cf0e5e1 | 2017-03-25 04:02:39 +0000 | [diff] [blame] | 126 | include "AArch64SchedFalkorDetails.td" |
| Balaram Makam | cacc08b | 2017-03-13 10:42:17 +0000 | [diff] [blame] | 127 | |
| Chad Rosier | d34c26e | 2016-11-29 20:00:27 +0000 | [diff] [blame] | 128 | } |