208 Commits

Author SHA1 Message Date
Trevor Gross
4ebfdf74db ci: Add a way to run libm tests that would otherwise be skipped
Introduce a new directive `ci: test-libm` to ensure tests run.
2025-07-30 08:59:57 +00:00
Trevor Gross
c045c9b1ca ci: Commonize the way PrInfo is loaded from env 2025-07-30 08:59:57 +00: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
ab8a2e1cb2 ci: Switch to strongly typed directives
Replace the current system with something that is more structured and
will also catch unknown directives.
2025-07-30 08:59:55 +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
Trevor Gross
5c4abe9ca0 ci: Upgrade ubuntu:25.04 for the PowerPC64LE test
Update the last remaining image.

For this to work, the `QEMU_CPU=POWER8` configuration needed to be
dropped to avoid a new SIGILL. Doing some debugging locally, the crash
comes from an `extswsli` (per `powerpc:common64` in gdb-multiarch) in
the `ld64.so` available with PowerPC, which qemu rejects when set to
power8. Testing a build with `+crt-static` hits the same issue at a
`maddld` in `__libc_start_main_impl`.

Rust isn't needed to reproduce this:

    $ cat a.c
    #include <stdio.h>

    int main() {
            printf("Hello, world!\n");
    }
    $ powerpc64le-linux-gnu-gcc a.c
    $ QEMU_CPU=power8 QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu/ ./a.out
    qemu: uncaught target signal 4 (Illegal instruction) - core dumped
    Illegal instruction

So the cross toolchain provided by Debian must have a power9 baseline
rather than rustc's power8. Alternatively, qemu may be incorrectly
rejecting these instructions (I can't find a source on whether or not
they should be available for power8). Testing instead with the `-musl`
toolchain and ppc linker from musl.cc works correctly.

