File: AArch64SchedOryon.td

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (1659 lines) | stat: -rw-r--r-- 57,971 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
//=- AArch64SchedOryon.td - Qualcomm Oryon CPU 001 ---*- tablegen -*-=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the scheduling model for Qualcomm Oryon
// family of processors.
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
// Pipeline Description.

def OryonModel : SchedMachineModel {
  let IssueWidth            =  14;
  let MicroOpBufferSize     = 376;
  let LoadLatency           =   4;
  let MispredictPenalty     =  13; // 13 cycles for mispredicted branch.
  let LoopMicroOpBufferSize =   0; // Do not have a LoopMicroOpBuffer
  let PostRAScheduler       =   1; // Using PostRA sched.
  let CompleteModel         =   1;

  list<Predicate> UnsupportedFeatures = !listconcat(SVEUnsupported.F,
                                                    SMEUnsupported.F,
                                                    MTEUnsupported.F,
                                                    PAUnsupported.F,
                                                    [HasPAuth, HasCSSC]);
}

let SchedModel = OryonModel in {

// Issue ports.
// IXU has 6 ports p0 ~ p5
// LSU has 4 ports p6 ~ p9(ls0 ~ ls3), p10/p11(std0, std1) has to work with ls0~ls3
// VXU has 4 ports p12 ~ p15

// cross IXU/LSU/VXU resource group for FMOV P41 of VXU
// I2V
def ORYONI4FP0 : ProcResource<1>;
def ORYONI5FP1 : ProcResource<1>;
// V2I
def ORYONFP0I4 : ProcResource<1>;
def ORYONFP1I5 : ProcResource<1>;

// store 1 for normal store instructions
def ORYONST0 : ProcResource<1>;
// store 2 for normal store instructions
def ORYONST1 : ProcResource<1>;

// Port 0: ALU/Indirect/Direct Branch.
def ORYONP0 : ProcResource<1>;

// Port 1: ALU/Direct Branch.
def ORYONP1 : ProcResource<1>;

// Port 2: ALU.
def ORYONP2 : ProcResource<1>;

// Port 3: ALU.
def ORYONP3 : ProcResource<1>;

// Port 4: ALU.
def ORYONP4 : ProcResource<1> {
    let Super = ORYONI4FP0;
    let Super = ORYONFP0I4; }

// Port 5: ALU.
def ORYONP5 : ProcResource<1> {
    let Super = ORYONI5FP1;
    let Super = ORYONFP1I5; }

// Port 6: Load/Store. LS0
def ORYONP6 : ProcResource<1> {
    let Super = ORYONST0; }

// Port 7: Load/store. LS1
def ORYONP7 : ProcResource<1> {
    let Super = ORYONST0; }

// Port 8: Load/Store. LS2
def ORYONP8 : ProcResource<1> {
    let Super = ORYONST1; }

// Port 9: Load/store. LS3
def ORYONP9 : ProcResource<1> {
    let Super = ORYONST1; }

// Port 10: Load/Store. STD0
def ORYONP10SD0 : ProcResource<1> {
    let Super = ORYONST0; }

// Port 11: Load/store. STD1
def ORYONP11SD1 : ProcResource<1> {
    let Super = ORYONST1; }

// Port 12: FP/Neon/SIMD/Crypto.
def ORYONP12FP0 : ProcResource<1> {
    let Super = ORYONI4FP0;
    let Super = ORYONFP0I4; }

// Port 13: FP/Neon/SIMD/Crypto.
def ORYONP13FP1 : ProcResource<1> {
    let Super = ORYONI5FP1;
    let Super = ORYONFP1I5; }

// Port 14: FP/Neon/SIMD/Crypto.
def ORYONP14FP2 : ProcResource<1>;

// Port 15: FP/Neon/SIMD/Crypto.
def ORYONP15FP3 : ProcResource<1>;

// Define groups for the functional units on each issue port.  Each group
// created will be used by a WriteRes.

// Integer add/shift/logical/misc. instructions on port I0/I1/I2/I3/I4/I5.
def ORYONI012345 : ProcResGroup<[ORYONP0, ORYONP1, ORYONP2,
                                  ORYONP3, ORYONP4, ORYONP5]> {
  let BufferSize = 120;
}

// Direct Conditional Branch instructions on ports I0/I1.
def ORYONI01 : ProcResGroup<[ORYONP0, ORYONP1]> {
  let BufferSize = 40;
}

// Indirect/crypto Conditional Branch instructions on ports I0.
def ORYONI0 : ProcResGroup<[ORYONP0]> {
  let BufferSize = 20;
}

// Crypto/CRC/PAU instructions on ports I2.
def ORYONI2 : ProcResGroup<[ORYONP2]> {
  let BufferSize = 20;
}

// Multiply/Multiply-ADD instructions on ports I4/I5.
def ORYONI45 : ProcResGroup<[ORYONP4, ORYONP5]> {
  let BufferSize = 40;
}

// Divide instructions on ports I5.
def ORYONI5 : ProcResGroup<[ORYONP5]> {
  let BufferSize = 20;
}

// Comparison instructions on ports I0/I1/I2/I3.
def ORYONI0123 : ProcResGroup<[ORYONP0, ORYONP1,
                                ORYONP2, ORYONP3]> {
  let BufferSize = 80;
}

// Load instructions on ports P6/P7/P8/P9.
def ORYONLD : ProcResGroup<[ORYONP6, ORYONP7, ORYONP8, ORYONP9]> {
  let BufferSize = 64;
}

// Store instructions on combo of STA/STD pipes
def ORYONST : ProcResGroup<[ORYONST0, ORYONST1]> {
    let BufferSize = 64;
}

// Arithmetic and CRYP-AED ASIMD/FP instructions on ports FP0/FP1/FP2/FP3.
def ORYONFP0123 : ProcResGroup<[ORYONP12FP0, ORYONP13FP1,
                                   ORYONP14FP2, ORYONP15FP3]> {
  let BufferSize = 192;
}

// FP Comparison and F/I move instructions on ports FP0/FP1.
def ORYONFP01 : ProcResGroup<[ORYONP12FP0, ORYONP13FP1]> {
  let BufferSize = 96;
}

// FDIV instructions on ports FP3.
def ORYONFP3 : ProcResGroup<[ORYONP15FP3]> {
  let BufferSize = 48;
}

// CRYP-SHA instructions on ports FP1.
def ORYONFP1 : ProcResGroup<[ORYONP14FP2]> {
  let BufferSize = 48;
}

def ORYONFP2 : ProcResGroup<[ORYONP14FP2]> {
  let BufferSize = 48;
}

// Reciprocal, Squre root on FP0.
def ORYONFP0 : ProcResGroup<[ORYONP12FP0]> {
  let BufferSize = 48;
}

// cross IXU/LSU/VXU resource group for FMOV P41 of VXU
// I2V
def ORYONI2V : ProcResGroup<[ORYONI4FP0, ORYONI5FP1]> {
    let BufferSize = 40;
}

// V2I
def ORYONV2I : ProcResGroup<[ORYONFP0I4, ORYONFP1I5]> {
    let BufferSize = 96;
}

// Define commonly used write types for InstRW specializations.
// All definitions follow the format: ORYONWrite_<NumCycles>Cyc_<Resources>.

// Because of the complexity of Oryon CPU, we skip the following
// generic definitions and define each instruction specifically

// These WriteRes entries are not used in the Falkor sched model.
def : WriteRes<WriteImm, []>     { let Unsupported = 1; }
def : WriteRes<WriteI, []>       { let Unsupported = 1; }
def : WriteRes<WriteISReg, []>   { let Unsupported = 1; }
def : WriteRes<WriteIEReg, []>   { let Unsupported = 1; }
def : WriteRes<WriteExtr, []>    { let Unsupported = 1; }
def : WriteRes<WriteIS, []>      { let Unsupported = 1; }
def : WriteRes<WriteID32, []>    { let Unsupported = 1; }
def : WriteRes<WriteID64, []>    { let Unsupported = 1; }
def : WriteRes<WriteIM32, []>    { let Unsupported = 1; }
def : WriteRes<WriteIM64, []>    { let Unsupported = 1; }
def : WriteRes<WriteBr, []>      { let Unsupported = 1; }
def : WriteRes<WriteBrReg, []>   { let Unsupported = 1; }
def : WriteRes<WriteLD, []>      { let Unsupported = 1; }
def : WriteRes<WriteST, []>      { let Unsupported = 1; }
def : WriteRes<WriteSTP, []>     { let Unsupported = 1; }
def : WriteRes<WriteAdr, []>     { let Unsupported = 1; }
def : WriteRes<WriteLDIdx, []>   { let Unsupported = 1; }
def : WriteRes<WriteSTIdx, []>   { let Unsupported = 1; }
def : WriteRes<WriteF, []>       { let Unsupported = 1; }
def : WriteRes<WriteFCmp, []>    { let Unsupported = 1; }
def : WriteRes<WriteFCvt, []>    { let Unsupported = 1; }
def : WriteRes<WriteFCopy, []>   { let Unsupported = 1; }
def : WriteRes<WriteFImm, []>    { let Unsupported = 1; }
def : WriteRes<WriteFMul, []>    { let Unsupported = 1; }
def : WriteRes<WriteFDiv, []>    { let Unsupported = 1; }
def : WriteRes<WriteVd, []>      { let Unsupported = 1; }
def : WriteRes<WriteVq, []>      { let Unsupported = 1; }
def : WriteRes<WriteVLD, []>     { let Unsupported = 1; }
def : WriteRes<WriteVST, []>     { let Unsupported = 1; }
def : WriteRes<WriteSys, []>     { let Unsupported = 1; }
def : WriteRes<WriteBarrier, []> { let Unsupported = 1; }
def : WriteRes<WriteHint, []>    { let Unsupported = 1; }
def : WriteRes<WriteLDHi, []>    { let Unsupported = 1; }
def : WriteRes<WriteAtomic, []>  { let Unsupported = 1; }

// These ReadAdvance entries will be defined in later implementation
def : ReadAdvance<ReadI,       0>;
def : ReadAdvance<ReadISReg,   0>;
def : ReadAdvance<ReadIEReg,   0>;
def : ReadAdvance<ReadIM,      0>;
def : ReadAdvance<ReadIMA,     0>;
def : ReadAdvance<ReadID,      0>;
def : ReadAdvance<ReadExtrHi,  0>;
def : ReadAdvance<ReadAdrBase, 0>;
def : ReadAdvance<ReadVLD,     0>;
def : ReadAdvance<ReadST,      0>;


//IXU resource definition
// 1 cycles NO pipe
def ORYONWrite_1Cyc_NONE : SchedWriteRes<[]>;

// 1 cycles on I01.
def ORYONWrite_1Cyc_I01 : SchedWriteRes<[ORYONI01]>;

def ORYONWrite_1Cyc_2Uops_I01 : SchedWriteRes<[ORYONI01]> {
  let NumMicroOps = 2;
}

def ORYONWrite_1Cyc_I0 : SchedWriteRes<[ORYONI0]>;

// 7 cycles on I2. PAC*/AUT* instructions
def ORYONWrite_7Cyc_I2 : SchedWriteRes<[ORYONI2]> {
  let Latency = 7;
}

// 7 cycles on I2. PAC*/AUT* instructions
def ORYONWrite_7Cyc_3Uops_I2 : SchedWriteRes<[ORYONI2]> {
  let Latency = 7;
  let NumMicroOps = 3;
}

// 9 (7+1+1) cycles on I2 and I0/I1, I0. Authentication branch instructions
// these instructions are broken down to three uops
// a.	PtrAuth on pipe 2 taking 7 cycles
// b.	Link Register Update on pipes 0 and 1 taking 1 cycle
// c.	Indirect branch on pipe 0 taking 1 cycle

def ORYONWrite_9Cyc_I012 : SchedWriteRes<[ORYONI2, ORYONI01]> {
  let Latency = 9;
  let NumMicroOps = 3;
}

// 3 cycles on I2. CRC32 and CRC32C instructions
def ORYONWrite_3Cyc_I2 : SchedWriteRes<[ORYONI2]> {
  let Latency = 3;
}

// 1 cycle on I012345
def ORYONWrite_1Cyc_I012345 : SchedWriteRes<[ORYONI012345]>;

// 1 cycle on I0123
def ORYONWrite_1Cyc_I0123 : SchedWriteRes<[ORYONI0123]>;

// 1 cycle on 2 of I012345
def ORYONWrite_1Cyc_I012345_I012345 :
SchedWriteRes<[ORYONI012345, ORYONI012345]> ;

// 2 cycle on 2 of I0123 with ReleaseAtCycles
def ORYONWrite_2Cyc_I0123_I0123_RC :
SchedWriteRes<[ORYONI0123, ORYONI0123]> {
  let Latency = 2;
  let ReleaseAtCycles = [2,2];
}

// 2 cycle on 2 of I012345
def ORYONWrite_2Cyc_I012345_I012345_RC :
SchedWriteRes<[ORYONI012345, ORYONI012345]> {
  let Latency = 2;
  let ReleaseAtCycles = [2,2];
}

// 3 cycle on 2 of I45
def ORYONWrite_3Cyc_I45_I45_RC :
SchedWriteRes<[ORYONI45, ORYONI45]> {
  let Latency = 3;
  let ReleaseAtCycles = [2,2];
}

// 3 cycle on I45
def ORYONWrite_3Cyc_I45 : SchedWriteRes<[ORYONI45]> {
  let Latency = 3;
}

// 7 cycle on I2 32-bit integer division
def ORYONWrite_7Cyc_I2_RC : SchedWriteRes<[ORYONI2]> {
  let Latency = 7;
  let ReleaseAtCycles = [2];
}

// 9 cycle on I2 64-bit integer division
def ORYONWrite_9Cyc_I2_RC : SchedWriteRes<[ORYONI2]> {
  let Latency = 9;
  let ReleaseAtCycles = [2];
}

// LSU resource definition
// need to define WriteLDAdr, WriteAdrAdr, WriteLDHi, WriteSTX
// 4 cycle on LS(P6789)
def ORYONWrite_4Cyc_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 4;
}

