Skip to content

Commit 908708f

Browse files
Rollup merge of #156901 - Zalathar:needs-asm-ret, r=folkertdev
compiletest: Simplify `//@ needs-asm-mnemonic: ret` to just `//@ needs-asm-ret` - Simplification of rust-lang/rust#155692. --- The `needs-asm-mnemonic` directive was very general, but in practice was only being used for `ret`. There are very few other mnemonics that it could plausibly be useful for (e.g. `nop`), because any instruction that requires arguments is probably going to be non-portable. This PR replaces `needs-asm-mnemonic` with a simpler `needs-asm-ret` directive that uses the same machinery as other simple needs directives. If we happend to need more mnemonics in the future, we can just add more simple directives as appropriate (e.g. `needs-asm-nop`).
2 parents aa463af + 366aeb6 commit 908708f

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

src/tests/compiletest.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,6 @@ See also the [codegen tests](#codegen-tests) for a similar set of tests.
346346
If you need to work with `#![no_std]` cross-compiling tests, consult the
347347
[`minicore` test auxiliary](./minicore.md) chapter.
348348

349-
#### Conditional assembly tests based on instruction support
350-
351-
Tests that depend on specific assembly instructions being available can use the
352-
`//@ needs-asm-mnemonic: <MNEMONIC>` directive.
353-
This will skip the test if the target backend does not support the specified instruction mnemonic.
354-
355-
For example, a test that requires the `RET` instruction:
356-
```rust,ignore
357-
//@ needs-asm-mnemonic: RET
358-
```
359-
360349
[`tests/assembly-llvm`]: https://github.com/rust-lang/rust/tree/HEAD/tests/assembly-llvm
361350

362351

src/tests/directives.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ The following directives will check rustc build settings and target settings:
164164
For tests that cross-compile to explicit targets
165165
via `--target`, use `needs-llvm-components` instead to ensure the appropriate
166166
backend is available.
167-
- `needs-asm-mnemonic: <MNEMONIC>` — ignores if the target backend does not
168-
support the specified assembly mnemonic (e.g., `RET`, `NOP`).
169-
Only supported with the LLVM backend.
167+
- `needs-asm-ret` - ignores if the target does not have a `ret` instruction
168+
in its assembly syntax. Most target architectures have this instruction,
169+
making it handy for portable inline-assembly tests, but some architectures
170+
(e.g. 32-bit ARM) do not have it.
170171
- `needs-profiler-runtime` — ignores the test if the profiler runtime was not
171172
enabled for the target (`build.profiler = true` in `bootstrap.toml`)
172173
- `needs-sanitizer-support` — ignores if the sanitizer support was not enabled

0 commit comments

Comments
 (0)