Skip to content

Conversation

@durin42
Copy link
Contributor

@durin42 durin42 commented Jan 14, 2026

It looks like the behavior only changed for loongarch32, so maybe the better path would be to split the test into 32 and 64 bit files, and then the 32 bit one could use revisions for LLVM versions, which would obviate the need for the goofy regular expression dancing. I'm not really sure what the best outcome is for this test, so I'm very open to suggestions.

@rustbot label llvm-main

It looks like the behavior only changed for loongarch32, so maybe the
better path would be to split the test into 32 and 64 bit files, and
then the 32 bit one could use revisions for LLVM versions, which would
obviate the need for the goofy regular expression dancing. I'm not
really sure what the best outcome is for this test, so I'm very open to
suggestions.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) label Jan 14, 2026
@Mark-Simulacrum
Copy link
Member

cc @heiher @xen0n as target maintainers (https://doc.rust-lang.org/nightly/rustc/platform-support/loongarch-none.html and loongarch-linux).

I don't have a strong opinion myself and unless there's opinions otherwise from the target maintainers will r+ in a few days/week.

@xen0n
Copy link
Contributor

xen0n commented Jan 20, 2026

Hi, thanks for the heads-up and fix! The LA32 ABI only recently got stabilized in the latest LoongArch ABI specs v2.50, so going forward the new behavior is expected. (The pcaddu12i vs pcalau12i change is mainly due to the fact that LA32 Reduced does not require pcalau12i to be present.)

In LLVM upstream, we usually don't separate LA32 and LA64 tests, but again one doesn't have to consider co-existence of multiple LLVM versions there, so IMO you can structure the tests however you want as long as it's easy to maintain. Personally, I think smaller arches benefit significantly more from maintainability than everything else.

Comment on lines +45 to +46
// loongarch32: pca{{(lau|ddu)}}12i $t0, %got_pc{{(add)?}}_hi20(extern_static)
// loongarch32: ld.w $t0, $t0, %got_pc{{(add)?}}_lo12({{(extern_static|\.Lpcadd_hi1)}})
Copy link
Contributor

@heiher heiher Jan 20, 2026

Choose a reason for hiding this comment

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

Thanks for the fix! The two LoongArch32 variants generate different instruction sequences here: la32r emits pcaddu12i + ld.w, while la32s emits pcalau12i + ld.w. While a regex wildcard would cut down on test code line, it also makes the expected output much harder to understand at a glance. A clearer option would be to split into loongarch32r and loongarch32s (using -Ctarget-feature=+32s).

Suggested change
// loongarch32: pca{{(lau|ddu)}}12i $t0, %got_pc{{(add)?}}_hi20(extern_static)
// loongarch32: ld.w $t0, $t0, %got_pc{{(add)?}}_lo12({{(extern_static|\.Lpcadd_hi1)}})
// loongarch32s: pcalau12i $t0, %got_pc_hi20(extern_static)
// loongarch32s: ld.w $t0, $t0, %got_pc_lo12(extern_static)
// loongarch32r: pcaddu12i $t0, %got_pcadd_hi20(extern_static)
// loongarch32r: ld.w $t0, $t0, %got_pcadd_lo12(.Lpcadd_hi1)

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like these changes were backported to LLVM 22, so I've incorporated this in #150722. I think that matches what you suggested here.

@Mark-Simulacrum
Copy link
Member

r=me if the suggestion makes sense + is squashed into the PR

@nikic nikic mentioned this pull request Jan 27, 2026
10 tasks
rust-bors bot pushed a commit that referenced this pull request Jan 27, 2026
Update to LLVM 22

Scheduled release date: Feb 24
1.94 becomes stable: Mar 5

Changes:
 * Update to rc2, with one patch to work around our outdated illumos sysroot (rust-lang/llvm-project@41256ab).
 * Update the host toolchain as well, otherwise we lose cross-language LTO, in particular for jemalloc.
 * Adjust one loongarch assembly test. The split into r and s variants is based on the suggestion in #151134.

Depends on:

 * [x] #151410
 * [ ] #150756
 * [x] llvm/llvm-project#175190
 * [x] llvm/llvm-project#175912
 * [x] llvm/llvm-project#175965
 * [x] llvm/llvm-project#176195
 * [x] llvm/llvm-project#157073
 * [x] llvm/llvm-project#176421
 * [x] llvm/llvm-project#176925
 * [x] llvm/llvm-project#177187
rust-bors bot pushed a commit that referenced this pull request Jan 28, 2026
Update to LLVM 22

Scheduled release date: Feb 24
1.94 becomes stable: Mar 5

Changes:
 * Update to rc2, with one patch to work around our outdated illumos sysroot (rust-lang/llvm-project@41256ab).
 * Update the host toolchain as well, otherwise we lose cross-language LTO, in particular for jemalloc.
 * Adjust one loongarch assembly test. The split into r and s variants is based on the suggestion in #151134.

Depends on:

 * [x] #151410
 * [ ] #150756
 * [x] llvm/llvm-project#175190
 * [x] llvm/llvm-project#175912
 * [x] llvm/llvm-project#175965
 * [x] llvm/llvm-project#176195
 * [x] llvm/llvm-project#157073
 * [x] llvm/llvm-project#176421
 * [x] llvm/llvm-project#176925
 * [x] llvm/llvm-project#177187
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 28, 2026

☔ The latest upstream changes (presumably #150722) made this pull request unmergeable. Please resolve the merge conflicts.

@durin42
Copy link
Contributor Author

durin42 commented Jan 28, 2026

Thanks @nikic! I'll close this.

@durin42 durin42 closed this Jan 28, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants