Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
resolver = "3"
members = [
# Note that builtins-test-intrinsics cannot be a default member because it
# needs the `mangled-names` feature disabled, while `testcrate` needs it
# enabled.
# needs the `mangled-names` feature disabled, while `builtins-test` needs
# it enabled.
"builtins-test",
"builtins-test-intrinsics",
"compiler-builtins",
"testcrate",
]

default-members = [
"compiler-builtins",
"testcrate",
"builtins-test",
]

[profile.release]
Expand Down
7 changes: 4 additions & 3 deletions testcrate/Cargo.toml → builtins-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "testcrate"
name = "builtins-test"
version = "0.1.0"
authors = ["Alex Crichton <[email protected]>"]
edition = "2024"
Expand Down Expand Up @@ -56,8 +56,9 @@ icount = ["dep:iai-callgrind"]
benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]

# NOTE: benchmarks must be run with `--no-default-features` or with
# `-p testcrate`, otherwise the default `compiler-builtins` feature of the
# `compiler_builtins` crate gets activated, resulting in linker errors.
# `-p builtins-test`, otherwise the default `compiler-builtins` feature
# of the `compiler_builtins` crate gets activated, resulting in linker
# errors.

[[bench]]
name = "float_add"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use compiler_builtins::float::add;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

float_bench! {
name: add_f32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

use compiler_builtins::float::cmp;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![allow(improper_ctypes)]
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use compiler_builtins::float::conv;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

/* unsigned int -> float */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use compiler_builtins::float::div;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

float_bench! {
name: div_f32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![cfg_attr(f128_enabled, feature(f128))]
#![cfg_attr(f16_enabled, feature(f16))]

use builtins_test::float_bench;
use compiler_builtins::float::extend;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

#[cfg(f16_enabled)]
float_bench! {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use compiler_builtins::float::mul;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

float_bench! {
name: mul_f32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use compiler_builtins::float::pow;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

float_bench! {
name: powi_f32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg_attr(f128_enabled, feature(f128))]

use builtins_test::float_bench;
use compiler_builtins::float::sub;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

float_bench! {
name: sub_f32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg_attr(f128_enabled, feature(f128))]
#![cfg_attr(f16_enabled, feature(f16))]

use builtins_test::float_bench;
use compiler_builtins::float::trunc;
use criterion::{Criterion, criterion_main};
use testcrate::float_bench;

#[cfg(f16_enabled)]
float_bench! {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions testcrate/src/lib.rs → builtins-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//! edge case testing is crucial for checking cases like where both inputs are equal or equal to
//! special values such as `i128::MIN`, which is unlikely for the random fuzzer by itself to
//! encounter. The randomized fuzz testing is specially designed to cover wide swaths of search
//! space in as few iterations as possible. See `fuzz_values` in `testcrate/tests/misc.rs` for an
//! example.
//! space in as few iterations as possible. See `fuzz_values` in `builtins-test/tests/misc.rs` for
//! an example.
//!
//! Some floating point tests are disabled for specific architectures, because they do not have
//! correct rounding.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(unused_macros)]
#![cfg_attr(f128_enabled, feature(f128))]

use testcrate::*;
use builtins_test::*;

mod int_addsub {
use super::*;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion testcrate/tests/cmp.rs → builtins-test/tests/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![allow(unreachable_code)]
#![cfg_attr(f128_enabled, feature(f128))]

use testcrate::*;
use builtins_test::*;

mod float_comparisons {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion testcrate/tests/conv.rs → builtins-test/tests/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#![allow(unused_macros)]
#![allow(unused_imports)]

use builtins_test::*;
use compiler_builtins::float::Float;
use rustc_apfloat::{Float as _, FloatConvert as _};
use testcrate::*;

mod i_to_f {
use super::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use compiler_builtins::int::sdiv::{__divmoddi4, __divmodsi4, __divmodti4};
use compiler_builtins::int::udiv::{__udivmoddi4, __udivmodsi4, __udivmodti4, u128_divide_sparc};

use testcrate::*;
use builtins_test::*;

// Division algorithms have by far the nastiest and largest number of edge cases, and experience shows
// that sometimes 100_000 iterations of the random fuzzer is needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![cfg_attr(f128_enabled, feature(f128))]
#![cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))]

use testcrate::*;
use builtins_test::*;

// This is approximate because of issues related to
// https://github.com/rust-lang/rust/issues/73920.
Expand Down
6 changes: 3 additions & 3 deletions testcrate/tests/lse.rs → builtins-test/tests/lse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod cas {
pub(super) macro test($_ordering:ident, $bytes:tt, $name:ident) {
#[test]
fn $name() {
testcrate::fuzz_2(10000, |expected: super::int_ty!($bytes), new| {
builtins_test::fuzz_2(10000, |expected: super::int_ty!($bytes), new| {
let mut target = expected.wrapping_add(10);
assert_eq!(
unsafe {
Expand Down Expand Up @@ -50,7 +50,7 @@ mod swap {
pub(super) macro test($_ordering:ident, $bytes:tt, $name:ident) {
#[test]
fn $name() {
testcrate::fuzz_2(10000, |left: super::int_ty!($bytes), mut right| {
builtins_test::fuzz_2(10000, |left: super::int_ty!($bytes), mut right| {
let orig_right = right;
assert_eq!(
unsafe { compiler_builtins::aarch64_linux::$name::$name(left, &mut right) },
Expand All @@ -69,7 +69,7 @@ macro_rules! test_op {
($_ordering:ident, $bytes:tt, $name:ident) => {
#[test]
fn $name() {
testcrate::fuzz_2(10000, |old, val| {
builtins_test::fuzz_2(10000, |old, val| {
let mut target = old;
let op: fn(super::int_ty!($bytes), super::int_ty!($bytes)) -> _ = $($op)*;
let expected = op(old, val);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion testcrate/tests/misc.rs → builtins-test/tests/misc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// makes configuration easier
#![allow(unused_macros)]

use testcrate::*;
use builtins_test::*;

/// Make sure that the the edge case tester and randomized tester don't break, and list examples of
/// fuzz values for documentation purposes.
Expand Down
2 changes: 1 addition & 1 deletion testcrate/tests/mul.rs → builtins-test/tests/mul.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(unused_macros)]
#![cfg_attr(f128_enabled, feature(f128))]

use testcrate::*;
use builtins_test::*;

mod int_mul {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion testcrate/tests/shift.rs → builtins-test/tests/shift.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use testcrate::*;
use builtins_test::*;

macro_rules! shift {
($($i:ty, $fn_std:ident, $fn_builtins:ident);*;) => {
Expand Down
2 changes: 1 addition & 1 deletion ci/miri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ TARGETS=(x86_64-unknown-linux-gnu
s390x-unknown-linux-gnu)
for TARGET in "${TARGETS[@]}"; do
# Only run the `mem` tests to avoid this taking too long.
cargo miri test --manifest-path testcrate/Cargo.toml --features no-asm --target $TARGET -- mem
cargo miri test --manifest-path builtins-test/Cargo.toml --features no-asm --target $TARGET -- mem
done
6 changes: 3 additions & 3 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
if [ "${NO_STD:-}" = "1" ]; then
echo "nothing to do for no_std"
else
run="cargo test --package testcrate --no-fail-fast --target $target"
run="cargo test --package builtins-test --no-fail-fast --target $target"
$run
$run --release
$run --features c
Expand All @@ -37,8 +37,8 @@ else
fi

if [ "${TEST_VERBATIM:-}" = "1" ]; then
verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\testcrate\\target2)
cargo build --package testcrate \
verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2)
cargo build --package builtins-test \
--target "$target" --target-dir "$verb_path" --features c
fi

Expand Down
2 changes: 1 addition & 1 deletion compiler-builtins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ mangled-names = []
rustc-dep-of-std = ['compiler-builtins', 'core']

# This makes certain traits and function specializations public that
# are not normally public but are required by the `testcrate`
# are not normally public but are required by the `builtins-test`
public-test-deps = []

[lints.rust]
Expand Down
2 changes: 1 addition & 1 deletion compiler-builtins/configure.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Configuration that is shared between `compiler_builtins` and `testcrate`.
// Configuration that is shared between `compiler_builtins` and `builtins_test`.

use std::env;

Expand Down
4 changes: 2 additions & 2 deletions compiler-builtins/src/int/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pub trait Int:
+ ops::BitAnd<Output = Self>
{
/// LUT used for maximizing the space covered and minimizing the computational cost of fuzzing
/// in `testcrate`. For example, Self = u128 produces [0,1,2,7,8,15,16,31,32,63,64,95,96,111,
/// 112,119,120,125,126,127].
/// in `builtins-test`. For example, Self = u128 produces [0,1,2,7,8,15,16,31,32,63,64,95,96,
/// 111,112,119,120,125,126,127].
const FUZZ_LENGTHS: [u8; 20] = make_fuzz_lengths(<Self as MinInt>::BITS);

/// The number of entries of `FUZZ_LENGTHS` actually used. The maximum is 20 for u128.
Expand Down
Loading