summaryrefslogtreecommitdiffstats
path: root/llvm/utils/update_llc_test_checks.py
Commit message (Collapse)AuthorAgeFilesLines
* Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code ↵Reid Kleckner2018-07-231-0/+5
| | | | | | | | | | | | | | models" Don't try to generate large PIC code for non-ELF targets. Neither COFF nor MachO have relocations for large position independent code, and users have been using "large PIC" code models to JIT 64-bit code for a while now. With this change, if they are generating ELF code, their JITed code will truly be PIC, but if they target MachO or COFF, it will contain 64-bit immediates that directly reference external symbols. For a JIT, that's perfectly fine. llvm-svn: 337740
* Revert "Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC ↵Jonas Devlieghere2018-06-281-5/+0
| | | | | | | | | | | | | code models"" Reverting because this is causing failures in the LLDB test suite on GreenDragon. LLVM ERROR: unsupported relocation with subtraction expression, symbol '__GLOBAL_OFFSET_TABLE_' can not be undefined in a subtraction expression llvm-svn: 335894
* Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code ↵Reid Kleckner2018-06-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | models" The large code model allows code and data segments to exceed 2GB, which means that some symbol references may require a displacement that cannot be encoded as a displacement from RIP. The large PIC model even relaxes the assumption that the GOT itself is within 2GB of all code. Therefore, we need a special code sequence to materialize it: .LtmpN: leaq .LtmpN(%rip), %rbx movabsq $_GLOBAL_OFFSET_TABLE_-.LtmpN, %rax # Scratch addq %rax, %rbx # GOT base reg From that, non-local references go through the GOT base register instead of being PC-relative loads. Local references typically use GOTOFF symbols, like this: movq extern_gv@GOT(%rbx), %rax movq local_gv@GOTOFF(%rbx), %rax All calls end up being indirect: movabsq $local_fn@GOTOFF, %rax addq %rbx, %rax callq *%rax The medium code model retains the assumption that the code segment is less than 2GB, so calls are once again direct, and the RIP-relative loads can be used to access the GOT. Materializing the GOT is easy: leaq _GLOBAL_OFFSET_TABLE_(%rip), %rbx # GOT base reg DSO local data accesses will use it: movq local_gv@GOTOFF(%rbx), %rax Non-local data accesses will use RIP-relative addressing, which means we may not always need to materialize the GOT base: movq extern_gv@GOTPCREL(%rip), %rax Direct calls are basically the same as they are in the small code model: They use direct, PC-relative addressing, and the PLT is used for calls to non-local functions. This patch adds reasonably comprehensive testing of LEA, but there are lots of interesting folding opportunities that are unimplemented. I restricted the MCJIT/eh-lg-pic.ll test to Linux, since the large PIC code model is not implemented for MachO yet. Differential Revision: https://reviews.llvm.org/D47211 llvm-svn: 335508
* Revert r335297 "[X86] Implement more of x86-64 large and medium PIC code models"Reid Kleckner2018-06-211-5/+0
| | | | | | MCJIT can't handle R_X86_64_GOT64 yet. llvm-svn: 335300
* [X86] Implement more of x86-64 large and medium PIC code modelsReid Kleckner2018-06-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The large code model allows code and data segments to exceed 2GB, which means that some symbol references may require a displacement that cannot be encoded as a displacement from RIP. The large PIC model even relaxes the assumption that the GOT itself is within 2GB of all code. Therefore, we need a special code sequence to materialize it: .LtmpN: leaq .LtmpN(%rip), %rbx movabsq $_GLOBAL_OFFSET_TABLE_-.LtmpN, %rax # Scratch addq %rax, %rbx # GOT base reg From that, non-local references go through the GOT base register instead of being PC-relative loads. Local references typically use GOTOFF symbols, like this: movq extern_gv@GOT(%rbx), %rax movq local_gv@GOTOFF(%rbx), %rax All calls end up being indirect: movabsq $local_fn@GOTOFF, %rax addq %rbx, %rax callq *%rax The medium code model retains the assumption that the code segment is less than 2GB, so calls are once again direct, and the RIP-relative loads can be used to access the GOT. Materializing the GOT is easy: leaq _GLOBAL_OFFSET_TABLE_(%rip), %rbx # GOT base reg DSO local data accesses will use it: movq local_gv@GOTOFF(%rbx), %rax Non-local data accesses will use RIP-relative addressing, which means we may not always need to materialize the GOT base: movq extern_gv@GOTPCREL(%rip), %rax Direct calls are basically the same as they are in the small code model: They use direct, PC-relative addressing, and the PLT is used for calls to non-local functions. This patch adds reasonably comprehensive testing of LEA, but there are lots of interesting folding opportunities that are unimplemented. Reviewers: chandlerc, echristo Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D47211 llvm-svn: 335297
* [Utils][X86] Help update_llc_test_checks.py to recognise retl/retq to reduce ↵Simon Pilgrim2018-06-011-2/+2
| | | | | | | | | | | | | | | | CHECK duplication (PR35003) This patch replaces the --x86_extra_scrub command line argument to automatically support a second level of regex-scrubbing if it improves the matching of nearly-identical code patterns. The argument '--extra_scrub' is there now to force extra matching if required. This is mostly useful to help us share 32-bit/64-bit x86 vector tests which only differs by retl/retq instructions, but any scrubber can now technically support this, meaning test checks don't have to be needlessly obfuscated. I've updated some of the existing checks that had been manually run with --x86_extra_scrub, to demonstrate the extra "ret{{[l|q]}}" scrub now only happens when useful, and re-run the sse42-intrinsics file to show extra matches - most sse/avx intrinsics files should be able to now share 32/64 checks. Tested with the opt/analysis scripts as well which share common code - AFAICT the other update scripts use their own versions. Differential Revision: https://reviews.llvm.org/D47485 llvm-svn: 333749
* [utils] Refactor utils/update_{,llc_}test_checks.py to share more codeFangrui Song2018-02-101-25/+1
| | | | | | | | | | | | | | Summary: This revision refactors 1. parser 2. CHECK line adder of utils/update_{,llc_}test_checks.py so that thir functionality can be re-used by other utility scripts (e.g. D42712) Reviewers: asb, craig.topper, RKSimon, echristo Subscribers: llvm-commits, spatel Differential Revision: https://reviews.llvm.org/D42805 llvm-svn: 324803
* [utils] De-duplicate utils/update_{llc_,}test_checks.pyFangrui Song2018-01-301-263/+16
| | | | | | | | Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42654 llvm-svn: 323718
* [utils] Make .cfi_startproc optional for powerpcFangrui Song2018-01-171-1/+1
| | | | | | | | | | Summary: llc sometimes may not emit .cfi_startproc which makes func_dict to have less entries. Subscribers: nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D42144 llvm-svn: 322725
* Add more triples to llc_test_checks.pySam Parker2017-12-011-0/+17
| | | | | | | | | Added some commonly used Arm triples to the script, with and without the -eabi suffix. Differential Revision: https://reviews.llvm.org/D40708 llvm-svn: 319545
* [utils][mips] Add support for mips for update_llc_checks.pySimon Dardis2017-11-261-0/+20
| | | | | | | | | | | Add support for mips, particularly skipping the matching of .frame, .(f)mask and LLVM's usage of the .set no(reorder|at|macro) directives. Reviewers: spatel Differential Revision: https://reviews.llvm.org/D40268 llvm-svn: 319001
* [utils] Fix RISC-V support in update_llc_test_checks.pyAlex Bradbury2017-11-091-1/+1
| | | | | | scrub_asm_riscv now takes two arguments rather than one. llvm-svn: 317826
* [utils] Add RISC-V support to update_llc_test_checks.pyAlex Bradbury2017-11-081-0/+18
| | | | | | | | | | | | This should be a trivial change, and I've started using it for generating all tests at https://github.com/lowrisc/riscv-llvm (i.e. it's been tested in action quite a lot). Note that the regex does not attempt to match .cfi_startproc, as I want to ensure compatibility with functions that have the nounwind attribute. Differential Revision: https://reviews.llvm.org/D39789 llvm-svn: 317693
* [utils] make retq/retl regex an option that is off by defaultSanjay Patel2017-10-241-10/+14
| | | | | | | | | Ideally, we should compare 32- and 64-bit versions to see if the ret line is the only difference and then insert the regex only in that case. But this is a quick hack to avoid a bunch of noise as existing tests are updated. llvm-svn: 316443
* [utils] Support -mtriple=powerpc64Fangrui Song2017-10-221-2/+3
| | | | | | | | | | Summary: test/CodeGen/PowerPC/pr33093.ll uses both powerpc64 (big-endian) and powerpc64le while the former was unsupported. Subscribers: nemanjai Differential Revision: https://reviews.llvm.org/D39164 llvm-svn: 316297
* [utils, x86] add regex for retl/retq to reduce duplicated FileChecking (PR35003)Sanjay Patel2017-10-201-0/+3
| | | | llvm-svn: 316242
* Util: Improve update_llc_test_checks to scrub macosx-style assembly annotationsZvi Rackover2017-09-061-1/+1
| | | | | | | | | | | | | | | | | | | Summary: In D37523 Sanjay pointed out that the tool does not scrub macosx-style 'End of Function' annotations, where the comments begin with a double-#. I tested this patch by verifying all existing occurences of 'End function' are scrubbed: find ./test/CodeGen/X86 -name '*.ll' | xargs grep -l "End function" | xargs utils/update_llc_test_checks.py --llc-binary build/bin/llc Reviewers: spatel, chandlerc, craig.topper Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37532 llvm-svn: 312678
* [utils] add aarch64 target as an optionSanjay Patel2017-08-251-19/+29
| | | | | | I don't know enough to add a custom scrubber for AArch64, so I just re-used ARM. llvm-svn: 311795
* Teach the llc check updater to recognize the end-of-function commentChandler Carruth2017-08-251-2/+2
| | | | | | | used on Windows and sometimes Darwin. Cleans up generated patterns for me quite a bit. llvm-svn: 311752
* Fix update_llc_test_checks.py ARM parsingEli Friedman2017-07-281-1/+1
| | | | | | | | | | | | When I tried running the script, the ARM regex parser could not parse my code. It failed because the .Lfunc_end line has a comment at the end of it, so this commit removes the newline at the end of the regex. Patch by Joel Galenson! Differential Revision: https://reviews.llvm.org/D35641 llvm-svn: 309457
* [PPC] Add generated tests for all atomic operationsTim Shen2017-03-231-0/+4
| | | | | | | | | | | | Summary: Add tests for all atomic operations for powerpc64le, so that all changes can be easily examined. Reviewers: kbarton, hfinkel, echristo Subscribers: mehdi_amini, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D31285 llvm-svn: 298614
* Add SystemZ to utils/update_llc_test_checks.py.Jonas Paulsson2017-03-171-0/+18
| | | | | | | | | Extend script for auto-generating CHECK lines so that it works for SystemZ. This is a pre-commit for the new tests resulting from https://reviews.llvm.org/D29489 llvm-svn: 298048
* [utils] allow auto-generation of checks for thumb triplesSanjay Patel2017-02-241-0/+2
| | | | | | | If there's some reason not to do this, feel free to revert and/or fix, but for the cases I'm looking at, the script appears to do fine for these targets. llvm-svn: 296181
* Add some testcases for bitfields with illegal widths.Eli Friedman2017-02-241-0/+1
| | | | | | | | clang will generate IR like this for input using packed bitfields; very simple semantically, but it's a bit tricky to actually generate good code. llvm-svn: 296080
* [utils] Improve extraction of check prefixes from RUN linesNikolai Bozhenov2017-01-141-3/+3
| | | | | | | | | | | | Correct handling of the following FileCheck options is implemented in update_llc_test_checks.py and update_test_checks.py scripts: 1) -check-prefix (with a single dash) 2) -check-prefixes (with multiple prefixes) Differential Revision: https://reviews.llvm.org/D28572 llvm-svn: 292008
* Fix indentation in r290716.Bryant Wong2016-12-291-4/+4
| | | | | | Use two-space indentation like the rest of the file. llvm-svn: 290722
* Correctly handle multi-lined RUN lines.Bryant Wong2016-12-291-1/+8
| | | | | | | | | | `utils/update_{llc_test,test}_checks` ought to be able to handle RUN commands that span multiple lines, as shown in the example at http://llvm.org/docs/CommandGuide/FileCheck.html#the-filecheck-check-prefix-option Differential Revision: https://reviews.llvm.org/D26523 llvm-svn: 290716
* [PowerPC] Add ppc support to update_llc_test_checks.py, and ppc tests. NFC.Tim Shen2016-12-221-17/+72
| | | | | | | | | | Reviewers: chandlerc, hfinkel, echristo, iteratee Subscribers: mehdi_amini, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D28036 llvm-svn: 290370
* Add ARM support to update_llc_test_checks.pyEli Friedman2016-12-191-9/+34
| | | | | | | | | | Just the minimal support to get it working at the moment. Includes checks for test/CodeGen/ARM/vzip.ll as an example. Differential Revision: https://reviews.llvm.org/D27829 llvm-svn: 290144
* [X86] Fix test checks script to satisfy pyflakesZvi Rackover2016-11-071-5/+4
| | | | | | | | - Remove unused imports. - Initialize the variable 'name' before its (static) uses, and rename it to a more descriptive name. llvm-svn: 286128
* [X86] Fix test checks script to handle run lines with no pipe checksZvi Rackover2016-11-071-1/+5
| | | | | | | Fixes crashes in tests such as test/CodeGen/X86/masked_gather_scatter.ll which contains a RUN: with no pipe chain. llvm-svn: 286125
* [X86][AVX512] Add support for masked shuffle commentsSimon Pilgrim2016-07-031-1/+1
| | | | | | | | | | This patch adds support for including the avx512 mask register information in the mask/maskz versions of shuffle instruction comments. This initial version just adds support for MOVDDUP/MOVSHDUP/MOVSLDUP to reduce the mass of test regenerations, other shuffle instructions can be added in due course. Differential Revision: http://reviews.llvm.org/D21953 llvm-svn: 274459
* [X86] Updated test checks script to generalise LCPI symbol refsSimon Pilgrim2016-06-111-1/+4
| | | | | | | | The script now replace '.LCPI888_8' style asm symbols with the {{\.LCPI.*}} re pattern - this helps stop hardcoded symbols in 32-bit x86 tests changing with every edit of the file Refreshed some tests to demonstrate the new check llvm-svn: 272488
* don't hardcode the name of the llc checks scriptSanjay Patel2016-03-241-5/+2
| | | | | | | | | | We lose the 'utils' directory name in our advertising line with this change. We could retain that, but I don't see the point. This removes a dependency for making the script apply to more than 'llc'. Ie, we'll want to change the script name if it works with opt/clang too. llvm-svn: 264310
* reorganize llc checks script to allow more flexibility, part 2; NFCISanjay Patel2016-03-241-73/+104
| | | | | | | | The goal is to enhance this script to be used with opt and clang: Break 'main' into functions and change variable names to be more generic because we want to handle more than x86 asm output. llvm-svn: 264307
* reorganize llc checks script to allow more flexibility; NFCISanjay Patel2016-03-231-28/+31
| | | | | | | | | The goal is to enhance this script to be used with opt and clang: Group all of the regexes together, so it's easier to see what's going on. This will make it easier to break main() up into pieces too. Also, note that some of the regexes are for x86-specific asm. llvm-svn: 264197
* [utils] Add windows support to update_llc_test_checks.pySimon Pilgrim2016-01-271-1/+3
| | | | | | | | Strip dos line endings from llc generated files to allow the regex patterns to match them. Ensure updated *.ll files are generated with unix style line endings. llvm-svn: 258987
* Make utils/update_llc_test_checks.py note that the assertions areJames Y Knight2015-11-231-1/+7
| | | | | | | | | autogenerated. Also update existing test cases which appear to be generated by it and weren't modified (other than addition of the header) by rerunning it. llvm-svn: 253917
* [x86] Teach my test updating script about another quirk of the printedChandler Carruth2015-02-151-1/+1
| | | | | | | | | | | asm and port the mmx vector shuffle test to it. Not thrilled with how it handles the stack manipulation logic, but I'm much less bothered by that than I am by updating the test manually. =] If anyone wants to teach the test checks management script about stack adjustment patterns, that'd be cool too. llvm-svn: 229268
* [x86] Teach the test update script to strip trailing whitespace.Chandler Carruth2015-02-041-0/+3
| | | | | | | | This is done in a bit of a strange way to use a multiline RE instead of looping over the lines. Suggestions welcome here for a more pythonic way of doing this as long as its reasonably fast. llvm-svn: 228131
* [x86] Tweak my update script to use test case function names startingChandler Carruth2015-02-031-0/+3
| | | | | | | | | | | | with 'stress' to indicate that the specific output isn't interesting and relax them to only check the last instruction (a ret). I've updated the one test case that really uses this to name the one 'stress_test' which was actually producing output we can directly check. With this, the script doesn't introduce noise when run over the v16 test file. llvm-svn: 228033
* Add a new utility script that helps update very simple regression tests.Chandler Carruth2015-01-121-0/+207
This script is currently specific to x86 and limited to use with very small regression or feature tests using 'llc' and 'FileCheck' in a reasonably canonical way. It is in no way general purpose or robust at this point. However, it works quite well for simple examples. Here is the intended workflow: - Make a change that requires updating N test files and M functions' assertions within those files. - Stash the change. - Update those N test files' RUN-lines to look "canonical"[1]. - Refresh the FileCheck lines for either the entire file or select functions by running this script. - The script will parse the RUN lines and run the 'llc' binary you give it according to each line, collecting the asm. - It will then annotate each function with the appropriate FileCheck comments to check every instruction from the start of the first basic block to the last return. - There will be numerous cases where the script either fails to remove the old lines, or inserts checks which need to be manually editted, but the manual edits tend to be deletions or replacements of registers with FileCheck variables which are fast manual edits. - A common pattern is to have the script insert complete checking of every instruction, and then edit it down to only check the relevant ones. - Be careful to do all of these cleanups though! The script is designed to make transferring and formatting the asm output of llc into a test case fast, it is *not* designed to be authoratitive about what constitutes a good test! - Commit the nice fresh baseline of checks. - Unstash your change and rebuild llc. - Re-run script to regenerate the FileCheck annotations - Remember to re-cleanup these annotations!!! - Check the diff to make sure this is sane, checking the things you expected it to, and check that the newly updated tests actually pass. - Profit! Also, I'm *terrible* at writing Python, and frankly I didn't spend a lot of time making this script beautiful or well engineered. But it's useful to me and may be useful to others so I thought I'd send it out. http://reviews.llvm.org/D5546 llvm-svn: 225618
OpenPOWER on IntegriCloud