-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't require the user to enable the unsized features.
Rather than forcing the user to enable the unsized_fn_params and unsized_locals features, we condition those features tests with if the type is a scalable simd type.
- Loading branch information
1 parent
17a06d9
commit 351bec3
Showing
8 changed files
with
96 additions
and
6 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
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
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
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,47 @@ | ||
#![allow(incomplete_features, internal_features, improper_ctypes)] | ||
#![feature( | ||
repr_simd, | ||
repr_scalable, | ||
simd_ffi, | ||
unsized_locals, | ||
unsized_fn_params, | ||
link_llvm_intrinsics | ||
)] | ||
|
||
#[repr(simd, scalable(4))] | ||
#[allow(non_camel_case_types)] | ||
pub struct svint32_t { | ||
_ty: [i32], | ||
} | ||
|
||
#[inline(never)] | ||
#[target_feature(enable = "sve")] | ||
pub unsafe fn svdup_n_s32(op: i32) -> svint32_t { | ||
extern "C" { | ||
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.sve.dup.x.nxv4i32")] | ||
fn _svdup_n_s32(op: i32) -> svint32_t; | ||
} | ||
unsafe { _svdup_n_s32(op) } | ||
} | ||
|
||
#[inline] | ||
#[target_feature(enable = "sve,sve2")] | ||
pub unsafe fn svxar_n_s32<const IMM3: i32>(op1: svint32_t, op2: svint32_t) -> svint32_t { | ||
extern "C" { | ||
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.sve.xar.nxv4i32")] | ||
fn _svxar_n_s32(op1: svint32_t, op2: svint32_t, imm3: i32) -> svint32_t; | ||
} | ||
unsafe { _svxar_n_s32(op1, op2, IMM3) } | ||
} | ||
|
||
#[inline(never)] | ||
fn run(f: impl Fn() -> ()) { | ||
f(); | ||
} | ||
|
||
fn main() { | ||
let a = svdup_n_s32(42); | ||
run(move || { | ||
svxar_n_s32::<2>(a, a); //~ ERROR E0277 | ||
}); | ||
} |
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,19 @@ | ||
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time | ||
--> $DIR/disallow-capture-closure.rs:45:26 | ||
| | ||
LL | run(move || { | ||
| -- this closure captures all values by move | ||
LL | svxar_n_s32::<2>(a, a); | ||
| ^ doesn't have a size known at compile-time | ||
| | ||
= help: within `svint32_t`, the trait `Sized` is not implemented for `[i32]`, which is required by `svint32_t: Sized` | ||
note: required because it appears within the type `svint32_t` | ||
--> $DIR/disallow-capture-closure.rs:13:12 | ||
| | ||
LL | pub struct svint32_t { | ||
| ^^^^^^^^^ | ||
= note: all values captured by value by a closure must have a statically known size | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |