Commit graph

83 commits

Author SHA1 Message Date
Trevor Gross
7183f983b2 ci: Enable verbose output for josh-sync 2026-02-07 01:42:15 -06:00
Trevor Gross
345acb1afd ci: Temporarily disable native PPC and s390x jobs
There are some permission changes that are causing the runners to fail
to launch.

Link: https://github.com/IBM/actionspz/issues/75
2026-02-06 22:51:00 +00:00
Juho Kahala
d0dc2e7c5f
add -Zjson-target-spec to custom target workflows (#1071)
With the json target specification format destabilized in
https://github.com/rust-lang/rust/pull/150151, `-Zjson-target-spec` is
needed for custom targets. This should resolve the CI failures seen in
rust-lang/compiler-builtins#1070
2026-02-03 00:03:21 -05:00
Trevor Gross
c30563a6bd ci: Pin rustc on the native PowerPC job
Recent nightlies have a miscompile on PowerPC hosts. Pin to a known
working nightly for now.

Link: https://github.com/rust-lang/rust/issues/151807
2026-01-30 21:36:22 -06:00
Taiki Endo
bf1239e78c
Implement __sync builtins for thumbv6-none-eabi (#1050)
This is a PR for thumbv6-none-eabi (bere-metal Armv6k in Thumb mode)
which proposed to be added by
https://github.com/rust-lang/rust/pull/150138.

Armv6k supports atomic instructions, but they are unavailable in Thumb
mode unless Thumb-2 instructions available (v6t2).

Using Thumb interworking (can be used via `#[instruction_set]`) allows
us to use these instructions even from Thumb mode without Thumb-2
instructions, but LLVM does not implement that processing (as of LLVM
21), so this PR implements it in compiler-builtins.

The code around `__sync` builtins is basically copied from
`arm_linux.rs` which uses kernel_user_helpers for atomic implementation.
The atomic implementation is a port of my [atomic-maybe-uninit inline
assembly code].

This PR has been tested on QEMU 10.2.0 using patched compiler-builtins
and core that applied the changes in this PR and
https://github.com/rust-lang/rust/pull/150138 and the [portable-atomic
no-std test suite] (can be run with `./tools/no-std.sh
thumbv6-none-eabi` on that repo) which tests wrappers around
`core::sync::atomic`. (Note that the target-spec used in test sets
max-atomic-width to 32 and atomic_cas to true, unlike the current
https://github.com/rust-lang/rust/pull/150138.) The original
atomic-maybe-uninit implementation has been tested on real Arm hardware.

(Note that Armv6k also supports 64-bit atomic instructions, but they are
skipped here. This is because there is no corresponding code in
`arm_linux.rs` (since the kernel requirements increased in 1.64, it may
be possible to implement 64-bit atomics there as well. see also
https://github.com/taiki-e/portable-atomic/pull/82), the code becomes
more complex than for 32-bit and smaller atomics.)

[atomic-maybe-uninit inline assembly code]: https://github.com/taiki-e/atomic-maybe-uninit/blob/HEAD/src/arch/arm.rs
[portable-atomic no-std test suite]: https://github.com/taiki-e/portable-atomic/tree/HEAD/tests/no-std-qemu
2026-01-22 10:09:48 +00:00
Trevor Gross
65639fe0dc ci: Move the dependency installs and wall time benchmarks to scripts
Make it easier to run the same steps outside of GitHub Actions.
2026-01-04 04:30:19 -05:00
Trevor Gross
d6139b1347 ci: Switch the x86 Apple job to the macos-15-intel runner
`macos-13` is being phased out. Now that GitHub has x86 runners with
MacOS 15, switch those.
2025-12-07 14:48:01 -05:00
Trevor Gross
01735687d8 ci: Update the default branch name in remaining workflow files
Missed as part of 936db7f5e890 ("ci: Update the default branch name").
2025-12-07 13:42:54 -05:00
Trevor Gross
e87befcf98
ci: Enable benchmarks on Aarch64
This was originally attempted at [1], but the numbers seemed to indicate
that tests weren't being run or counted completely. That issue appears
to be resolved, so add benchmarks for Aarch64.

[1]:  https://github.com/rust-lang/compiler-builtins/pull/930
2025-12-06 03:22:14 -05:00
Trevor Gross
1cfe3585e7 bench: Update the benchmark runner to gungraun 0.17
`iai-callgrind` was renamed to `gungraun` and had a new release. Update
everything to match.

There shouldn't be any changes to observable behavior here.
2025-12-04 21:35:41 -05:00
Trevor Gross
382e9fa4a3 ci: Update the default branch name 2025-12-04 21:35:23 -05:00
Trevor Gross
93b5361202 ci: Increase the benchmark rustc version to 2025-12-01
Zerocopy (an indirect test dependency) has started requiring
recently-stabilized features, so upgrade our benchmark toolchain to
match.
2025-12-02 05:22:04 -05:00
Taiki Endo
3220121a33
ci: Use nextest on PowerPC64LE and s390x
See https://github.com/taiki-e/install-action/issues/1056 for the
context.
2025-09-10 16:22:44 -04:00
Trevor Gross
9a81b2a6a0 Start runnning tests for aarch64-pc-windows-msvc
This target is currently build-only. Switch to the windows-11-arm
runner, which allows us to start running tests.
2025-08-07 15:49:49 -05:00
Trevor Gross
3cbd088ee4 ci: Set pipefail before running ci-util
Currently, a failure in `ci-util.py` does not cause the job to fail
because the pipe eats the failure status . Set pipefail to fix this.

Fixes: ff2cc0e38e3e ("ci: Don't print output twice in `ci-util`")
2025-07-30 09:57:45 -05:00
Trevor Gross
eafafc44ab ci: Don't print output twice in ci-util
Use `tee` rather than printing to both stdout and stderr.
2025-07-30 08:59:57 +00:00
Trevor Gross
97c35d3aed ci: Simplify tests for verbatim paths
Rather than setting an environment variable in the workflow job based on
whether or not the environment is non-MinGW Windows, we can just check
this in the ci script.

This was originally added in b0f19660f0 ("Add tests for UNC paths on
windows builds") and its followup commits.
2025-07-29 19:07:55 +00:00
Trevor Gross
54a4f867f8 cleanup: Trim trailing whitespace 2025-07-29 18:56:46 +00:00
Jakub Beránek
54f6ab73b1
Switch to using a GH app for authenticating sync PRs
So there will no longer be the need to close and reopen sync PRs in
order for CI to run.
2025-07-29 08:20:22 +00:00
Trevor Gross
08bca4d6a2
ci: Add native PowerPC64LE and s390x jobs
We now have access to native runners, so make use of them for these
architectures. The existing ppc64le Docker job is kept for now.
2025-07-23 04:50:41 -05:00
Trevor Gross
ed50029b92 ci: Switch to nightly rustfmt
We are getting warnings in CI about unsupported features. There isn't
any reason to use stable rustfmt so switch the channel here.
2025-07-21 12:18:45 -05:00
Jakub Beránek
7a1593c597
Add CI workflow for automatically performing subtree sync pulls
This CI workflow will run the https://github.com/rust-lang/josh-sync
tool on Mondays and Thursdays. It will try to do a pull (sync stdarch
changes from rust-lang/rust into this repository). When it runs, three
things can happen:
- There are no rustc changes to be pulled, the bot does nothing.
- There are some new changes to be pulled. In that case, the bot will
either open or update an existing PR titled "Rustc pull update" on this
repository with the changes. After the PR is merged, we should ideally
do the opposite sync (push) manually.
- The pull fails (usually because of a merge conflict), or the bot
determines that a pull PR has been opened for more than a week without
being merged. In that case, it will post a ping to
https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/compiler-builtins.20subtree.20sync.20automation/with/528482375.
2025-07-12 20:30:19 +00:00
Trevor Gross
016bc61312
Test building custom targets and resolve an issue probing rustc
The `rustc` probe done in our build scripts needs to pass `--target` to
get the correct configuration, which usually comes from the `TARGET`
environment variable. However, for targets specified via a `target.json`
file, `TARGET` gets set to the file name without an extension or path.
`rustc` will check a search path to attempt to locate the file, but this
is likely to fail since the directory where Cargo invokes build scripts
(and hence where those scripts invoke `rustc`) might not have any
relation to the JSON spec file.

Resolve this for now by leaving `f16` and `f128` disabled if the `rustc`
command fails. Result of the discussion at CARGO-14208 may eventually
provide a better solution.

A CI test is also added since custom JSON files are an edge case that
could fail in other ways. I verified this fails without the fix here.
The JSON file is the output for `thumbv7em-none-eabi`, just renamed so
`rustc` doesn't identify it.
2025-07-04 21:09:56 -05:00
Trevor Gross
e1e3cc24a2 Replace the musl submodule with a download script
The submodule was causing issues in rust-lang/rust, so eliminiate it
here. `build-musl` is also removed from `libm-test`'s default features
so the crate doesn't need to be built by default.
2025-06-04 17:20:43 +00:00
Trevor Gross
4d325e8b2c ci: Allow for multiple icount benchmarks in the same run
We don't actually need this for now, but eventually it would be nice to
run icount benchmarks on multiple targets. Start tagging artifact names
with the architecture, and allow passing `--tag` to `ci-util.py` in
order to retrieve the correct one.
2025-05-29 21:58:21 +00:00
Trevor Gross
9f84e9904f Increase the benchmark rustc version to 2025-05-28
We may soon want to use some new nightly features in `compiler-builtins`
and `libm`, specifically `cfg_target_has_reliable_f16_f128` which was
added in the past few weeks. This will mean we need a newer toolchain
for benchmarks to continue building.

Bump to the current latest nightly so we are not blocked on this down
the line.
2025-05-29 19:56:59 +00:00
Trevor Gross
3464b4b231 ci: Allow concurrency outside of pull requests
When multiple merges to `master` happen before a CI run completes, the
in-progress job is getting canceled. Fix this by using the commit sha
for the group key if a pull request number is not available, rather than
`github.ref` (which is always `refs/head/master` after merge). This
should prevent jobs running on previous commits from getting cancelled,
while still ensuring there is only ever one active run per pull request.
2025-05-29 19:01:03 +00:00
Trevor Gross
8db9bd6a59 Remove the now-unneeded llvm-tools-preview
Since a working `nm` is no longer needed as part of CI, the rustup
component can be removed.
2025-05-29 15:38:10 +00:00
Trevor Gross
13b94cf89f ci: Fix extensive tests
Move this to a script and ensure only `libm-test` gets built to avoid
default feature issues with `compiler-builtins`.
2025-04-21 22:50:42 -04:00
Trevor Gross
46bbc3dd88 ci: Clean up workflow file and docker script 2025-04-20 05:33:19 -04:00
Trevor Gross
ee431374eb ci: Add a timeout for all jobs 2025-04-20 04:39:06 -04:00
Trevor Gross
8902f740da ci: Skip testing libm in PRs if it did not change
Many contributions to compiler-builtins don't have any need to touch
libm, and could get by with the few minutes of CI for compiler-builtins
rather than the ~30 minutes for libm. We already have some scripts that
handle changed file detection, so expand its use to skip libm CI if it
doesn't need to run.
2025-04-20 04:24:24 -04:00
Trevor Gross
9c96f245b8 ci: Enable testing of libm crates
Update `run.sh` to start testing `libm`. Currently this is somewhat
inefficient because `builtins-test` gets run more than once on some
targets; this can be cleaned up later.
2025-04-20 03:22:27 -04:00
Trevor Gross
d0e0134dc5 ci: Add extensive tests from rust-lang/libm 2025-04-20 02:33:17 -04:00
Trevor Gross
9919218493 ci: Add a libm MSRV check
Add the job from rust-lang/libm
2025-04-20 02:23:28 -04:00
Trevor Gross
0d0d317242 Enable icount benchmarks in CI 2025-04-20 00:58:50 -04:00
Trevor Gross
ca5c4ed8d7 Fix the release-plz job 2025-04-19 17:31:43 -04:00
Trevor Gross
01c5888246 ci: Make CI configuration more similar to libm
Apply a handful of changes to reduce the diff between the two:

* Cancel running jobs on new pushes
* Enable log color and backtraces
* Add timeouts
* Specify CI runner versions
* Add an armv7 job
* Replace the name NO_STD with BUILD_ONLY
* Update the extension to the canonical .yaml
* Set AR_ and CC_ environments in docker
* Install requirements to build MPFR
2025-04-18 23:49:29 -04:00
Ralf Jung
5cf993880a
copy_misaligned_words: avoid out-of-bounds accesses (#799)
* copy_misaligned_words: avoid out-of-bounds accesses
* add test to make Miri able to detect OOB in memmove
* run Miri on CI
2025-03-22 05:36:40 +00:00
Trevor Gross
683485cda2 Switch repository layout to use a virtual manifest
The current setup has the `Cargo.toml` for `compiler-builtins` at the
repository root, which means all support crates and other files are
located within the package root. This works for now but is not the
cleanest setup since files that should or shouldn't be included in the
package need to be configured in `Cargo.toml`. If we eventually merge
`libm` development into this repository, it would be nice to make this
separation more straightforward.

Begin cleaning things up by moving the crate source to a new
`compiler-builtins` directory and adding a virtual manifest. For now the
`libm` submodule is also moved, but in the future it can likely move
back to the top level (ideally `compiler-builtins/src` would contain a
symlink to `libm/src/math`, but unfortunately it seems like Cargo does
not like something about the submodule + symlink combination).
2025-03-19 00:49:34 -05:00
Ralf Jung
014f530f76 nightlies without clippy are not a thing any more 2025-03-18 16:37:52 -05:00
Trevor Gross
f8b03df54e Add a script for downloading compiler-rt
Rather than needing to copy the version and URL from the CI workflow,
put this into a script that can be directly run locally.
2025-03-18 06:23:30 -05:00
Trevor Gross
e4c1eb803d Revert "ci: Pin the nightly toolchain for aarch64-unknown-linux-gnu"
The fix to this issue was synced in [1] so we should no longer need to
keep aarch64 pinned.

This reverts commit b2bcfc838e2a4b72fa62b333e3eb91f250aa4539.

[1]: https://github.com/rust-lang/rust/pull/137661
2025-03-04 22:15:03 -05:00
Trevor Gross
60ea5815b2 Update LLVM downloads to 20.1-2025-02-13
This matches the version used by rust-lang/rust.
2025-02-26 02:47:49 -05:00
Trevor Gross
54e7ff15c0 Revert "ci: Pin the nightly toolchain for i686-pc-windows-gnu"
Since [1], the issue should be resolved so the workaround can be
dropped.

This reverts commit 88e83b96ad09f3cf9e2d1b4543a7d43f9c5a77c0.

[1]: https://github.com/rust-lang/compiler-builtins/pull/759
2025-02-23 03:40:11 -05:00
Trevor Gross
bade6290c8 ci: Pin the nightly toolchain for aarch64-unknown-linux-gnu
Pin aarch64-unknown-linux-gnu to nightly-2025-02-07 until [1] is
resolved.

[1]: https://github.com/llvm/llvm-project/issues/127804
2025-02-19 15:38:45 -05:00
Trevor Gross
4517c7ea90 ci: Pin the nightly toolchain for i686-pc-windows-gnu
Pin i686-pc-windows-gnu to nightly-2025-02-07 until [1] is resolved.

[1]: https://github.com/rust-lang/rust/issues/136795
2025-02-19 15:38:45 -05:00
Trevor Gross
37da10edde ci: Update actions/cache to v4
Github has deprecated v2 so this needs to be bumped.
2025-02-19 15:38:45 -05:00
WANG Rui
ec673535f7 ci: add support for loongarch64-unknown-linux-gnu 2024-11-01 05:48:47 -05:00
Trevor Gross
76580a96a7 Upgrade CI LLVM version to 19.1
19.1 is the latest stable release from 2024-09-17. This will match what
is currently being used in rust-lang/rust.
2024-10-03 11:49:45 -04:00