Skip to content

Commit 7e763e9

Browse files
committed
check that target features don't leak out of a naked function
1 parent 5e370a2 commit 7e763e9

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//@ add-core-stubs
2+
//@ compile-flags: --target aarch64-unknown-linux-gnu
3+
//@ build-fail
4+
//@ needs-llvm-components: arm
5+
6+
#![crate_type = "lib"]
7+
#![feature(no_core, naked_functions)]
8+
#![no_core]
9+
10+
extern crate minicore;
11+
use minicore::*;
12+
13+
// check that a naked function using target features does not keep these features enabled
14+
// for subsequent asm blocks.
15+
16+
#[no_mangle]
17+
#[naked]
18+
#[target_feature(enable = "i8mm")]
19+
unsafe extern "C" fn a() {
20+
naked_asm!("usdot v0.4s, v1.16b, v2.4b[3]")
21+
}
22+
23+
#[no_mangle]
24+
#[naked]
25+
unsafe extern "C" fn b() {
26+
naked_asm!("usdot v0.4s, v1.16b, v2.4b[3]")
27+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: instruction requires: i8mm
2+
|
3+
note: instantiated into assembly here
4+
--> <inline asm>:16:1
5+
|
6+
LL | usdot v0.4s, v1.16b, v2.4b[3]
7+
| ^
8+
9+
error: instruction requires: i8mm
10+
|
11+
note: instantiated into assembly here
12+
--> <inline asm>:16:1
13+
|
14+
LL | usdot v0.4s, v1.16b, v2.4b[3]
15+
| ^
16+
17+
error: aborting due to 2 previous errors
18+

0 commit comments

Comments
 (0)