Skip to content

Port stdarch-gen-loongarch to stdarch-gen-common harness#2178

Open
xonx4l wants to merge 2 commits into
rust-lang:mainfrom
xonx4l:port-loongarch
Open

Port stdarch-gen-loongarch to stdarch-gen-common harness#2178
xonx4l wants to merge 2 commits into
rust-lang:mainfrom
xonx4l:port-loongarch

Conversation

@xonx4l

@xonx4l xonx4l commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This PR ports stdarch-gen-loongarch to stdarch-gen-common harness.

The change in main invokes run_generator once per committed dir when called with no args or lsx/lasx.

The CI switches from -- <spec> to -- lsx / -- lasx with STDARCH_GEN_MODE=check.

Swapped the first two comment lines of lsx/tests.rs and lasx/tests.rs so the auto-generated marker moves to line 2 . So discover_owned only checks the first line and makes the harness skip tests.rs which is not produced by stdarch-gen-loongarch .

r? @folkertdev

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, thanks! I suppose that we could just generate even the spec and tests using the new stdarch-gen-common machinery? Or do they differ somehow from gen_bind?

View changes since this review

STDARCH_GEN_MODE: check
run: |
cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lsx.spec
cargo run -p stdarch-gen-loongarch --release -- lsx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately, this will still be a bit annoying to replicate in bootstrap, as we have to ensure that we invoke both the right crates, and with the right arguments.

That is not for this PR, but I'd think about merging everything into a single binary that will generate everything, I think that would be easier to work with.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@@ -1,5 +1,5 @@
// This code is automatically generated. DO NOT MODIFY.
// See crates/stdarch-gen-loongarch/README.md
// This code is automatically generated. DO NOT MODIFY.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the tests.rs files are not generated using the stdarch-gen-common machinery, let's use a different header for them, to avoid this line moving hack.

By the way, if you regenerate the Loongarch tests.rs files now, are they the same as they committed versions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a different header . As for regenerating the tests.rs i haven't actually run it. Thank you!

@folkertdev

Copy link
Copy Markdown
Contributor

cc @heiher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants