aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/UpdateTestChecks/asm.py
AgeCommit message (Collapse)AuthorFilesLines
2020-12-30[update_llc_test_checks] Support Windows .seh_proc for x86Fangrui Song1-1/+1
2020-12-30[update_llc_test_checks] Support .Lfunc$local for x86 -relocation-model=pic ↵Fangrui Song1-1/+3
dsolocal tests
2020-12-16[NFC] factor update test function test builder as a classMircea Trofin1-6/+2
This allows us to have shared logic over multiple test runs, e.g. do we have unused prefixes, or which function bodies have conflicting outputs for a prefix appearing in different RUN lines. This patch is just wrapping existing functionality, and replacing its uses. A subsequent patch would then fold the current functionality into the newly introduced class. Differential Revision: https://reviews.llvm.org/D93413
2020-12-12[UpdateTestChecks] Add --(no-)x86_scrub_sp option.Harald van Dijk1-2/+3
This makes it possible to use update_llc_test_checks to manage tests that check for incorrect x86 stack offsets. It does not yet modify any test to make use of this new option.
2020-12-03[Triple][MachO] Define "arm64e", an AArch64 subarch for Pointer Auth.Ahmed Bougacha1-0/+1
This also teaches MachO writers/readers about the MachO cpu subtype, beyond the minimal subtype reader support present at the moment. This also defines a preprocessor macro to allow users to distinguish __arm64__ from __arm64e__. arm64e defaults to an "apple-a12" CPU, which supports v8.3a, allowing pointer-authentication codegen. It also currently defaults to ios14 and macos11. Differential Revision: https://reviews.llvm.org/D87095
2020-09-18[UpdateCCTestChecks] Include generated functions if askedDavid Greene1-4/+5
Add the --include-generated-funcs option to update_cc_test_checks.py so that any functions created by the compiler that don't exist in the source will also be checked. We need to maintain the output order of generated function checks so that CHECK-LABEL works properly. To do so, maintain a list of functions output for each prefix in the order they are output. Use this list to output checks for generated functions in the proper order. Differential Revision: https://reviews.llvm.org/D83004
2020-09-16[UpdateTestChecks] Allow $ in function namesDavid Greene1-14/+14
Some compilers generation functions with '$' in their names, so recognize those functions. This also requires recognizing function names inside quotes in some contexts in order to escape certain characters. Differential Revision: https://reviews.llvm.org/D82995
2020-08-25Fix update_llc_test_checks function regex for RV64Alex Richardson1-1/+3
Some functions also include a `.Lfunc$local:` label due to -fno-semantic-interposition Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D85888
2020-08-12[UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"Johannes Doerfert1-1/+2
With this patch we will match most *uses* of "temporary" named things in the IR via regular expressions, not their name at creation time. The new "values" we match are: - "unnamed" globals: `@[0-9]+` - debug metadata: `!dbg ![0-9]+` - loop metadata: `!loop ![0-9]+` - tbaa metadata: `!tbaa ![0-9]+` - range metadata: `!range ![0-9]+` - generic metadata: `metadata ![0-9]+` - attributes groups: `#[0-9]` We still don't match the declarations but that can be done later. This patch can introduce churn when existing check lines contain the old hardcoded versions of the above "values". We can add a flag to opt-out, or opt-in, if necessary. Reviewed By: arichardson, MaskRay Differential Revision: https://reviews.llvm.org/D85099
2020-07-19[Utils] Check function attributes in update_test_checkssstefan11-1/+1
Summary: This introduces new flag to the update_test_checks and update_cc_test_checks that allows for function attributes to be checked in a check-line. If the flag is not set, the behavior should remain the same. Reviewers: jdoerfert Subscribers: arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D83629
2020-04-10[NFC][UpdateTestChecks] Fix typos in commentsJinsong Ji1-2/+2
2020-04-10[PowerPC][UpdateTestChecks] Remove the extra # when scrubbing loop commentsKang Zhang1-0/+2
Summary: The patch D63957 is to avoid empty string when scrubbing loop comments, it will replace loop comments to a `#`, that's correct. But if the line has something else not only loop comments, we will get a extra `#`. The patch is to remove the extra `#`. Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D77357
2020-04-02[NFC][update_llc_test_checks] Remove the redundant SCRUB_LOOP_COMMENT_RE in ↵Kang Zhang1-5/+1
asm.py Summary: In the patch: https://reviews.llvm.org/D42654 De-duplicate utils/update_{llc_,}test_checks.py, Some common part has been move to common.py. The SCRUB_LOOP_COMMENT_RE has been moved to common.py, but forgetting to remove from asm.py. This patch is to remove the redundant SCRUB_LOOP_COMMENT_RE in asm.py and use common.SCRUB_LOOP_COMMENT_RE.
2020-02-20[Utils][x86] add an option to reduce scrubbing of shuffles with memopsSanjay Patel1-1/+12
I was drafting a patch that would increase broadcast load usage, but our shuffle scrubbing makes it impossible to see if the memory operand offset was getting created correctly. I'm proposing to make that an option (defaulted to 'off' for now to reduce regression test churn). The updated files provide examples of tests where we can now verify that the pointer offset for a loaded memory operand is correct. We still have stack and constant scrubbing that can obscure the operand even if we don't scrub the entire instruction. Differential Revision: https://reviews.llvm.org/D74775
2019-11-01[utils] Reflow asm check generation to tolerate blank linesSimon Atanasyan1-1/+2
This change introduces two fixes. The second fix allows to generate a test to check the first fix. - Output `CHECK-EMPTY` prefix for an empty line in ASM output. Before that fix `update_llc_test_checks.py` incorrectly emits `CHECK-NEXT: <space>` prefix. - Fix the `ASM_FUNCTION_MIPS_RE` regex to stop on a real function epilogue not on an inline assembler prologue and include inline assembler code into a test. Differential Revision: https://reviews.llvm.org/D47192
2019-10-31[Utils][FIX] Unbreak update_XXX_test_checks after 3598b810029dJohannes Doerfert1-2/+2
The users of build_function_body_dictionary and add_checks need to be adjusted after the changes in UpdateTestChecks/common.py.
2019-10-03[UpdateTestChecks] add basic support for parsing msp430 asmSanjay Patel1-0/+17
llvm-svn: 373605
2019-08-04[UpdateTestChecks] Add end_function directive to regex matcher for wasm32 ↵Simon Pilgrim1-1/+1
function body llvm-svn: 367786
2019-07-08[UpdateTestChecks] Skip over .Lfunc_begin for RISC-VAlex Bradbury1-1/+1
This mirrors the change made for X86 in rL336987. Without this patch, update_llc_test_checks will completely skip functions with personality functions. llvm-svn: 365297
2019-07-01[UpdateTestChecks][PowerPC] Avoid empty string when scrubbing loop commentsJinsong Ji1-2/+2
Summary: SCRUB_LOOP_COMMENT_RE was introduced in https://reviews.llvm.org/D31285 This works for some loops. However, we may generate lines with loop comments only. And since we don't scrub leading white spaces, this will leave an empty line there, and FileCheck will complain it. eg: llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll:27:15: error: found empty check string with prefix 'CHECK:' ; CHECK-NEXT: This prevented us from using the `update_llc_test_checks.py` for quite some cases. We should still keep the comment token there, so that we can safely scrub the loop comment without breaking FileCheck. Reviewers: timshen, hfinkel, lebedev.ri, RKSimon Subscribers: nemanjai, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63957 llvm-svn: 364775
2019-06-28[UpdateChecks] Add support for armv7-apple-darwinJinsong Ji1-0/+9
armv7-apple-darwin was not supported well, the script can't generate checks. https://reviews.llvm.org/D60601/new/#inline-568671 Differential Revision: https://reviews.llvm.org/D63939 llvm-svn: 364668
2019-06-26[UpdateTestChecks][NFC] Remove entries with same prefixJinsong Ji1-2/+0
Matching is 'lossy', triples with same prefix can be dropped. Differential Revision: https://reviews.llvm.org/D63732 llvm-svn: 364471
2019-06-24[PowerPC][UpdateTestChecks] powerpc- triple supportJinsong Ji1-2/+1
There are quite some old testcases with powerpc- triple, we should add this triple support so that we can update them with script. Differential Revision: https://reviews.llvm.org/D63723 llvm-svn: 364213
2019-06-18[NFC] Improve triple match of scripts that update testsDiogo N. Sampaio1-29/+40
Summary: The prior behavior of the triple matcher would stop in the first matched triple. It was not possible to create specific matches for sub-sets of a triple (e.g aarch64-apple-darwin would never be used after aarch64 was matched). This patch: 1) Allows that specialized triples take priority, considering that the string lenght of the triple indentifies how specialized a triple is. If two triples of same lenght match, the one matched first prevails, preserving the old behavior. 2) Remove 20 duplicated triples of arm, thumb, aarch64 options with same arguments, matching the common prefix (aarch64, arm, thumb) of them. 3) Creates three new function matching regexes and five triple options for arm64-apple-ios, (arm|thumb)-apple-ios and thumb(v5)?-macho Reviewers: lebedev.ri, RKSimon, MaskRay, gbedwell Reviewed By: MaskRay Subscribers: javed.absar, kristof.beyls, llvm-commits, carwil Tags: #llvm Differential Revision: https://reviews.llvm.org/D63145 llvm-svn: 363656
2019-06-14UpdateTestChecks: Consider .section as end of function for AMDGPUMatt Arsenault1-1/+1
Kernels seem to go directly to a section switch instead of emitting .Lfunc_end. This fixes including all of the kernel metadata in the check lines, which is undesirable most of the time. llvm-svn: 363452
2019-06-05UpdateTestChecks: hexagon supportRoman Lebedev1-0/+19
Summary: These tests are being affected by an upcoming patch, so having an understandable (autogenerated) diff is helpful. This target, again, prefers `-march`: ``` llvm/test/CodeGen/Hexagon$ grep -r triple | wc -l 467 llvm/test/CodeGen/Hexagon$ grep -r march | wc -l 1167 ``` Reviewers: RKSimon, kparzysz Reviewed By: kparzysz Subscribers: xbolva00, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62867 llvm-svn: 362605
2019-05-31[UpdateTestChecks] Add support for -march=r600 to match existing ↵Simon Pilgrim1-0/+1
-march=amdgcn support llvm-svn: 362228
2019-05-29UpdateTestChecks: Lanai triple supportRoman Lebedev1-0/+18
Summary: The assembly structure most resembles the SPARC pattern: ``` .globl f6 ! -- Begin function f6 .p2align 2 .type f6,@function f6: ! @f6 .cfi_startproc ! %bb.0: st %fp, [--%sp] <...> ld -8[%fp], %fp .Lfunc_end0: .size f6, .Lfunc_end0-f6 .cfi_endproc ! -- End function ``` Test being affected by upcoming patch, so regenerate it. Reviewers: RKSimon, jpienaar Reviewed By: RKSimon Subscribers: jyknight, fedor.sergeev, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62545 llvm-svn: 362019
2019-05-23UpdateTestChecks: ppc32 triple supportRoman Lebedev1-3/+4
Summary: Appears identical to powerpc64{,le}. Regenerate test that is being affected by upcoming patch. Reviewers: RKSimon Reviewed By: RKSimon Subscribers: nemanjai, jsji, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62339 llvm-svn: 361543
2019-05-23[NFC] UpdateTestChecks: asm.py: fix whitespace issueRoman Lebedev1-1/+1
llvm-svn: 361538
2019-05-23UpdateTestChecks: -march=mips/-march=mipsel is mips triple.Roman Lebedev1-0/+1
Again, a mixture of march and triple, with majority being march: llvm/test/CodeGen/Mips$ grep -ri triple | wc -l 818 llvm/test/CodeGen/Mips$ grep -ri march | wc -l 1457 llvm-svn: 361521
2019-05-22UpdateTestChecks: sparc march handlingRoman Lebedev1-0/+1
Summary: Another target that prefers to use `-march` in tests ``` llvm/test/CodeGen/SPARC$ grep -ri mtriple | wc -l 25 llvm/test/CodeGen/SPARC$ grep -ri march | wc -l 165 ``` This test is being affected by a further patch, so regenerate it to better visualize the changes Reviewers: RKSimon, dcederman, gberry Reviewed By: RKSimon Subscribers: jyknight, fedor.sergeev, jrtc27, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62242 llvm-svn: 361381
2019-05-21[WebAssembly] Add the signature for the new llround builtin functionDan Gohman1-0/+17
r360889 added new llround builtin functions. This patch adds their signatures for the WebAssembly backend. It also adds wasm32 support to utils/update_llc_test_checks.py, since that's the script other targets are using for their testcases for this feature. Differential Revision: https://reviews.llvm.org/D62207 llvm-svn: 361327
2019-05-18UpdateTestChecks: fix AMDGPU handlingRoman Lebedev1-0/+10
Summary: Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner, this test changes, but makes `update_llc_test_checks.py` unhappy. **Many** AMDGPU tests specify `-march`, not `-mtriple`, which results in `update_llc_test_checks.py` defaulting to x86 asm function detection heuristics, which don't work here. I propose to fix this by adding an infrastructure to map from `-march` to `-mtriple`, in the UpdateTestChecks tooling. Reviewers: RKSimon, MaskRay, arsenm Reviewed By: arsenm Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62099 llvm-svn: 361101
2019-05-18UpdateTestChecks: arm64-eabi handlindRoman Lebedev1-0/+1
Summary: Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner, this test changes, but makes `update_llc_test_checks.py` unhappy Reviewers: RKSimon Reviewed By: RKSimon Subscribers: javed.absar, kristof.beyls, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62097 llvm-svn: 361100
2019-04-29[UpdateTestChecks] Allow Lbegin_func without a leading periodMartin Storsjo1-1/+1
On mingw/i686, local labels don't start with a leading period. Also escape the leading period, as it previously could match any char. Differential Revision: https://reviews.llvm.org/D61254 llvm-svn: 359497
2019-03-01[ARM] Add armv8a triple to test check updatersOliver Stannard1-0/+1
llvm-svn: 355186
2018-10-26[NFC] Fix the regular expression for BE PPC in update_llc_test_checks.pyNemanja Ivanovic1-0/+1
Currently, the regular expression that matches the lines of assembly for PPC LE (ELFv2) does not work for the assembly for BE (ELFv1). This patch fixes it. Differential revision: https://reviews.llvm.org/D53059 llvm-svn: 345363
2018-07-23Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code ↵Reid Kleckner1-2/+3
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
2018-07-13[UpdateTestChecks] Teach the x86 asm parser to skip over the functionChandler Carruth1-1/+1
begin label emitted for some routines with personality functions and such. Without this, we don't even recognize such functions as appearing in the output and so don't attach any assertions to them. Happy to tweak this or improve it if folks w/ deeper knowledge of the asm sequences that show up here want. llvm-svn: 336987
2018-06-28Revert "Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC ↵Jonas Devlieghere1-3/+2
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
2018-06-25Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code ↵Reid Kleckner1-2/+3
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
2018-06-21Revert r335297 "[X86] Implement more of x86-64 large and medium PIC code models"Reid Kleckner1-3/+2
MCJIT can't handle R_X86_64_GOT64 yet. llvm-svn: 335300
2018-06-21[X86] Implement more of x86-64 large and medium PIC code modelsReid Kleckner1-2/+3
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
2018-06-11[Utils] update_llc_test_checks.py: support AMDGPU backend: AMDGCN, r600 triplesRoman Lebedev1-0/+19
Summary: Lack of that support has taken me by surprise. I need to add (or at least look at) some tests for https://reviews.llvm.org/D47980#1127615, and i don't really fancy doing that by hand. The asm pattern is quite similar to that of x86: https://godbolt.org/g/hfgeds just with `#` replaced with `;` Reviewers: spatel, RKSimon, MaskRay, tstellar, arsenm Reviewed By: arsenm Subscribers: arsenm, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, rampitec, bogner, mareko, llvm-commits Tags: #amdgpu Differential Revision: https://reviews.llvm.org/D48001 llvm-svn: 334396
2018-06-01[Utils][X86] Help update_llc_test_checks.py to recognise retl/retq to reduce ↵Simon Pilgrim1-1/+1
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
2018-04-20[utils] improve AArch64 asm parserSanjay Patel1-1/+1
If we don't mark the cfi line as optional, the script won't work with 'nounwind' code. Without that attr, there may be extra noise in the asm body that we don't want to see. llvm-svn: 330453
2018-04-20Add SPARC support to update_llc_test_checks.pyDaniel Cederman1-0/+18
Reviewers: spatel, jyknight Reviewed By: spatel Subscribers: fedor.sergeev, llvm-commits Differential Revision: https://reviews.llvm.org/D45809 llvm-svn: 330401
2018-04-06[UpdateTestChecks] Add update_analyze_test_checks.py for cost model analysis ↵Simon Pilgrim1-1/+1
generation The script allows the auto-generation of checks for cost model tests to speed up their creation and help improve coverage, which will help a lot with PR36550. If the need arises we can add support for other analyze passes as well, but the cost models was the one I needed to get done - at the moment it just warns that any other analysis mode is unsupported. I've regenerated a couple of x86 test files to show the effect. Differential Revision: https://reviews.llvm.org/D45272 llvm-svn: 329390
2018-04-05[UpdateTestChecks] Moved core functionality of add_asm_checks into add_checksSimon Pilgrim1-23/+1
As discussed on D45272 llvm-svn: 329270