// 4 cycle for Post/Pre inc/dec access, also covers all pair loads Post/Pre
def ORYONWrite_4Cyc_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 4;
}

// 5 (4+1) for VXU SIMD access/could also include FP
// resource might not be correct, as VXU resource not included
def ORYONWrite_5Cyc_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
}

def ORYONWrite_5Cyc_2Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 2;
}

def ORYONWrite_5Cyc_3Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 3;
}

def ORYONWrite_5Cyc_4Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 4;
}

def ORYONWrite_5Cyc_5Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 5;
}

def ORYONWrite_5Cyc_6Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 6;
}

def ORYONWrite_5Cyc_8Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 8;
}

def ORYONWrite_5Cyc_10Uops_LD : SchedWriteRes<[ORYONLD]> {
  let Latency = 5;
  let NumMicroOps = 10;
}

// 6 cycle for Post/Pre inc/dec access
def ORYONWrite_5Cyc_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
}

def ORYONWrite_5Cyc_2Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 2;
}

def ORYONWrite_5Cyc_3Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 3;
}

def ORYONWrite_5Cyc_4Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 4;
}

def ORYONWrite_5Cyc_5Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 5;
}

def ORYONWrite_5Cyc_6Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 6;
}

def ORYONWrite_5Cyc_8Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 8;
}

def ORYONWrite_5Cyc_10Uops_LD_I012345 : SchedWriteRes<[ORYONLD, ORYONI012345]> {
  let Latency = 5;
  let NumMicroOps = 10;
}

// 1 cycle for all generic stores
def ORYONWrite_1Cyc_ST : SchedWriteRes<[ORYONST]>;

def ORYONWrite_1Cyc_2Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 2;
}

def ORYONWrite_1Cyc_3Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 3;
}

def ORYONWrite_1Cyc_4Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 4;
}

def ORYONWrite_1Cyc_5Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 5;
}

def ORYONWrite_1Cyc_6Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 6;
}

def ORYONWrite_1Cyc_8Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 8;
}

def ORYONWrite_1Cyc_10Uops_ST : SchedWriteRes<[ORYONST]> {
  let NumMicroOps = 10;
}

// 1 cycle for neon write: float + ASIMD with Post/Pre Inc/Dec access
// also includes Pair store until further informed
def ORYONWrite_1Cyc_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 3;
}

def ORYONWrite_1Cyc_2Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 2;
}

def ORYONWrite_1Cyc_3Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 3;
}

def ORYONWrite_1Cyc_4Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 4;
}

def ORYONWrite_1Cyc_5Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 5;
}

def ORYONWrite_1Cyc_6Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 6;
}

def ORYONWrite_1Cyc_8Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 8;
}

def ORYONWrite_1Cyc_10Uops_ST_I012345 : SchedWriteRes<[ORYONST, ORYONI012345]> {
  let NumMicroOps = 10;
}

// VXU resource definition

// I2V instruction has 1 uOp
// I2v with convert has 2 uOps
// all I2V, V2I's throughputs are 2
// On VXU doc, p37 -- latencies and throughput
// P41, resource taken, P42, uOps
def ORYONWrite_I2V_4Cyc_I45 : SchedWriteRes<[ORYONI2V]> {
  let Latency = 4;
}

// inline a FCVT, so add one more uOp
def ORYONWrite_I2V_7Cyc_I45 : SchedWriteRes<[ORYONI2V]> {
  let Latency = 7;
  let NumMicroOps = 2;
}

// V2I move instruction has 1/2 uOps, P42 in VXU doc
// Latency is 3, FCVT is also 3 cycle
// move + convert is 6 (3+3) cycles
// throughput is 2
def ORYONWrite_V2I_3Cyc_FP01 : SchedWriteRes<[ORYONV2I]> {
  let Latency = 3;
}

// inline a FCVT, so add one more uOp
def ORYONWrite_V2I_6Cyc_FP01 : SchedWriteRes<[ORYONV2I]> {
  let Latency = 6;
  let NumMicroOps = 2;
}

def ORYONWrite_V2V_2Cyc_FP0123 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 2;
}

def ORYONWrite_V2V_3Cyc_FP0123 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 3;
}

def ORYONWrite_V2V_6Cyc_FP01 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 6;
  let NumMicroOps = 3;
}

def ORYONWrite_4Cyc_FP0123 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 4;
}

def ORYONWrite_3Cyc_FP0 : SchedWriteRes<[ORYONFP0]> {
  let Latency = 3;
}

def ORYONWrite_3Cyc_FP0123 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 3;
}

def ORYONWrite_3Cyc_2Uops_FP0123 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 3;
  let NumMicroOps = 2;
}

def ORYONWrite_2Cyc_FP0123 : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 2;
}

def ORYONWrite_2Cyc_FP01 : SchedWriteRes<[ORYONFP01]> {
  let Latency = 2;
}

// 2 cycle on FP1
def ORYONWrite_2Cyc_FP1 : SchedWriteRes<[ORYONFP1]> {
  let Latency = 2;
}

// 3 cycle on FP1
def ORYONWrite_3Cyc_FP1 : SchedWriteRes<[ORYONFP1]> {
  let Latency = 3;
}

// 4 cycle , 0.5 throughput on FP1
def ORYONWrite_4Cyc_FP1_RC4 : SchedWriteRes<[ORYONFP1]> {
  let Latency = 4;
  let ReleaseAtCycles = [4];
}

// 5 cycle , 1 throughput on FP1
def ORYONWrite_5Cyc_FP1 : SchedWriteRes<[ORYONFP1]> {
  let Latency = 5;
}

// 8 cycle , 2 throughput on FP0123
def ORYONWrite_8Cyc_FP0123_RC : SchedWriteRes<[ORYONFP0123]> {
  let Latency = 8;
  let ReleaseAtCycles = [2];
}

def ORYONWrite_6Cyc_FP3 : SchedWriteRes<[ORYONFP3]> {
  let Latency = 6;
}

def ORYONWrite_7Cyc_FP3 : SchedWriteRes<[ORYONFP3]> {
  let Latency = 7;
}

def ORYONWrite_8Cyc_FP3 : SchedWriteRes<[ORYONFP3]> {
  let Latency = 8;
}

def ORYONWrite_9Cyc_FP3 : SchedWriteRes<[ORYONFP3]> {
  let Latency = 9;
}

def ORYONWrite_10Cyc_FP3 : SchedWriteRes<[ORYONFP3]> {
  let Latency = 10;
}

def ORYONWrite_8Cyc_FP3_RC : SchedWriteRes<[ORYONFP3]> {
  let Latency = 8;
  let ReleaseAtCycles = [2];
}

def ORYONWrite_10Cyc_FP3_RC : SchedWriteRes<[ORYONFP3]> {
  let Latency = 10;
  let ReleaseAtCycles = [2];
}

def ORYONWrite_13Cyc_FP3_RC : SchedWriteRes<[ORYONFP3]> {
  let Latency = 13;
  let ReleaseAtCycles = [2];
}

def ORYONWrite_4Cyc_FP0123_RC :
SchedWriteRes<[ORYONFP0123]> {
  let Latency = 4;
  let ReleaseAtCycles = [2];
}

def ORYONWrite_4Cyc_FP0123_FP0123_RC :
SchedWriteRes<[ORYONFP0123, ORYONFP0123]> {
  let Latency = 4;
  let NumMicroOps = 2;
  let ReleaseAtCycles = [2,2];
}

def ORYONWrite_4Cyc_FP0123_FP0123_FP0123_RC :
SchedWriteRes<[ORYONFP0123, ORYONFP0123, ORYONFP0123]> {
  let Latency = 4;
  let NumMicroOps = 3;
  let ReleaseAtCycles = [3,3,3];
}

def ORYONWrite_6Cyc_FP0123_FP0123_FP0123_FP0123_RC :
SchedWriteRes<[ORYONFP0123, ORYONFP0123, ORYONFP0123, ORYONFP0123]> {
  let Latency = 6;
  let NumMicroOps = 4;
  let ReleaseAtCycles = [6,6,6,6];
}

//===----------------------------------------------------------------------===//
// Instruction Tables in IXU
//===----------------------------------------------------------------------===//

//---
// Arithmetic Instructions
//---

//1, 1, 6
def : InstRW<[ORYONWrite_1Cyc_I012345],
            (instregex "^ADD(W|X)r(i|r|x)", "^SUB(W|X)r(i|r|x)")>;

