Skip to content

compiler-builtins subtree update #144974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ed50029
ci: Switch to nightly rustfmt
tgross35 Jul 21, 2025
08bca4d
ci: Add native PowerPC64LE and s390x jobs
tgross35 Jul 23, 2025
fcc7824
ci: Update to the latest ubuntu:25.04 Docker images
tgross35 Jul 24, 2025
95c4263
symcheck: Switch the `object` dependency from git to crates.io
tgross35 Jul 24, 2025
83aea65
ci: Use a mirror for musl
tgross35 Jul 24, 2025
5c4abe9
ci: Upgrade ubuntu:25.04 for the PowerPC64LE test
tgross35 Jul 24, 2025
43c3e1b
Enable tests that were skipped on PowerPC
tgross35 Jul 24, 2025
b168793
Enable tests that were skipped on aarch64
tgross35 Jul 24, 2025
0b6c1d3
Enable skipped `f32` and `f64` multiplication tests
tgross35 Jul 24, 2025
9dad77f
Use `x86_no_sse` configuration in more places
tgross35 Jul 24, 2025
4743158
libm: Update for new warn-by-default clippy lints
tgross35 Jul 26, 2025
c061e73
Avoid inlining `floor` into `rem_pio2`
quaternic Jul 27, 2025
9c683d3
Implement `floor` and `ceil` in assembly on `i586`
folkertdev Jul 27, 2025
16cb37c
Remove `no-asm` gating when there is no alternative implementation
tgross35 Jul 25, 2025
54f6ab7
Switch to using a GH app for authenticating sync PRs
Kobzol Jul 29, 2025
54a4f86
cleanup: Trim trailing whitespace
tgross35 Jul 29, 2025
97c35d3
ci: Simplify tests for verbatim paths
tgross35 Jul 29, 2025
ab8a2e1
ci: Switch to strongly typed directives
tgross35 Jul 30, 2025
eafafc4
ci: Don't print output twice in `ci-util`
tgross35 Jul 30, 2025
c045c9b
ci: Commonize the way `PrInfo` is loaded from env
tgross35 Jul 30, 2025
4ebfdf7
ci: Add a way to run `libm` tests that would otherwise be skipped
tgross35 Jul 30, 2025
3cbd088
ci: Set pipefail before running ci-util
tgross35 Jul 30, 2025
ecf6d3c
Simplify the configuration for no-panic
tgross35 Jul 30, 2025
fbc700f
configure: Use `CARGO_CFG_*_{F16,F128}` rather than invoking rustc
tgross35 Aug 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions library/compiler-builtins/.github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
- name: Fetch pull request ref
run: git fetch origin "$GITHUB_REF:$GITHUB_REF"
if: github.event_name == 'pull_request'
- run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT"
- run: |
set -eo pipefail # Needed to actually fail the job if ci-util fails
python3 ci/ci-util.py generate-matrix | tee "$GITHUB_OUTPUT"
id: script

test:
Expand All @@ -50,7 +52,6 @@ jobs:
os: ubuntu-24.04-arm
- target: aarch64-pc-windows-msvc
os: windows-2025
test_verbatim: 1
build_only: 1
- target: arm-unknown-linux-gnueabi
os: ubuntu-24.04
Expand All @@ -70,8 +71,12 @@ jobs:
os: ubuntu-24.04
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-24.04
- target: powerpc64le-unknown-linux-gnu
os: ubuntu-24.04-ppc64le
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-24.04
- target: s390x-unknown-linux-gnu
os: ubuntu-24.04-s390x
- target: thumbv6m-none-eabi
os: ubuntu-24.04
- target: thumbv7em-none-eabi
Expand All @@ -88,10 +93,8 @@ jobs:
os: macos-13
- target: i686-pc-windows-msvc
os: windows-2025
test_verbatim: 1
- target: x86_64-pc-windows-msvc
os: windows-2025
test_verbatim: 1
- target: i686-pc-windows-gnu
os: windows-2025
channel: nightly-i686-gnu
Expand All @@ -102,11 +105,23 @@ jobs:
needs: [calculate_vars]
env:
BUILD_ONLY: ${{ matrix.build_only }}
TEST_VERBATIM: ${{ matrix.test_verbatim }}
MAY_SKIP_LIBM_CI: ${{ needs.calculate_vars.outputs.may_skip_libm_ci }}
steps:
- name: Print $HOME
shell: bash
run: |
set -x
echo "${HOME:-not found}"
pwd
printenv
- name: Print runner information
run: uname -a

# Native ppc and s390x runners don't have rustup by default
- name: Install rustup
if: matrix.os == 'ubuntu-24.04-ppc64le' || matrix.os == 'ubuntu-24.04-s390x'
run: sudo apt-get update && sudo apt-get install -y rustup

- uses: actions/checkout@v4
- name: Install Rust (rustup)
shell: bash
Expand All @@ -117,7 +132,12 @@ jobs:
rustup update "$channel" --no-self-update
rustup default "$channel"
rustup target add "${{ matrix.target }}"

# Our scripts use nextest if possible. This is skipped on the native ppc
# and s390x runners since install-action doesn't support them.
- uses: taiki-e/install-action@nextest
if: "!(matrix.os == 'ubuntu-24.04-ppc64le' || matrix.os == 'ubuntu-24.04-s390x')"

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
Expand All @@ -144,7 +164,7 @@ jobs:
shell: bash
- run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV"
shell: bash

- name: Download musl source
run: ./ci/update-musl.sh
shell: bash
Expand Down Expand Up @@ -256,7 +276,7 @@ jobs:
with:
name: ${{ env.BASELINE_NAME }}
path: ${{ env.BASELINE_NAME }}.tar.xz

- name: Run wall time benchmarks
run: |
# Always use the same seed for benchmarks. Ideally we should switch to a
Expand Down Expand Up @@ -311,8 +331,8 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install stable `rustfmt`
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
- name: Install nightly `rustfmt`
run: rustup set profile minimal && rustup default nightly && rustup component add rustfmt
- run: cargo fmt -- --check

extensive:
Expand Down
5 changes: 3 additions & 2 deletions library/compiler-builtins/.github/workflows/rustc-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
if: github.repository == 'rust-lang/compiler-builtins'
uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main
with:
github-app-id: ${{ vars.APP_CLIENT_ID }}
# https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/compiler-builtins.20subtree.20sync.20automation/with/528482375
zulip-stream-id: 219381
zulip-topic: 'compiler-builtins subtree sync automation'
zulip-bot-email: "[email protected]"
zulip-bot-email: "[email protected]"
pr-base-branch: master
branch-name: rustc-pull
secrets:
zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
github-app-secret: ${{ secrets.APP_PRIVATE_KEY }}
5 changes: 3 additions & 2 deletions library/compiler-builtins/builtins-shim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ default = ["compiler-builtins"]
# implementations and also filling in unimplemented intrinsics
c = ["dep:cc"]

# Workaround for the Cranelift codegen backend. Disables any implementations
# which use inline assembly and fall back to pure Rust versions (if available).
# For implementations where there is both a generic version and a platform-
# specific version, use the generic version. This is meant to enable testing
# the generic versions on all platforms.
no-asm = []

# Workaround for codegen backends which haven't yet implemented `f16` and
Expand Down
84 changes: 16 additions & 68 deletions library/compiler-builtins/builtins-test-intrinsics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ mod intrinsics {
x as f64
}

#[cfg(all(
f16_enabled,
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(all(f16_enabled, f128_enabled))]
pub fn extendhftf(x: f16) -> f128 {
x as f128
}
Expand Down Expand Up @@ -201,11 +197,7 @@ mod intrinsics {

/* f128 operations */

#[cfg(all(
f16_enabled,
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(all(f16_enabled, f128_enabled))]
pub fn trunctfhf(x: f128) -> f16 {
x as f16
}
Expand All @@ -220,50 +212,32 @@ mod intrinsics {
x as f64
}

#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
pub fn fixtfsi(x: f128) -> i32 {
x as i32
}

#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
pub fn fixtfdi(x: f128) -> i64 {
x as i64
}

#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
pub fn fixtfti(x: f128) -> i128 {
x as i128
}

#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
pub fn fixunstfsi(x: f128) -> u32 {
x as u32
}

#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
pub fn fixunstfdi(x: f128) -> u64 {
x as u64
}

