Skip to content

Commit 8077797

Browse files
committed
gen-arm: remove SvUndef
The `SvUndef` expression is no longer necessary as a `core::intrinsics::scalable::sve_undef` intrinsic has been introduced to produce an undefined SVE vector, used by `svundef*` intrinsics. Other intrinsics that used `SvUndef` now use the `svundef*` intrinsics.
1 parent 2637e08 commit 8077797

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

library/stdarch/crates/stdarch-gen-arm/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,6 @@ MatchKind:
205205
- `Array`
206206
- An array of expressions
207207
- Usage: `Array: [<expression>, ...]`
208-
- `SvUndef`
209-
- Returns the LLVM `undef` symbol
210-
- Usage: `SvUndef`
211208
- `Multiply`
212209
- Simply `*`
213210
- Usage: `Multiply: [<expression>, <expression>]`

library/stdarch/crates/stdarch-gen-arm/src/expression.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ pub enum Expression {
143143
LLVMLink(LLVMLink),
144144
/// Casts the given expression to the specified (unchecked) type
145145
CastAs(Box<Expression>, String),
146-
/// Returns the LLVM `undef` symbol
147-
SvUndef,
148146
/// Multiplication
149147
Multiply(Box<Expression>, Box<Expression>),
150148
/// Xor
@@ -295,7 +293,7 @@ impl Expression {
295293
/// - An unnecessary `unsafe` is a warning, made into an error by the CI's `-D warnings`.
296294
///
297295
/// This **panics** if it encounters an expression that shouldn't appear in a safe function at
298-
/// all (such as `SvUndef`).
296+
/// all.
299297
pub fn requires_unsafe_wrapper(&self, ctx_fn: &str) -> bool {
300298
match self {
301299
// The call will need to be unsafe, but the declaration does not.
@@ -347,9 +345,6 @@ impl Expression {
347345
},
348346
// We only use macros to check const generics (using static assertions).
349347
Self::MacroCall(_name, _args) => false,
350-
// Materialising uninitialised values is always unsafe, and we avoid it in safe
351-
// functions.
352-
Self::SvUndef => panic!("Refusing to wrap unsafe SvUndef in safe function '{ctx_fn}'."),
353348
// Variants that aren't tokenised. We shouldn't encounter these here.
354349
Self::MatchKind(..) => {
355350
unimplemented!("The unsafety of {self:?} cannot be determined in '{ctx_fn}'.")
@@ -390,9 +385,7 @@ impl FromStr for Expression {
390385
static MACRO_RE: LazyLock<Regex> =
391386
LazyLock::new(|| Regex::new(r"^(?P<name>[\w\d_]+)!\((?P<ex>.*?)\);?$").unwrap());
392387

393-
if s == "SvUndef" {
394-
Ok(Expression::SvUndef)
395-
} else if MACRO_RE.is_match(s) {
388+
if MACRO_RE.is_match(s) {
396389
let c = MACRO_RE.captures(s).unwrap();
397390
let ex = c["ex"].to_string();
398391
let _: TokenStream = ex
@@ -533,7 +526,6 @@ impl ToTokens for Expression {
533526
let ty: TokenStream = ty.parse().expect("invalid syntax");
534527
tokens.append_all(quote! { #ex as #ty })
535528
}
536-
Self::SvUndef => tokens.append_all(quote! { simd_reinterpret(()) }),
537529
Self::Multiply(lhs, rhs) => tokens.append_all(quote! { #lhs * #rhs }),
538530
Self::Xor(lhs, rhs) => tokens.append_all(quote! { #lhs ^ #rhs }),
539531
Self::Type(ty) => ty.to_tokens(tokens),

0 commit comments

Comments
 (0)