]>
Commit | Line | Data |
---|---|---|
c295e0f8 XL |
1 | // only-aarch64 |
2 | // build-fail | |
3 | // compile-flags: -Ccodegen-units=1 | |
4 | #![feature(asm)] | |
5 | ||
6 | // Checks that inline asm errors are mapped to the correct line in the source code. | |
7 | ||
8 | fn main() { | |
9 | unsafe { | |
10 | asm!("invalid_instruction"); | |
11 | //~^ ERROR: unrecognized instruction mnemonic | |
12 | ||
13 | asm!(" | |
14 | invalid_instruction | |
15 | "); | |
16 | //~^^ ERROR: unrecognized instruction mnemonic | |
17 | ||
18 | asm!(r#" | |
19 | invalid_instruction | |
20 | "#); | |
21 | //~^^ ERROR: unrecognized instruction mnemonic | |
22 | ||
23 | asm!(" | |
24 | mov x0, x0 | |
25 | invalid_instruction | |
26 | mov x0, x0 | |
27 | "); | |
28 | //~^^^ ERROR: unrecognized instruction mnemonic | |
29 | ||
30 | asm!(r#" | |
31 | mov x0, x0 | |
32 | invalid_instruction | |
33 | mov x0, x0 | |
34 | "#); | |
35 | //~^^^ ERROR: unrecognized instruction mnemonic | |
36 | ||
37 | asm!(concat!("invalid", "_", "instruction")); | |
38 | //~^ ERROR: unrecognized instruction mnemonic | |
39 | ||
40 | asm!( | |
41 | "invalid_instruction", | |
42 | ); | |
43 | //~^^ ERROR: unrecognized instruction mnemonic | |
44 | ||
45 | asm!( | |
46 | "mov x0, x0", | |
47 | "invalid_instruction", | |
48 | "mov x0, x0", | |
49 | ); | |
50 | //~^^^ ERROR: unrecognized instruction mnemonic | |
51 | ||
52 | asm!( | |
53 | "mov x0, x0\n", | |
54 | "invalid_instruction", | |
55 | "mov x0, x0", | |
56 | ); | |
57 | //~^^^ ERROR: unrecognized instruction mnemonic | |
58 | ||
59 | asm!( | |
60 | "mov x0, x0", | |
61 | concat!("invalid", "_", "instruction"), | |
62 | "mov x0, x0", | |
63 | ); | |
64 | //~^^^ ERROR: unrecognized instruction mnemonic | |
65 | ||
66 | asm!( | |
67 | concat!("mov x0", ", ", "x0"), | |
68 | concat!("invalid", "_", "instruction"), | |
69 | concat!("mov x0", ", ", "x0"), | |
70 | ); | |
71 | //~^^^ ERROR: unrecognized instruction mnemonic | |
72 | ||
73 | // Make sure template strings get separated | |
74 | asm!( | |
75 | "invalid_instruction1", | |
76 | "invalid_instruction2", | |
77 | ); | |
78 | //~^^^ ERROR: unrecognized instruction mnemonic | |
79 | //~^^^ ERROR: unrecognized instruction mnemonic | |
80 | ||
81 | asm!( | |
82 | concat!( | |
83 | "invalid", "_", "instruction1", "\n", | |
84 | "invalid", "_", "instruction2", | |
85 | ), | |
86 | ); | |
87 | //~^^^^^ ERROR: unrecognized instruction mnemonic | |
88 | //~^^^^^^ ERROR: unrecognized instruction mnemonic | |
89 | ||
90 | asm!( | |
91 | concat!( | |
92 | "invalid", "_", "instruction1", "\n", | |
93 | "invalid", "_", "instruction2", | |
94 | ), | |
95 | concat!( | |
96 | "invalid", "_", "instruction3", "\n", | |
97 | "invalid", "_", "instruction4", | |
98 | ), | |
99 | ); | |
100 | //~^^^^^^^^^ ERROR: unrecognized instruction mnemonic | |
101 | //~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic | |
102 | //~^^^^^^^ ERROR: unrecognized instruction mnemonic | |
103 | //~^^^^^^^^ ERROR: unrecognized instruction mnemonic | |
104 | ||
105 | asm!( | |
106 | concat!( | |
107 | "invalid", "_", "instruction1", "\n", | |
108 | "invalid", "_", "instruction2", "\n", | |
109 | ), | |
110 | concat!( | |
111 | "invalid", "_", "instruction3", "\n", | |
112 | "invalid", "_", "instruction4", "\n", | |
113 | ), | |
114 | ); | |
115 | //~^^^^^^^^^ ERROR: unrecognized instruction mnemonic | |
116 | //~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic | |
117 | //~^^^^^^^ ERROR: unrecognized instruction mnemonic | |
118 | //~^^^^^^^^ ERROR: unrecognized instruction mnemonic | |
119 | } | |
120 | } |