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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
"--test-successful-rustc --nb-parts 2 --current-part 0",
"--test-successful-rustc --nb-parts 2 --current-part 1",
"--projects",
"--gcc-asm-tests",
"--gcc-asm-tests --test-release-libcore",
]

steps:
Expand Down
16 changes: 14 additions & 2 deletions build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fn get_runners() -> Runners {
runners.insert("--run-ui-tests", ("Run specified rustc UI tests", run_ui_tests));
runners.insert("--projects", ("Run the tests of popular crates", test_projects));
runners.insert("--test-libcore", ("Run libcore tests", test_libcore));
runners.insert("--test-release-libcore", ("Run libcore tests", test_release_libcore));
runners.insert("--alloc-tests", ("Run alloc tests", test_alloc));
runners.insert("--clean", ("Empty cargo target directory", clean));
runners.insert("--build-sysroot", ("Build sysroot", build_sysroot));
Expand Down Expand Up @@ -766,12 +767,23 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
}

fn test_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
test_libcore_inner(env, args, false)
}

fn test_release_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
test_libcore_inner(env, args, true)
}

fn test_libcore_inner(env: &Env, args: &TestArg, release: bool) -> Result<(), String> {
// FIXME: create a function "display_if_not_quiet" or something along the line.
println!("[TEST] libcore");
let path = get_sysroot_dir().join("sysroot_src/library/coretests");
let _ = remove_dir_all(path.join("target"));
// FIXME(antoyo): run in release mode when we fix the failures.
run_cargo_command(&[&"test"], Some(&path), env, args)?;
let mut command: Vec<&dyn AsRef<OsStr>> = vec![&"test"];
if release {
command.push(&"--release");
}
run_cargo_command(&command, Some(&path), env, args)?;
Ok(())
}

Expand Down
21 changes: 18 additions & 3 deletions src/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
} else {
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
if a_type != b_type {
b = self.gcc_int_cast(b, a_type);
}
let signed = a_type.is_compatible_with(self.i128_type);
let func_name = match (operation, signed) {
(BinaryOp::Plus, true) => "__rust_i128_add",
Expand All @@ -187,7 +190,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
_ => unreachable!("unexpected additive operation {:?}", operation),
};
let param_a = self.context.new_parameter(self.location, a_type, "a");
let param_b = self.context.new_parameter(self.location, b_type, "b");
let param_b = self.context.new_parameter(self.location, a_type, "b");
let func = self.context.new_function(
self.location,
FunctionType::Extern,
Expand Down Expand Up @@ -238,10 +241,13 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
} else {
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
if a_type != b_type {
b = self.gcc_int_cast(b, a_type);
}
let sign = if signed { "" } else { "u" };
let func_name = format!("__{}{}ti3", sign, operation_name);
let param_a = self.context.new_parameter(self.location, a_type, "a");
let param_b = self.context.new_parameter(self.location, b_type, "b");
let param_b = self.context.new_parameter(self.location, a_type, "b");
let func = self.context.new_function(
self.location,
FunctionType::Extern,
Expand Down Expand Up @@ -470,7 +476,10 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
lhs_high = self.context.new_cast(self.location, lhs_high, signed_type);
rhs_high = self.context.new_cast(self.location, rhs_high, signed_type);
}
IntPredicate::IntEQ | IntPredicate::IntNE => (),
IntPredicate::IntEQ | IntPredicate::IntNE => {
lhs_high = self.context.new_cast(self.location, lhs_high, unsigned_type);
rhs_high = self.context.new_cast(self.location, rhs_high, unsigned_type);
}
}

let condition = self.context.new_comparison(
Expand Down Expand Up @@ -637,6 +646,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
}
a ^ b
} else {
if a_type != b_type {
b = self.gcc_int_cast(b, a_type);
}
self.concat_low_high_rvalues(
a_type,
self.low(a) ^ self.low(b),
Expand Down Expand Up @@ -846,6 +858,9 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
!a_native && !b_native,
"both types should either be native or non-native for or operation"
);
if a_type != b_type {
b = self.gcc_int_cast(b, a_type);
}
let native_int_type = a_type.dyncast_array().expect("get element type");
self.concat_low_high_rvalues(
a_type,
Expand Down
Loading