Auto merge of #132800 - matthiaskrgr:rollup-c1kkj56, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #132552 (Add v9, v8plus, and leoncasa target feature to sparc and use v8plus in create_object_file) - #132745 (pointee_info_at: fix logic for recursing into enums) - #132777 (try_question_mark_nop: update test for LLVM 20) - #132785 (rustc_target: more target string fixes for LLVM 20) - #132794 (Use a separate dir for r-a builds consistently in helix config) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
80445576d0
@ -1743,15 +1743,23 @@ pub enum PointerKind {
|
|||||||
Box { unpin: bool, global: bool },
|
Box { unpin: bool, global: bool },
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Note that this information is advisory only, and backends are free to ignore it.
|
/// Encodes extra information we have about a pointer.
|
||||||
/// It can only be used to encode potential optimizations, but no critical information.
|
/// Note that this information is advisory only, and backends are free to ignore it:
|
||||||
|
/// if the information is wrong, that can cause UB, but if the information is absent,
|
||||||
|
/// that must always be okay.
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct PointeeInfo {
|
pub struct PointeeInfo {
|
||||||
pub size: Size,
|
|
||||||
pub align: Align,
|
|
||||||
/// If this is `None`, then this is a raw pointer, so size and alignment are not guaranteed to
|
/// If this is `None`, then this is a raw pointer, so size and alignment are not guaranteed to
|
||||||
/// be reliable.
|
/// be reliable.
|
||||||
pub safe: Option<PointerKind>,
|
pub safe: Option<PointerKind>,
|
||||||
|
/// If `safe` is `Some`, then the pointer is either null or dereferenceable for this many bytes.
|
||||||
|
/// On a function argument, "dereferenceable" here means "dereferenceable for the entire duration
|
||||||
|
/// of this function call", i.e. it is UB for the memory that this pointer points to to be freed
|
||||||
|
/// while this function is still running.
|
||||||
|
/// The size can be zero if the pointer is not dereferenceable.
|
||||||
|
pub size: Size,
|
||||||
|
/// If `safe` is `Some`, then the pointer is aligned as indicated.
|
||||||
|
pub align: Align,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
|
impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
|
||||||
|
@ -228,6 +228,8 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
|
|||||||
"x86"
|
"x86"
|
||||||
} else if sess.target.arch == "arm64ec" {
|
} else if sess.target.arch == "arm64ec" {
|
||||||
"aarch64"
|
"aarch64"
|
||||||
|
} else if sess.target.arch == "sparc64" {
|
||||||
|
"sparc"
|
||||||
} else {
|
} else {
|
||||||
&*sess.target.arch
|
&*sess.target.arch
|
||||||
};
|
};
|
||||||
@ -280,6 +282,13 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
|
|||||||
// Support for `wide-arithmetic` will first land in LLVM 20 as part of
|
// Support for `wide-arithmetic` will first land in LLVM 20 as part of
|
||||||
// llvm/llvm-project#111598
|
// llvm/llvm-project#111598
|
||||||
("wasm32" | "wasm64", "wide-arithmetic") if get_version() < (20, 0, 0) => None,
|
("wasm32" | "wasm64", "wide-arithmetic") if get_version() < (20, 0, 0) => None,
|
||||||
|
("sparc", "leoncasa") => Some(LLVMFeature::new("hasleoncasa")),
|
||||||
|
// In LLVM 19, there is no `v8plus` feature and `v9` means "SPARC-V9 instruction available and SPARC-V8+ ABI used".
|
||||||
|
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L27-L28
|
||||||
|
// Before LLVM 19, there is no `v8plus` feature and `v9` means "SPARC-V9 instruction available".
|
||||||
|
// https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26
|
||||||
|
("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")),
|
||||||
|
("sparc", "v8plus") if get_version().0 < 19 => None,
|
||||||
(_, s) => Some(LLVMFeature::new(s)),
|
(_, s) => Some(LLVMFeature::new(s)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,6 +628,8 @@ pub(crate) fn global_llvm_features(
|
|||||||
.features
|
.features
|
||||||
.split(',')
|
.split(',')
|
||||||
.filter(|v| !v.is_empty() && backend_feature_name(sess, v).is_some())
|
.filter(|v| !v.is_empty() && backend_feature_name(sess, v).is_some())
|
||||||
|
// Drop +v8plus feature introduced in LLVM 20.
|
||||||
|
.filter(|v| *v != "+v8plus" || get_version() >= (20, 0, 0))
|
||||||
.map(String::from),
|
.map(String::from),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
|
|||||||
"riscv32" => (Architecture::Riscv32, None),
|
"riscv32" => (Architecture::Riscv32, None),
|
||||||
"riscv64" => (Architecture::Riscv64, None),
|
"riscv64" => (Architecture::Riscv64, None),
|
||||||
"sparc" => {
|
"sparc" => {
|
||||||
if sess.target.options.cpu == "v9" {
|
if sess.unstable_target_features.contains(&sym::v8plus) {
|
||||||
// Target uses V8+, aka EM_SPARC32PLUS, aka 64-bit V9 but in 32-bit mode
|
// Target uses V8+, aka EM_SPARC32PLUS, aka 64-bit V9 but in 32-bit mode
|
||||||
(Architecture::Sparc32Plus, None)
|
(Architecture::Sparc32Plus, None)
|
||||||
} else {
|
} else {
|
||||||
|
@ -336,6 +336,7 @@ pub fn internal(&self, feature: Symbol) -> bool {
|
|||||||
(unstable, riscv_target_feature, "1.45.0", Some(44839)),
|
(unstable, riscv_target_feature, "1.45.0", Some(44839)),
|
||||||
(unstable, rtm_target_feature, "1.35.0", Some(44839)),
|
(unstable, rtm_target_feature, "1.35.0", Some(44839)),
|
||||||
(unstable, s390x_target_feature, "1.82.0", Some(44839)),
|
(unstable, s390x_target_feature, "1.82.0", Some(44839)),
|
||||||
|
(unstable, sparc_target_feature, "CURRENT_RUSTC_VERSION", Some(132783)),
|
||||||
(unstable, sse4a_target_feature, "1.27.0", Some(44839)),
|
(unstable, sse4a_target_feature, "1.27.0", Some(44839)),
|
||||||
(unstable, tbm_target_feature, "1.27.0", Some(44839)),
|
(unstable, tbm_target_feature, "1.27.0", Some(44839)),
|
||||||
(unstable, wasm_target_feature, "1.30.0", Some(44839)),
|
(unstable, wasm_target_feature, "1.30.0", Some(44839)),
|
||||||
|
@ -1011,25 +1011,41 @@ fn ty_and_layout_pointee_info_at(
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
let mut data_variant = match this.variants {
|
let mut data_variant = match &this.variants {
|
||||||
// Within the discriminant field, only the niche itself is
|
// Within the discriminant field, only the niche itself is
|
||||||
// always initialized, so we only check for a pointer at its
|
// always initialized, so we only check for a pointer at its
|
||||||
// offset.
|
// offset.
|
||||||
//
|
//
|
||||||
// If the niche is a pointer, it's either valid (according
|
// Our goal here is to check whether this represents a
|
||||||
// to its type), or null (which the niche field's scalar
|
// "dereferenceable or null" pointer, so we need to ensure
|
||||||
// validity range encodes). This allows using
|
// that there is only one other variant, and it must be null.
|
||||||
// `dereferenceable_or_null` for e.g., `Option<&T>`, and
|
// Below, we will then check whether the pointer is indeed
|
||||||
// this will continue to work as long as we don't start
|
// dereferenceable.
|
||||||
// using more niches than just null (e.g., the first page of
|
|
||||||
// the address space, or unaligned pointers).
|
|
||||||
Variants::Multiple {
|
Variants::Multiple {
|
||||||
tag_encoding: TagEncoding::Niche { untagged_variant, .. },
|
tag_encoding:
|
||||||
|
TagEncoding::Niche { untagged_variant, niche_variants, niche_start },
|
||||||
tag_field,
|
tag_field,
|
||||||
|
variants,
|
||||||
..
|
..
|
||||||
} if this.fields.offset(tag_field) == offset => {
|
} if variants.len() == 2 && this.fields.offset(*tag_field) == offset => {
|
||||||
Some(this.for_variant(cx, untagged_variant))
|
let tagged_variant = if untagged_variant.as_u32() == 0 {
|
||||||
|
VariantIdx::from_u32(1)
|
||||||
|
} else {
|
||||||
|
VariantIdx::from_u32(0)
|
||||||
|
};
|
||||||
|
assert_eq!(tagged_variant, *niche_variants.start());
|
||||||
|
if *niche_start == 0 {
|
||||||
|
// The other variant is encoded as "null", so we can recurse searching for
|
||||||
|
// a pointer here. This relies on the fact that the codegen backend
|
||||||
|
// only adds "dereferenceable" if there's also a "nonnull" proof,
|
||||||
|
// and that null is aligned for all alignments so it's okay to forward
|
||||||
|
// the pointer's alignment.
|
||||||
|
Some(this.for_variant(cx, *untagged_variant))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Variants::Multiple { .. } => None,
|
||||||
_ => Some(this),
|
_ => Some(this),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1867,6 +1867,7 @@
|
|||||||
slice_patterns,
|
slice_patterns,
|
||||||
slicing_syntax,
|
slicing_syntax,
|
||||||
soft,
|
soft,
|
||||||
|
sparc_target_feature,
|
||||||
specialization,
|
specialization,
|
||||||
speed,
|
speed,
|
||||||
spotlight,
|
spotlight,
|
||||||
@ -2109,6 +2110,7 @@
|
|||||||
usize_legacy_fn_max_value,
|
usize_legacy_fn_max_value,
|
||||||
usize_legacy_fn_min_value,
|
usize_legacy_fn_min_value,
|
||||||
usize_legacy_mod,
|
usize_legacy_mod,
|
||||||
|
v8plus,
|
||||||
va_arg,
|
va_arg,
|
||||||
va_copy,
|
va_copy,
|
||||||
va_end,
|
va_end,
|
||||||
|
@ -143,7 +143,8 @@ pub struct ArgAttributes {
|
|||||||
pub regular: ArgAttribute,
|
pub regular: ArgAttribute,
|
||||||
pub arg_ext: ArgExtension,
|
pub arg_ext: ArgExtension,
|
||||||
/// The minimum size of the pointee, guaranteed to be valid for the duration of the whole call
|
/// The minimum size of the pointee, guaranteed to be valid for the duration of the whole call
|
||||||
/// (corresponding to LLVM's dereferenceable and dereferenceable_or_null attributes).
|
/// (corresponding to LLVM's dereferenceable_or_null attributes, i.e., it is okay for this to be
|
||||||
|
/// set on a null pointer, but all non-null pointers must be dereferenceable).
|
||||||
pub pointee_size: Size,
|
pub pointee_size: Size,
|
||||||
pub pointee_align: Option<Align>,
|
pub pointee_align: Option<Align>,
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
data_layout: "E-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||||
arch: "aarch64".into(),
|
arch: "aarch64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
features: "+v8a,+outline-atomics".into(),
|
features: "+v8a,+outline-atomics".into(),
|
||||||
|
@ -14,7 +14,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 32,
|
pointer_width: 32,
|
||||||
data_layout: "E-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
data_layout: "E-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||||
arch: "aarch64".into(),
|
arch: "aarch64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: "ilp32".into(),
|
abi: "ilp32".into(),
|
||||||
|
@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 64,
|
pointer_width: 64,
|
||||||
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
data_layout: "E-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||||
arch: "aarch64".into(),
|
arch: "aarch64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
mcount: "__mcount".into(),
|
mcount: "__mcount".into(),
|
||||||
|
@ -10,7 +10,7 @@ pub(crate) fn target() -> Target {
|
|||||||
std: Some(true),
|
std: Some(true),
|
||||||
},
|
},
|
||||||
pointer_width: 32,
|
pointer_width: 32,
|
||||||
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||||
arch: "aarch64".into(),
|
arch: "aarch64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: "ilp32".into(),
|
abi: "ilp32".into(),
|
||||||
|
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
|
|||||||
data_layout: "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64".into(),
|
data_layout: "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64".into(),
|
||||||
arch: "sparc".into(),
|
arch: "sparc".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
|
features: "+v8plus".into(),
|
||||||
cpu: "v9".into(),
|
cpu: "v9".into(),
|
||||||
endian: Endian::Big,
|
endian: Endian::Big,
|
||||||
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
|
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
|
||||||
|
@ -545,6 +545,14 @@ pub fn is_supported(self) -> bool {
|
|||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const SPARC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
|
||||||
|
// tidy-alphabetical-start
|
||||||
|
("leoncasa", Unstable(sym::sparc_target_feature), &[]),
|
||||||
|
("v8plus", Unstable(sym::sparc_target_feature), &[]),
|
||||||
|
("v9", Unstable(sym::sparc_target_feature), &[]),
|
||||||
|
// tidy-alphabetical-end
|
||||||
|
];
|
||||||
|
|
||||||
/// When rustdoc is running, provide a list of all known features so that all their respective
|
/// When rustdoc is running, provide a list of all known features so that all their respective
|
||||||
/// primitives may be documented.
|
/// primitives may be documented.
|
||||||
///
|
///
|
||||||
@ -563,6 +571,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
|
|||||||
.chain(CSKY_FEATURES)
|
.chain(CSKY_FEATURES)
|
||||||
.chain(LOONGARCH_FEATURES)
|
.chain(LOONGARCH_FEATURES)
|
||||||
.chain(IBMZ_FEATURES)
|
.chain(IBMZ_FEATURES)
|
||||||
|
.chain(SPARC_FEATURES)
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(|(f, s, _)| (f, s))
|
.map(|(f, s, _)| (f, s))
|
||||||
}
|
}
|
||||||
@ -582,6 +591,7 @@ pub fn rust_target_features(&self) -> &'static [(&'static str, Stability, Implie
|
|||||||
"csky" => CSKY_FEATURES,
|
"csky" => CSKY_FEATURES,
|
||||||
"loongarch64" => LOONGARCH_FEATURES,
|
"loongarch64" => LOONGARCH_FEATURES,
|
||||||
"s390x" => IBMZ_FEATURES,
|
"s390x" => IBMZ_FEATURES,
|
||||||
|
"sparc" | "sparc64" => SPARC_FEATURES,
|
||||||
_ => &[],
|
_ => &[],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
# This config uses a separate build directory for rust-analyzer,
|
||||||
|
# so that r-a's checks don't block user `x` commands and vice-verse.
|
||||||
|
# R-a's build directory is located in `build/rust-analyzer`.
|
||||||
|
#
|
||||||
|
# To build rustfmt and proc macro server for r-a run the following command:
|
||||||
|
# ```
|
||||||
|
# x b proc-macro-srv-cli rustfmt --stage 0 --build-dir build/rust-analyzer
|
||||||
|
# ```
|
||||||
|
|
||||||
[language-server.rust-analyzer.config]
|
[language-server.rust-analyzer.config]
|
||||||
linkedProjects = [
|
linkedProjects = [
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
@ -17,16 +26,18 @@ overrideCommand = [
|
|||||||
"x.py",
|
"x.py",
|
||||||
"check",
|
"check",
|
||||||
"--json-output",
|
"--json-output",
|
||||||
|
"--build-dir",
|
||||||
|
"build/rust-analyzer",
|
||||||
]
|
]
|
||||||
|
|
||||||
[language-server.rust-analyzer.config.rustfmt]
|
[language-server.rust-analyzer.config.rustfmt]
|
||||||
overrideCommand = [
|
overrideCommand = [
|
||||||
"build-rust-analyzer/host/rustfmt/bin/rustfmt",
|
"build/rust-analyzer/host/rustfmt/bin/rustfmt",
|
||||||
"--edition=2021"
|
"--edition=2021"
|
||||||
]
|
]
|
||||||
|
|
||||||
[language-server.rust-analyzer.config.procMacro]
|
[language-server.rust-analyzer.config.procMacro]
|
||||||
server = "build-rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
|
server = "build/rust-analyzer/host/stage0/libexec/rust-analyzer-proc-macro-srv"
|
||||||
enable = true
|
enable = true
|
||||||
|
|
||||||
[language-server.rust-analyzer.config.rustc]
|
[language-server.rust-analyzer.config.rustc]
|
||||||
@ -47,4 +58,6 @@ overrideCommand = [
|
|||||||
"x.py",
|
"x.py",
|
||||||
"check",
|
"check",
|
||||||
"--json-output",
|
"--json-output",
|
||||||
|
"--build-dir",
|
||||||
|
"build/rust-analyzer",
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//@ compile-flags: -O -C no-prepopulate-passes
|
//@ compile-flags: -O -C no-prepopulate-passes
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
#![feature(rustc_attrs)]
|
||||||
#![feature(dyn_star)]
|
#![feature(dyn_star)]
|
||||||
#![feature(allocator_api)]
|
#![feature(allocator_api)]
|
||||||
|
|
||||||
@ -143,13 +144,28 @@ pub fn indirect_struct(_: S) {}
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn borrowed_struct(_: &S) {}
|
pub fn borrowed_struct(_: &S) {}
|
||||||
|
|
||||||
// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %x)
|
// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %_x)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_borrow(x: Option<&i32>) {}
|
pub fn option_borrow(_x: Option<&i32>) {}
|
||||||
|
|
||||||
// CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %x)
|
// CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %_x)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_borrow_mut(x: Option<&mut i32>) {}
|
pub fn option_borrow_mut(_x: Option<&mut i32>) {}
|
||||||
|
|
||||||
|
// Function that must NOT have `dereferenceable` or `align`.
|
||||||
|
#[rustc_layout_scalar_valid_range_start(16)]
|
||||||
|
pub struct RestrictedAddress(&'static i16);
|
||||||
|
enum E {
|
||||||
|
A(RestrictedAddress),
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
}
|
||||||
|
// If the `nonnull` ever goes missing, you might have to tweak the
|
||||||
|
// scalar_valid_range on `RestrictedAddress` to get it back. You
|
||||||
|
// might even have to add a `rustc_layout_scalar_valid_range_end`.
|
||||||
|
// CHECK: @nonnull_and_nondereferenceable(ptr noundef nonnull %_x)
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn nonnull_and_nondereferenceable(_x: E) {}
|
||||||
|
|
||||||
// CHECK: @raw_struct(ptr noundef %_1)
|
// CHECK: @raw_struct(ptr noundef %_1)
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
//@ compile-flags: -O -Z merge-functions=disabled --edition=2021
|
//@ compile-flags: -O -Z merge-functions=disabled --edition=2021
|
||||||
//@ only-x86_64
|
//@ only-x86_64
|
||||||
// FIXME: Remove the `min-llvm-version`.
|
// FIXME: Remove the `min-llvm-version`.
|
||||||
|
//@ revisions: NINETEEN TWENTY
|
||||||
|
//@[NINETEEN] min-llvm-version: 19
|
||||||
|
//@[NINETEEN] ignore-llvm-version: 20-99
|
||||||
|
//@[TWENTY] min-llvm-version: 20
|
||||||
//@ min-llvm-version: 19
|
//@ min-llvm-version: 19
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
@ -13,8 +17,11 @@
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
|
pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
|
||||||
// CHECK: start:
|
// CHECK: start:
|
||||||
|
// TWENTY-NEXT: %trunc = trunc nuw i32 %0 to i1
|
||||||
|
// TWENTY-NEXT: %.2 = select i1 %trunc, i32 %1, i32 undef
|
||||||
// CHECK-NEXT: [[REG1:%.*]] = insertvalue { i32, i32 } poison, i32 %0, 0
|
// CHECK-NEXT: [[REG1:%.*]] = insertvalue { i32, i32 } poison, i32 %0, 0
|
||||||
// CHECK-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %1, 1
|
// NINETEEN-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %1, 1
|
||||||
|
// TWENTY-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %.2, 1
|
||||||
// CHECK-NEXT: ret { i32, i32 } [[REG2]]
|
// CHECK-NEXT: ret { i32, i32 } [[REG2]]
|
||||||
match x {
|
match x {
|
||||||
Some(x) => Some(x),
|
Some(x) => Some(x),
|
||||||
@ -26,6 +33,8 @@ pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn option_nop_traits_32(x: Option<u32>) -> Option<u32> {
|
pub fn option_nop_traits_32(x: Option<u32>) -> Option<u32> {
|
||||||
// CHECK: start:
|
// CHECK: start:
|
||||||
|
// TWENTY-NEXT: %trunc = trunc nuw i32 %0 to i1
|
||||||
|
// TWENTY-NEXT: %.1 = select i1 %trunc, i32 %1, i32 undef
|
||||||
// CHECK-NEXT: insertvalue { i32, i32 }
|
// CHECK-NEXT: insertvalue { i32, i32 }
|
||||||
// CHECK-NEXT: insertvalue { i32, i32 }
|
// CHECK-NEXT: insertvalue { i32, i32 }
|
||||||
// CHECK-NEXT: ret { i32, i32 }
|
// CHECK-NEXT: ret { i32, i32 }
|
||||||
|
43
tests/ui/abi/sparcv8plus.rs
Normal file
43
tests/ui/abi/sparcv8plus.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
//@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus
|
||||||
|
//@[sparc] compile-flags: --target sparc-unknown-none-elf
|
||||||
|
//@[sparc] needs-llvm-components: sparc
|
||||||
|
//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu
|
||||||
|
//@[sparcv8plus] needs-llvm-components: sparc
|
||||||
|
//@[sparc_cpu_v9] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9
|
||||||
|
//@[sparc_cpu_v9] needs-llvm-components: sparc
|
||||||
|
//@[sparc_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-feature=+v8plus
|
||||||
|
//@[sparc_feature_v8plus] needs-llvm-components: sparc
|
||||||
|
//@[sparc_cpu_v9_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9 -C target-feature=+v8plus
|
||||||
|
//@[sparc_cpu_v9_feature_v8plus] needs-llvm-components: sparc
|
||||||
|
//@ min-llvm-version: 19
|
||||||
|
|
||||||
|
#![crate_type = "rlib"]
|
||||||
|
#![feature(no_core, rustc_attrs, lang_items)]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
#[lang = "sized"]
|
||||||
|
trait Sized {}
|
||||||
|
#[lang = "copy"]
|
||||||
|
trait Copy {}
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! compile_error {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(all(not(target_feature = "v8plus"), not(target_feature = "v9")))]
|
||||||
|
compile_error!("-v8plus,-v9");
|
||||||
|
//[sparc]~^ ERROR -v8plus,-v9
|
||||||
|
|
||||||
|
// FIXME: sparc_cpu_v9 should be in "-v8plus,+v9" group (fixed in LLVM 20)
|
||||||
|
#[cfg(all(target_feature = "v8plus", target_feature = "v9"))]
|
||||||
|
compile_error!("+v8plus,+v9");
|
||||||
|
//[sparcv8plus,sparc_cpu_v9_feature_v8plus,sparc_cpu_v9]~^ ERROR +v8plus,+v9
|
||||||
|
|
||||||
|
// FIXME: should be rejected
|
||||||
|
#[cfg(all(target_feature = "v8plus", not(target_feature = "v9")))]
|
||||||
|
compile_error!("+v8plus,-v9 (FIXME)");
|
||||||
|
//[sparc_feature_v8plus]~^ ERROR +v8plus,-v9 (FIXME)
|
||||||
|
|
||||||
|
#[cfg(all(not(target_feature = "v8plus"), target_feature = "v9"))]
|
||||||
|
compile_error!("-v8plus,+v9");
|
8
tests/ui/abi/sparcv8plus.sparc.stderr
Normal file
8
tests/ui/abi/sparcv8plus.sparc.stderr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
error: -v8plus,-v9
|
||||||
|
--> $DIR/sparcv8plus.rs:29:1
|
||||||
|
|
|
||||||
|
LL | compile_error!("-v8plus,-v9");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
8
tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr
Normal file
8
tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
error: +v8plus,+v9
|
||||||
|
--> $DIR/sparcv8plus.rs:34:1
|
||||||
|
|
|
||||||
|
LL | compile_error!("+v8plus,+v9");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
error: +v8plus,+v9
|
||||||
|
--> $DIR/sparcv8plus.rs:34:1
|
||||||
|
|
|
||||||
|
LL | compile_error!("+v8plus,+v9");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
8
tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr
Normal file
8
tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
error: +v8plus,-v9 (FIXME)
|
||||||
|
--> $DIR/sparcv8plus.rs:39:1
|
||||||
|
|
|
||||||
|
LL | compile_error!("+v8plus,-v9 (FIXME)");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
8
tests/ui/abi/sparcv8plus.sparcv8plus.stderr
Normal file
8
tests/ui/abi/sparcv8plus.sparcv8plus.stderr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
error: +v8plus,+v9
|
||||||
|
--> $DIR/sparcv8plus.rs:34:1
|
||||||
|
|
|
||||||
|
LL | compile_error!("+v8plus,+v9");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
@ -251,7 +251,7 @@ warning: unexpected `cfg` condition value: `zebra`
|
|||||||
LL | cfg!(target_feature = "zebra");
|
LL | cfg!(target_feature = "zebra");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 247 more
|
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 250 more
|
||||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
|
||||||
warning: 27 warnings emitted
|
warning: 27 warnings emitted
|
||||||
|
@ -174,7 +174,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
|||||||
LL | target_feature = "_UNEXPECTED_VALUE",
|
LL | target_feature = "_UNEXPECTED_VALUE",
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pauth-lr`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `wide-arithmetic`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt`
|
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `leoncasa`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pauth-lr`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v8plus`, `v9`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `wide-arithmetic`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt`
|
||||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
|
||||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
// gate-test-lahfsahf_target_feature
|
// gate-test-lahfsahf_target_feature
|
||||||
// gate-test-prfchw_target_feature
|
// gate-test-prfchw_target_feature
|
||||||
// gate-test-s390x_target_feature
|
// gate-test-s390x_target_feature
|
||||||
|
// gate-test-sparc_target_feature
|
||||||
|
|
||||||
#[target_feature(enable = "avx512bw")]
|
#[target_feature(enable = "avx512bw")]
|
||||||
//~^ ERROR: currently unstable
|
//~^ ERROR: currently unstable
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0658]: the target feature `avx512bw` is currently unstable
|
error[E0658]: the target feature `avx512bw` is currently unstable
|
||||||
--> $DIR/gate.rs:27:18
|
--> $DIR/gate.rs:28:18
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "avx512bw")]
|
LL | #[target_feature(enable = "avx512bw")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
Loading…
Reference in New Issue
Block a user