Skip to content

Commit b3030e5

Browse files
committed
Fix up the generator crates to use the new syntax
1 parent 4eaf55c commit b3030e5

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

crates/stdarch-gen-arm/src/load_store_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn generate_single_test(
364364
quote!()
365365
};
366366

367-
let feats = load.target_features.join(",");
367+
let feats = &load.target_features;
368368

369369
if let Some(store) = store {
370370
let data_init = if *tuple_len == 1 {
@@ -415,7 +415,7 @@ fn generate_single_test(
415415
};
416416

417417
Ok(quote! {
418-
#[simd_test(enable = #feats)]
418+
#[simd_test(#( #feats ),*)]
419419
unsafe fn #test_name() {
420420
#octaword_guard
421421
#length_call
@@ -458,7 +458,7 @@ fn generate_single_test(
458458
}
459459
};
460460
Ok(quote! {
461-
#[simd_test(enable = #feats)]
461+
#[simd_test(#( #feats ),*)]
462462
unsafe fn #test_name() {
463463
#octaword_guard
464464
#bases_load
@@ -804,7 +804,7 @@ fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {{
804804
)
805805
});
806806

807-
const MANUAL_TESTS: &str = "#[simd_test(enable = \"sve\")]
807+
const MANUAL_TESTS: &str = "#[simd_test(\"sve\")]
808808
unsafe fn test_ffr() {
809809
svsetffr();
810810
let ffr = svrdffr();

crates/stdarch-gen-loongarch/src/main.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,19 @@ impl TargetFeature {
5353
}
5454

5555
/// A string for use with `#[target_feature(...)]`.
56-
fn as_target_feature_arg(&self, ins: &str) -> String {
56+
fn as_target_feature_arg(&self, ins: &str) -> Vec<&'static str> {
5757
let vec = match *self {
5858
// Features included with LoongArch64 LSX and LASX.
5959
Self::Lsx => "lsx",
6060
Self::Lasx => "lasx",
6161
};
62-
let frecipe = match ins {
62+
match ins {
6363
"lsx_vfrecipe_s" | "lsx_vfrecipe_d" | "lsx_vfrsqrte_s" | "lsx_vfrsqrte_d"
6464
| "lasx_xvfrecipe_s" | "lasx_xvfrecipe_d" | "lasx_xvfrsqrte_s" | "lasx_xvfrsqrte_d" => {
65-
",frecipe"
65+
vec![vec, "frecipe"]
6666
}
67-
_ => "",
68-
};
69-
format!("{vec}{frecipe}")
67+
_ => vec![vec],
68+
}
7069
}
7170

7271
fn attr(name: &str, value: impl fmt::Display) -> String {
@@ -77,7 +76,7 @@ impl TargetFeature {
7776
fn to_target_feature_attr(self, ins: &str) -> Lines {
7877
Lines::single(Self::attr(
7978
"target_feature",
80-
self.as_target_feature_arg(ins),
79+
self.as_target_feature_arg(ins).join(","),
8180
))
8281
}
8382

@@ -1561,7 +1560,7 @@ fn gen_test_body(
15611560
r#"
15621561
static void {current_name}(void)
15631562
{{
1564-
printf("\n#[simd_test(enable = \"{}\")]\n");
1563+
printf("\n#[simd_test(\"{}\")]\n");
15651564
printf("unsafe fn test_{current_name}() {{\n");
15661565
{fn_inputs}
15671566
{fn_output}
@@ -1571,7 +1570,7 @@ static void {current_name}(void)
15711570
printf("}}\n");
15721571
}}
15731572
"#,
1574-
target.as_target_feature_arg(current_name)
1573+
target.as_target_feature_arg(current_name).join("\", \"")
15751574
)
15761575
};
15771576
let call_function = format!(" {current_name}();\n");

0 commit comments

Comments
 (0)