1
Fork 0

Auto merge of #137796 - jieyouxu:rollup-qt9yr1g, r=jieyouxu

Rollup of 10 pull requests

Successful merges:

 - #134943 (Add FileCheck annotations to mir-opt/issues)
 - #137017 (Don't error when adding a staticlib with bitcode files compiled by newer LLVM)
 - #137197 (Update some comparison codegen tests now that they pass in LLVM20)
 - #137540 (Fix (more) test directives that were accidentally ignored)
 - #137551 (import `simd_` intrinsics)
 - #137599 (tests: use minicore more)
 - #137673 (Fix Windows `Command` search path bug)
 - #137676 (linker: Fix escaping style for response files on Windows)
 - #137693 (Re-enable `--generate-link-to-defintion` for tools internal rustdoc)
 - #137770 (Fix sized constraint for unsafe binder)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-03-01 00:53:19 +00:00
commit 30508faeb3
300 changed files with 1614 additions and 2162 deletions

View file

@ -132,14 +132,33 @@ fn get_llvm_object_symbols(
if err.is_null() { if err.is_null() {
return Ok(true); return Ok(true);
} else { } else {
return Err(unsafe { *Box::from_raw(err as *mut io::Error) }); let error = unsafe { *Box::from_raw(err as *mut io::Error) };
// These are the magic constants for LLVM bitcode files:
// https://github.com/llvm/llvm-project/blob/7eadc1960d199676f04add402bb0aa6f65b7b234/llvm/lib/BinaryFormat/Magic.cpp#L90-L97
if buf.starts_with(&[0xDE, 0xCE, 0x17, 0x0B]) || buf.starts_with(&[b'B', b'C', 0xC0, 0xDE])
{
// For LLVM bitcode, failure to read the symbols is not fatal. The bitcode may have been
// produced by a newer LLVM version that the one linked to rustc. This is fine provided
// that the linker does use said newer LLVM version. We skip writing the symbols for the
// bitcode to the symbol table of the archive. Traditional linkers don't like this, but
// newer linkers like lld, mold and wild ignore the symbol table anyway, so if they link
// against a new enough LLVM it will work out in the end.
// LLVM's archive writer also has this same behavior of only warning about invalid
// bitcode since https://github.com/llvm/llvm-project/pull/96848
// We don't have access to the DiagCtxt here to produce a nice warning in the correct format.
eprintln!("warning: Failed to read symbol table from LLVM bitcode: {}", error);
return Ok(true);
} else {
return Err(error);
}
} }
unsafe extern "C" fn callback(state: *mut c_void, symbol_name: *const c_char) -> *mut c_void { unsafe extern "C" fn callback(state: *mut c_void, symbol_name: *const c_char) -> *mut c_void {
let f = unsafe { &mut *(state as *mut &mut dyn FnMut(&[u8]) -> io::Result<()>) }; let f = unsafe { &mut *(state as *mut &mut dyn FnMut(&[u8]) -> io::Result<()>) };
match f(unsafe { CStr::from_ptr(symbol_name) }.to_bytes()) { match f(unsafe { CStr::from_ptr(symbol_name) }.to_bytes()) {
Ok(()) => std::ptr::null_mut(), Ok(()) => std::ptr::null_mut(),
Err(err) => Box::into_raw(Box::new(err)) as *mut c_void, Err(err) => Box::into_raw(Box::new(err) as Box<io::Error>) as *mut c_void,
} }
} }
@ -148,7 +167,7 @@ fn get_llvm_object_symbols(
Box::into_raw(Box::new(io::Error::new( Box::into_raw(Box::new(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,
format!("LLVM error: {}", error.to_string_lossy()), format!("LLVM error: {}", error.to_string_lossy()),
))) as *mut c_void )) as Box<io::Error>) as *mut c_void
} }
} }

View file

@ -1726,8 +1726,12 @@ fn exec_linker(
args.push_str( args.push_str(
&Escape { &Escape {
arg: arg.to_str().unwrap(), arg: arg.to_str().unwrap(),
// LLD also uses MSVC-like parsing for @-files by default when running on windows hosts // Windows-style escaping for @-files is used by
is_like_msvc: sess.target.is_like_msvc || (cfg!(windows) && flavor.uses_lld()), // - all linkers targeting MSVC-like targets, including LLD
// - all LLD flavors running on Windows hosts
// С/С++ compilers use Posix-style escaping (except clang-cl, which we do not use).
is_like_msvc: sess.target.is_like_msvc
|| (cfg!(windows) && flavor.uses_lld() && !flavor.uses_cc()),
} }
.to_string(), .to_string(),
); );

View file

@ -37,8 +37,6 @@ fn sized_constraint_for_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'
| Never | Never
| Dynamic(_, _, ty::DynStar) => None, | Dynamic(_, _, ty::DynStar) => None,
UnsafeBinder(_) => todo!(),
// these are never sized // these are never sized
Str | Slice(..) | Dynamic(_, _, ty::Dyn) | Foreign(..) => Some(ty), Str | Slice(..) | Dynamic(_, _, ty::Dyn) | Foreign(..) => Some(ty),
@ -52,9 +50,14 @@ fn sized_constraint_for_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'
sized_constraint_for_ty(tcx, ty) sized_constraint_for_ty(tcx, ty)
}), }),
// these can be sized or unsized // these can be sized or unsized.
Param(..) | Alias(..) | Error(_) => Some(ty), Param(..) | Alias(..) | Error(_) => Some(ty),
// We cannot instantiate the binder, so just return the *original* type back,
// but only if the inner type has a sized constraint. Thus we skip the binder,
// but don't actually use the result from `sized_constraint_for_ty`.
UnsafeBinder(inner_ty) => sized_constraint_for_ty(tcx, inner_ty.skip_binder()).map(|_| ty),
Placeholder(..) | Bound(..) | Infer(..) => { Placeholder(..) | Bound(..) | Infer(..) => {
bug!("unexpected type `{ty:?}` in sized_constraint_for_ty") bug!("unexpected type `{ty:?}` in sized_constraint_for_ty")
} }

View file

@ -1369,7 +1369,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "cmp_partialord_lt"] #[rustc_diagnostic_item = "cmp_partialord_lt"]
fn lt(&self, other: &Rhs) -> bool { fn lt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less)) self.partial_cmp(other).is_some_and(Ordering::is_lt)
} }
/// Tests less than or equal to (for `self` and `other`) and is used by the /// Tests less than or equal to (for `self` and `other`) and is used by the
@ -1387,7 +1387,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "cmp_partialord_le"] #[rustc_diagnostic_item = "cmp_partialord_le"]
fn le(&self, other: &Rhs) -> bool { fn le(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less | Equal)) self.partial_cmp(other).is_some_and(Ordering::is_le)
} }
/// Tests greater than (for `self` and `other`) and is used by the `>` /// Tests greater than (for `self` and `other`) and is used by the `>`
@ -1405,7 +1405,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "cmp_partialord_gt"] #[rustc_diagnostic_item = "cmp_partialord_gt"]
fn gt(&self, other: &Rhs) -> bool { fn gt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater)) self.partial_cmp(other).is_some_and(Ordering::is_gt)
} }
/// Tests greater than or equal to (for `self` and `other`) and is used by /// Tests greater than or equal to (for `self` and `other`) and is used by
@ -1423,7 +1423,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "cmp_partialord_ge"] #[rustc_diagnostic_item = "cmp_partialord_ge"]
fn ge(&self, other: &Rhs) -> bool { fn ge(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater | Equal)) self.partial_cmp(other).is_some_and(Ordering::is_ge)
} }
} }

View file

