llvm.org GIT mirror llvm / b11917c
[MC] bundle alignment: prevent padding instructions from crossing bundle boundaries git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174067 91177308-0d34-0410-b5e6-96231b3b80d8 Derek Schuff 7 years ago
4 changed file(s) with 140 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
466466 //
467467 //
468468 // BundlePadding
469 // |||
469 // |||
470470 // -------------------------------------
471471 // Prev |##########| F |
472472 // -------------------------------------
505505 const MCFragment &F) {
506506 MCObjectWriter *OW = &Asm.getWriter();
507507
508 // FIXME: Embed in fragments instead?
509 uint64_t FragmentSize = Asm.computeFragmentSize(Layout, F);
510
508511 // Should NOP padding be written out before this fragment?
509512 unsigned BundlePadding = F.getBundlePadding();
510513 if (BundlePadding > 0) {
513516 assert(F.hasInstructions() &&
514517 "Writing bundle padding for a fragment without instructions");
515518
519 unsigned TotalLength = BundlePadding + static_cast(FragmentSize);
520 if (F.alignToBundleEnd() && TotalLength > Asm.getBundleAlignSize()) {
521 // If the padding itself crosses a bundle boundary, it must be emitted
522 // in 2 pieces, since even nop instructions must not cross boundaries.
523 // v--------------v <- BundleAlignSize
524 // v---------v <- BundlePadding
525 // ----------------------------
526 // | Prev |####|####| F |
527 // ----------------------------
528 // ^-------------------^ <- TotalLength
529 unsigned DistanceToBoundary = TotalLength - Asm.getBundleAlignSize();
530 if (!Asm.getBackend().writeNopData(DistanceToBoundary, OW))
531 report_fatal_error("unable to write NOP sequence of " +
532 Twine(DistanceToBoundary) + " bytes");
533 BundlePadding -= DistanceToBoundary;
534 }
516535 if (!Asm.getBackend().writeNopData(BundlePadding, OW))
517536 report_fatal_error("unable to write NOP sequence of " +
518537 Twine(BundlePadding) + " bytes");
525544
526545 ++stats::EmittedFragments;
527546
528 // FIXME: Embed in fragments instead?
529 uint64_t FragmentSize = Asm.computeFragmentSize(Layout, F);
530547 switch (F.getKind()) {
531548 case MCFragment::FT_Align: {
532549 ++stats::EmittedAlignFragments;
11331150 void MCLEBFragment::anchor() { }
11341151 void MCDwarfLineAddrFragment::anchor() { }
11351152 void MCDwarfCallFrameFragment::anchor() { }
1136
353353 .endr
354354 .bundle_unlock
355355 # CHECK: 3ef: nop
356 # CHECK: 3f0: nop
356357 # CHECK: 3fe: incl
357358
358359 .align 32, 0x90
516517 .endr
517518 .bundle_unlock
518519 # CHECK: 5ce: nop
520 # CHECK: 5d0: nop
519521 # CHECK: 5dd: incl
520522
521523 .align 32, 0x90
527529 .endr
528530 .bundle_unlock
529531 # CHECK: 5ef: nop
532 # CHECK: 5f0: nop
530533 # CHECK: 5fd: incl
531534
532535 .align 32, 0x90
679682 .endr
680683 .bundle_unlock
681684 # CHECK: 7ad: nop
685 # CHECK: 7b0: nop
682686 # CHECK: 7bc: incl
683687
684688 .align 32, 0x90
690694 .endr
691695 .bundle_unlock
692696 # CHECK: 7ce: nop
697 # CHECK: 7d0: nop
693698 # CHECK: 7dc: incl
694699
695700 .align 32, 0x90
701706 .endr
702707 .bundle_unlock
703708 # CHECK: 7ef: nop
709 # CHECK: 7f0: nop
704710 # CHECK: 7fc: incl
705711
706712 .align 32, 0x90
842848 .endr
843849 .bundle_unlock
844850 # CHECK: 98c: nop
851 # CHECK: 990: nop
845852 # CHECK: 99b: incl
846853
847854 .align 32, 0x90
853860 .endr
854861 .bundle_unlock
855862 # CHECK: 9ad: nop
863 # CHECK: 9b0: nop
856864 # CHECK: 9bb: incl
857865
858866 .align 32, 0x90
864872 .endr
865873 .bundle_unlock
866874 # CHECK: 9ce: nop
875 # CHECK: 9d0: nop
867876 # CHECK: 9db: incl
868877
869878 .align 32, 0x90
875884 .endr
876885 .bundle_unlock
877886 # CHECK: 9ef: nop
887 # CHECK: 9f0: nop
878888 # CHECK: 9fb: incl
879889
880890 .align 32, 0x90
10051015 .endr
10061016 .bundle_unlock
10071017 # CHECK: b6b: nop
1018 # CHECK: b70: nop
10081019 # CHECK: b7a: incl
10091020
10101021 .align 32, 0x90
10161027 .endr
10171028 .bundle_unlock
10181029 # CHECK: b8c: nop
1030 # CHECK: b90: nop
10191031 # CHECK: b9a: incl
10201032
10211033 .align 32, 0x90
10271039 .endr
10281040 .bundle_unlock
10291041 # CHECK: bad: nop
1042 # CHECK: bb0: nop
10301043 # CHECK: bba: incl
10311044
10321045 .align 32, 0x90
10381051 .endr
10391052 .bundle_unlock
10401053 # CHECK: bce: nop
1054 # CHECK: bd0: nop
10411055 # CHECK: bda: incl
10421056
10431057 .align 32, 0x90
10491063 .endr
10501064 .bundle_unlock
10511065 # CHECK: bef: nop
1066 # CHECK: bf0: nop
10521067 # CHECK: bfa: incl
10531068
10541069 .align 32, 0x90
11681183 .endr
11691184 .bundle_unlock
11701185 # CHECK: d4a: nop
1186 # CHECK: d50: nop
11711187 # CHECK: d59: incl
11721188
11731189 .align 32, 0x90
11791195 .endr
11801196 .bundle_unlock
11811197 # CHECK: d6b: nop
1198 # CHECK: d70: nop
11821199 # CHECK: d79: incl
11831200
11841201 .align 32, 0x90
11901207 .endr
11911208 .bundle_unlock
11921209 # CHECK: d8c: nop
1210 # CHECK: d90: nop
11931211 # CHECK: d99: incl
11941212
11951213 .align 32, 0x90
12011219 .endr
12021220 .bundle_unlock
12031221 # CHECK: dad: nop
1222 # CHECK: db0: nop
12041223 # CHECK: db9: incl
12051224
12061225 .align 32, 0x90
12121231 .endr
12131232 .bundle_unlock
12141233 # CHECK: dce: nop
1234 # CHECK: dd0: nop
12151235 # CHECK: dd9: incl
12161236
12171237 .align 32, 0x90
12231243 .endr
12241244 .bundle_unlock
12251245 # CHECK: def: nop
1246 # CHECK: df0: nop
12261247 # CHECK: df9: incl
12271248
12281249 .align 32, 0x90
13311352 .endr
13321353 .bundle_unlock
13331354 # CHECK: f29: nop
1355 # CHECK: f30: nop
13341356 # CHECK: f38: incl
13351357
13361358 .align 32, 0x90
13421364 .endr
13431365 .bundle_unlock
13441366 # CHECK: f4a: nop
1367 # CHECK: f50: nop
13451368 # CHECK: f58: incl
13461369
13471370 .align 32, 0x90
13531376 .endr
13541377 .bundle_unlock
13551378 # CHECK: f6b: nop
1379 # CHECK: f70: nop
13561380 # CHECK: f78: incl
13571381
13581382 .align 32, 0x90
13641388 .endr
13651389 .bundle_unlock
13661390 # CHECK: f8c: nop
1391 # CHECK: f90: nop
13671392 # CHECK: f98: incl
13681393
13691394 .align 32, 0x90
13751400 .endr
13761401 .bundle_unlock
13771402 # CHECK: fad: nop
1403 # CHECK: fb0: nop
13781404 # CHECK: fb8: incl
13791405
13801406 .align 32, 0x90
13861412 .endr
13871413 .bundle_unlock
13881414 # CHECK: fce: nop
1415 # CHECK: fd0: nop
13891416 # CHECK: fd8: incl
13901417
13911418 .align 32, 0x90
13971424 .endr
13981425 .bundle_unlock
13991426 # CHECK: fef: nop
1427 # CHECK: ff0: nop
14001428 # CHECK: ff8: incl
14011429
14021430 .align 32, 0x90
14941522 .endr
14951523 .bundle_unlock
14961524 # CHECK: 1108: nop
1525 # CHECK: 1110: nop
14971526 # CHECK: 1117: incl
14981527
14991528 .align 32, 0x90
15051534 .endr
15061535 .bundle_unlock
15071536 # CHECK: 1129: nop
1537 # CHECK: 1130: nop
15081538 # CHECK: 1137: incl
15091539
15101540 .align 32, 0x90
15161546 .endr
15171547 .bundle_unlock
15181548 # CHECK: 114a: nop
1549 # CHECK: 1150: nop
15191550 # CHECK: 1157: incl
15201551
15211552 .align 32, 0x90
15271558 .endr
15281559 .bundle_unlock
15291560 # CHECK: 116b: nop
1561 # CHECK: 1170: nop
15301562 # CHECK: 1177: incl
15311563
15321564 .align 32, 0x90
15381570 .endr
15391571 .bundle_unlock
15401572 # CHECK: 118c: nop
1573 # CHECK: 1190: nop
15411574 # CHECK: 1197: incl
15421575
15431576 .align 32, 0x90
15491582 .endr
15501583 .bundle_unlock
15511584 # CHECK: 11ad: nop
1585 # CHECK: 11b0: nop
15521586 # CHECK: 11b7: incl
15531587
15541588 .align 32, 0x90
15601594 .endr
15611595 .bundle_unlock
15621596 # CHECK: 11ce: nop
1597 # CHECK: 11d0: nop
15631598 # CHECK: 11d7: incl
15641599
15651600 .align 32, 0x90
15711606 .endr
15721607 .bundle_unlock
15731608 # CHECK: 11ef: nop
1609 # CHECK: 11f0: nop
15741610 # CHECK: 11f7: incl
15751611
15761612 .align 32, 0x90
16571693 .endr
16581694 .bundle_unlock
16591695 # CHECK: 12e7: nop
1696 # CHECK: 12f0: nop
16601697 # CHECK: 12f6: incl
16611698
16621699 .align 32, 0x90
16681705 .endr
16691706 .bundle_unlock
16701707 # CHECK: 1308: nop
1708 # CHECK: 1310: nop
16711709 # CHECK: 1316: incl
16721710
16731711 .align 32, 0x90
16791717 .endr
16801718 .bundle_unlock
16811719 # CHECK: 1329: nop
1720 # CHECK: 1330: nop
16821721 # CHECK: 1336: incl
16831722
16841723 .align 32, 0x90
16901729 .endr
16911730 .bundle_unlock
16921731 # CHECK: 134a: nop
1732 # CHECK: 1350: nop
16931733 # CHECK: 1356: incl
16941734
16951735 .align 32, 0x90
17011741 .endr
17021742 .bundle_unlock
17031743 # CHECK: 136b: nop
1744 # CHECK: 1370: nop
17041745 # CHECK: 1376: incl
17051746
17061747 .align 32, 0x90
17121753 .endr
17131754 .bundle_unlock
17141755 # CHECK: 138c: nop
1756 # CHECK: 1390: nop
17151757 # CHECK: 1396: incl
17161758
17171759 .align 32, 0x90
17231765 .endr
17241766 .bundle_unlock
17251767 # CHECK: 13ad: nop
1768 # CHECK: 13b0: nop
17261769 # CHECK: 13b6: incl
17271770
17281771 .align 32, 0x90
17341777 .endr
17351778 .bundle_unlock
17361779 # CHECK: 13ce: nop
1780 # CHECK: 13d0: nop
17371781 # CHECK: 13d6: incl
17381782
17391783 .align 32, 0x90
17451789 .endr
17461790 .bundle_unlock
17471791 # CHECK: 13ef: nop
1792 # CHECK: 13f0: nop
17481793 # CHECK: 13f6: incl
17491794
17501795 .align 32, 0x90
18201865 .endr
18211866 .bundle_unlock
18221867 # CHECK: 14c6: nop
1868 # CHECK: 14d0: nop
18231869 # CHECK: 14d5: incl
18241870
18251871 .align 32, 0x90
18311877 .endr
18321878 .bundle_unlock
18331879 # CHECK: 14e7: nop
1880 # CHECK: 14f0: nop
18341881 # CHECK: 14f5: incl
18351882
18361883 .align 32, 0x90
18421889 .endr
18431890 .bundle_unlock
18441891 # CHECK: 1508: nop
1892 # CHECK: 1510: nop
18451893 # CHECK: 1515: incl
18461894
18471895 .align 32, 0x90
18531901 .endr
18541902 .bundle_unlock
18551903 # CHECK: 1529: nop
1904 # CHECK: 1530: nop
18561905 # CHECK: 1535: incl
18571906
18581907 .align 32, 0x90
18641913 .endr
18651914 .bundle_unlock
18661915 # CHECK: 154a: nop
1916 # CHECK: 1550: nop
18671917 # CHECK: 1555: incl
18681918
18691919 .align 32, 0x90
18751925 .endr
18761926 .bundle_unlock
18771927 # CHECK: 156b: nop
1928 # CHECK: 1570: nop
18781929 # CHECK: 1575: incl
18791930
18801931 .align 32, 0x90
18861937 .endr
18871938 .bundle_unlock
18881939 # CHECK: 158c: nop
1940 # CHECK: 1590: nop
18891941 # CHECK: 1595: incl
18901942
18911943 .align 32, 0x90
18971949 .endr
18981950 .bundle_unlock
18991951 # CHECK: 15ad: nop
1952 # CHECK: 15b0: nop
19001953 # CHECK: 15b5: incl
19011954
19021955 .align 32, 0x90
19081961 .endr
19091962 .bundle_unlock
19101963 # CHECK: 15ce: nop
1964 # CHECK: 15d0: nop
19111965 # CHECK: 15d5: incl
19121966
19131967 .align 32, 0x90
19191973 .endr
19201974 .bundle_unlock
19211975 # CHECK: 15ef: nop
1976 # CHECK: 15f0: nop
19221977 # CHECK: 15f5: incl
19231978
19241979 .align 32, 0x90
19832038 .endr
19842039 .bundle_unlock
19852040 # CHECK: 16a5: nop
2041 # CHECK: 16b0: nop
19862042 # CHECK: 16b4: incl
19872043
19882044 .align 32, 0x90
19942050 .endr
19952051 .bundle_unlock
19962052 # CHECK: 16c6: nop
2053 # CHECK: 16d0: nop
19972054 # CHECK: 16d4: incl
19982055
19992056 .align 32, 0x90
20052062 .endr
20062063 .bundle_unlock
20072064 # CHECK: 16e7: nop
2065 # CHECK: 16f0: nop
20082066 # CHECK: 16f4: incl
20092067
20102068 .align 32, 0x90
20162074 .endr
20172075 .bundle_unlock
20182076 # CHECK: 1708: nop
2077 # CHECK: 1710: nop
20192078 # CHECK: 1714: incl
20202079
20212080 .align 32, 0x90
20272086 .endr
20282087 .bundle_unlock
20292088 # CHECK: 1729: nop
2089 # CHECK: 1730: nop
20302090 # CHECK: 1734: incl
20312091
20322092 .align 32, 0x90
20382098 .endr
20392099 .bundle_unlock
20402100 # CHECK: 174a: nop
2101 # CHECK: 1750: nop
20412102 # CHECK: 1754: incl
20422103
20432104 .align 32, 0x90
20492110 .endr
20502111 .bundle_unlock
20512112 # CHECK: 176b: nop
2113 # CHECK: 1770: nop
20522114 # CHECK: 1774: incl
20532115
20542116 .align 32, 0x90
20602122 .endr
20612123 .bundle_unlock
20622124 # CHECK: 178c: nop
2125 # CHECK: 1790: nop
20632126 # CHECK: 1794: incl
20642127
20652128 .align 32, 0x90
20712134 .endr
20722135 .bundle_unlock
20732136 # CHECK: 17ad: nop
2137 # CHECK: 17b0: nop
20742138 # CHECK: 17b4: incl
20752139
20762140 .align 32, 0x90
20822146 .endr
20832147 .bundle_unlock
20842148 # CHECK: 17ce: nop
2149 # CHECK: 17d0: nop
20852150 # CHECK: 17d4: incl
20862151
20872152 .align 32, 0x90
20932158 .endr
20942159 .bundle_unlock
20952160 # CHECK: 17ef: nop
2161 # CHECK: 17f0: nop
20962162 # CHECK: 17f4: incl
20972163
20982164 .align 32, 0x90
21462212 .endr
21472213 .bundle_unlock
21482214 # CHECK: 1884: nop
2215 # CHECK: 1890: nop
21492216 # CHECK: 1893: incl
21502217
21512218 .align 32, 0x90
21572224 .endr
21582225 .bundle_unlock
21592226 # CHECK: 18a5: nop
2227 # CHECK: 18b0: nop
21602228 # CHECK: 18b3: incl
21612229
21622230 .align 32, 0x90
21682236 .endr
21692237 .bundle_unlock
21702238 # CHECK: 18c6: nop
2239 # CHECK: 18d0: nop
21712240 # CHECK: 18d3: incl
21722241
21732242 .align 32, 0x90
21792248 .endr
21802249 .bundle_unlock
21812250 # CHECK: 18e7: nop
2251 # CHECK: 18f0: nop
21822252 # CHECK: 18f3: incl
21832253
21842254 .align 32, 0x90
21902260 .endr
21912261 .bundle_unlock
21922262 # CHECK: 1908: nop
2263 # CHECK: 1910: nop
21932264 # CHECK: 1913: incl
21942265
21952266 .align 32, 0x90
22012272 .endr
22022273 .bundle_unlock
22032274 # CHECK: 1929: nop
2275 # CHECK: 1930: nop
22042276 # CHECK: 1933: incl
22052277
22062278 .align 32, 0x90
22122284 .endr
22132285 .bundle_unlock
22142286 # CHECK: 194a: nop
2287 # CHECK: 1950: nop
22152288 # CHECK: 1953: incl
22162289
22172290 .align 32, 0x90
22232296 .endr
22242297 .bundle_unlock
22252298 # CHECK: 196b: nop
2299 # CHECK: 1970: nop
22262300 # CHECK: 1973: incl
22272301
22282302 .align 32, 0x90
22342308 .endr
22352309 .bundle_unlock
22362310 # CHECK: 198c: nop
2311 # CHECK: 1990: nop
22372312 # CHECK: 1993: incl
22382313
22392314 .align 32, 0x90
22452320 .endr
22462321 .bundle_unlock
22472322 # CHECK: 19ad: nop
2323 # CHECK: 19b0: nop
22482324 # CHECK: 19b3: incl
22492325
22502326 .align 32, 0x90
22562332 .endr
22572333 .bundle_unlock
22582334 # CHECK: 19ce: nop
2335 # CHECK: 19d0: nop
22592336 # CHECK: 19d3: incl
22602337
22612338 .align 32, 0x90
22672344 .endr
22682345 .bundle_unlock
22692346 # CHECK: 19ef: nop
2347 # CHECK: 19f0: nop
22702348 # CHECK: 19f3: incl
22712349
22722350 .align 32, 0x90
23092387 .endr
23102388 .bundle_unlock
23112389 # CHECK: 1a63: nop
2390 # CHECK: 1a70: nop
23122391 # CHECK: 1a72: incl
23132392
23142393 .align 32, 0x90
23202399 .endr
23212400 .bundle_unlock
23222401 # CHECK: 1a84: nop
2402 # CHECK: 1a90: nop
23232403 # CHECK: 1a92: incl
23242404
23252405 .align 32, 0x90
23312411 .endr
23322412 .bundle_unlock
23332413 # CHECK: 1aa5: nop
2414 # CHECK: 1ab0: nop
23342415 # CHECK: 1ab2: incl
23352416
23362417 .align 32, 0x90
23422423 .endr
23432424 .bundle_unlock
23442425 # CHECK: 1ac6: nop
2426 # CHECK: 1ad0: nop
23452427 # CHECK: 1ad2: incl
23462428
23472429 .align 32, 0x90
23532435 .endr
23542436 .bundle_unlock
23552437 # CHECK: 1ae7: nop
2438 # CHECK: 1af0: nop
23562439 # CHECK: 1af2: incl
23572440
23582441 .align 32, 0x90
23642447 .endr
23652448 .bundle_unlock
23662449 # CHECK: 1b08: nop
2450 # CHECK: 1b10: nop
23672451 # CHECK: 1b12: incl
23682452
23692453 .align 32, 0x90
23752459 .endr
23762460 .bundle_unlock
23772461 # CHECK: 1b29: nop
2462 # CHECK: 1b30: nop
23782463 # CHECK: 1b32: incl
23792464
23802465 .align 32, 0x90
23862471 .endr
23872472 .bundle_unlock
23882473 # CHECK: 1b4a: nop
2474 # CHECK: 1b50: nop
23892475 # CHECK: 1b52: incl
23902476
23912477 .align 32, 0x90
23972483 .endr
23982484 .bundle_unlock
23992485 # CHECK: 1b6b: nop
2486 # CHECK: 1b70: nop
24002487 # CHECK: 1b72: incl
24012488
24022489 .align 32, 0x90
24082495 .endr
24092496 .bundle_unlock
24102497 # CHECK: 1b8c: nop
2498 # CHECK: 1b90: nop
24112499 # CHECK: 1b92: incl
24122500
24132501 .align 32, 0x90
24192507 .endr
24202508 .bundle_unlock
24212509 # CHECK: 1bad: nop
2510 # CHECK: 1bb0: nop
24222511 # CHECK: 1bb2: incl
24232512
24242513 .align 32, 0x90
24302519 .endr
24312520 .bundle_unlock
24322521 # CHECK: 1bce: nop
2522 # CHECK: 1bd0: nop
24332523 # CHECK: 1bd2: incl
24342524
24352525 .align 32, 0x90
24412531 .endr
24422532 .bundle_unlock
24432533 # CHECK: 1bef: nop
2534 # CHECK: 1bf0: nop
24442535 # CHECK: 1bf2: incl
24452536
24462537 .align 32, 0x90
24722563 .endr
24732564 .bundle_unlock
24742565 # CHECK: 1c42: nop
2566 # CHECK: 1c50: nop
24752567 # CHECK: 1c51: incl
24762568
24772569 .align 32, 0x90
24832575 .endr
24842576 .bundle_unlock
24852577 # CHECK: 1c63: nop
2578 # CHECK: 1c70: nop
24862579 # CHECK: 1c71: incl
24872580
24882581 .align 32, 0x90
24942587 .endr
24952588 .bundle_unlock
24962589 # CHECK: 1c84: nop
2590 # CHECK: 1c90: nop
24972591 # CHECK: 1c91: incl
24982592
24992593 .align 32, 0x90
25052599 .endr
25062600 .bundle_unlock
25072601 # CHECK: 1ca5: nop
2602 # CHECK: 1cb0: nop
25082603 # CHECK: 1cb1: incl
25092604
25102605 .align 32, 0x90
25162611 .endr
25172612 .bundle_unlock
25182613 # CHECK: 1cc6: nop
2614 # CHECK: 1cd0: nop
25192615 # CHECK: 1cd1: incl
25202616
25212617 .align 32, 0x90
25272623 .endr
25282624 .bundle_unlock
25292625 # CHECK: 1ce7: nop
2626 # CHECK: 1cf0: nop
25302627 # CHECK: 1cf1: incl
25312628
25322629 .align 32, 0x90
25382635 .endr
25392636 .bundle_unlock
25402637 # CHECK: 1d08: nop
2638 # CHECK: 1d10: nop
25412639 # CHECK: 1d11: incl
25422640
25432641 .align 32, 0x90
25492647 .endr
25502648 .bundle_unlock
25512649 # CHECK: 1d29: nop
2650 # CHECK: 1d30: nop
25522651 # CHECK: 1d31: incl
25532652
25542653 .align 32, 0x90
25602659 .endr
25612660 .bundle_unlock
25622661 # CHECK: 1d4a: nop
2662 # CHECK: 1d50: nop
25632663 # CHECK: 1d51: incl
25642664
25652665 .align 32, 0x90
25712671 .endr
25722672 .bundle_unlock
25732673 # CHECK: 1d6b: nop
2674 # CHECK: 1d70: nop
25742675 # CHECK: 1d71: incl
25752676
25762677 .align 32, 0x90
25822683 .endr
25832684 .bundle_unlock
25842685 # CHECK: 1d8c: nop
2686 # CHECK: 1d90: nop
25852687 # CHECK: 1d91: incl
25862688
25872689 .align 32, 0x90
25932695 .endr
25942696 .bundle_unlock
25952697 # CHECK: 1dad: nop
2698 # CHECK: 1db0: nop
25962699 # CHECK: 1db1: incl
25972700
25982701 .align 32, 0x90
26042707 .endr
26052708 .bundle_unlock
26062709 # CHECK: 1dce: nop
2710 # CHECK: 1dd0: nop
26072711 # CHECK: 1dd1: incl
26082712
26092713 .align 32, 0x90
26152719 .endr
26162720 .bundle_unlock
26172721 # CHECK: 1def: nop
2722 # CHECK: 1df0: nop
26182723 # CHECK: 1df1: incl
26192724
26202725 .align 32, 0x90
2525 # Here we have to pad until the end of the *next* boundary because
2626 # otherwise the group crosses a boundary.
2727 # CHECK: 1a: nop
28 # The nop sequence may be implemented as one instruction or many, but if
29 # it's one instruction, that instruction cannot itself cross the boundary.
30 # CHECK: 20: nop
2831 # CHECK-NEXT: 26: callq
2932 # CHECK-NEXT: 2b: callq
30
31
0
1 #!/usr/bin/python
12
23 # Auto-generates an exhaustive and repetitive test for correct bundle-locked
3940
4041 def generate(align_to_end=False):
4142 print(PREAMBLE)
42
43
4344 ntest = 0
4445 for instlen in range(1, BUNDLE_SIZE + 1):
4546 for offset in range(0, BUNDLE_SIZE):
5556 base_offset = ntest * 2 * BUNDLE_SIZE
5657 inst_orig_offset = base_offset + offset # had it not been padded...
5758
58 def print_check(adjusted_offset=None):
59 def print_check(adjusted_offset=None, nop_split_offset=None):
5960 if adjusted_offset is not None:
6061 print('# CHECK: {0:x}: nop'.format(inst_orig_offset))
62 if nop_split_offset is not None:
63 print('# CHECK: {0:x}: nop'.format(nop_split_offset))
6164 print('# CHECK: {0:x}: incl'.format(adjusted_offset))
6265 else:
6366 print('# CHECK: {0:x}: incl'.format(inst_orig_offset))
64
67
6568 if align_to_end:
6669 if offset + instlen == BUNDLE_SIZE:
6770 # No padding needed
7174 offset_to_end = base_offset + (BUNDLE_SIZE - instlen)
7275 print_check(offset_to_end)
7376 else: # offset + instlen > BUNDLE_SIZE
74 # Pad to end at next bundle boundary
77 # Pad to end at next bundle boundary, splitting the nop sequence
78 # at the nearest bundle boundary
79 offset_to_nearest_bundle = base_offset + BUNDLE_SIZE
7580 offset_to_end = base_offset + (BUNDLE_SIZE * 2 - instlen)
76 print_check(offset_to_end)
81 if offset_to_nearest_bundle == offset_to_end:
82 offset_to_nearest_bundle = None
83 print_check(offset_to_end, offset_to_nearest_bundle)
7784 else:
7885 if offset + instlen > BUNDLE_SIZE:
7986 # Padding needed
93100 help='generate .bundle_lock with align_to_end option')
94101 args = argparser.parse_args()
95102 generate(align_to_end=args.align_to_end)
96
97