//2,2,3
def : InstRW<[ORYONWrite_2Cyc_I012345_I012345_RC],
            (instregex "^ADD(W|X)rs", "^SUB(W|X)rs")>;

//1,1,4 alias CMP, CMN on page 75
def : InstRW<[ORYONWrite_1Cyc_I0123],
            (instregex "^ADDS(W|X)r(i|r|x)(64)?", "^SUBS(W|X)r(i|r|x)")>;

//2,2,2 alias CMP, CMN on page 75
def : InstRW<[ORYONWrite_2Cyc_I0123_I0123_RC],
            (instregex "^ADDS(W|X)rs", "^SUBS(W|X)rs")>;

//1,1,4
def : InstRW<[ORYONWrite_1Cyc_I0123],
            (instregex "^ADC(W|X)r","^SBC(W|X)r",
                       "^ADCS(W|X)r","^SBCS(W|X)r")>;

//1,1,2
def : InstRW<[ORYONWrite_1Cyc_2Uops_I01],
            (instrs ADR,ADRP)>;

//1,1,4
def : InstRW<[ORYONWrite_1Cyc_I0123],
            (instregex "^CSEL(W|X)r", "^CSINV(W|X)r",
                       "^CSNEG(W|X)r", "^CSINC(W|X)r")>;

//---
//Compare Instruciton
//---

// We have CCMP, CCMN as LLVM DAG node
// CMP is an alias of SUBS as above
// CMN is an alias of ADDS as above
// We also have no way to get shift compare node in LLVM
//2,2,1.5 CMP, CMN

//1,1,4
def : InstRW<[ORYONWrite_1Cyc_I0123],
            (instregex "^CCMP(W|X)(i|r)", "^CCMN(W|X)(i|r)")>;

//---
// Branch
//---

def : InstRW<[ORYONWrite_1Cyc_NONE], (instrs B)>;
def : InstRW<[ORYONWrite_1Cyc_I01], (instrs BL)>;
def : InstRW<[ORYONWrite_1Cyc_I01],
            (instrs Bcc, CBZW, CBZX, CBNZW, CBNZX, TBZW, TBZX, TBNZW, TBNZX)>;
def : InstRW<[ORYONWrite_1Cyc_I0], (instrs BR, BLR)>;
def : InstRW<[ORYONWrite_1Cyc_I0], (instrs RET)>;

// 3 uOp, 1 cycle for branch, 7 cycle for Authentication,
// 1 cycle for updating link register
// V8.3a PAC
def : InstRW<[ORYONWrite_9Cyc_I012],
            (instrs BLRAA, BLRAAZ, BLRAB, BLRABZ,
                    BRAA, BRAAZ, BRAB, BRABZ)>;
def : InstRW<[ORYONWrite_9Cyc_I012], (instrs RETAA, RETAB, ERETAA, ERETAB)>;

def : InstRW<[ORYONWrite_7Cyc_3Uops_I2], (instregex "^LDRAA", "^LDRAB")>;

// Logical Instructions
//---

//1,1,4 TST is an alias of ANDS
def : InstRW<[ORYONWrite_1Cyc_I0123],
            (instregex "^ANDS(W|X)r(i|r|x)", "^BICS(W|X)r(i|r|x)")>;

//2,2,2 TST shift is an alias
def : InstRW<[ORYONWrite_2Cyc_I0123_I0123_RC],
            (instregex "^ANDS(W|X)rs", "^BICS(W|X)rs")>;

//1,1,6
def : InstRW<[ORYONWrite_1Cyc_I012345],
            (instregex "^AND(W|X)r(i|r|x)", "^EOR(W|X)r(i|r|x)",
                       "^ORR(W|X)r(i|r|x)", "^BIC(W|X)r(i|r|x)",
                       "^EON(W|X)r(i|r|x)", "^ORN(W|X)r(i|r|x)")>;

//2,2,3
def : InstRW<[ORYONWrite_2Cyc_I012345_I012345_RC],
            (instregex "^AND(W|X)rs", "^EOR(W|X)rs", "^ORR(W|X)rs",
                       "^BIC(W|X)rs", "^EON(W|X)rs", "^ORN(W|X)rs")>;


//---
// Shift Instructions
//---

//1,1,6
def : InstRW<[ORYONWrite_1Cyc_I012345],
            (instregex "^ASRV(W|X)r", "^LSLV(W|X)r",
                       "^LSRV(W|X)r", "^RORV(W|X)r",
                       "RMIF")>;

//---
// Move-Data Bit-field and Sign_Extension Instructions
//---

//1,1,6
def : InstRW<[ORYONWrite_1Cyc_I012345],
            (instregex "^MOVK(W|X)i", "^MOVN(W|X)i",
                       "^MOVZ(W|X)i", "^SBFM(W|X)ri",
                       "^UBFM(W|X)ri", "^BFM(W|X)ri",
                       "^SXT(W|B|H|X)", "^UXT(H|B)")>;

// COPY instruction is an LLVM internal DAG node, needs further study
def : InstRW<[ORYONWrite_1Cyc_I012345], (instrs COPY)>;

//---
// Reverse Instructions
//---

//1,1,6
def : InstRW<[ORYONWrite_1Cyc_I012345],
            (instregex "^RBIT(W|X)r", "^REV(16|32|64)?(W|X)r")>;


//---
// Flag Manipulate Instructions
//---

//1,1,4
def : InstRW<[ORYONWrite_1Cyc_I0123],
            (instregex "^SETF8", "^SETF16", "^CFINV")>;

//---
// Miscellaneous Instructions
//---

//1,1,6
def : InstRW<[ORYONWrite_1Cyc_I012345],
              (instregex "^CLS(W|X)r$", "^CLZ(W|X)r$", "^EXTR(W|X)rri")>;


//---
// Multiply Instructions
//---

//1,3,2
def : InstRW<[ORYONWrite_3Cyc_I45],
            (instregex "^MADD(W|X)rrr", "^MSUB(W|X)rrr",
                       "^(S|U)MADDLrrr", "^(S|U)MSUBLrrr",
                       "^(S|U)MULHrr")>;

//---
// Divide Instructions
//---

def : InstRW<[ORYONWrite_7Cyc_I2_RC],
             (instregex "^(S|U)DIVWr")>;

def : InstRW<[ORYONWrite_9Cyc_I2_RC],
             (instregex "^(S|U)DIVXr")>;


//---
// Cryptgraphy Instructions
//
//1,3,1  on I2
def : InstRW<[ORYONWrite_3Cyc_I2],
            (instregex "^CRC32(B|H|W|X)rr", "^CRC32C(B|H|W|X)rr")>;

//---
// PAU instructions
//---

// on p47 of IXU document, we have 7 cycles for all PAU instructions
// here we just assume all signing and pauth instructions are 7 cycles
// assume all are 7 cycles here

// signing instrucitons
def : InstRW<[ORYONWrite_7Cyc_I2], (instrs PACIA, PACIB,
                                            PACDA, PACDB,
                                            PACIZA, PACIZB,
                                            PACDZA, PACDZB,
                                            PACGA)>;
// authentication instrucitons
def : InstRW<[ORYONWrite_7Cyc_I2], (instrs AUTIA, AUTIB,
                                            AUTDA, AUTDB,
                                            AUTIZA, AUTIZB,
                                            AUTDZA, AUTDZB)>;
def : InstRW<[ORYONWrite_7Cyc_I2], (instrs XPACI, XPACD)>;

