]> git.lizzy.rs Git - rust.git/blob - tests/codegen/asm-sanitize-llvm.rs
Rollup merge of #106793 - Mark-Simulacrum:normalize-test, r=compiler-errors
[rust.git] / tests / codegen / asm-sanitize-llvm.rs
1 // FIXME(nagisa): remove the flags below once all targets support `asm!`.
2 // compile-flags: --target x86_64-unknown-linux-gnu
3 // needs-llvm-components: x86
4
5 // Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
6 // inadvertently rely on the LLVM-specific syntax and features.
7 #![no_core]
8 #![feature(no_core, lang_items, rustc_attrs)]
9 #![crate_type = "rlib"]
10 #![allow(named_asm_labels)]
11
12 #[rustc_builtin_macro]
13 macro_rules! asm {
14     () => {};
15 }
16
17 #[lang = "sized"]
18 trait Sized {}
19 #[lang = "copy"]
20 trait Copy {}
21
22 pub unsafe fn we_escape_dollar_signs() {
23     // CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
24     asm!(
25         r"banana$:",
26     )
27 }
28
29 pub unsafe fn we_escape_escapes_too() {
30     // CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
31     asm!(
32         r"banana\36:",
33     )
34 }