Skip to content

Commit 6d4ee5d

Browse files
authored
Merge pull request #1877 from folkertdev/check-stdarch-gen
Check that the checked-in version of `stdarch-gen-{arm, loongarch}` is up-to-date
2 parents e89f568 + a75f731 commit 6d4ee5d

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,28 @@ jobs:
255255
env:
256256
TARGET: ${{ matrix.target.tuple }}
257257

258+
# Check that the generated files agree with the checked-in versions.
259+
check-stdarch-gen:
260+
needs: [style]
261+
name: Check stdarch-gen-{arm, loongarch} output
262+
runs-on: ubuntu-latest
263+
steps:
264+
- uses: actions/checkout@v4
265+
- name: Install Rust
266+
run: rustup update nightly && rustup default nightly && rustup component add rustfmt
267+
- name: Check arm spec
268+
run: |
269+
cargo run --bin=stdarch-gen-arm --release -- crates/stdarch-gen-arm/spec
270+
git diff --exit-code
271+
- name: Check lsx.spec
272+
run: |
273+
cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lsx.spec
274+
git diff --exit-code
275+
- name: Check lasx.spec
276+
run: |
277+
cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lasx.spec
278+
git diff --exit-code
279+
258280
build-std-detect:
259281
needs: [style]
260282
name: Build std_detect
@@ -271,6 +293,7 @@ jobs:
271293
- verify
272294
- test
273295
- build-std-detect
296+
- check-stdarch-gen
274297
runs-on: ubuntu-latest
275298
# We need to ensure this job does *not* get skipped if its dependencies fail,
276299
# because a skipped job is considered a success by GitHub. So we have to

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fn gen_bind_body(
280280
let fn_output = if out_t.to_lowercase() == "void" {
281281
String::new()
282282
} else {
283-
format!("-> {}", type_to_rst(out_t, is_store))
283+
format!(" -> {}", type_to_rst(out_t, is_store))
284284
};
285285
let fn_inputs = match para_num {
286286
1 => format!("(a: {})", type_to_rst(in_t[0], is_store)),
@@ -304,7 +304,7 @@ fn gen_bind_body(
304304
),
305305
_ => panic!("unsupported parameter number"),
306306
};
307-
format!("fn __{current_name}{fn_inputs} {fn_output};")
307+
format!("fn __{current_name}{fn_inputs}{fn_output};")
308308
};
309309
let function = format!(
310310
r#" #[link_name = "llvm.loongarch.{}"]

0 commit comments

Comments
 (0)