//===----------------------------------------------------------------------===//
// Instruction Tables in LSU
//===----------------------------------------------------------------------===//

// 4 cycle Load-to-use from L1D$
// Neon load with 5 cycle
// 6 cycle to STA ?
// STD cycle ?
// NEON STD + 2

// Load Instructions
// FP Load Instructions

// Load pair, immed pre-index, normal
// Load pair, immed pre-index, signed words
// Load pair, immed post-index, normal
// Load pair, immed post-index, signed words
// NOTE: Handled by WriteLD, WriteLDHi, WriteAdr.

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDNPDi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDNPQi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDNPSi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDNPWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDNPXi)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDPDi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDPQi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDPSi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDPSWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDPWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDPXi)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRBui)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRDui)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRHui)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRQui)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSui)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRDl)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRQl)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRWl)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRXl)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRBi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRHi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRXi)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRSBWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRSBXi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRSHWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRSHXi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDTRSWi)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPDpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPQpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPSpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPWpre)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRBpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRDpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRHpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRQpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRWpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRXpre)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSBWpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSBXpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSBWpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSBXpost)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSHWpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSHXpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSHWpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSHXpost)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRBBpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRBBpost)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRHHpre)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRHHpost)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPDpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPQpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPSpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPWpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345],
            (instrs LDPXpost)>;

def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRBpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRDpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRHpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRQpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRSpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRWpost)>;
def : InstRW<[ORYONWrite_4Cyc_LD_I012345], (instrs LDRXpost)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRBroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRDroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRHroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRHHroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRQroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSHWroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSHXroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRWroW)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRXroW)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRBroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRDroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRHHroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRHroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRQroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSHWroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRSHXroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRWroX)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDRXroX)>;

def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURBi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURBBi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURDi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURHi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURHHi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURQi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURSi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURXi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURSBWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURSBXi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURSHWi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURSHXi)>;
def : InstRW<[ORYONWrite_4Cyc_LD], (instrs LDURSWi)>;



// Store register, immed post-index
// NOTE: Handled by WriteST, ReadAdrBase

// Store register, immed pre-index
// NOTE: Handled by WriteST

// Store pair, immed post-index, W-form
// Store pair, immed post-indx, X-form
// Store pair, immed pre-index, W-form
// Store pair, immed pre-index, X-form
// NOTE: Handled by WriteSTP.

def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURBi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURBBi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURDi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURHi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURHHi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURQi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURSi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURWi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STURXi)>;

def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STTRBi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STTRHi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STTRWi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STTRXi)>;

def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STNPDi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STNPQi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STNPXi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STNPWi)>;

def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STPDi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STPQi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STPXi)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STPWi)>;

def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STRBui)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STRDui)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STRHui)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STRQui)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STRXui)>;
def : InstRW<[ORYONWrite_1Cyc_ST], (instrs STRWui)>;

def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STPDpre, STPDpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STPSpre, STPSpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STPWpre, STPWpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STPXpre, STPXpost)>;

def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRBpre, STRBpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRBBpre, STRBBpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRDpre, STRDpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRHpre, STRHpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRHHpre, STRHHpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRQpre, STRQpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRSpre, STRSpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRWpre, STRWpost)>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instrs STRXpre, STRXpost)>;

def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRBroW, STRBroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRDroW, STRDroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRHroW, STRHroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRHHroW, STRHHroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRQroW, STRQroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRSroW, STRSroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRWroW, STRWroX)>;
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instrs STRXroW, STRXroX)>;

// ASIMD Load instructions, 4 cycle access + 2 cycle NEON access
// ASIMD load, 1 element, multiple, 1 reg, D-form 1uOps
// ASIMD load, 1 element, multiple, 1 reg, Q-form 1uOps
def : InstRW<[ORYONWrite_5Cyc_LD],
            (instregex "^LD1Onev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;

def : InstRW<[ORYONWrite_5Cyc_LD_I012345],
            (instregex "^LD1Onev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD load, 1 element, multiple, 2 reg, D-form 3 uOps
// ASIMD load, 1 element, multiple, 2 reg, Q-form 2 uOps
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD],
            (instregex "^LD1Twov(8b|4h|2s|1d)$")>;

def : InstRW<[ORYONWrite_5Cyc_2Uops_LD],
            (instregex "^LD1Twov(16b|8h|4s|2d)$")>;

def : InstRW<[ORYONWrite_5Cyc_3Uops_LD_I012345],
            (instregex "^LD1Twov(8b|4h|2s|1d)_POST$")>;

def : InstRW<[ORYONWrite_5Cyc_2Uops_LD_I012345],
            (instregex "^LD1Twov(16b|8h|4s|2d)_POST$")>;

// ASIMD load, 1 element, multiple, 3 reg, D-form 4 uOps
// ASIMD load, 1 element, multiple, 3 reg, Q-form 3 uOps
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD],
            (instregex "^LD1Threev(8b|4h|2s|1d)$")>;

def : InstRW<[ORYONWrite_5Cyc_3Uops_LD],
            (instregex "^LD1Threev(16b|8h|4s|2d)$")>;

def : InstRW<[ORYONWrite_5Cyc_4Uops_LD_I012345],
            (instregex "^LD1Threev(8b|4h|2s|1d)_POST$")>;

def : InstRW<[ORYONWrite_5Cyc_3Uops_LD_I012345],
            (instregex "^LD1Threev(16b|8h|4s|2d)_POST$")>;

// ASIMD load, 1 element, multiple, 4 reg, D-form 6 uOps
// ASIMD load, 1 element, multiple, 4 reg, Q-form 4 uOps
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD],
            (instregex "^LD1Fourv(8b|4h|2s|1d)$")>;
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD],
            (instregex "^LD1Fourv(16b|8h|4s|2d)$")>;

