aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/UpdateTestChecks/asm.py
AgeCommit message (Collapse)AuthorFilesLines
2025-06-14[utils] Add "aarch64-apple-macosx" triple to update_llc_test_checks.py (#144023)Tomer Shafir1-0/+1
Add a missing valid triple "aarch64-apple-macosx" for usability.
2025-05-18[MC][AArch64][ARM][X86] Push target-dependent assembler flags into targets ↵Jessica Clarke1-5/+11
(#139844) The .syntax unified directive and .codeX/.code X directives are, other than some simple common printing code, exclusively implemented in the targets themselves. Thus, remove the corresponding MCAF_* flags and reimplement the directives solely within the targets. This avoids exposing all targets to all other targets' flags. Since MCAF_SubsectionsViaSymbols is all that remains, convert it to its own function like other directives, simplifying its implementation. Note that, on X86, we now always need a target streamer when parsing assembly, as it's now used for directives that aren't COFF-specific. It still does not however need to do anything when producing a non-COFF object file, so this commit does not introduce any new target streamers. There is some churn in test output, and corresponding UTC regex changes, due to comments no longer being flushed by these various directives (and EmitEOL is not exposed outside MCAsmStreamer.cpp so we couldn't do so even if we wanted to), but that was a bit odd to be doing anyway. This is motivated by Morello LLVM, which adds yet another assembler flag to distinguish A64 and C64 instruction sets, but did not update every switch and so emits warnings during the build. Rather than fix those warnings it seems better to instead make the problem not exist in the first place via this change.
2024-11-23[UTC] Add support for Xtensa (#117441)Sergei Barannikov1-0/+17
Regenerate the failing test as well.
2024-08-09[update_llc_test_checks][AMDGPU] Update AMDGPU regexp in ↵Juan Manuel Martinez Caamaño1-0/+1
update_llc_test_checks.py (#102480) Updating `llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.ll` with `update_llc_test_checks.py` ended with several kernels with no checks. Llc's output contained the line ".amdgpu_hsa_kernel <funcname>" after the ".type <funcname>,@function" entry which was not considered by the regexp.
2024-06-04update_test_checks: drop the other arm64_32 handlersJon Roelofs1-5/+0
2024-06-03update_test_checks: support more arm64_32-apple-watchos triplesJon Roelofs1-1/+2
Having the version in `get_run_handlers` meant that a RUN line without the version in it would not match, and therefore UTC would generate a useless catch-all check of the form: ``` ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: ; CHECK: {{.*}} ``` This patch also adds `arm64_32` as a base-level run handler, and assumes it will always apply to a darwin target (which is currently the case for all arm64_32-* triples I see in tree currently).
2024-05-27update_llc_test_checks: better support for non-llc tools (#93135)Nicolai Hähnle1-1/+2
A full downstream fork can already hack up update_llc_test_checks.py to support custom tools that output assembly. An out-of-tree frontend which is meant to build against upstream llvm-project cannot do this, and so providing additional arguments to support a non-standard tool is useful. This also makes a minor adjustment to the regular expression for matching AMDGPU functions when fewer comments are enabled, which happens to be the case for our out-of-tree shader compiler (which motivated this change).
2024-05-19update_test_checks: match IR basic block labels (#88979)Nicolai Hähnle1-3/+2
Labels are matched using a regexp of the form '^(pattern):', which requires the addition of a "suffix" concept to NamelessValue. Aside from that, the key challenge is that block labels are values, and we typically capture values including the prefix '%'. However, when labels appear at the start of a basic block, the prefix '%' is not included, so we must capture block label values *without* the prefix '%'. We don't know ahead of time whether an IR value is a label or not. In most cases, they are prefixed by the word "label" (their type), but this isn't the case in phi nodes. We solve this issue by leveraging the two-phase nature of variable generalization: the first pass finds all occurences of a variable and determines whether the '%' prefix can be included or not. The second pass does the actual substitution. This change also unifies the generalization path for assembly with that for IR and analysis, in the hope that any future changes avoid diverging those cases future. I also considered the alternative of trying to detect the phi node case using more regular expression special cases but ultimately decided against that because it seemed more fragile, and perhaps the approach of keeping a tentative prefix that may later be discarded could also be eventually applied to some metadata and attribute cases. Note that an early version of this change was reviewed as https://reviews.llvm.org/D142452, before version numbers were introduced. This is a substantially updated version of that change.
2023-11-28[UTC] Support arm64-apple-macosx in update_llc_test_checks.py. (#73568)Florian Hahn1-0/+1
arm64-apple-macosx is the default triple (usually with the macOS version number) on arm64 macOS. Support it in update_llc_test_checks.py.
2023-09-21[UpdateTestChecks] Add support for SPIRV in update_llc_test_checks.py (#66213)Paulo Matos1-0/+26
Support for SPIRV added, updated test SPV_INTEL_optnone.ll using the script. Previously https://reviews.llvm.org/D157858
2023-06-03coach UpdateTestChecks to filter out certain symbol aliases for m68kSheng1-4/+5
This patch coaches UpdateTestChecks to filter out these symbol aliases in llc test for m68k - .L<function name>$local: - .type .L<function name>$local,@function Reviewed By: myhsu Differential Revision: https://reviews.llvm.org/D151526
2023-05-17[NFC][Py Reformat] Reformat python files in llvmTobias Hieta1-401/+458
This is the first commit in a series that will reformat all the python files in the LLVM repository. Reformatting is done with `black`. See more information here: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Reviewed By: jhenderson, JDevlieghere, MatzeB Differential Revision: https://reviews.llvm.org/D150545
2023-05-06[UpdateTestChecks] More support for X86 exception handlingJay Foad1-1/+1
Differential Revision: https://reviews.llvm.org/D149971
2023-03-02[UTC] Include return type/attributes under --version 2Nikita Popov1-2/+2
If --function-signature is used with --version 2, then also include the return type/attributes in the check lines. This is the implementation of D133943 rebased on the --version mechanism from D142473. This doesn't bump the default version yet, because I'd like to do that together with D140212 (which enables --function-signature by default), as these changes seem closely related. For now this functionality can be accessed by explicitly passing --version 2 to UTC. Fixes https://github.com/llvm/llvm-project/issues/61058. Differential Revision: https://reviews.llvm.org/D144963
2023-01-12[UpdateTestChecks] Handle nounwind functions for s390xNikita Popov1-1/+1
Unlike all the other architectures, s390x requires cfi_startproc to be present, so update_llc_test_checks did no work with nounwind functions.
2023-01-10[UpdateTestChecks] Add wasm64 targetLuke Lau1-3/+4
wasm32 was already supported, so here I've just reused the same regex. I'm not sure if this is actually correct: I don't know for certain if wasm32 and wasm64 have different output formats, but it seems to work. Reviewed By: dschuff, asb Differential Revision: https://reviews.llvm.org/D141130
2022-12-15[UpdateTestChecks][PowerPC] Add ppc64 triple supportKai Nacke1-0/+1
Newer tests use ppc64le-linux triple. It is identical to ppc32. Some of the PPC GIsel tests were generated by this change. Reviewed by: RKSimon Differential Revision: https://reviews.llvm.org/D140107
2022-10-12[UpdateTestChecks] Add basic BPF triple handlingSimon Pilgrim1-0/+20
Working on Issue #57872 - its really useful to be able to autogenerate checks
2022-09-05[ARM64EC 3/?] Mark reserved registers specific to ARM64EC ABI.Eli Friedman1-0/+1
Part of patchset to add initial support for ARM64EC. I'm not completely sure I understand the reason for this restriction, but Microsoft documentation says that asynchronous signals clobber these registers, so we can't ever use them. As far as I know, none of these registers have any hardcoded meaning, so reserving them shouldn't have any significant side-effects. Differental Revision: https://reviews.llvm.org/D125413
2022-08-26Mark the $local function begin symbol as a functionAlex Richardson1-1/+4
While this does not matter for most targets, when building for Arm Morello, we have to mark the symbol as a function and add size information, so that LLD can correctly evaluate relocations against the local symbol. Since Morello is an out-of-tree target, I tried to reproduce this with in-tree backends and with the previous reviews applied this results in a noticeable difference when targeting Thumb. Background: Morello uses a method similar Thumb where the encoding mode is specified in the LSB of the symbol. If we don't mark the target as a function, the relocation will not have the LSB set and calls will end up using the wrong encoding mode (which will almost certainly crash). Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D131429
2022-08-24[update_llc_test_checks][VE] Handle .Lfoo$local in function regexAlex Richardson1-0/+3
While working on https://reviews.llvm.org/D131429, I got a test diff in one of the VE tests and running update_llc_test_checks.py deleted all the code for that function. This updates the regex to handle this new output. Reviewed By: kaz7 Differential Revision: https://reviews.llvm.org/D131431
2022-08-09[ARM] Emit local aliases (.Lfoo$local) for functionsAlex Richardson1-0/+1
ARMAsmPrinter::emitFunctionEntryLabel() was not calling the base class function so the $local alias was not being emitted. This should not have any function effect right now since ARM does not generate different code for the $local symbols, but it could be improved in the future. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D131392
2022-07-20update-test-checks: safely handle tests with #if'sNicolai Hähnle1-4/+5
There is at least one Clang test (clang/test/CodeGen/arm_acle.c) which has functions guarded by #if's that cause those functions to be compiled only for a subset of RUN lines. This results in a case where one RUN line has a body for the function and another doesn't. Treat this case as a conflict for any prefixes that the two RUN lines have in common. This change exposed a bug where functions with '$' in the name weren't properly recognized in ARM assembly (despite there being a test case that was supposed to catch the problem!). This bug is fixed as well. Differential Revision: https://reviews.llvm.org/D130089
2022-07-06[LoongArch] Add LoongArch support to update_llc_test_checkswanglei1-1/+20
Add LoongArch assembly scrubbing and triple support to update_llc_test_checks. Depends on D128432 Reviewed By: MaskRay, xen0n Differential Revision: https://reviews.llvm.org/D128433
2022-07-03[AArch64] Regenerate more tests. NFCDavid Green1-1/+2
Also includes some adjustments for asm.py to handle updating more cases successfully.
2022-05-26[UpdateTestChecks] Auto-generate stub bodies for unused prefixesMircea Trofin1-3/+3
This is scoped to autogenerated tests. The goal is to support having each RUN line specify a list of check-prefixes where one can specify potentially redundant prefixes. For example, for X86, if one specified prefixes for both AVX1 and AVX2, and the codegen happened to match today, one of the prefixes would be used and the onther one not. If the unused prefix were dropped, and later, codegen differences were introduced, one would have to go figure out where to add what prefix (paraphrasing https://lists.llvm.org/pipermail/llvm-dev/2021-February/148326.html) To avoid getting errors due to unused prefixes, whole directories can be opted out (as discussed on that thread), but that means that tests that aren't autogenerated in such directories could have undetected unused prefix bugs. This patch proposes an alternative that both avoids the above, dir-level optout, and supports the main autogen scenario discussed first. The autogen tool appends at the end of the test file the list of unused prefixes, together with a note explaining that is the case. Each prefix is set up to always pass. This way, unexpected unused prefixes are easily discoverable, and expected cases "just work". Differential Revision: https://reviews.llvm.org/D124306
2022-05-14[update_llc_test_checks] Use FileCheck captures for MCInst/MCReg outputAlex Richardson1-5/+3
To avoid test churn when backends add/rename new instructions/registers, it makes sense to use FileCheck captures for the exact MCInst/Reg number. This is motivated by D125307, where I use --asm-show-inst to differentiate the output for multiple instructions with the same mnemonic. This does not quite fix the churn issue yet: While files with the generated checks will be immune to the numbers changing, the update script test still suffers from this problem since the number is encoded in the FileCheck variable name. I plan to address this in a follow-up patch. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D125307
2022-04-15[NFC][UpdateTestChecks] Fix whitespace in common.py and asm.pyDaniil Kovalev1-34/+34
While working on D122986, noticed that indentation size varies even within one file. Fixed that - now indentation is 2 spaces everywhere. This indentation Differential Revision: https://reviews.llvm.org/D123859
2022-04-15[UpdateTestChecks] Add NVPTX support in update_llc_test_checks.pyDaniil Kovalev1-1/+41
This patch makes possible generating NVPTX assembly check lines with update_llc_test_checks.py utility. Differential Revision: https://reviews.llvm.org/D122986
2022-03-01[UpdateLLCTestChecks] Add support for isel debug output in ↵Yatao Wang1-16/+1
update_llc_test_checks.py Add a check on run lines to pick up isel options in llc commands and allow generating check lines of isel final output other than assembly. If llc command line contains -debug-only=isel, update_llc_test_checks.py will try to scrub isel output, otherwise, the script will fall back on default behaviour, which is try to scrub assembly output instead. The motivation of this change is to allow usage of update_llc_test_checks.py to autogenerate checks of instruction selection results. In this way, we can detect errors at an earlier stage before the compilation goes all the way to assembly. It is an example of having some transparency for the stages between IR and assembly. These generated tests are almost like "unit tests" of isel stage. This patch only implements the initial change to differentiate isel output from assembly output for Lanai. Other targets will not be supported for isel check generation at the moment. Although adding support for it will only require implementing the function regex and scrubber for corresponding targets. The Lanai implementation was chosen mainly for the simplicity of demonstrating the difference between isel checks and asm checks. This patch also do not include the implementation of function prefix, which is required for the generated isel checks to pass. I will put up a follow up revision for the function prefix change to complete isel support. Reviewed By: Flakebi Differential Revision: https://reviews.llvm.org/D119368
2022-01-31[UpdateTestChecks] Re-add --filter and --filter-out optionsDavid Greene1-2/+5
Re-add filtering options with fixes for failed tests. We were not passing the is_filtered argument in all check generator calls in update_cc_test_checks.py Enhance the various update_*_test_checks.py tools to allow filtering the tool output with regular expressions. The --filter option will emit only tool output lines matching the given regular expression while the --filter-out option will emit only tools output lines not matching the given regular expression. Filters are applied in order of appearance on the command line (or in UTC_ARGS) and the first matching filter terminates the search. This allows test authors to create more focused tests by removing irrelevant tool output and checking only the pieces of output necessary to test the desired functionality. Differential Revision: https://reviews.llvm.org/D117694
2022-01-28Revert "[UpdateTestChecks] Add --filter and --filter-out options"David Greene1-5/+2
Broke some update-test-checks tests. Reverting while developing a fix. This reverts commit 030f71698d52f228929da5e3148602f4a3daff7d.
2022-01-28[UpdateTestChecks] Add --filter and --filter-out optionsDavid Greene1-2/+5
Enhance the various update_*_test_checks.py tools to allow filtering the tool output with regular expressions. The --filter option will emit only tool output lines matching the given regular expression while the --filter-out option will emit only tools output lines not matching the given regular expression. Filters are applied in order of appearance on the command line (or in UTC_ARGS) and the first matching filter terminates the search. This allows test authors to create more focused tests by removing irrelevant tool output and checking only the pieces of output necessary to test the desired functionality. Differential Revision: https://reviews.llvm.org/D117694
2022-01-05[CSKY] Add python script of CSKY asm update test checkZi Xuan Wu1-0/+19
2021-12-23[VE] Add VE support to update_llc_test_checksSimon Moll1-0/+18
Add VE assembly scrubbing and triple support to update_llc_test_checks. Reviewed By: kaz7 Differential Revision: https://reviews.llvm.org/D116104
2021-09-28[update_llc_test_checks.py] Fix MIPS ASM regex for functions with EHAlex Richardson1-0/+1
On MIPS, functions with exception handling code emits an additional temporary label at the start of the function (due to UseAssignmentForEHBegin): _Z8do_catchv: # @_Z8do_catchv .Ltmp3: .set .Lfunc_begin0, .Ltmp3 .cfi_startproc .cfi_personality 128, DW.ref.__gxx_personality_v0 .cfi_lsda 0, .Lexception0 .frame $c11,48,$c17 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro .set noat # %bb.0: # %entry The `[^:]*` regex was terminating the search after .Ltmp<N>: and therefore not detecting functions with exception handling. Reviewed By: atanasyan, MaskRay Differential Revision: https://reviews.llvm.org/D100027
2021-06-23[NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-darwin, autogenerate ↵Roman Lebedev1-2/+9
thumb2-ifcvt1.ll
2021-06-23[NFC][ARM] Fix update_llc_test_checks for ↵Roman Lebedev1-0/+9
aarch64-apple-ios/thumbv7s-apple-darwin, autogenerate a few tests
2021-06-23[NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-ios, autogenerate ↵Roman Lebedev1-9/+1
switch-minsize.ll
2021-06-23[NFC][ARM] Fix update_llc_test_checks for armv7-apple-ios, autogenerate ↵Roman Lebedev1-1/+7
ifcvt5.ll/ifcvt6.ll
2021-05-21[UpdateTestChecks] Default --x86_scrub_rip to FalseFangrui Song1-2/+2
True is a bad default: the useful symbol names and `@GOTPCREL` are scrubbed. Change the default and add global variable tests to x86-basic.ll (renamed from x86_function_name.ll since we now also test variables). I updated some tests to show the differences. Updated LCPI regex to include Darwin style `LCPI_[0-9]+_[0-9]+` (no leading dot). Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D102588
2021-03-28[X86][update_llc_test_checks] Use a less greedy regular expression for ↵Craig Topper1-1/+1
replacing constant pool labels in tests. While working on D97208 I noticed that these greedy regular expressions prevent tests from failing when (%rip) appears after a constant pool label when it didn't before. Reviewed By: RKSimon, pengfei Differential Revision: https://reviews.llvm.org/D99460
2021-03-08[M68k][test](6/8) Add all of the testsMin-Yih Hsu1-0/+17
And a small utilities -- extract-section.py -- that helps extracting specific object file section and printing in textual format. This utility is just a workaround for tests inside `Encoding`. Hopefully in the future we can replace dependencies in those tests with existing tools (e.g. llvm-readobj). Please refer to this bug for more context: https://bugs.llvm.org/show_bug.cgi?id=49245 Note that since we don't have AsmParser for now, we are testing the MC part using MIR as input and put those tests under the `Encoding` folder. In the future when AsmParser (and disassembler) is finished, those tests will be moved to `test/MC/M68k`. Authors: myhsu, m4yers, glaubitz Differential Revision: https://reviews.llvm.org/D88392
2021-01-26[update_llc_test_checks] Support AVRBen Shi1-0/+17
Reviewed By: arichardson Differential Revision: https://reviews.llvm.org/D95240
2021-01-05[UpdateTestChecks] Fix PowerPC RE to support AIX assemblyQiu Chaofan1-6/+5
Current update_llc_test_checks.py cannot generate checks for AIX (powerpc64-ibm-aix-xcoff) properly. Assembly generated is little bit different from Linux. So I use begin function comment here to capture function name. Reviewed By: MaskRay, steven.zhang Differential Revision: https://reviews.llvm.org/D93676
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