@ -11,7 +11,7 @@
/// `idx` must be in-bounds of the vector. /// `idx` must be in-bounds of the vector.
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T; pub const unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T;
/// Extracts an element from a vector. /// Extracts an element from a vector.
/// ///
@ -22,7 +22,7 @@ pub unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T;
/// `idx` must be in-bounds of the vector. /// `idx` must be in-bounds of the vector.
#[rustc_intrinsic] #[rustc_intrinsic]
#[rustc_nounwind] #[rustc_nounwind]
pub unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U; pub const unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U;
/// Adds two simd vectors elementwise. /// Adds two simd vectors elementwise.
/// ///

View file

@ -260,9 +260,10 @@ impl Command {
needs_stdin: bool, needs_stdin: bool,
proc_thread_attribute_list: Option<&ProcThreadAttributeList<'_>>, proc_thread_attribute_list: Option<&ProcThreadAttributeList<'_>>,
) -> io::Result<(Process, StdioPipes)> { ) -> io::Result<(Process, StdioPipes)> {
let env_saw_path = self.env.have_changed_path();
let maybe_env = self.env.capture_if_changed(); let maybe_env = self.env.capture_if_changed();
let child_paths = if let Some(env) = maybe_env.as_ref() { let child_paths = if env_saw_path && let Some(env) = maybe_env.as_ref() {
env.get(&EnvKey::new("PATH")).map(|s| s.as_os_str()) env.get(&EnvKey::new("PATH")).map(|s| s.as_os_str())
} else { } else {
None None

View file

@ -987,9 +987,7 @@ macro_rules! tool_doc {
cargo.rustdocflag("-Arustdoc::private-intra-doc-links"); cargo.rustdocflag("-Arustdoc::private-intra-doc-links");
cargo.rustdocflag("--enable-index-page"); cargo.rustdocflag("--enable-index-page");
cargo.rustdocflag("--show-type-layout"); cargo.rustdocflag("--show-type-layout");
// FIXME: `--generate-link-to-definition` tries to resolve cfged out code cargo.rustdocflag("--generate-link-to-definition");
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
// cargo.rustdocflag("--generate-link-to-definition");
let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target).join("doc"); let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target).join("doc");
$(for krate in $crates { $(for krate in $crates {

View file

@ -269,7 +269,13 @@ impl Step for Cargotest {
.args(builder.config.test_args()) .args(builder.config.test_args())
.env("RUSTC", builder.rustc(compiler)) .env("RUSTC", builder.rustc(compiler))
.env("RUSTDOC", builder.rustdoc(compiler)); .env("RUSTDOC", builder.rustdoc(compiler));
add_rustdoc_cargo_linker_args(&mut cmd, builder, compiler.host, LldThreads::No); add_rustdoc_cargo_linker_args(
&mut cmd,
builder,
compiler.host,
LldThreads::No,
compiler.stage,
);
cmd.delay_failure().run(builder); cmd.delay_failure().run(builder);
} }
} }
@ -847,7 +853,7 @@ impl Step for RustdocTheme {
.env("CFG_RELEASE_CHANNEL", &builder.config.channel) .env("CFG_RELEASE_CHANNEL", &builder.config.channel)
.env("RUSTDOC_REAL", builder.rustdoc(self.compiler)) .env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
.env("RUSTC_BOOTSTRAP", "1"); .env("RUSTC_BOOTSTRAP", "1");
cmd.args(linker_args(builder, self.compiler.host, LldThreads::No)); cmd.args(linker_args(builder, self.compiler.host, LldThreads::No, self.compiler.stage));
cmd.delay_failure().run(builder); cmd.delay_failure().run(builder);
} }
@ -1023,7 +1029,13 @@ impl Step for RustdocGUI {
cmd.env("RUSTDOC", builder.rustdoc(self.compiler)) cmd.env("RUSTDOC", builder.rustdoc(self.compiler))
.env("RUSTC", builder.rustc(self.compiler)); .env("RUSTC", builder.rustc(self.compiler));
add_rustdoc_cargo_linker_args(&mut cmd, builder, self.compiler.host, LldThreads::No); add_rustdoc_cargo_linker_args(
&mut cmd,
builder,
self.compiler.host,
LldThreads::No,
self.compiler.stage,
);
for path in &builder.paths { for path in &builder.paths {
if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) { if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) {
@ -1887,7 +1899,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
let mut hostflags = flags.clone(); let mut hostflags = flags.clone();
hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No)); hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No, compiler.stage));
let mut targetflags = flags; let mut targetflags = flags;
targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display()));

View file

@ -260,7 +260,7 @@ impl Cargo {
} }
} }
for arg in linker_args(builder, compiler.host, LldThreads::Yes) { for arg in linker_args(builder, compiler.host, LldThreads::Yes, 0) {
self.hostflags.arg(&arg); self.hostflags.arg(&arg);
} }
@ -270,10 +270,10 @@ impl Cargo {
} }
// We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not // We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not
// `linker_args` here. // `linker_args` here.
for flag in linker_flags(builder, target, LldThreads::Yes) { for flag in linker_flags(builder, target, LldThreads::Yes, compiler.stage) {
self.rustflags.arg(&flag); self.rustflags.arg(&flag);
} }
for arg in linker_args(builder, target, LldThreads::Yes) { for arg in linker_args(builder, target, LldThreads::Yes, compiler.stage) {
self.rustdocflags.arg(&arg); self.rustdocflags.arg(&arg);
} }

View file

@ -1462,7 +1462,7 @@ impl<'a> Builder<'a> {
cmd.arg("-Dwarnings"); cmd.arg("-Dwarnings");
} }
cmd.arg("-Znormalize-docs"); cmd.arg("-Znormalize-docs");
cmd.args(linker_args(self, compiler.host, LldThreads::Yes)); cmd.args(linker_args(self, compiler.host, LldThreads::Yes, compiler.stage));
cmd cmd
} }

View file

@ -430,8 +430,9 @@ pub fn linker_args(
builder: &Builder<'_>, builder: &Builder<'_>,
target: TargetSelection, target: TargetSelection,
lld_threads: LldThreads, lld_threads: LldThreads,
stage: u32,
) -> Vec<String> { ) -> Vec<String> {
let mut args = linker_flags(builder, target, lld_threads); let mut args = linker_flags(builder, target, lld_threads, stage);
if let Some(linker) = builder.linker(target) { if let Some(linker) = builder.linker(target) {
args.push(format!("-Clinker={}", linker.display())); args.push(format!("-Clinker={}", linker.display()));
@ -446,12 +447,18 @@ pub fn linker_flags(
builder: &Builder<'_>, builder: &Builder<'_>,
target: TargetSelection, target: TargetSelection,
lld_threads: LldThreads, lld_threads: LldThreads,
stage: u32,
) -> Vec<String> { ) -> Vec<String> {
let mut args = vec![]; let mut args = vec![];
if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() { if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() {
match builder.config.lld_mode { match builder.config.lld_mode {
LldMode::External => { LldMode::External => {
args.push("-Clinker-flavor=gnu-lld-cc".to_string()); // cfg(bootstrap) - remove after updating bootstrap compiler (#137498)
if stage == 0 && target.is_windows() {
args.push("-Clink-arg=-fuse-ld=lld".to_string());
} else {
args.push("-Clinker-flavor=gnu-lld-cc".to_string());
}
// FIXME(kobzol): remove this flag once MCP510 gets stabilized // FIXME(kobzol): remove this flag once MCP510 gets stabilized
args.push("-Zunstable-options".to_string()); args.push("-Zunstable-options".to_string());
} }
@ -479,8 +486,9 @@ pub fn add_rustdoc_cargo_linker_args(
builder: &Builder<'_>, builder: &Builder<'_>,
target: TargetSelection, target: TargetSelection,
lld_threads: LldThreads, lld_threads: LldThreads,
stage: u32,
) { ) {
let args = linker_args(builder, target, lld_threads); let args = linker_args(builder, target, lld_threads, stage);
let mut flags = cmd let mut flags = cmd
.get_envs() .get_envs()
.find_map(|(k, v)| if k == OsStr::new("RUSTDOCFLAGS") { v } else { None }) .find_map(|(k, v)| if k == OsStr::new("RUSTDOCFLAGS") { v } else { None })

View file

@ -1,5 +1,6 @@
// Test that PAC instructions are emitted when branch-protection is specified. // Test that PAC instructions are emitted when branch-protection is specified.
//@ add-core-stubs
//@ revisions: PACRET PAUTHLR_NOP PAUTHLR //@ revisions: PACRET PAUTHLR_NOP PAUTHLR
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ needs-llvm-components: aarch64 //@ needs-llvm-components: aarch64
@ -14,8 +15,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// PACRET: hint #25 // PACRET: hint #25
// PACRET: hint #29 // PACRET: hint #29

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: hard soft //@ revisions: hard soft
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ [hard] compile-flags: --target thumbv8m.main-none-eabihf --crate-type lib -Copt-level=1 //@ [hard] compile-flags: --target thumbv8m.main-none-eabihf --crate-type lib -Copt-level=1
@ -7,10 +8,9 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items)] #![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"]
pub trait Sized {} extern crate minicore;
#[lang = "copy"] use minicore::*;
pub trait Copy {}
// CHECK-LABEL: __acle_se_entry_point: // CHECK-LABEL: __acle_se_entry_point:
// CHECK-NEXT: entry_point: // CHECK-NEXT: entry_point:

View file

@ -1,5 +1,6 @@
// Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4. // Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4.
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ add-core-stubs
//@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 //@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
@ -7,10 +8,8 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
pub fn wibble() {} pub fn wibble() {}

View file

@ -1,4 +1,5 @@
// Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5. // Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5.
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0 //@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
@ -7,10 +8,8 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
pub fn wibble() {} pub fn wibble() {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x64 //@ revisions: x64
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic
@ -7,10 +8,8 @@
#![no_core] #![no_core]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
// CHECK-LABEL: call_other_fn: // CHECK-LABEL: call_other_fn:
// CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip) // CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip)

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x64 //@ revisions: x64
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie
@ -7,10 +8,8 @@
#![no_core] #![no_core]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
// CHECK-LABEL: call_other_fn: // CHECK-LABEL: call_other_fn:
// With PIE local functions are called "directly". // With PIE local functions are called "directly".

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: elfv1-be elfv2-be elfv2-le aix //@ revisions: elfv1-be elfv2-be elfv2-le aix
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ compile-flags: -Copt-level=3 //@ compile-flags: -Copt-level=3
@ -20,21 +21,9 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "unpin"]
trait Unpin {}
impl Copy for u8 {}
impl Copy for u16 {}
impl Copy for u32 {}
impl Copy for FiveU32s {} impl Copy for FiveU32s {}
impl Copy for FiveU16s {} impl Copy for FiveU16s {}
impl Copy for ThreeU8s {} impl Copy for ThreeU8s {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d //@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d
//@ needs-llvm-components: riscv //@ needs-llvm-components: riscv
@ -9,15 +10,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for f16 {}
impl Copy for f32 {}
impl Copy for f64 {}
// This test checks that the floats are all returned in `a0` as required by the `lp64` ABI. // This test checks that the floats are all returned in `a0` as required by the `lp64` ABI.

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: enable-backchain disable-backchain //@ revisions: enable-backchain disable-backchain
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu //@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu
@ -8,8 +9,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
extern "C" { extern "C" {
fn extern_func(); fn extern_func();

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86 x86-avx2 x86-avx512 aarch64 //@ revisions: x86 x86-avx2 x86-avx512 aarch64
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
//@ [x86] needs-llvm-components: x86 //@ [x86] needs-llvm-components: x86
@ -16,12 +17,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
#[repr(simd)] #[repr(simd)]
pub struct m8x16([i8; 16]); pub struct m8x16([i8; 16]);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86-avx512 //@ revisions: x86-avx512
//@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
@ -9,12 +10,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
#[repr(simd)] #[repr(simd)]
pub struct f64x4([f64; 4]); pub struct f64x4([f64; 4]);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86-avx2 x86-avx512 //@ revisions: x86-avx2 x86-avx512
//@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
//@ [x86-avx2] compile-flags: -C target-feature=+avx2 //@ [x86-avx2] compile-flags: -C target-feature=+avx2
@ -12,13 +13,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
impl<T: ?Sized> Copy for *const T {}
#[repr(simd)] #[repr(simd)]
pub struct i8x16([i8; 16]); pub struct i8x16([i8; 16]);

View file

@ -1,4 +1,5 @@
// verify that simd mask reductions do not introduce additional bit shift operations // verify that simd mask reductions do not introduce additional bit shift operations
//@ add-core-stubs
//@ revisions: x86 aarch64 //@ revisions: x86 aarch64
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
// Set the base cpu explicitly, in case the default has been changed. // Set the base cpu explicitly, in case the default has been changed.
@ -13,12 +14,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
#[repr(simd)] #[repr(simd)]
pub struct mask8x16([i8; 16]); pub struct mask8x16([i8; 16]);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86-avx2 x86-avx512 //@ revisions: x86-avx2 x86-avx512
//@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
//@ [x86-avx2] compile-flags: -C target-feature=+avx2 //@ [x86-avx2] compile-flags: -C target-feature=+avx2
@ -12,13 +13,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
impl<T: ?Sized> Copy for *mut T {}
#[repr(simd)] #[repr(simd)]
pub struct i8x16([i8; 16]); pub struct i8x16([i8; 16]);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86-avx512 //@ revisions: x86-avx512
//@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
//@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq
@ -9,12 +10,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
#[repr(simd)] #[repr(simd)]
pub struct f64x4([f64; 4]); pub struct f64x4([f64; 4]);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86-avx2 x86-avx512 aarch64 //@ revisions: x86-avx2 x86-avx512 aarch64
//@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
//@ [x86-avx2] compile-flags: -C target-feature=+avx2 //@ [x86-avx2] compile-flags: -C target-feature=+avx2
@ -14,12 +15,8 @@
#![no_core] #![no_core]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
// Because we don't have core yet. extern crate minicore;
#[lang = "sized"] use minicore::*;
pub trait Sized {}
#[lang = "copy"]
trait Copy {}
#[repr(simd)] #[repr(simd)]
pub struct i8x16([i8; 16]); pub struct i8x16([i8; 16]);

View file

@ -2,6 +2,7 @@
// - float structure members are passes in floating point registers // - float structure members are passes in floating point registers
// (#86163) // (#86163)
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ needs-llvm-components: sparc //@ needs-llvm-components: sparc
//@ compile-flags: --target=sparcv9-sun-solaris -Copt-level=3 //@ compile-flags: --target=sparcv9-sun-solaris -Copt-level=3
@ -9,11 +10,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
pub trait Sized {} use minicore::*;
#[lang = "copy"]
pub trait Copy {}
impl Copy for f32 {}
#[repr(C)] #[repr(C)]
pub struct Franta { pub struct Franta {

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x86_64 i686 aarch64 //@ revisions: x86_64 i686 aarch64
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
@ -11,12 +12,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for u8 {}
// Check that inline-asm stack probes are generated correctly. // Check that inline-asm stack probes are generated correctly.
// To avoid making this test fragile to slight asm changes, // To avoid making this test fragile to slight asm changes,

View file

@ -1,6 +1,7 @@
// Test that stack smash protection code is emitted for all tier1 and tier2 // Test that stack smash protection code is emitted for all tier1 and tier2
// targets, with the exception of nvptx64-nvidia-cuda // targets, with the exception of nvptx64-nvidia-cuda
// //
//@ add-core-stubs
//@ revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 //@ revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23
//@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 //@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44
//@ revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65 //@ revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65
@ -183,10 +184,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
#[no_mangle] #[no_mangle]
pub fn foo() { pub fn foo() {

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: x64 A64 ppc64le //@ revisions: x64 A64 ppc64le
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static
@ -11,20 +12,8 @@
#![no_core] #![no_core]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
#[lang = "sync"]
trait Sync {}
#[lang = "drop_in_place"]
fn drop_in_place<T>(_: *mut T) {}
impl Copy for u8 {}
impl Sync for u8 {}
#[no_mangle] #[no_mangle]
pub static PIERIS: u8 = 42; pub static PIERIS: u8 = 42;

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ revisions: TWOFLAGS SINGLEFLAG //@ revisions: TWOFLAGS SINGLEFLAG
@ -19,11 +20,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for u32 {}
// Use of these requires target features to be enabled // Use of these requires target features to be enabled
extern "unadjusted" { extern "unadjusted" {

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
// ignore-tidy-linelength // ignore-tidy-linelength
//@ revisions: amdgcn_amd_amdhsa //@ revisions: amdgcn_amd_amdhsa
@ -11,8 +12,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
pub fn test() -> u8 { pub fn test() -> u8 {
42 42

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
// ignore-tidy-linelength // ignore-tidy-linelength
//@ revisions: aarch64_be_unknown_linux_gnu //@ revisions: aarch64_be_unknown_linux_gnu
@ -709,8 +710,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// Force linkage to ensure code is actually generated // Force linkage to ensure code is actually generated
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
// ignore-tidy-linelength // ignore-tidy-linelength
//@ revisions: aarch64_apple_darwin //@ revisions: aarch64_apple_darwin
@ -80,8 +81,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// Force linkage to ensure code is actually generated // Force linkage to ensure code is actually generated
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
// ignore-tidy-linelength // ignore-tidy-linelength
//@ revisions: nvptx64_nvidia_cuda //@ revisions: nvptx64_nvidia_cuda
@ -11,8 +12,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
pub fn test() -> u8 { pub fn test() -> u8 {
42 42

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ assembly-output: emit-asm //@ assembly-output: emit-asm
// ignore-tidy-linelength // ignore-tidy-linelength
//@ revisions: aarch64_pc_windows_msvc //@ revisions: aarch64_pc_windows_msvc
@ -95,8 +96,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
pub fn test() -> u8 { pub fn test() -> u8 {
42 42

View file

@ -25,7 +25,8 @@
naked_functions, naked_functions,
f16, f16,
f128, f128,
asm_experimental_arch asm_experimental_arch,
unboxed_closures
)] )]
#![allow(unused, improper_ctypes_definitions, internal_features)] #![allow(unused, improper_ctypes_definitions, internal_features)]
#![no_std] #![no_std]
@ -61,7 +62,7 @@ pub auto trait Unpin {}
impl_marker_trait!( impl_marker_trait!(
Copy => [ Copy => [
bool, char, char, bool,
isize, i8, i16, i32, i64, i128, isize, i8, i16, i32, i64, i128,
usize, u8, u16, u32, u64, u128, usize, u8, u16, u32, u64, u128,
f16, f32, f64, f128, f16, f32, f64, f128,
@ -102,6 +103,9 @@ pub struct UnsafeCell<T: ?Sized> {
} }
impl<T: ?Sized> !Freeze for UnsafeCell<T> {} impl<T: ?Sized> !Freeze for UnsafeCell<T> {}
#[lang = "tuple_trait"]
pub trait Tuple {}
#[rustc_builtin_macro] #[rustc_builtin_macro]
pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
/* compiler built-in */ /* compiler built-in */
@ -129,3 +133,61 @@ macro_rules! stringify {
/* compiler built-in */ /* compiler built-in */
}; };
} }
#[lang = "add"]
pub trait Add<Rhs = Self> {
type Output;
fn add(self, _: Rhs) -> Self::Output;
}
impl Add<isize> for isize {
type Output = isize;
fn add(self, other: isize) -> isize {
7 // avoid needing to add all of the overflow handling and panic language items
}
}
#[lang = "sync"]
trait Sync {}
impl Sync for u8 {}
#[lang = "drop_in_place"]
fn drop_in_place<T>(_: *mut T) {}
#[lang = "fn_once"]
pub trait FnOnce<Args: Tuple> {
#[lang = "fn_once_output"]
type Output;
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
#[lang = "fn_mut"]
pub trait FnMut<Args: Tuple>: FnOnce<Args> {
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
}
#[lang = "fn"]
pub trait Fn<Args: Tuple>: FnMut<Args> {
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
}
#[lang = "dispatch_from_dyn"]
trait DispatchFromDyn<T> {}
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
#[lang = "unsize"]
trait Unsize<T: ?Sized> {}
#[lang = "coerce_unsized"]
pub trait CoerceUnsized<T: ?Sized> {}
impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
#[lang = "drop"]
trait Drop {
fn drop(&mut self);
}

View file

@ -1,15 +1,12 @@
//@ add-core-stubs
//@ compile-flags: --target aarch64-unknown-none-softfloat -Zmerge-functions=disabled //@ compile-flags: --target aarch64-unknown-none-softfloat -Zmerge-functions=disabled
//@ needs-llvm-components: aarch64 //@ needs-llvm-components: aarch64
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for f32 {}
impl Copy for f64 {}
// CHECK: i64 @pass_f64_C(i64 {{[^,]*}}) // CHECK: i64 @pass_f64_C(i64 {{[^,]*}})
#[no_mangle] #[no_mangle]

View file

@ -1,5 +1,6 @@
// Test that structs aligned to 128 bits are passed with the correct ABI on aarch64. // Test that structs aligned to 128 bits are passed with the correct ABI on aarch64.
//@ add-core-stubs
//@ revisions: linux darwin win //@ revisions: linux darwin win
//@[linux] compile-flags: --target aarch64-unknown-linux-gnu //@[linux] compile-flags: --target aarch64-unknown-linux-gnu
//@[darwin] compile-flags: --target aarch64-apple-darwin //@[darwin] compile-flags: --target aarch64-apple-darwin
@ -12,12 +13,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits.
#[repr(C)] #[repr(C)]

View file

@ -1,5 +1,6 @@
// Checks if the correct annotation for the efiapi ABI is passed to llvm. // Checks if the correct annotation for the efiapi ABI is passed to llvm.
//@ add-core-stubs
//@ revisions:x86_64 i686 aarch64 arm riscv //@ revisions:x86_64 i686 aarch64 arm riscv
//@[x86_64] compile-flags: --target x86_64-unknown-uefi //@[x86_64] compile-flags: --target x86_64-unknown-uefi
//@[x86_64] needs-llvm-components: aarch64 arm riscv //@[x86_64] needs-llvm-components: aarch64 arm riscv
@ -17,12 +18,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
//x86_64: define win64cc void @has_efiapi //x86_64: define win64cc void @has_efiapi
//i686: define void @has_efiapi //i686: define void @has_efiapi

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 //@ compile-flags: -Copt-level=3
//@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
@ -24,12 +25,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(i8)] #[repr(i8)]
pub enum Type { pub enum Type {

View file

@ -2,6 +2,7 @@
// llvm. Also checks that the abi-sysv64 feature gate allows usage // llvm. Also checks that the abi-sysv64 feature gate allows usage
// of the sysv64 abi. // of the sysv64 abi.
// //
//@ add-core-stubs
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 //@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0
@ -9,11 +10,8 @@
#![no_core] #![no_core]
#![feature(abi_x86_interrupt, no_core, lang_items)] #![feature(abi_x86_interrupt, no_core, lang_items)]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i64 {}
// CHECK: define x86_64_sysvcc i64 @has_sysv64_abi // CHECK: define x86_64_sysvcc i64 @has_sysv64_abi
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Z merge-functions=disabled //@ compile-flags: -Z merge-functions=disabled
//@ add-core-stubs //@ add-core-stubs

View file

@ -2,6 +2,7 @@
// llvm. Also checks that the abi_x86_interrupt feature gate allows usage // llvm. Also checks that the abi_x86_interrupt feature gate allows usage
// of the x86-interrupt abi. // of the x86-interrupt abi.
//@ add-core-stubs
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 //@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0
@ -9,11 +10,8 @@
#![no_core] #![no_core]
#![feature(abi_x86_interrupt, no_core, lang_items)] #![feature(abi_x86_interrupt, no_core, lang_items)]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i64 {}
// CHECK: define x86_intrcc i64 @has_x86_interrupt_abi // CHECK: define x86_intrcc i64 @has_x86_interrupt_abi
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 --target=avr-none -C target-cpu=atmega328p --crate-type=rlib -C panic=abort //@ compile-flags: -Copt-level=3 --target=avr-none -C target-cpu=atmega328p --crate-type=rlib -C panic=abort
//@ needs-llvm-components: avr //@ needs-llvm-components: avr
@ -13,45 +14,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
pub trait Sized {} use minicore::*;
#[lang = "copy"]
pub trait Copy {}
impl<T: ?Sized> Copy for *const T {}
#[lang = "legacy_receiver"]
pub trait LegacyReceiver {}
#[lang = "tuple_trait"]
pub trait Tuple {}
pub struct Result<T, E> {
_a: T,
_b: E,
}
impl Copy for usize {}
impl Copy for &usize {}
#[lang = "drop_in_place"]
pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {}
#[lang = "fn_once"]
pub trait FnOnce<Args: Tuple> {
#[lang = "fn_once_output"]
type Output;
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
#[lang = "fn_mut"]
pub trait FnMut<Args: Tuple>: FnOnce<Args> {
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
}
#[lang = "fn"]
pub trait Fn<Args: Tuple>: FnOnce<Args> {
/// Performs the call operation.
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
}
extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn transmute<Src, Dst>(src: Src) -> Dst; pub fn transmute<Src, Dst>(src: Src) -> Dst;

View file

@ -1,5 +1,6 @@
// Test that the correct module flags are emitted with different branch protection flags. // Test that the correct module flags are emitted with different branch protection flags.
//@ add-core-stubs
//@ revisions: BTI PACRET LEAF BKEY NONE //@ revisions: BTI PACRET LEAF BKEY NONE
//@ needs-llvm-components: aarch64 //@ needs-llvm-components: aarch64
//@ [BTI] compile-flags: -Z branch-protection=bti //@ [BTI] compile-flags: -Z branch-protection=bti
@ -13,8 +14,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// A basic test function. // A basic test function.
pub fn test() {} pub fn test() {}

View file

@ -1,5 +1,6 @@
// Test that the correct module flags are emitted with different branch protection flags. // Test that the correct module flags are emitted with different branch protection flags.
//@ add-core-stubs
//@ revisions: BTI PACRET LEAF BKEY PAUTHLR PAUTHLR_BKEY PAUTHLR_LEAF PAUTHLR_BTI NONE //@ revisions: BTI PACRET LEAF BKEY PAUTHLR PAUTHLR_BKEY PAUTHLR_LEAF PAUTHLR_BTI NONE
//@ needs-llvm-components: aarch64 //@ needs-llvm-components: aarch64
//@ [BTI] compile-flags: -Z branch-protection=bti //@ [BTI] compile-flags: -Z branch-protection=bti
@ -17,8 +18,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// A basic test function. // A basic test function.
// CHECK: @test(){{.*}} [[ATTR:#[0-9]+]] { // CHECK: @test(){{.*}} [[ATTR:#[0-9]+]] {

View file

@ -1,4 +1,5 @@
// ignore-tidy-linelength // ignore-tidy-linelength
//@ add-core-stubs
//@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64 //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64
//@ min-llvm-version: 19 //@ min-llvm-version: 19
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error //@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
@ -21,12 +22,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// This struct will be passed as a single `i64` or `i32`. // This struct will be passed as a single `i64` or `i32`.
// This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`. // This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`.

View file

@ -1,5 +1,6 @@
// Test that the correct module flags are emitted with different control-flow protection flags. // Test that the correct module flags are emitted with different control-flow protection flags.
//@ add-core-stubs
//@ revisions: undefined none branch return full //@ revisions: undefined none branch return full
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ [undefined] compile-flags: //@ [undefined] compile-flags:
@ -13,8 +14,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// A basic test function. // A basic test function.
pub fn test() {} pub fn test() {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: linux apple //@ revisions: linux apple
//@ min-llvm-version: 19 //@ min-llvm-version: 19
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error //@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
@ -14,12 +15,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
struct S { struct S {

View file

@ -0,0 +1,61 @@
//@ compile-flags: -C opt-level=1
//@ min-llvm-version: 20
// The `derive(PartialOrd)` for a 2-field type doesn't override `lt`/`le`/`gt`/`ge`.
// This double-checks that the `Option<Ordering>` intermediate values used
// in the operators for such a type all optimize away.
#![crate_type = "lib"]
use std::cmp::Ordering;
#[derive(PartialOrd, PartialEq)]
pub struct Foo(i32, u32);
// CHECK-LABEL: @check_lt(
// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]])
#[no_mangle]
pub fn check_lt(a: Foo, b: Foo) -> bool {
// CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R0:.+]] = icmp slt i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R1:.+]] = icmp ult i32 %[[A1]], %[[B1]]
// CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]]
// CHECK-NEXT: ret i1 %[[R]]
a < b
}
// CHECK-LABEL: @check_le(
// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]])
#[no_mangle]
pub fn check_le(a: Foo, b: Foo) -> bool {
// CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R0:.+]] = icmp sle i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R1:.+]] = icmp ule i32 %[[A1]], %[[B1]]
// CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]]
// CHECK-NEXT: ret i1 %[[R]]
a <= b
}
// CHECK-LABEL: @check_gt(
// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]])
#[no_mangle]
pub fn check_gt(a: Foo, b: Foo) -> bool {
// CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R0:.+]] = icmp sgt i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R1:.+]] = icmp ugt i32 %[[A1]], %[[B1]]
// CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]]
// CHECK-NEXT: ret i1 %[[R]]
a > b
}
// CHECK-LABEL: @check_ge(
// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]])
#[no_mangle]
pub fn check_ge(a: Foo, b: Foo) -> bool {
// CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R0:.+]] = icmp sge i32 %[[A0]], %[[B0]]
// CHECK-DAG: %[[R1:.+]] = icmp uge i32 %[[A1]], %[[B1]]
// CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]]
// CHECK-NEXT: ret i1 %[[R]]
a >= b
}

View file

@ -1,5 +1,6 @@
//@ compile-flags: -C opt-level=1 -Z merge-functions=disabled //@ compile-flags: -C opt-level=1 -Z merge-functions=disabled
//@ only-x86_64 //@ only-x86_64
//@ min-llvm-version: 20
#![crate_type = "lib"] #![crate_type = "lib"]
@ -65,12 +66,7 @@ pub fn check_ge_direct(a: TwoTuple, b: TwoTuple) -> bool {
} }
// //
// These ones are harder, since there are more intermediate values to remove. // These used to not optimize as well, but thanks to LLVM 20 they work now 🎉
//
// `<` seems to be getting lucky right now, so test that doesn't regress.
//
// The others, however, aren't managing to optimize away the extra `select`s yet.
// See <https://github.com/rust-lang/rust/issues/106107> for more about this.
// //
// CHECK-LABEL: @check_lt_via_cmp // CHECK-LABEL: @check_lt_via_cmp
@ -89,11 +85,11 @@ pub fn check_lt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool {
// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]])
#[no_mangle] #[no_mangle]
pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool {
// FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]]
// FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]] // CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]]
// FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] // CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]]
// FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]]
// FIXME-CHECK: ret i1 %[[R]] // CHECK: ret i1 %[[R]]
Ord::cmp(&a, &b).is_le() Ord::cmp(&a, &b).is_le()
} }
@ -101,11 +97,11 @@ pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool {
// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]])
#[no_mangle] #[no_mangle]
pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool {
// FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]]
// FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] // CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]]
// FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] // CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]]
// FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]]
// FIXME-CHECK: ret i1 %[[R]] // CHECK: ret i1 %[[R]]
Ord::cmp(&a, &b).is_gt() Ord::cmp(&a, &b).is_gt()
} }
@ -113,10 +109,10 @@ pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool {
// CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]])
#[no_mangle] #[no_mangle]
pub fn check_ge_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { pub fn check_ge_via_cmp(a: TwoTuple, b: TwoTuple) -> bool {
// FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]]
// FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]] // CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]]
// FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] // CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]]
// FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]]
// FIXME-CHECK: ret i1 %[[R]] // CHECK: ret i1 %[[R]]
Ord::cmp(&a, &b).is_ge() Ord::cmp(&a, &b).is_ge()
} }

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: WINDOWS_ ANDROID_ //@ revisions: WINDOWS_ ANDROID_
//@ compile-flags: -C panic=abort -Copt-level=0 //@ compile-flags: -C panic=abort -Copt-level=0
//@ [WINDOWS_] compile-flags: --target=x86_64-pc-windows-msvc //@ [WINDOWS_] compile-flags: --target=x86_64-pc-windows-msvc
@ -9,8 +10,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// CHECK: attributes #{{.*}} uwtable // CHECK: attributes #{{.*}} uwtable
pub fn foo() {} pub fn foo() {}

View file

@ -2,6 +2,7 @@
// as "inreg" like the C/C++ compilers for the platforms. // as "inreg" like the C/C++ compilers for the platforms.
// x86 only. // x86 only.
//@ add-core-stubs
//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
@ -9,10 +10,8 @@
#![no_core] #![no_core]
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
pub mod tests { pub mod tests {
// CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3) // CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3)

View file

@ -1,6 +1,7 @@
// Test that the `reserve-x18` target feature is (not) emitted when // Test that the `reserve-x18` target feature is (not) emitted when
// the `-Zfixed-x18` flag is (not) set. // the `-Zfixed-x18` flag is (not) set.
//@ add-core-stubs
//@ revisions: unset set //@ revisions: unset set
//@ needs-llvm-components: aarch64 //@ needs-llvm-components: aarch64
//@ compile-flags: --target aarch64-unknown-none //@ compile-flags: --target aarch64-unknown-none
@ -10,8 +11,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[no_mangle] #[no_mangle]
pub fn foo() { pub fn foo() {

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: --crate-type=rlib -Copt-level=0 //@ compile-flags: --crate-type=rlib -Copt-level=0
//@ revisions: aarch64-apple aarch64-linux force x64-apple x64-linux //@ revisions: aarch64-apple aarch64-linux force x64-apple x64-linux
//@ [aarch64-apple] needs-llvm-components: aarch64 //@ [aarch64-apple] needs-llvm-components: aarch64
@ -13,11 +14,9 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"]
trait Sized {} extern crate minicore;
#[lang = "copy"] use minicore::*;
trait Copy {}
impl Copy for u32 {}
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] { // CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] {
#[no_mangle] #[no_mangle]

View file

@ -1,6 +1,7 @@
// Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when // Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when
// the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. // the `-Zfunction-return={keep,thunk-extern}` flag is (not) set.
//@ add-core-stubs
//@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep //@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ compile-flags: --target x86_64-unknown-linux-gnu //@ compile-flags: --target x86_64-unknown-linux-gnu
@ -13,8 +14,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[no_mangle] #[no_mangle]
pub fn foo() { pub fn foo() {

View file

@ -1,17 +1,14 @@
// Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions. // Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions.
//@ add-core-stubs
//@ revisions: nvptx //@ revisions: nvptx
//@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda
//@ [nvptx] needs-llvm-components: nvptx //@ [nvptx] needs-llvm-components: nvptx
#![feature(no_core, lang_items, abi_gpu_kernel)] #![feature(no_core, lang_items, abi_gpu_kernel)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// nvptx: define ptx_kernel void @fun(i32 // nvptx: define ptx_kernel void @fun(i32
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 //@ compile-flags: -Copt-level=3
//@revisions: with_nontemporal without_nontemporal //@revisions: with_nontemporal without_nontemporal
//@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu //@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu
@ -14,13 +15,8 @@
#![no_core] #![no_core]
#![crate_type = "lib"] #![crate_type = "lib"]
#[lang = "sized"] extern crate minicore;
pub trait Sized {} use minicore::*;
#[lang = "copy"]
pub trait Copy {}
impl Copy for u32 {}
impl<T> Copy for *mut T {}
extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn nontemporal_store<T>(ptr: *mut T, val: T); pub fn nontemporal_store<T>(ptr: *mut T, val: T);

View file

@ -1,10 +1,7 @@
//@ compile-flags: -Copt-level=3 --crate-type=rlib //@ compile-flags: -Copt-level=3 --crate-type=rlib
#![feature(intrinsics, repr_simd)] #![feature(core_intrinsics, repr_simd)]
extern "rust-intrinsic" { use std::intrinsics::simd::{simd_eq, simd_fabs};
fn simd_fabs<T>(x: T) -> T;
fn simd_eq<T, U>(x: T, y: T) -> U;
}
#[repr(simd)] #[repr(simd)]
pub struct V([f32; 4]); pub struct V([f32; 4]);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu
//@ needs-llvm-components: loongarch //@ needs-llvm-components: loongarch
@ -6,12 +7,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i)
#[no_mangle] #[no_mangle]

View file

@ -1,19 +1,15 @@
//
// Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set.
// See issue #60235. // See issue #60235.
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
pub struct Bool { pub struct Bool {

View file

@ -1,19 +1,15 @@
//
// Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset. // Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset.
// See issue #60235. // See issue #60235.
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
pub struct Bool { pub struct Bool {

View file

@ -1,19 +1,15 @@
//
// Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set.
// See issue #60235. // See issue #60235.
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
pub struct Bool { pub struct Bool {

View file

@ -1,19 +1,15 @@
//
// Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset. // Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset.
// See issue #60235. // See issue #60235.
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
pub struct Bool { pub struct Bool {

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: arm-mode thumb-mode //@ revisions: arm-mode thumb-mode
//@ [arm-mode] compile-flags: --target armv5te-none-eabi //@ [arm-mode] compile-flags: --target armv5te-none-eabi
//@ [thumb-mode] compile-flags: --target thumbv5te-none-eabi //@ [thumb-mode] compile-flags: --target thumbv5te-none-eabi
@ -8,15 +9,8 @@
#![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![feature(no_core, lang_items, rustc_attrs, naked_functions)]
#![no_core] #![no_core]
#[rustc_builtin_macro] extern crate minicore;
macro_rules! naked_asm { use minicore::*;
() => {};
}
#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
// arm-mode: .arm // arm-mode: .arm
// thumb-mode: .thumb // thumb-mode: .thumb

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: linux win macos thumb //@ revisions: linux win macos thumb
// //
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu //@[linux] compile-flags: --target x86_64-unknown-linux-gnu
@ -13,15 +14,8 @@
#![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![feature(no_core, lang_items, rustc_attrs, naked_functions)]
#![no_core] #![no_core]
#[rustc_builtin_macro] extern crate minicore;
macro_rules! naked_asm { use minicore::*;
() => {};
}
#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
// linux,win: .intel_syntax // linux,win: .intel_syntax
// //

View file

@ -1,6 +1,7 @@
// Test that the `no-jump-tables` function attribute are (not) emitted when // Test that the `no-jump-tables` function attribute are (not) emitted when
// the `-Zno-jump-tables` flag is (not) set. // the `-Zno-jump-tables` flag is (not) set.
//@ add-core-stubs
//@ revisions: unset set //@ revisions: unset set
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
//@ compile-flags: --target x86_64-unknown-linux-gnu //@ compile-flags: --target x86_64-unknown-linux-gnu
@ -10,8 +11,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[no_mangle] #[no_mangle]
pub fn foo() { pub fn foo() {

View file

@ -1,6 +1,7 @@
// Test that structs aligned to 128 bits are passed with the correct ABI on powerpc64le. // Test that structs aligned to 128 bits are passed with the correct ABI on powerpc64le.
// This is similar to aarch64-struct-align-128.rs, but for ppc. // This is similar to aarch64-struct-align-128.rs, but for ppc.
//@ add-core-stubs
//@ compile-flags: --target powerpc64le-unknown-linux-gnu //@ compile-flags: --target powerpc64le-unknown-linux-gnu
//@ needs-llvm-components: powerpc //@ needs-llvm-components: powerpc
@ -8,12 +9,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
pub struct Align8 { pub struct Align8 {

View file

@ -2,6 +2,7 @@
// marks function arguments as "inreg" like the C/C++ compilers for the platforms. // marks function arguments as "inreg" like the C/C++ compilers for the platforms.
// x86 only. // x86 only.
//@ add-core-stubs
//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3
//@ needs-llvm-components: x86 //@ needs-llvm-components: x86
@ -14,10 +15,9 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#![feature(no_core, lang_items, repr_simd)] #![feature(no_core, lang_items, repr_simd)]
#[lang = "sized"]
trait Sized {} extern crate minicore;
#[lang = "copy"] use minicore::*;
trait Copy {}
pub mod tests { pub mod tests {
// regparm doesn't work for "fastcall" calling conv (only 2 inregs) // regparm doesn't work for "fastcall" calling conv (only 2 inregs)

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: i686-linux i686-freebsd x64-linux x64-apple //@ revisions: i686-linux i686-freebsd x64-linux x64-apple
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
@ -21,14 +22,9 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
impl Copy for [u32; 16] {}
impl Copy for BigS {} impl Copy for BigS {}
impl Copy for BigU {} impl Copy for BigU {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: arm-linux arm-android armv7-linux armv7-android mips thumb sparc //@ revisions: arm-linux arm-android armv7-linux armv7-android mips thumb sparc
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
@ -27,14 +28,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
impl Copy for [u32; 16] {}
impl Copy for BigS {} impl Copy for BigS {}
impl Copy for BigU {} impl Copy for BigU {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: mips64 mips64el //@ revisions: mips64 mips64el
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
@ -13,14 +14,9 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
impl Copy for [u32; 16] {}
impl Copy for BigS {} impl Copy for BigS {}
impl Copy for BigU {} impl Copy for BigU {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1 //@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
@ -19,14 +20,9 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
impl Copy for [u32; 16] {}
impl Copy for BigS {} impl Copy for BigS {}
impl Copy for BigU {} impl Copy for BigU {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target sparc64-unknown-linux-gnu //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target sparc64-unknown-linux-gnu
//@ needs-llvm-components: sparc //@ needs-llvm-components: sparc
@ -8,14 +9,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
impl Copy for [u32; 16] {}
impl Copy for BigS {} impl Copy for BigS {}
impl Copy for BigU {} impl Copy for BigU {}

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: linux apple win //@ revisions: linux apple win
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
@ -13,12 +14,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
#[repr(C)] #[repr(C)]
pub struct Rgb8 { pub struct Rgb8 {

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: --target riscv64gc-unknown-linux-gnu -Copt-level=3 -C no-prepopulate-passes -C panic=abort //@ compile-flags: --target riscv64gc-unknown-linux-gnu -Copt-level=3 -C no-prepopulate-passes -C panic=abort
//@ needs-llvm-components: riscv //@ needs-llvm-components: riscv
@ -6,19 +7,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![allow(improper_ctypes)] #![allow(improper_ctypes)]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for bool {}
impl Copy for i8 {}
impl Copy for u8 {}
impl Copy for i32 {}
impl Copy for i64 {}
impl Copy for u64 {}
impl Copy for f32 {}
impl Copy for f64 {}
impl<T> Copy for *mut T {}
// CHECK: define void @f_void() // CHECK: define void @f_void()
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
//@ needs-llvm-components: riscv //@ needs-llvm-components: riscv
@ -6,12 +7,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i)
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
//@ needs-llvm-components: riscv //@ needs-llvm-components: riscv
@ -6,12 +7,8 @@
#![no_std] #![no_std]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "freeze"]
trait Freeze {}
#[lang = "copy"]
trait Copy {}
// CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 noundef zeroext %i) // CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 noundef zeroext %i)
#[no_mangle] #[no_mangle]

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions:riscv64gc riscv32gc riscv32imac //@ revisions:riscv64gc riscv32gc riscv32imac
//@[riscv64gc] compile-flags: --target=riscv64gc-unknown-linux-gnu //@[riscv64gc] compile-flags: --target=riscv64gc-unknown-linux-gnu
@ -16,5 +17,5 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ revisions: aarch64 android //@ revisions: aarch64 android
//@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack //@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack
//@[aarch64] needs-llvm-components: aarch64 //@[aarch64] needs-llvm-components: aarch64
@ -9,8 +10,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// CHECK: ; Function Attrs:{{.*}}shadowcallstack // CHECK: ; Function Attrs:{{.*}}shadowcallstack
#[no_mangle] #[no_mangle]

View file

@ -1,5 +1,6 @@
// Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. // Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation.
//@ add-core-stubs
//@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 //@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0
//@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@ revisions: aarch64 riscv64imac riscv64gc x86_64
//@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] compile-flags: --target aarch64-unknown-none
@ -15,13 +16,8 @@
#![feature(no_core, no_sanitize, lang_items)] #![feature(no_core, no_sanitize, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for u8 {}
// CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized // CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized
// CHECK-NEXT: ; Function Attrs: // CHECK-NEXT: ; Function Attrs:

View file

@ -1,5 +1,6 @@
// Verifies that "cfi-normalize-integers" module flag is added. // Verifies that "cfi-normalize-integers" module flag is added.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,10 +12,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
pub fn foo() {} pub fn foo() {}

View file

@ -1,5 +1,6 @@
// Verifies that "kcfi" module flag is added. // Verifies that "kcfi" module flag is added.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,10 +12,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
pub fn foo() {} pub fn foo() {}

View file

@ -1,5 +1,6 @@
// Verifies that "kcfi-offset" module flag is added. // Verifies that "kcfi-offset" module flag is added.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,10 +12,8 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
pub fn foo() {} pub fn foo() {}

View file

@ -1,5 +1,6 @@
// Verifies that KCFI operand bundles are omitted. // Verifies that KCFI operand bundles are omitted.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,12 +12,8 @@
#![feature(no_core, no_sanitize, lang_items)] #![feature(no_core, no_sanitize, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i32 {}
#[no_sanitize(kcfi)] #[no_sanitize(kcfi)]
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {

View file

@ -1,5 +1,6 @@
// Verifies that generalized KCFI type metadata for functions are emitted. // Verifies that generalized KCFI type metadata for functions are emitted.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,12 +12,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i32 {}
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
// CHECK-LABEL: define{{.*}}foo // CHECK-LABEL: define{{.*}}foo

View file

@ -1,5 +1,6 @@
// Verifies that normalized and generalized KCFI type metadata for functions are emitted. // Verifies that normalized and generalized KCFI type metadata for functions are emitted.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,12 +12,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i32 {}
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
// CHECK-LABEL: define{{.*}}foo // CHECK-LABEL: define{{.*}}foo

View file

@ -1,5 +1,6 @@
// Verifies that normalized KCFI type metadata for functions are emitted. // Verifies that normalized KCFI type metadata for functions are emitted.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,12 +12,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i32 {}
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
// CHECK-LABEL: define{{.*}}foo // CHECK-LABEL: define{{.*}}foo

View file

@ -1,5 +1,6 @@
// Verifies that KCFI type metadata for functions are emitted. // Verifies that KCFI type metadata for functions are emitted.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,12 +12,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i32 {}
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
// CHECK-LABEL: define{{.*}}foo // CHECK-LABEL: define{{.*}}foo

View file

@ -1,5 +1,6 @@
// Verifies that KCFI operand bundles are emitted. // Verifies that KCFI operand bundles are emitted.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,12 +12,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl Copy for i32 {}
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
// CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}} // CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}}

View file

@ -1,5 +1,6 @@
// Verifies that type metadata identifiers for trait objects are emitted correctly. // Verifies that type metadata identifiers for trait objects are emitted correctly.
// //
//@ add-core-stubs
//@ revisions: aarch64 x86_64 //@ revisions: aarch64 x86_64
//@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64 //@ [aarch64] needs-llvm-components: aarch64
@ -11,29 +12,8 @@
#![feature(arbitrary_self_types, no_core, lang_items)] #![feature(arbitrary_self_types, no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
#[lang = "copy"]
trait Copy {}
impl<T: ?Sized> Copy for &T {}
#[lang = "legacy_receiver"]
trait LegacyReceiver {}
#[lang = "dispatch_from_dyn"]
trait DispatchFromDyn<T> {}
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
#[lang = "unsize"]
trait Unsize<T: ?Sized> {}
#[lang = "coerce_unsized"]
pub trait CoerceUnsized<T: ?Sized> {}
impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
#[lang = "freeze"]
trait Freeze {}
#[lang = "drop_in_place"]
fn drop_in_place_fn<T>() {}
#[lang = "drop"]
trait Drop {
fn drop(&mut self);
}
pub trait Trait1 { pub trait Trait1 {
fn foo(&self); fn foo(&self);

View file

@ -1,3 +1,4 @@
//@ add-core-stubs
//@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack //@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack
//@ needs-llvm-components: riscv //@ needs-llvm-components: riscv
@ -6,8 +7,8 @@
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]
#[lang = "sized"] extern crate minicore;
trait Sized {} use minicore::*;
// CHECK: ; Function Attrs:{{.*}}shadowcallstack // CHECK: ; Function Attrs:{{.*}}shadowcallstack
// CHECK: define dso_local void @foo() unnamed_addr #0 // CHECK: define dso_local void @foo() unnamed_addr #0

View file

@ -1,10 +1,11 @@
//@ compile-flags: -C no-prepopulate-passes //@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(repr_simd, core_intrinsics)]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use std::intrinsics::simd::simd_fabs;
#[repr(simd)] #[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub [f32; 2]); pub struct f32x2(pub [f32; 2]);
@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub [f32; 16]); pub struct f32x16(pub [f32; 16]);
extern "rust-intrinsic" {
fn simd_fabs<T>(x: T) -> T;
}
// CHECK-LABEL: @fabs_32x2 // CHECK-LABEL: @fabs_32x2
#[no_mangle] #[no_mangle]
pub unsafe fn fabs_32x2(a: f32x2) -> f32x2 { pub unsafe fn fabs_32x2(a: f32x2) -> f32x2 {

View file

@ -1,10 +1,11 @@
//@ compile-flags: -C no-prepopulate-passes //@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(repr_simd, core_intrinsics)]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use std::intrinsics::simd::simd_ceil;
#[repr(simd)] #[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub [f32; 2]); pub struct f32x2(pub [f32; 2]);
@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub [f32; 16]); pub struct f32x16(pub [f32; 16]);
extern "rust-intrinsic" {
fn simd_ceil<T>(x: T) -> T;
}
// CHECK-LABEL: @ceil_32x2 // CHECK-LABEL: @ceil_32x2
#[no_mangle] #[no_mangle]
pub unsafe fn ceil_32x2(a: f32x2) -> f32x2 { pub unsafe fn ceil_32x2(a: f32x2) -> f32x2 {

View file

@ -1,10 +1,11 @@
//@ compile-flags: -C no-prepopulate-passes //@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(repr_simd, core_intrinsics)]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use std::intrinsics::simd::simd_fcos;
#[repr(simd)] #[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub [f32; 2]); pub struct f32x2(pub [f32; 2]);
@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub [f32; 16]); pub struct f32x16(pub [f32; 16]);
extern "rust-intrinsic" {
fn simd_fcos<T>(x: T) -> T;
}
// CHECK-LABEL: @fcos_32x2 // CHECK-LABEL: @fcos_32x2
#[no_mangle] #[no_mangle]
pub unsafe fn fcos_32x2(a: f32x2) -> f32x2 { pub unsafe fn fcos_32x2(a: f32x2) -> f32x2 {

View file

@ -1,10 +1,11 @@
//@ compile-flags: -C no-prepopulate-passes //@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(repr_simd, core_intrinsics)]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use std::intrinsics::simd::simd_fexp;
#[repr(simd)] #[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub [f32; 2]); pub struct f32x2(pub [f32; 2]);
@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub [f32; 16]); pub struct f32x16(pub [f32; 16]);
extern "rust-intrinsic" {
fn simd_fexp<T>(x: T) -> T;
}
// CHECK-LABEL: @exp_32x2 // CHECK-LABEL: @exp_32x2
#[no_mangle] #[no_mangle]
pub unsafe fn exp_32x2(a: f32x2) -> f32x2 { pub unsafe fn exp_32x2(a: f32x2) -> f32x2 {

View file

@ -1,10 +1,11 @@
//@ compile-flags: -C no-prepopulate-passes //@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(repr_simd, core_intrinsics)]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use std::intrinsics::simd::simd_fexp2;
#[repr(simd)] #[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub [f32; 2]); pub struct f32x2(pub [f32; 2]);
@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub [f32; 16]); pub struct f32x16(pub [f32; 16]);
extern "rust-intrinsic" {
fn simd_fexp2<T>(x: T) -> T;
}
// CHECK-LABEL: @exp2_32x2 // CHECK-LABEL: @exp2_32x2
#[no_mangle] #[no_mangle]
pub unsafe fn exp2_32x2(a: f32x2) -> f32x2 { pub unsafe fn exp2_32x2(a: f32x2) -> f32x2 {

View file

@ -1,10 +1,11 @@
//@ compile-flags: -C no-prepopulate-passes //@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(repr_simd, core_intrinsics)]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use std::intrinsics::simd::simd_floor;
#[repr(simd)] #[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub [f32; 2]); pub struct f32x2(pub [f32; 2]);
@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]);
#[derive(Copy, Clone, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub [f32; 16]); pub struct f32x16(pub [f32; 16]);
extern "rust-intrinsic" {
fn simd_floor<T>(x: T) -> T;
}
// CHECK-LABEL: @floor_32x2 // CHECK-LABEL: @floor_32x2
#[no_mangle] #[no_mangle]
pub unsafe fn floor_32x2(a: f32x2) -> f32x2 { pub unsafe fn floor_32x2(a: f32x2) -> f32x2 {

Some files were not shown because too many files have changed in this diff Show more