def : InstRW<[ORYONWrite_5Cyc_6Uops_LD_I012345],
            (instregex "^LD1Fourv(8b|4h|2s|1d)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD_I012345],
            (instregex "^LD1Fourv(16b|8h|4s|2d)_POST$")>;

// ASIMD load, 1 element, one lane, B/H/S 2uOps
// ASIMD load, 1 element, one lane, D     2UOps
def : InstRW<[ORYONWrite_5Cyc_2Uops_LD], (instregex "^LD1i(8|16|32|64)$")>;
def : InstRW<[ORYONWrite_5Cyc_2Uops_LD_I012345],
            (instregex "^LD1i(8|16|32|64)_POST$")>;

// ASIMD load, 1 element, all lanes, D-form, B/H/S 2uOps
// ASIMD load, 1 element, all lanes, D-form, D     2uOps
// ASIMD load, 1 element, all lanes, Q-form        2uOps
def : InstRW<[ORYONWrite_5Cyc_2Uops_LD],
            (instregex "^LD1Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_2Uops_LD_I012345],
            (instregex "^LD1Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD load, 2 element, multiple, D-form, B/H/S 3 uOps
// ASIMD load, 2 element, multiple, Q-form, D     4 uOps
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD],
            (instregex "^LD2Twov(8b|4h|2s)$")>;
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD],
            (instregex "^LD2Twov(16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD_I012345],
            (instregex "^LD2Twov(8b|4h|2s)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD_I012345],
            (instregex "^LD2Twov(16b|8h|4s|2d)_POST$")>;

// ASIMD load, 2 element, one lane, B/H           3 uOps
// ASIMD load, 2 element, one lane, S             3 uOps
// ASIMD load, 2 element, one lane, D             3 uOps
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD], (instregex "^LD2i(8|16|32|64)$")>;
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD_I012345],
            (instregex "^LD2i(8|16|32|64)_POST$")>;

// ASIMD load, 2 element, all lanes, D-form, B/H/S 3 uOps
// ASIMD load, 2 element, all lanes, D-form, D     3 uOps
// ASIMD load, 2 element, all lanes, Q-form        3 uOps
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD],
            (instregex "^LD2Rv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_3Uops_LD_I012345],
            (instregex "^LD2Rv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD load, 3 element, multiple, D-form, B/H/S  5 uOps
// ASIMD load, 3 element, multiple, Q-form, B/H/S  6 uOps
// ASIMD load, 3 element, multiple, Q-form, D      6 uOps
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD],
            (instregex "^LD3Threev(8b|4h|2s)$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD],
            (instregex "^LD3Threev(16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD_I012345],
            (instregex "^LD3Threev(8b|4h|2s)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD_I012345],
            (instregex "^LD3Threev(16b|8h|4s|2d)_POST$")>;

// ASIMD load, 3 element, one lone, B/H            4 uOps
// ASIMD load, 3 element, one lane, S              4 uOps
// ASIMD load, 3 element, one lane, D              5 uOps
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD], (instregex "^LD3i(8|16|32)$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD], (instregex "^LD3i(64)$")>;
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD_I012345],
            (instregex "^LD3i(8|16|32)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD_I012345],
            (instregex "^LD3i(64)_POST$")>;

// ASIMD load, 3 element, all lanes, D-form, B/H/S 4 uOps
// ASIMD load, 3 element, all lanes, D-form, D     5 uOps
// ASIMD load, 3 element, all lanes, Q-form, B/H/S 4 uOps
// ASIMD load, 3 element, all lanes, Q-form, D     5 uOps
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD],
            (instregex "^LD3Rv(8b|4h|2s|16b|8h|4s)$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD],
            (instregex "^LD3Rv(1d|2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_4Uops_LD_I012345],
            (instregex "^LD3Rv(8b|4h|2s|16b|8h|4s)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD_I012345],
            (instregex "^LD3Rv(1d|2d)_POST$")>;

// ASIMD load, 4 element, multiple, D-form, B/H/S  6 uOps
// ASIMD load, 4 element, multiple, Q-form, B/H/S  10 uOps
// ASIMD load, 4 element, multiple, Q-form, D      8 uOps
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD],
            (instregex "^LD4Fourv(8b|4h|2s)$")>;
def : InstRW<[ORYONWrite_5Cyc_10Uops_LD],
            (instregex "^LD4Fourv(16b|8h|4s)$")>;
def : InstRW<[ORYONWrite_5Cyc_8Uops_LD],
            (instregex "^LD4Fourv(2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD_I012345],
            (instregex "^LD4Fourv(8b|4h|2s)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_10Uops_LD_I012345],
            (instregex "^LD4Fourv(16b|8h|4s)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_8Uops_LD_I012345],
            (instregex "^LD4Fourv(2d)_POST$")>;

// ASIMD load, 4 element, one lane, B/H            5 uOps
// ASIMD load, 4 element, one lane, S              5 uOps
// ASIMD load, 4 element, one lane, D              6 uOps
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD], (instregex "^LD4i(8|16|32)$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD], (instregex "^LD4i(64)$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD_I012345],
            (instregex "^LD4i(8|16|32)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD_I012345],
            (instregex "^LD4i(64)_POST$")>;

// ASIMD load, 4 element, all lanes, D-form, B/H/S    5 uOps
// ASIMD load, 4 element, all lanes, D-form, D        6 uOps
// ASIMD load, 4 element, all lanes, Q-form, B/H/S    5 uOps
// ASIMD load, 4 element, all lanes, Q-form, D        6 uOps
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD],
            (instregex "^LD4Rv(8b|4h|2s|16b|8h|4s)$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD],
            (instregex "^LD4Rv(1d|2d)$")>;
def : InstRW<[ORYONWrite_5Cyc_5Uops_LD_I012345],
            (instregex "^LD4Rv(8b|4h|2s|16b|8h|4s)_POST$")>;
def : InstRW<[ORYONWrite_5Cyc_6Uops_LD_I012345],
            (instregex "^LD4Rv(1d|2d)_POST$")>;

// ASIMD Store Instructions
// ASIMD store, 1 element, multiple, 1 reg, D-form    1 uOps
// ASIMD store, 1 element, multiple, 1 reg, Q-form    1 uops
def : InstRW<[ORYONWrite_1Cyc_ST],
            (instregex "^ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_ST_I012345],
            (instregex "^ST1Onev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD store, 1 element, multiple, 2 reg, D-form    2 uOps
// ASIMD store, 1 element, multiple, 2 reg, Q-form    2 uOps
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST],
            (instregex "^ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST_I012345],
            (instregex "^ST1Twov(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD store, 1 element, multiple, 3 reg, D-form    3 uOps
// ASIMD store, 1 element, multiple, 3 reg, Q-form    3 uOps
def : InstRW<[ORYONWrite_1Cyc_3Uops_ST],
            (instregex "^ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_3Uops_ST_I012345],
            (instregex "^ST1Threev(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD store, 1 element, multiple, 4 reg, D-form    4 uOps
// ASIMD store, 1 element, multiple, 4 reg, Q-form    4 uOps
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST],
            (instregex "^ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST_I012345],
            (instregex "^ST1Fourv(8b|4h|2s|1d|16b|8h|4s|2d)_POST$")>;

// ASIMD store, 1 element, one lane, B/H/S            2 uOps
// ASIMD store, 1 element, one lane, D                2 uOps
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST],
            (instregex "^ST1i(8|16|32|64)$")>;
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST_I012345],
            (instregex "^ST1i(8|16|32|64)_POST$")>;

// ASIMD store, 2 element, multiple, D-form, B/H/S    2 uOps
// ASIMD store, 2 element, multiple, Q-form, B/H/S    4 uOps
// ASIMD store, 2 element, multiple, Q-form, D        4 uOps
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST],
            (instregex "^ST2Twov(8b|4h|2s)$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST],
            (instregex "^ST2Twov(16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST_I012345],
            (instregex "^ST2Twov(8b|4h|2s)_POST$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST_I012345],
            (instregex "^ST2Twov(16b|8h|4s|2d)_POST$")>;

// ASIMD store, 2 element, one lane, B/H/S            2 uOps
// ASIMD store, 2 element, one lane, D                2 uOps
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST],
            (instregex "^ST2i(8|16|32|64)$")>;
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST_I012345],
            (instregex "^ST2i(8|16|32|64)_POST$")>;

// ASIMD store, 3 element, multiple, D-form, B/H/S    4 uOps
// ASIMD store, 3 element, multiple, Q-form, B/H/S    6 uOps
// ASIMD store, 3 element, multiple, Q-form, D        6 uOps
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST],
            (instregex "^ST3Threev(8b|4h|2s)$")>;
def : InstRW<[ORYONWrite_1Cyc_6Uops_ST],
            (instregex "^ST3Threev(16b|8h|4s|2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST_I012345],
            (instregex "^ST3Threev(8b|4h|2s)_POST$")>;
def : InstRW<[ORYONWrite_1Cyc_6Uops_ST_I012345],
            (instregex "^ST3Threev(16b|8h|4s|2d)_POST$")>;

// ASIMD store, 3 element, one lane, B/H              2 uOps
// ASIMD store, 3 element, one lane, S                2 uOps
// ASIMD store, 3 element, one lane, D                4 uOps
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST], (instregex "^ST3i(8|16|32)$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST], (instregex "^ST3i(64)$")>;
def : InstRW<[ORYONWrite_1Cyc_2Uops_ST_I012345],
            (instregex "^ST3i(8|16|32)_POST$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST_I012345],
            (instregex "^ST3i(64)_POST$")>;


// ASIMD store, 4 element, multiple, D-form, B/H/S    5 uOps
// ASIMD store, 4 element, multiple, Q-form, B/H/S    10 uOps
// ASIMD store, 4 element, multiple, Q-form, D        8 uOps
def : InstRW<[ORYONWrite_1Cyc_5Uops_ST],
            (instregex "^ST4Fourv(8b|4h|2s)$")>;
def : InstRW<[ORYONWrite_1Cyc_10Uops_ST],
            (instregex "^ST4Fourv(16b|8h|4s)$")>;
def : InstRW<[ORYONWrite_1Cyc_8Uops_ST],
            (instregex "^ST4Fourv(2d)$")>;
def : InstRW<[ORYONWrite_1Cyc_5Uops_ST_I012345],
            (instregex "^ST4Fourv(8b|4h|2s)_POST$")>;
def : InstRW<[ORYONWrite_1Cyc_10Uops_ST_I012345],
            (instregex "^ST4Fourv(16b|8h|4s)_POST$")>;
def : InstRW<[ORYONWrite_1Cyc_8Uops_ST_I012345],
            (instregex "^ST4Fourv(2d)_POST$")>;

// ASIMD store, 4 element, one lane, B/H              3 uOps
// ASIMD store, 4 element, one lane, S                3 uOps
// ASIMD store, 4 element, one lane, D                4 uOps
def : InstRW<[ORYONWrite_1Cyc_3Uops_ST], (instregex "^ST4i(8|16|32)$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST], (instregex "^ST4i(64)$")>;
def : InstRW<[ORYONWrite_1Cyc_3Uops_ST_I012345],
            (instregex "^ST4i(8|16|32)_POST$")>;
def : InstRW<[ORYONWrite_1Cyc_4Uops_ST_I012345],
            (instregex "^ST4i(64)_POST$")>;


//===----------------------------------------------------------------------===//
// Instruction Tables in VXU
//===----------------------------------------------------------------------===//
// all uOps are not clearly written in the VXU document

// I2V
def : InstRW<[ORYONWrite_I2V_4Cyc_I45], (instregex "^FMOV[HSD][WX]r", "^FMOVDXHighr")>;

// I2V with convert
def : InstRW<[ORYONWrite_I2V_7Cyc_I45], (instregex "^[SU]CVTF[SU][XW][HSD]ri")>;

// V2I
def : InstRW<[ORYONWrite_V2I_3Cyc_FP01], (instregex "^FMOV[WX][HSD]r", "FMOVXDHighr")>;

// V2I with convert 2nd [SU] necessary?
def : InstRW<[ORYONWrite_V2I_6Cyc_FP01], (instregex "^FCVT[AMNPZ][SU][SU][XW][HSD]r")>;

// float to float move immediate, row 7 in big chart
def : InstRW<[ORYONWrite_V2V_2Cyc_FP0123], (instregex "^FMOV[HSD]r")>;
def : InstRW<[ORYONWrite_V2V_2Cyc_FP0123], (instregex "^FMOV[HSD]i")>;

// float to float conversion within VXU, precision conversion
def : InstRW<[ORYONWrite_V2V_6Cyc_FP01], (instregex "^FJCVTZS")>;
def : InstRW<[ORYONWrite_V2V_3Cyc_FP0123], (instregex "^FCVT[HSD][HSD]r",
                                                       "^FRINT(A|I|M|N|P|X|Z)(Sr|Dr)")>;

// floating comparison write to NZCV
def : InstRW<[ORYONWrite_2Cyc_FP01], (instregex "^FCMP(E)?[HSD]r[ir]")>;
def : InstRW<[ORYONWrite_2Cyc_FP01], (instregex "^FCCMP(E)?[HSD]rr")>;

// floating point conditional select
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^FCSEL")>;

// floating multiply-add
def : InstRW<[ORYONWrite_4Cyc_FP0123], (instregex "^(F|FN)MADD", "^(F|FN)MSUB")>;

// floating unary, cycle/throughput? xls row14
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^F(ABS|NEG)[SD]r")>;

//floating division/square root
def : InstRW<[ORYONWrite_7Cyc_FP3], (instregex "^FDIVHrr")>;
def : InstRW<[ORYONWrite_8Cyc_FP3], (instregex "^FDIVSrr")>;
def : InstRW<[ORYONWrite_10Cyc_FP3], (instregex "^FDIVDrr")>;

def : InstRW<[ORYONWrite_8Cyc_FP3_RC], (instregex "^FSQRTHr")>;
def : InstRW<[ORYONWrite_10Cyc_FP3_RC], (instregex "^FSQRTSr")>;
def : InstRW<[ORYONWrite_13Cyc_FP3_RC], (instregex "^FSQRTDr")>;

//==========
// SIMD move instructions
//==========

// ASIMD DUP element
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^DUPv.+lane")>;
// ASIMD DUP general thoughput undecided, 3? FP0123
// VXU doc, p42, 2 uOps
def : InstRW<[ORYONWrite_3Cyc_2Uops_FP0123], (instregex "^DUPv.+gpr")>;

// ASIMD insert, element to element
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^INSv.+lane")>;
// ASIMD insert,  gen reg 3? FP0123?
def : InstRW<[ORYONWrite_3Cyc_2Uops_FP0123], (instregex "^INSv.+gpr")>;

// ASIMD move, FP immed
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^FMOVv")>;

// ASIMD transfer, element to gen reg
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^[SU]MOVv")>;

//==========
// SIMD arithmetic instructions
//==========
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^ADDv", "^SUBv",
                                         "^BIFv", "^BITv", "^BSLv",
                                         "^ANDv", "^BICv", "^EORv",
                                         "^ORRv", "^ORNv")>;


def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^FABDv", "^FADDv", "^FSUBv")>;

// floating division
def : InstRW<[ORYONWrite_6Cyc_FP3], (instregex "^FDIVv.*16$")>;
def : InstRW<[ORYONWrite_7Cyc_FP3], (instregex "^FDIVv.*32$")>;
def : InstRW<[ORYONWrite_9Cyc_FP3], (instregex "^FDIVv.*64$")>;

def : InstRW<[ORYONWrite_4Cyc_FP0123], (instregex "^FMUL(X)?v",
                                                   "^FRECPSv", "^FRSQRTSv")>;

def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^MLAv","^MLSv", "^MULv",
                                                   "^PMULv", "UABAv")>;

def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "SABAv", "SABDv",
                                                   "^(SH|UH)(ADD|SUB)v",
                                                   "^S(MAX|MIN)v",
                                                   "^(SQ|UQ)(ADD|SUB)v",
                                                   "^(SQ|SQR|UQ|UQR)SHLv",
                                                   "^(SR|UR)HADDv",
                                                   "^(SR|UR)SHLv",
                                                   "^UABDv",
                                                   "^U(MAX|MIN)v")>;
// IMAX or UMAX in the above line
//==========
// SIMD compare instructions
//==========

def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^CMEQv","^CMGEv","^CMGTv",
                                                   "^CMLEv","^CMLTv", "^CMHIv",
                                                   "^CMHSv",
                                                   "^FCMEQv", "^FCMGEv",
                                                   "^FCMGTv", "^FCMLEv",
                                                   "^FCMLTv",
                                                   "^FACGEv", "^FACGTv")>;

//==========
// SIMD widening and narrowing arithmetic instructions
//==========
// NO need to list ADDHN2, RADDHN2, RSUBHN2 as they are not distinguished
// from ADDHN, RADDHN, RSUBHN in td file(v16i8, v8i16, v4i32).
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^ADDHNv",
                                                   "^SUBHNv",
                                                   "^RADDHNv",
                                                   "^RSUBHNv",
                                                   "^SABD(L|L2)v", "^UABD(L|L2)v",
                                                   "^(S|U)(ADD|SUB)(L|L2|W|W2)v")>;

def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^PMUL(L|L2)v","^SABA(L|L2)v",
                                                   "^(S|U|SQ)(MLA|MSL|MUL)(L|L2)v")>;

//==========
// SIMD unary arithmetic instructions
//==========
//^MVNv is an alias of ^NOTv
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^ABSv", "^CLSv","^CLZv", "^CNTv",
                                                   "^NEGv", "^NOTv",
                                                   "^RBITv", "^REV(16|32|64)v",
                                                   "^SQ(ABS|NEG)v", "^SQ(XT|XTU)(N|N2)v",
                                                   "^(SU|US)QADDv",
                                                   "^UQXT(N|N2)v", "^XTN2?v")>;

def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^FCVT(L|L2|N|N2|XN|XN2)v",
                                                   "^FRINT[AIMNPXZ]v",
                                                   "^FRSQRTEv",
                                                   "^(S|U)ADALPv",
                                                   "^(S|U)ADDLPv")>;


def : InstRW<[ORYONWrite_3Cyc_FP0], (instregex "^URECPEv", "^URSQRTEv",
                                                "^FRECPEv", "^FRECPXv")>;

def : InstRW<[ORYONWrite_8Cyc_FP3_RC], (instregex "^FSQRTv.*16$")>;
def : InstRW<[ORYONWrite_10Cyc_FP3_RC], (instregex "^FSQRTv.*32$")>;
def : InstRW<[ORYONWrite_13Cyc_FP3_RC], (instregex "^FSQRTv.*64$")>;

//==========
// SIMD binary elememt arithmetic instructions
//==========

def : InstRW<[ORYONWrite_4Cyc_FP0123], (instregex "^FMLAv", "^FMLSv")>;

def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex  "^SQDMULHv",
                                                   "^SQRD(MLA|MLS|MUL)Hv")>;

//==========
// SIMD permute instructions
//==========

def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^EXTv", "^TRN(1|2)v",
                                                   "^UZP(1|2)v", "^ZIP(1|2)v")>;

//==========
// SIMD immediate instructions
//==========

def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex  "^MOVIv", "^MVNIv")>;

//==========
// SIMD shift(immediate) instructions
//==========
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^RSHR(N|N2)v", "^SHLv",
                                                   "^(SHL|SHR)(N|N2)v",
                                                   "^SLIv",
                                                   "^(SQ|SQR)SHR(U)?(N|N2)v",
                                                   "^(UQ|UQR)SHR(N|N2)v",
                                                   "^SQSHLUv",
                                                   "^SRIv",
                                                   "^(S|SR|U|UR)SHRv",
                                                   "^(S|SR|U|UR)SRAv",
                                                   "^(S|U)SHL(L|L2)v")>;

//==========
// SIMD floating-point and integer conversion instructions
//==========
// same as above conversion

//==========
// SIMD reduce (acoss vector lanes) instructions
//==========

def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^ADDVv",
                                                   "^(FMAX|FMIN)(V|NMV)v",
                                                   "^(S|U)ADDLVv",
                                                   "^(S|U)(MAX|MIN)Vv")>;