#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
pub fn fixunstfti(x: f128) -> u128 {
x as u128
}
Expand Down Expand Up @@ -540,47 +514,25 @@ fn run() {
bb(extendhfdf(bb(2.)));
#[cfg(f16_enabled)]
bb(extendhfsf(bb(2.)));
#[cfg(all(
f16_enabled,
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(all(f16_enabled, f128_enabled))]
bb(extendhftf(bb(2.)));
#[cfg(f128_enabled)]
bb(extendsftf(bb(2.)));
bb(fixdfti(bb(2.)));
bb(fixsfti(bb(2.)));
#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
bb(fixtfdi(bb(2.)));
#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
bb(fixtfsi(bb(2.)));
#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
bb(fixtfti(bb(2.)));
bb(fixunsdfti(bb(2.)));
bb(fixunssfti(bb(2.)));
#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
bb(fixunstfdi(bb(2.)));
#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
bb(fixunstfsi(bb(2.)));
#[cfg(all(
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(f128_enabled)]
bb(fixunstfti(bb(2.)));
#[cfg(f128_enabled)]
bb(floatditf(bb(2)));
Expand Down Expand Up @@ -616,11 +568,7 @@ fn run() {
bb(truncsfhf(bb(2.)));
#[cfg(f128_enabled)]
bb(trunctfdf(bb(2.)));
#[cfg(all(
f16_enabled,
f128_enabled,
not(any(target_arch = "powerpc", target_arch = "powerpc64"))
))]
#[cfg(all(f16_enabled, f128_enabled))]
bb(trunctfhf(bb(2.)));
#[cfg(f128_enabled)]
bb(trunctfsf(bb(2.)));
Expand Down
9 changes: 0 additions & 9 deletions library/compiler-builtins/builtins-test/benches/float_conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ float_bench! {

/* float -> unsigned int */

#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
float_bench! {
name: conv_f32_u32,
sig: (a: f32) -> u32,
Expand All @@ -387,7 +386,6 @@ float_bench! {
],
}

#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
float_bench! {
name: conv_f32_u64,
sig: (a: f32) -> u64,
Expand All @@ -409,7 +407,6 @@ float_bench! {
],
}

#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
float_bench! {
name: conv_f32_u128,
sig: (a: f32) -> u128,
Expand Down Expand Up @@ -505,7 +502,6 @@ float_bench! {

/* float -> signed int */

#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
float_bench! {
name: conv_f32_i32,
sig: (a: f32) -> i32,
Expand All @@ -527,7 +523,6 @@ float_bench! {
],
}

#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
float_bench! {
name: conv_f32_i64,
sig: (a: f32) -> i64,
Expand All @@ -549,7 +544,6 @@ float_bench! {
],
}

#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
float_bench! {
name: conv_f32_i128,
sig: (a: f32) -> i128,
Expand Down Expand Up @@ -666,9 +660,6 @@ pub fn float_conv() {
conv_f64_i128(&mut criterion);

#[cfg(f128_enabled)]
// FIXME: ppc64le has a sporadic overflow panic in the crate functions
// <https://github.com/rust-lang/compiler-builtins/issues/617#issuecomment-2125914639>
#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))]
{
conv_u32_f128(&mut criterion);
conv_u64_f128(&mut criterion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ float_bench! {
pub fn float_extend() {
let mut criterion = Criterion::default().configure_from_args();

// FIXME(#655): `f16` tests disabled until we can bootstrap symbols
#[cfg(f16_enabled)]
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
{
extend_f16_f32(&mut criterion);
extend_f16_f64(&mut criterion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ float_bench! {
pub fn float_trunc() {
let mut criterion = Criterion::default().configure_from_args();

// FIXME(#655): `f16` tests disabled until we can bootstrap symbols
#[cfg(f16_enabled)]
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
{
trunc_f32_f16(&mut criterion);
trunc_f64_f16(&mut criterion);
Expand All @@ -133,11 +131,8 @@ pub fn float_trunc() {

#[cfg(f128_enabled)]
{
// FIXME(#655): `f16` tests disabled until we can bootstrap symbols
#[cfg(f16_enabled)]
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
trunc_f128_f16(&mut criterion);

trunc_f128_f32(&mut criterion);
trunc_f128_f64(&mut criterion);
}
Expand Down
Loading
Loading