Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
74 changes: 74 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,80 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
}
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct IntrinsicTest {
host: TargetSelection,
}

impl Step for IntrinsicTest {
type Output = ();
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("library/stdarch/crates/intrinsic-test")
}
Comment on lines +916 to +918
Copy link
Copy Markdown
Contributor

@folkertdev folkertdev May 10, 2026

Choose a reason for hiding this comment

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

the intrinsic tests should also run when any of the source in core_arch changes (unless I'm misinterpreting what this function does).

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No you are not misinterpreting :) . You're so right I have added the core_arch path so it triggers . Thanks for the review.


fn is_default_step(_builder: &Builder<'_>) -> bool {
true
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(IntrinsicTest { host: run.target });
}

fn run(self, builder: &Builder<'_>) {
let host = self.host;

let (input_file, skip_file, runner, cppflags) = if host.contains("x86_64-unknown-linux") {
let cpuid_def =
builder.src.join("library/stdarch/ci/docker/x86_64-unknown-linux-gnu/cpuid.def");
let runner = format!(
"/intel-sde/sde64 -cpuid-in {} -rtm-mode full -tsx --",
cpuid_def.display()
);
(
builder.src.join("library/stdarch/intrinsics_data/x86-intel.xml"),
builder.src.join("library/stdarch/crates/intrinsic-test/missing_x86.txt"),
runner,
String::from("-fuse-ld=lld -I/usr/include/x86_64-linux-gnu/"),
)
} else if host.contains("aarch64-unknown-linux") {
(
builder.src.join("library/stdarch/intrinsics_data/arm_intrinsics.json"),
builder.src.join("library/stdarch/crates/intrinsic-test/missing_aarch64.txt"),
String::from("env"),
String::from(""),
)
} else {
return;
};

let out_dir = builder.out.join(host).join("intrinsic-test");
t!(fs::create_dir_all(&out_dir));

let mut cmd = builder.tool_cmd(Tool::IntrinsicTest);
cmd.current_dir(&out_dir);
cmd.arg(&input_file);
cmd.arg("--target").arg(&*host.triple);
cmd.arg("--cppcompiler").arg("clang++");
cmd.arg("--runner").arg(&runner);
cmd.arg("--skip").arg(&skip_file);
cmd.arg("--sample-percentage").arg("10");
cmd.env("CPPFLAGS", &cppflags);

if let Some(cargo_dir) = builder.initial_cargo.parent() {
let old_path = env::var_os("PATH").unwrap_or_default();
let new_path = env::join_paths(
iter::once(cargo_dir.to_path_buf()).chain(env::split_paths(&old_path)),
)
.expect("Could not prepend cargo bin path to PATH");
cmd.env("PATH", new_path);
}

cmd.delay_failure().run(builder);
}
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Clippy {
compilers: RustcPrivateCompilers,
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ bootstrap_tool!(
FeaturesStatusDump, "src/tools/features-status-dump", "features-status-dump";
OptimizedDist, "src/tools/opt-dist", "opt-dist", submodules = &["src/tools/rustc-perf"];
RunMakeSupport, "src/tools/run-make-support", "run_make_support", artifact_kind = ToolArtifactKind::Library;
IntrinsicTest, "library/stdarch/crates/intrinsic-test", "intrinsic-test", is_external_tool = true;
);

/// These are the submodules that are required for rustbook to work due to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ expression: test
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::IntrinsicTest
targets: [x86_64-unknown-linux-gnu]
- Set({test::library/stdarch/crates/intrinsic-test})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ expression: test library
- Set({test::library/sysroot})
- Set({test::library/test})
- Set({test::library/unwind})
[Test] test::IntrinsicTest
targets: [x86_64-unknown-linux-gnu]
- Set({test::library/stdarch/crates/intrinsic-test})
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ expression: test --skip=coverage
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::IntrinsicTest
targets: [x86_64-unknown-linux-gnu]
- Set({test::library/stdarch/crates/intrinsic-test})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js-std)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ expression: test --skip=tests
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::IntrinsicTest
targets: [x86_64-unknown-linux-gnu]
- Set({test::library/stdarch/crates/intrinsic-test})
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rustdoc-themes})
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ impl<'a> Builder<'a> {
test::CargoMiri,
test::Clippy,
test::CompiletestTest,
test::IntrinsicTest,
test::CrateRunMakeSupport,
test::CrateBuildHelper,
test::RustdocJSStd,
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,7 @@ mod snapshot {
[test] link-check <host>
[test] tier-check <host>
[test] rustc 0 <host> -> rust-analyzer 1 <host>
[build] rustc 0 <host> -> IntrinsicTest 1 <host>
[build] rustc 0 <host> -> RustdocTheme 1 <host>
[test] rustdoc-theme 1 <host>
[test] compiletest-rustdoc-ui 1 <host>
Expand Down Expand Up @@ -2321,6 +2322,7 @@ mod snapshot {
[test] rustc 1 <host> -> rust-analyzer 2 <host>
[doc] rustc (book) <host>
[test] rustc 1 <host> -> lint-docs 2 <host>
[build] rustc 0 <host> -> IntrinsicTest 1 <host>
[build] rustc 0 <host> -> RustdocTheme 1 <host>
[test] rustdoc-theme 2 <host>
[test] compiletest-rustdoc-ui 2 <host>
Expand Down
2 changes: 2 additions & 0 deletions src/ci/docker/host-aarch64/aarch64-gnu-llvm-21/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gdb \
llvm-21-tools \
llvm-21-dev \
clang \
lld \
libedit-dev \
libssl-dev \
pkg-config \
Expand Down
5 changes: 4 additions & 1 deletion src/ci/docker/host-aarch64/aarch64-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
pkg-config \
xz-utils \
clang \
lld \
&& rm -rf /var/lib/apt/lists/*



COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

Expand Down
2 changes: 2 additions & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-llvm-21/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gdb \
llvm-21-tools \
llvm-21-dev \
clang \
lld \
libedit-dev \
libssl-dev \
pkg-config \
Expand Down
2 changes: 2 additions & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-llvm-22/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gdb \
llvm-22-tools \
llvm-22-dev \
clang \
lld \
libedit-dev \
libssl-dev \
pkg-config \
Expand Down
8 changes: 8 additions & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
mingw-w64 \
zlib1g-dev \
libzstd-dev \
clang \
lld \
&& rm -rf /var/lib/apt/lists/*

# Install Intel SDE for AVX-512 emulation
RUN curl -L http://ci-mirrors.rust-lang.org/sde-external-10.8.0-2026-03-15-lin.tar.xz -o /tmp/sde.tar.xz \
&& mkdir -p /intel-sde \
&& tar -xJf /tmp/sde.tar.xz --strip-components=1 -C /intel-sde \
&& rm /tmp/sde.tar.xz
Comment on lines +27 to +30
Copy link
Copy Markdown
Contributor

@folkertdev folkertdev May 10, 2026

Choose a reason for hiding this comment

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

this doesn't need an instant fix, but we bump the version of this tool occasionally, so ideally we'd sync that version between the repositories.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, noted.


COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

Expand Down
Loading