//==========
// SIMD pairwise arithmetic instructions
//==========

def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^ADDPv", "^FADDPv",
                                                   "^(FMAX|FMIN)(NMP|P)v",
                                                   "^(S|U)(MIN|MAX)Pv")>;
//==========
// SIMD dot prodcut instructions
//==========

def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^(U|S)DOTv")>;

//==========
// SIMD table lookup instructions
//==========
// TBL 1-reg/2-reg; TBX 1-reg, 1uOp, throughput=4 latency=2
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instrs TBLv8i8One, TBLv16i8One,
                                                TBXv8i8One, TBXv16i8One,
                                                TBLv8i8Two, TBLv16i8Two)>;

// TBL 3-reg/4-reg, 3uops, throughtput=4/3=1.33 latency=4
def : InstRW<[ORYONWrite_4Cyc_FP0123_FP0123_FP0123_RC],
            (instrs TBLv8i8Three, TBLv16i8Three,
                    TBLv8i8Four, TBLv16i8Four)>;


// TBX 2-reg 2 uOps, throughput=2 latency=4
def : InstRW<[ORYONWrite_4Cyc_FP0123_FP0123_RC], (instrs TBXv8i8Two, TBXv16i8Two)>;

// TBX 3-reg/4-reg, 4uOps, throughput=1, latency=6
def : InstRW<[ORYONWrite_6Cyc_FP0123_FP0123_FP0123_FP0123_RC],
            (instrs TBXv8i8Three, TBXv16i8Three,
                    TBXv8i8Four, TBXv16i8Four)>;