In any case, things work with the default qemu config so it seems fine
to drop. The env was originally added in 5d164a4edafb ("fix the
powerpc64le target") but whatever the problem was there appears to no
longer be relevant.
2025-07-24 05:52:58 -05:00
Trevor Gross
83aea652e4 ci: Use a mirror for musl
We pretty often get at least one job failed because of failure to pull
the musl git repo. Switch this to the unofficial mirror [1] which should
be more reliable.

Link: https://github.com/kraj/musl [1]
2025-07-24 04:06:56 -05:00
Trevor Gross
fcc7824b88 ci: Update to the latest ubuntu:25.04 Docker images
This includes a qemu update from 8.2.2 to 9.2.1 which should hopefully
fix some bugs we have encountered.

PowerPC64LE is skipped for now because the new version seems to cause a
number of new SIGILLs.
2025-07-24 01:42:53 -05:00
Trevor Gross
f5c9403551 Upgrade iai-callgrind to 0.15
Pick up the latest version of iai-callgrind, which includes some output
improvements.

Changelog: https://github.com/iai-callgrind/iai-callgrind/releases
2025-07-10 18:47:26 -04:00
Trevor Gross
e164811f5d symcheck: Make target a positional argument
This makes it more obvious what we intend to check rather than looking
for `--target`.
2025-07-04 17:44:54 -05:00
Trevor Gross
b5fafd9816 ci: Fix a typo that was causing a command failure 2025-06-10 07:02:57 +00: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
ba7cdb6814 ci: Refactor benchmark regression checks
iai-callgrind now correctly exits with error if regressions were found
[1], so we no longer need to check for regressions manually. Remove this
check and instead exit based on the exit status of the benchmark run.

[1] https://github.com/iai-callgrind/iai-callgrind/issues/337
2025-06-02 21:29:46 +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
c136fb7734 Run builtins-test-intrinsics when possible
Currently we only build this, but it is possible to run the binary.
Change the CI script to do so here.
2025-05-29 18:46:06 +00:00
Trevor Gross
a63f4826cf Replace the nm symbol check with a Rust implementation
This should be less error-prone and adaptable than the `nm` version, and
have better cross-platform support without needing LLVM `nm` installed.
2025-05-29 15:38:10 +00:00
Trevor Gross
339793d62b ci: Mention ci: skip-extensive in the error message 2025-05-05 02:31:52 -04: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
13bf5f5bb4 ci: Use lowercase for bash locals, fix shellcheck 2025-04-20 05:33:19 -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
a829d916b5 ci: Add /cargo/bin to the path in Docker
This makes it possible to use nextest within the container.
2025-04-20 04:11:53 -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
0d0d317242 Enable icount benchmarks in CI 2025-04-20 00:58:50 -04:00
Trevor Gross
141c7b06c4 Add remaining libm crates to the workspace
These are still not yet covered in CI since we always name explicit
packages there, but all crates are now part of the workspace.
2025-04-19 23:20:13 -04:00
Trevor Gross
a48de6950c Move builtins-test-intrinsics out of the workspace
This crate doesn't need to be a default member since it requires the
opposite settings from everything else. Exclude it from the workspace
and run it only when explicitly requested.

This also makes `cargo t --no-default-features` work without additional
qualifiers. `--no-default-features` still needs to be passed to ensure
`#![compiler_builtins]` does not get set.

compiler-builtins needs doctests disabled in order for everything to
work correctly, since this causes an error running rustdoc that is
unrelated to features (our `compiler_builtins` is getting into the crate
graph before that from the sysroot, but `#![compiler_builtins]` is not
set).

We can also remove `test = false` and `doctest = false` in
`builtins-test` since these no longer cause issues. This is unlikely to
be used but it is better to not quietly skip if anything ever gets added
by accident.
2025-04-19 22:30:58 -04:00
Trevor Gross
b0d6024f20 ci: Update ci/run-docker.sh to match libm
Prepare for having the repositories combined by ensuring EMULATED,
RUST_BACKTRACE, and CI are set or forwarded as applicable. Also
re-indent the file to four spaces and do some reorganization.
2025-04-19 01:04:33 -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
Trevor Gross
92b1e8454d Rename testcrate to builtins-test
The repo will soon have `libm` as a top-level crate, so make it clear
that this is only the test crate for `compiler-builtins`.
2025-04-18 21:14:41 -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
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
a179959e0b Move examples/intrinsics.rs to its own crate
Currently there is an interesting situation with the way features get
enabled; `testcrate` enables `mangled-names`, but the `intrinsics.rs`
example requires this feature be disabled (otherwise the test fails with
missing symbols, as expected). This is also the reason that `testcrate`
is not a default workspace member, meaning `cargo test` doesn't actually
run `testcrate`'s tests; making it a default member would mean that
`compiler-builtins/mangled-names` gets enabled when
`examples/intrinsics.rs` gets built, due to the way features get
unified.

Simplify the situation by making moving the example to its own crate as
`builtins-test-intrinsics`. This also means `testcrate` can become a
default member so it is included in `cargo check` or `cargo test` when
run at the workspace root.

`testcrate` and `builtins-test-intrinsics` still can't be built at the
same time since there isn't a straightforward way to have Cargo build
`compiler-builtins` twice with different features. This is a side effect
of us using non-additive features, but there isn't really a better
option since enabling both mangled and unmangled names would render
`builtins-test-intrinsics` useless.
2025-03-18 05:35:19 -05:00
WANG Rui
ec673535f7 ci: add support for loongarch64-unknown-linux-gnu 2024-11-01 05:48:47 -05:00
Trevor Gross
0c97b10dc0 Add riscv64gc to CI
There is a proposal to promote `riscv64gc-unknown-linux-gnu` to tier 1
[1]. We do not currently test RISC-V in CI; add it here.

[1]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Imminent.20RFC.20PR.3A.20riscv64gc-unknown-linux-gnu.20to.20Tier-1
2024-10-02 16:35:28 -04:00
Trevor Gross
85cd4c0660 Fix some warnings from shellcheck 2024-09-28 21:24:44 -04:00
Trevor Gross
fdec3b6514 Fix unset variables in the build script
These were preventing building via Docker locally.
2024-06-22 16:15:46 +02:00
Trevor Gross
f2092967cb Update the Ubuntu docker image to the latest version 2024-06-22 05:58:25 -04:00
Trevor Gross
98ddf3c66d Enable cache for Docker images 2024-05-24 23:18:59 +02:00
Trevor Gross
6cd17ff4d2 Add benchmarks for floating point math
This adds comparisons among the compiler-builtins function, system
functions if available, and optionally handwritten assembly.

These also help us identify inconsistencies between this crate and
system functions, which may otherwise go unnoticed if intrinsics get
lowered to inline operations rather than library calls.
2024-05-24 02:49:41 -04:00
Henry Wang
7d60c93165 Only run --features c for verbatim test 2024-05-21 01:09:47 +02:00
theKidOfArcrania
416be726df verbatim tests only need to build 2024-05-21 01:09:47 +02:00
theKidOfArcrania
fd290b1339 Properly escape /C and fix naming 2024-05-21 01:09:47 +02:00
theKidOfArcrania
e3d86a8350 Instead have cmd.exe dump out path 2024-05-21 01:09:47 +02:00
theKidOfArcrania
0000f98d73 Fix backslash 2024-05-21 01:09:47 +02:00
theKidOfArcrania
e246ba5a46 Use cmd.exe 2024-05-21 01:09:47 +02:00
theKidOfArcrania
24cb0c2bcc Fix CI 2024-05-21 01:09:47 +02:00
theKidOfArcrania
3fdef93258 Add tests for UNC paths on windows builds 2024-05-21 01:09:47 +02:00
Trevor Gross
4509315d2f Enable no-fail-fast for more usable test output 2024-05-15 07:19:17 -05:00