forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebAssembly] Split and tidy up target features test (llvm#96735)
This splits `target-features.ll` into two tests: `target-features-attrs.ll` and `target-features-cpus.ll`. Now `target-features-attrs.ll` contains tests with bitcode function attributes and `-mattr=` options. The current `target-features.ll` file's FileCheck lines are confusing, mainly because it is unclear how `CHECK` and `ATTRS` lines are meant to be different. Turns out, before llvm@67ec874, `-mattr=` options used to override any existing bitcode function attributes, but after the commit that's not the case anymore. So the original test had a line that tested `i32.atomic.rmw.cmpxchg` was not generated when `-mattr=+simd128` was given (because the existing `+atomics` in the function attributes is overriden). That commit deleted that line and changed some `ATTRS` lines into `CHECK`, which was confusing. This PR simplifies that part and does not test the absence of any instructions, and the effect of `-mattr=` option is only tested with the target features section. And `target-features-cpus.ll` only tests the sets of features enabled by `-mcpu=` lines. It is better to have this as a separate file because once you have bitcode function attributes they end up in the target features section too, making the testing of only the `-mcpu=` options difficult.
- Loading branch information
Showing
2 changed files
with
84 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
; RUN: llc < %s -mcpu=mvp | FileCheck %s --check-prefixes MVP | ||
; RUN: llc < %s -mcpu=generic | FileCheck %s --check-prefixes GENERIC | ||
; RUN: llc < %s | FileCheck %s --check-prefixes GENERIC | ||
; RUN: llc < %s -mcpu=bleeding-edge | FileCheck %s --check-prefixes BLEEDING-EDGE | ||
|
||
; Test that the target features section contains the correct set of features | ||
; depending on -mcpu= options. | ||
|
||
target triple = "wasm32-unknown-unknown" | ||
|
||
; mvp: should not contain the target features section | ||
; MVP-NOT: .custom_section.target_features,"",@ | ||
|
||
; generic: +mutable-globals, +sign-ext | ||
; GENERIC-LABEL: .custom_section.target_features,"",@ | ||
; GENERIC-NEXT: .int8 2 | ||
; GENERIC-NEXT: .int8 43 | ||
; GENERIC-NEXT: .int8 15 | ||
; GENERIC-NEXT: .ascii "mutable-globals" | ||
; GENERIC-NEXT: .int8 43 | ||
; GENERIC-NEXT: .int8 8 | ||
; GENERIC-NEXT: .ascii "sign-ext" | ||
|
||
; bleeding-edge: +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint, | ||
; +sign-ext, +simd128, +tail-call | ||
; BLEEDING-EDGE-LABEL: .section .custom_section.target_features,"",@ | ||
; BLEEDING-EDGE-NEXT: .int8 7 | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 7 | ||
; BLEEDING-EDGE-NEXT: .ascii "atomics" | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 11 | ||
; BLEEDING-EDGE-NEXT: .ascii "bulk-memory" | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 15 | ||
; BLEEDING-EDGE-NEXT: .ascii "mutable-globals" | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 19 | ||
; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint" | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 8 | ||
; BLEEDING-EDGE-NEXT: .ascii "sign-ext" | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 7 | ||
; BLEEDING-EDGE-NEXT: .ascii "simd128" | ||
; BLEEDING-EDGE-NEXT: .int8 43 | ||
; BLEEDING-EDGE-NEXT: .int8 9 | ||
; BLEEDING-EDGE-NEXT: .ascii "tail-call" |