//==========
// SIMD complex number arithmetic instructions
//==========

def : InstRW<[ORYONWrite_4Cyc_FP0123], (instregex "^FCADDv", "^FCMLAv")>;

//==========
// SIMD cryptographic instructions
//==========
// 3,4 on IMLA, CRYP
def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^AES[DE]",
                                                   "^SM3(TT1|TT2)(A|B)")>;

// 2,4 on CRYP
def : InstRW<[ORYONWrite_2Cyc_FP0123], (instregex "^AESI?MC",
                                                   "^EOR3",
                                                   "^RAX1",
                                                   "^XAR",
                                                   "^BCAX",
                                                   "^SM3SS1",
                                                   "^SM3PART(W1|W2)")>;
// 5,1 on CRYP
def : InstRW<[ORYONWrite_5Cyc_FP1], (instregex "^SM4E",
                                                "^SM4EKEY")>;

// 2,1 on CRYP
def : InstRW<[ORYONWrite_2Cyc_FP1], (instregex "^SHA1(H|SU0|SU1)",
                                                "^SHA256SU0",
                                                "^SHA512(SU0|SU1)")>;

// 3,1 on CRYP
def : InstRW<[ORYONWrite_3Cyc_FP1], (instregex "^SHA256SU1",
                                                "^SHA512(H|H2)")>;

// 4,0.25 on CRYP
def : InstRW<[ORYONWrite_4Cyc_FP1_RC4], (instregex "^SHA1(C|P|M)",
                                                "^SHA256(H|H2)")>;

//==========
// SIMD v8.6 instructions
//==========
// 4,2 on IMLA
def : InstRW<[ORYONWrite_4Cyc_FP0123_RC], (instregex "^(S|U|US)MMLA$")>;

// 4,0.5 on IMLA
def : InstRW<[ORYONWrite_8Cyc_FP0123_RC], (instregex "^BFMMLA$")>;

// 4,0.5 on IMLA
def : InstRW<[ORYONWrite_8Cyc_FP0123_RC], (instregex "^BFMLAL(B|T)")>;

// 3,4
def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^(US|SU)DOTv")>;

// 3,1
def : InstRW<[ORYONWrite_4Cyc_FP0123], (instregex "^BF(16)?DOTv")>;

// 3,4
def : InstRW<[ORYONWrite_3Cyc_FP0123], (instregex "^BFCVT(N|N2)?$")>;


} // SchedModel = OryonModel