diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c6dee16fb..59aad0b5d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -255,6 +255,28 @@ jobs: env: TARGET: ${{ matrix.target.tuple }} + # Check that the generated files agree with the checked-in versions. + check-stdarch-gen: + needs: [style] + name: Check stdarch-gen-{arm, loongarch} output + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly && rustup component add rustfmt + - name: Check arm spec + run: | + cargo run --bin=stdarch-gen-arm --release -- crates/stdarch-gen-arm/spec + git diff --exit-code + - name: Check lsx.spec + run: | + cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lsx.spec + git diff --exit-code + - name: Check lasx.spec + run: | + cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lasx.spec + git diff --exit-code + build-std-detect: needs: [style] name: Build std_detect @@ -271,6 +293,7 @@ jobs: - verify - test - build-std-detect + - check-stdarch-gen runs-on: ubuntu-latest # We need to ensure this job does *not* get skipped if its dependencies fail, # because a skipped job is considered a success by GitHub. So we have to diff --git a/crates/stdarch-gen-loongarch/src/main.rs b/crates/stdarch-gen-loongarch/src/main.rs index aa9990b6cc..9e10a4c3f0 100644 --- a/crates/stdarch-gen-loongarch/src/main.rs +++ b/crates/stdarch-gen-loongarch/src/main.rs @@ -280,7 +280,7 @@ fn gen_bind_body( let fn_output = if out_t.to_lowercase() == "void" { String::new() } else { - format!("-> {}", type_to_rst(out_t, is_store)) + format!(" -> {}", type_to_rst(out_t, is_store)) }; let fn_inputs = match para_num { 1 => format!("(a: {})", type_to_rst(in_t[0], is_store)), @@ -304,7 +304,7 @@ fn gen_bind_body( ), _ => panic!("unsupported parameter number"), }; - format!("fn __{current_name}{fn_inputs} {fn_output};") + format!("fn __{current_name}{fn_inputs}{fn_output};") }; let function = format!( r#" #[link_name = "llvm.loongarch.{}"]