Skip to content

Commit 5f4a90e

Browse files
authored
Rollup merge of #148402 - folkertdev:stdarch-sync-nov-2025, r=sayantn
stdarch subtree update Subtree update of `stdarch` to rust-lang/stdarch@b5c1645. Created using https://github.com/rust-lang/josh-sync. r? `@sayantn` --- Only the last 2 commits contain manual changes to some incorrect miri tests. The remainder is mechanical, and just synchronizes changes from stdarch.
2 parents 4104f80 + be22a3f commit 5f4a90e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+14183
-2105
lines changed

library/core/src/hint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ pub fn spin_loop() {
271271
crate::cfg_select! {
272272
target_arch = "x86" => {
273273
// SAFETY: the `cfg` attr ensures that we only execute this on x86 targets.
274-
unsafe { crate::arch::x86::_mm_pause() }
274+
crate::arch::x86::_mm_pause()
275275
}
276276
target_arch = "x86_64" => {
277277
// SAFETY: the `cfg` attr ensures that we only execute this on x86_64 targets.
278-
unsafe { crate::arch::x86_64::_mm_pause() }
278+
crate::arch::x86_64::_mm_pause()
279279
}
280280
target_arch = "riscv32" => crate::arch::riscv32::pause(),
281281
target_arch = "riscv64" => crate::arch::riscv64::pause(),

library/stdarch/.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,43 @@ jobs:
249249
env:
250250
TARGET: ${{ matrix.target.tuple }}
251251

252+
intrinsic-test:
253+
needs: [style]
254+
name: Intrinsic Test
255+
runs-on: ubuntu-latest
256+
strategy:
257+
matrix:
258+
target:
259+
- aarch64-unknown-linux-gnu
260+
- aarch64_be-unknown-linux-gnu
261+
- armv7-unknown-linux-gnueabihf
262+
- arm-unknown-linux-gnueabihf
263+
- x86_64-unknown-linux-gnu
264+
profile: [dev, release]
265+
include:
266+
- target: aarch64_be-unknown-linux-gnu
267+
build_std: true
268+
269+
steps:
270+
- uses: actions/checkout@v4
271+
- name: Install Rust
272+
run: |
273+
rustup update nightly --no-self-update
274+
rustup default nightly
275+
- run: rustup target add ${{ matrix.target }}
276+
if: ${{ (matrix.build_std || false) == false }}
277+
- run: |
278+
rustup component add rust-src
279+
echo "CARGO_UNSTABLE_BUILD_STD=std" >> $GITHUB_ENV
280+
if: ${{ matrix.build_std }}
281+
282+
# Configure some env vars based on matrix configuration
283+
- run: echo "PROFILE=--profile=${{ matrix.profile }}" >> $GITHUB_ENV
284+
- run: ./ci/intrinsic-test-docker.sh ${{ matrix.target }}
285+
if: ${{ !startsWith(matrix.target, 'thumb') }}
286+
env:
287+
TARGET: ${{ matrix.target }}
288+
252289
# Check that the generated files agree with the checked-in versions.
253290
check-stdarch-gen:
254291
needs: [style]
@@ -276,6 +313,7 @@ jobs:
276313
- docs
277314
- verify
278315
- test
316+
- intrinsic-test
279317
- check-stdarch-gen
280318
runs-on: ubuntu-latest
281319
# We need to ensure this job does *not* get skipped if its dependencies fail,

library/stdarch/Cargo.lock

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,11 @@ dependencies = [
347347
"itertools",
348348
"log",
349349
"pretty_env_logger",
350+
"quick-xml 0.37.5",
350351
"rayon",
352+
"regex",
351353
"serde",
354+
"serde-xml-rs",
352355
"serde_json",
353356
]
354357

@@ -404,9 +407,9 @@ checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
404407

405408
[[package]]
406409
name = "memchr"
407-
version = "2.7.5"
410+
version = "2.7.6"
408411
source = "registry+https://github.com/rust-lang/crates.io-index"
409-
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
412+
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
410413

411414
[[package]]
412415
name = "once_cell_polyfill"
@@ -452,6 +455,16 @@ dependencies = [
452455
"serde",
453456
]
454457

458+
[[package]]
459+
name = "quick-xml"
460+
version = "0.37.5"
461+
source = "registry+https://github.com/rust-lang/crates.io-index"
462+
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
463+
dependencies = [
464+
"memchr",
465+
"serde",
466+
]
467+
455468
[[package]]
456469
name = "quickcheck"
457470
version = "1.0.3"
@@ -587,6 +600,18 @@ dependencies = [
587600
"serde_derive",
588601
]
589602

603+
[[package]]
604+
name = "serde-xml-rs"
605+
version = "0.8.1"
606+
source = "registry+https://github.com/rust-lang/crates.io-index"
607+
checksum = "53630160a98edebde0123eb4dfd0fce6adff091b2305db3154a9e920206eb510"
608+
dependencies = [
609+
"log",
610+
"serde",
611+
"thiserror",
612+
"xml-rs",
613+
]
614+
590615
[[package]]
591616
name = "serde_derive"
592617
version = "1.0.219"
@@ -698,7 +723,7 @@ name = "stdarch-verify"
698723
version = "0.1.0"
699724
dependencies = [
700725
"proc-macro2",
701-
"quick-xml",
726+
"quick-xml 0.33.0",
702727
"quote",
703728
"serde",
704729
"serde_json",
@@ -746,6 +771,26 @@ dependencies = [
746771
"winapi-util",
747772
]
748773

774+
[[package]]
775+
name = "thiserror"
776+
version = "1.0.69"
777+
source = "registry+https://github.com/rust-lang/crates.io-index"
778+
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
779+
dependencies = [
780+
"thiserror-impl",
781+
]
782+
783+
[[package]]
784+
name = "thiserror-impl"
785+
version = "1.0.69"
786+
source = "registry+https://github.com/rust-lang/crates.io-index"
787+
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
788+
dependencies = [
789+
"proc-macro2",
790+
"quote",
791+
"syn",
792+
]
793+
749794
[[package]]
750795
name = "unicode-ident"
751796
version = "1.0.18"
@@ -958,6 +1003,12 @@ version = "0.53.0"
9581003
source = "registry+https://github.com/rust-lang/crates.io-index"
9591004
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
9601005

1006+
[[package]]
1007+
name = "xml-rs"
1008+
version = "0.8.27"
1009+
source = "registry+https://github.com/rust-lang/crates.io-index"
1010+
checksum = "6fd8403733700263c6eb89f192880191f1b83e332f7a20371ddcf421c4a337c7"
1011+
9611012
[[package]]
9621013
name = "yaml-rust"
9631014
version = "0.4.5"

library/stdarch/ci/docker/wasm32-wasip1/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
77
xz-utils \
88
clang
99

10-
ENV VERSION=v34.0.1
10+
ENV VERSION=v38.0.3
1111

1212
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/${VERSION}/wasmtime-${VERSION}-x86_64-linux.tar.xz | tar xJf -
1313
ENV PATH=$PATH:/wasmtime-${VERSION}-x86_64-linux
1414

15-
ENV CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime --dir /checkout/target/wasm32-wasip1/release/deps::."
15+
ENV CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime -Wexceptions --dir /checkout/target/wasm32-wasip1/release/deps::."

library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
66
make \
77
ca-certificates \
88
wget \
9-
xz-utils
9+
xz-utils \
10+
clang \
11+
libstdc++-14-dev \
12+
build-essential \
13+
lld
1014

1115
RUN wget http://ci-mirrors.rust-lang.org/stdarch/sde-external-9.58.0-2025-06-16-lin.tar.xz -O sde.tar.xz
1216
RUN mkdir intel-sde
1317
RUN tar -xJf sde.tar.xz --strip-components=1 -C intel-sde
1418
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/intel-sde/sde64 \
1519
-cpuid-in /checkout/ci/docker/x86_64-unknown-linux-gnu/cpuid.def \
1620
-rtm-mode full -tsx --"
17-
# These tests fail with SDE as it doesn't support saving register data
18-
ENV STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64"
21+
# SDE doesn't support AMD extensions
22+
# FIXME: find a way to test these
23+
ENV STDARCH_TEST_SKIP_FEATURE="sse4a,tbm,xop"

library/stdarch/ci/docker/x86_64-unknown-linux-gnu/cpuid.def

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# CPUID_VERSION = 1.0
1313
# Input => Output
1414
# EAX ECX => EAX EBX ECX EDX
15-
00000000 ******** => 00000024 68747541 444d4163 69746e65
15+
00000000 ******** => 00000024 756e6547 6c65746e 49656e69
1616
00000001 ******** => 00400f10 00100800 7ffaf3ff bfebfbff
1717
00000002 ******** => 76035a01 00f0b6ff 00000000 00c10000
1818
00000003 ******** => 00000000 00000000 00000000 00000000
@@ -49,7 +49,7 @@
4949
00000024 00000000 => 00000001 00070002 00000000 00000000 #AVX10
5050
00000024 00000001 => 00000000 00000000 00000004 00000000
5151
80000000 ******** => 80000008 00000000 00000000 00000000
52-
80000001 ******** => 00000000 00000000 00200961 2c100000
52+
80000001 ******** => 00000000 00000000 00000121 2c100000
5353
80000002 ******** => 00000000 00000000 00000000 00000000
5454
80000003 ******** => 00000000 00000000 00000000 00000000
5555
80000004 ******** => 00000000 00000000 00000000 00000000
@@ -59,5 +59,4 @@
5959
80000008 ******** => 00003028 00000200 00000200 00000000
6060

6161
# This file was copied from intel-sde/misc/cpuid/future/cpuid.def, and modified to
62-
# use "AuthenticAMD" as the vendor and the support for `XOP`, `SSE4a`, `TBM`,
63-
# `AVX512_VP2INTERSECT` and the VEX variants of AVX512 was added in the CPUID.
62+
# add support for `AVX512_VP2INTERSECT`
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env sh
2+
3+
# Small script to run tests for a target (or all targets) inside all the
4+
# respective docker images.
5+
6+
set -ex
7+
8+
if [ $# -lt 1 ]; then
9+
>&2 echo "Usage: $0 <TARGET>"
10+
exit 1
11+
fi
12+
13+
run() {
14+
# Set the linker that is used for the host (e.g. when compiling a build.rs)
15+
# This overrides any configuration in e.g. `.cargo/config.toml`, which will
16+
# probably not work within the docker container.
17+
HOST_LINKER="CARGO_TARGET_$(rustc --print host-tuple | tr '[:lower:]-' '[:upper:]_')_LINKER"
18+
19+
# Prevent `Read-only file system (os error 30)`.
20+
cargo generate-lockfile
21+
22+
echo "Building docker container for TARGET=${1}"
23+
docker build -t stdarch -f "ci/docker/${1}/Dockerfile" ci/
24+
mkdir -p target c_programs rust_programs
25+
echo "Running docker"
26+
# shellcheck disable=SC2016
27+
docker run \
28+
--rm \
29+
--user "$(id -u)":"$(id -g)" \
30+
--env CARGO_HOME=/cargo \
31+
--env CARGO_TARGET_DIR=/checkout/target \
32+
--env TARGET="${1}" \
33+
--env "${HOST_LINKER}"="cc" \
34+
--env STDARCH_DISABLE_ASSERT_INSTR \
35+
--env NOSTD \
36+
--env NORUN \
37+
--env RUSTFLAGS \
38+
--env CARGO_UNSTABLE_BUILD_STD \
39+
--volume "${HOME}/.cargo":/cargo \
40+
--volume "$(rustc --print sysroot)":/rust:ro \
41+
--volume "$(pwd)":/checkout:ro \
42+
--volume "$(pwd)"/target:/checkout/target \
43+
--volume "$(pwd)"/c_programs:/checkout/c_programs \
44+
--volume "$(pwd)"/rust_programs:/checkout/rust_programs \
45+
--init \
46+
--workdir /checkout \
47+
--privileged \
48+
stdarch \
49+
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/intrinsic-test.sh ${1}"
50+
}
51+
52+
if [ -z "$1" ]; then
53+
>&2 echo "No target specified!"
54+
exit 1
55+
else
56+
run "${1}"
57+
fi

0 commit comments

Comments
 (0)