Auto merge of #143239 - GuillaumeGomez:subtree-update_cg_gcc_2025-06-30, r=GuillaumeGomez
GCC backend subtree update cc `@antoyo` r? ghost
This commit is contained in:
commit
f26e580230
12 changed files with 131 additions and 171 deletions
|
|
@ -6,6 +6,7 @@ resolver = "2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
core = { path = "./sysroot_src/library/core" }
|
core = { path = "./sysroot_src/library/core" }
|
||||||
|
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
|
||||||
alloc = { path = "./sysroot_src/library/alloc" }
|
alloc = { path = "./sysroot_src/library/alloc" }
|
||||||
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
|
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
|
||||||
test = { path = "./sysroot_src/library/test" }
|
test = { path = "./sysroot_src/library/test" }
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ use crate::build;
|
||||||
use crate::config::{Channel, ConfigInfo};
|
use crate::config::{Channel, ConfigInfo};
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
|
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
|
||||||
run_command, run_command_with_env, run_command_with_output, run_command_with_output_and_env,
|
run_command, run_command_with_env, run_command_with_output_and_env, rustc_version_info,
|
||||||
rustc_version_info, split_args, walk_dir,
|
split_args, walk_dir,
|
||||||
};
|
};
|
||||||
|
|
||||||
type Env = HashMap<String, String>;
|
type Env = HashMap<String, String>;
|
||||||
|
|
@ -485,30 +485,6 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
|
||||||
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
|
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut patches = Vec::new();
|
|
||||||
walk_dir(
|
|
||||||
"patches/tests",
|
|
||||||
&mut |_| Ok(()),
|
|
||||||
&mut |file_path: &Path| {
|
|
||||||
patches.push(file_path.to_path_buf());
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
)?;
|
|
||||||
patches.sort();
|
|
||||||
// TODO: remove duplication with prepare.rs by creating a apply_patch function in the utils
|
|
||||||
// module.
|
|
||||||
for file_path in patches {
|
|
||||||
println!("[GIT] apply `{}`", file_path.display());
|
|
||||||
let path = Path::new("../..").join(file_path);
|
|
||||||
run_command_with_output(&[&"git", &"apply", &path], rust_dir)?;
|
|
||||||
run_command_with_output(&[&"git", &"add", &"-A"], rust_dir)?;
|
|
||||||
run_command_with_output(
|
|
||||||
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
|
|
||||||
rust_dir,
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cargo = String::from_utf8(
|
let cargo = String::from_utf8(
|
||||||
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
|
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
From a131c69e54b5c02fe3b517e8f3ad23d4f784ffc8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Antoni Boucher <bouanto@zoho.com>
|
|
||||||
Date: Fri, 13 Jun 2025 20:25:33 -0400
|
|
||||||
Subject: [PATCH] Workaround to make a run-make test pass
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/run-make/linker-warning/rmake.rs | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs
|
|
||||||
index bc21739fefc..0946a7e2a48 100644
|
|
||||||
--- a/tests/run-make/linker-warning/rmake.rs
|
|
||||||
+++ b/tests/run-make/linker-warning/rmake.rs
|
|
||||||
@@ -55,7 +55,7 @@ fn main() {
|
|
||||||
diff()
|
|
||||||
.expected_file("short-error.txt")
|
|
||||||
.actual_text("(linker error)", out.stderr())
|
|
||||||
- .normalize(r#"/rustc[^/]*/"#, "/rustc/")
|
|
||||||
+ .normalize(r#"/tmp/rustc[^/]*/"#, "/tmp/rustc/")
|
|
||||||
.normalize(
|
|
||||||
regex::escape(run_make_support::build_root().to_str().unwrap()),
|
|
||||||
"/build-root",
|
|
||||||
--
|
|
||||||
2.49.0
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2025-06-02"
|
channel = "nightly-2025-06-28"
|
||||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
use gccjit::FnAttribute;
|
use gccjit::FnAttribute;
|
||||||
use gccjit::{ToLValue, ToRValue, Type};
|
use gccjit::{ToLValue, ToRValue, Type};
|
||||||
use rustc_abi::{ArmCall, CanonAbi, InterruptKind, Reg, RegKind, X86Call};
|
#[cfg(feature = "master")]
|
||||||
|
use rustc_abi::{ArmCall, CanonAbi, InterruptKind, X86Call};
|
||||||
|
use rustc_abi::{Reg, RegKind};
|
||||||
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
|
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
|
|
|
||||||
|
|
@ -538,11 +538,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ret(&mut self, mut value: RValue<'gcc>) {
|
fn ret(&mut self, mut value: RValue<'gcc>) {
|
||||||
if self.structs_as_pointer.borrow().contains(&value) {
|
|
||||||
// NOTE: hack to workaround a limitation of the rustc API: see comment on
|
|
||||||
// CodegenCx.structs_as_pointer
|
|
||||||
value = value.dereference(self.location).to_rvalue();
|
|
||||||
}
|
|
||||||
let expected_return_type = self.current_func().get_return_type();
|
let expected_return_type = self.current_func().get_return_type();
|
||||||
if !expected_return_type.is_compatible_with(value.get_type()) {
|
if !expected_return_type.is_compatible_with(value.get_type()) {
|
||||||
// NOTE: due to opaque pointers now being used, we need to cast here.
|
// NOTE: due to opaque pointers now being used, we need to cast here.
|
||||||
|
|
@ -700,7 +695,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
let a = self.gcc_int_cast(a, a_type);
|
let a = self.gcc_int_cast(a, a_type);
|
||||||
let b_type = b.get_type().to_unsigned(self);
|
let b_type = b.get_type().to_unsigned(self);
|
||||||
let b = self.gcc_int_cast(b, b_type);
|
let b = self.gcc_int_cast(b, b_type);
|
||||||
a / b
|
self.gcc_udiv(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
fn sdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||||
|
|
@ -712,8 +707,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
// FIXME(antoyo): rustc_codegen_ssa::mir::intrinsic uses different types for a and b but they
|
// FIXME(antoyo): rustc_codegen_ssa::mir::intrinsic uses different types for a and b but they
|
||||||
// should be the same.
|
// should be the same.
|
||||||
let typ = a.get_type().to_signed(self);
|
let typ = a.get_type().to_signed(self);
|
||||||
let b = self.context.new_cast(self.location, b, typ);
|
let b = self.gcc_int_cast(b, typ);
|
||||||
a / b
|
self.gcc_sdiv(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
fn fdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||||
|
|
@ -1119,13 +1114,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
// TODO(antoyo)
|
// TODO(antoyo)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn store(&mut self, mut val: RValue<'gcc>, ptr: RValue<'gcc>, align: Align) -> RValue<'gcc> {
|
fn store(&mut self, val: RValue<'gcc>, ptr: RValue<'gcc>, align: Align) -> RValue<'gcc> {
|
||||||
if self.structs_as_pointer.borrow().contains(&val) {
|
|
||||||
// NOTE: hack to workaround a limitation of the rustc API: see comment on
|
|
||||||
// CodegenCx.structs_as_pointer
|
|
||||||
val = val.dereference(self.location).to_rvalue();
|
|
||||||
}
|
|
||||||
|
|
||||||
self.store_with_flags(val, ptr, align, MemFlags::empty())
|
self.store_with_flags(val, ptr, align, MemFlags::empty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1508,16 +1497,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
element.get_address(self.location)
|
element.get_address(self.location)
|
||||||
} else if value_type.dyncast_vector().is_some() {
|
} else if value_type.dyncast_vector().is_some() {
|
||||||
panic!();
|
panic!();
|
||||||
} else if let Some(pointer_type) = value_type.get_pointee() {
|
|
||||||
if let Some(struct_type) = pointer_type.is_struct() {
|
|
||||||
// NOTE: hack to workaround a limitation of the rustc API: see comment on
|
|
||||||
// CodegenCx.structs_as_pointer
|
|
||||||
aggregate_value
|
|
||||||
.dereference_field(self.location, struct_type.get_field(idx as i32))
|
|
||||||
.to_rvalue()
|
|
||||||
} else {
|
|
||||||
panic!("Unexpected type {:?}", value_type);
|
|
||||||
}
|
|
||||||
} else if let Some(struct_type) = value_type.is_struct() {
|
} else if let Some(struct_type) = value_type.is_struct() {
|
||||||
aggregate_value
|
aggregate_value
|
||||||
.access_field(self.location, struct_type.get_field(idx as i32))
|
.access_field(self.location, struct_type.get_field(idx as i32))
|
||||||
|
|
@ -1537,21 +1516,18 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
assert_eq!(idx as usize as u64, idx);
|
assert_eq!(idx as usize as u64, idx);
|
||||||
let value_type = aggregate_value.get_type();
|
let value_type = aggregate_value.get_type();
|
||||||
|
|
||||||
|
let new_val = self.current_func().new_local(None, value_type, "aggregate_value");
|
||||||
|
self.block.add_assignment(None, new_val, aggregate_value);
|
||||||
|
|
||||||
let lvalue = if value_type.dyncast_array().is_some() {
|
let lvalue = if value_type.dyncast_array().is_some() {
|
||||||
let index = self
|
let index = self
|
||||||
.context
|
.context
|
||||||
.new_rvalue_from_long(self.u64_type, i64::try_from(idx).expect("i64::try_from"));
|
.new_rvalue_from_long(self.u64_type, i64::try_from(idx).expect("i64::try_from"));
|
||||||
self.context.new_array_access(self.location, aggregate_value, index)
|
self.context.new_array_access(self.location, new_val, index)
|
||||||
} else if value_type.dyncast_vector().is_some() {
|
} else if value_type.dyncast_vector().is_some() {
|
||||||
panic!();
|
panic!();
|
||||||
} else if let Some(pointer_type) = value_type.get_pointee() {
|
} else if let Some(struct_type) = value_type.is_struct() {
|
||||||
if let Some(struct_type) = pointer_type.is_struct() {
|
new_val.access_field(None, struct_type.get_field(idx as i32))
|
||||||
// NOTE: hack to workaround a limitation of the rustc API: see comment on
|
|
||||||
// CodegenCx.structs_as_pointer
|
|
||||||
aggregate_value.dereference_field(self.location, struct_type.get_field(idx as i32))
|
|
||||||
} else {
|
|
||||||
panic!("Unexpected type {:?}", value_type);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
panic!("Unexpected type {:?}", value_type);
|
panic!("Unexpected type {:?}", value_type);
|
||||||
};
|
};
|
||||||
|
|
@ -1568,7 +1544,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||||
|
|
||||||
self.llbb().add_assignment(self.location, lvalue, value);
|
self.llbb().add_assignment(self.location, lvalue, value);
|
||||||
|
|
||||||
aggregate_value
|
new_val.to_rvalue()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_personality_fn(&mut self, _personality: Function<'gcc>) {
|
fn set_personality_fn(&mut self, _personality: Function<'gcc>) {
|
||||||
|
|
|
||||||
|
|
@ -117,15 +117,7 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {
|
||||||
|
|
||||||
fn const_undef(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
fn const_undef(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
||||||
let local = self.current_func.borrow().expect("func").new_local(None, typ, "undefined");
|
let local = self.current_func.borrow().expect("func").new_local(None, typ, "undefined");
|
||||||
if typ.is_struct().is_some() {
|
local.to_rvalue()
|
||||||
// NOTE: hack to workaround a limitation of the rustc API: see comment on
|
|
||||||
// CodegenCx.structs_as_pointer
|
|
||||||
let pointer = local.get_address(None);
|
|
||||||
self.structs_as_pointer.borrow_mut().insert(pointer);
|
|
||||||
pointer
|
|
||||||
} else {
|
|
||||||
local.to_rvalue()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn const_poison(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
fn const_poison(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
||||||
|
|
|
||||||
|
|
@ -124,14 +124,6 @@ pub struct CodegenCx<'gcc, 'tcx> {
|
||||||
|
|
||||||
pub pointee_infos: RefCell<FxHashMap<(Ty<'tcx>, Size), Option<PointeeInfo>>>,
|
pub pointee_infos: RefCell<FxHashMap<(Ty<'tcx>, Size), Option<PointeeInfo>>>,
|
||||||
|
|
||||||
/// NOTE: a hack is used because the rustc API is not suitable to libgccjit and as such,
|
|
||||||
/// `const_undef()` returns struct as pointer so that they can later be assigned a value (in
|
|
||||||
/// e.g. Builder::insert_value).
|
|
||||||
/// As such, this set remembers which of these pointers were returned by this function so that
|
|
||||||
/// they can be dereferenced later.
|
|
||||||
/// FIXME(antoyo): fix the rustc API to avoid having this hack.
|
|
||||||
pub structs_as_pointer: RefCell<FxHashSet<RValue<'gcc>>>,
|
|
||||||
|
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
pub cleanup_blocks: RefCell<FxHashSet<Block<'gcc>>>,
|
pub cleanup_blocks: RefCell<FxHashSet<Block<'gcc>>>,
|
||||||
/// The alignment of a u128/i128 type.
|
/// The alignment of a u128/i128 type.
|
||||||
|
|
@ -304,7 +296,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
rust_try_fn: Cell::new(None),
|
rust_try_fn: Cell::new(None),
|
||||||
pointee_infos: Default::default(),
|
pointee_infos: Default::default(),
|
||||||
structs_as_pointer: Default::default(),
|
|
||||||
#[cfg(feature = "master")]
|
#[cfg(feature = "master")]
|
||||||
cleanup_blocks: Default::default(),
|
cleanup_blocks: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`
|
// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`
|
||||||
// DO NOT EDIT IT!
|
// DO NOT EDIT IT!
|
||||||
/// Translate a given LLVM intrinsic name to an equivalent GCC one.
|
/// Translate a given LLVM intrinsic name to an equivalent GCC one.
|
||||||
fn map_arch_intrinsic(name: &str) -> &str {
|
fn map_arch_intrinsic(full_name: &str) -> &'static str {
|
||||||
let Some(name) = name.strip_prefix("llvm.") else {
|
let Some(name) = full_name.strip_prefix("llvm.") else {
|
||||||
unimplemented!("***** unsupported LLVM intrinsic {}", name)
|
unimplemented!("***** unsupported LLVM intrinsic {}", full_name)
|
||||||
};
|
};
|
||||||
let Some((arch, name)) = name.split_once('.') else {
|
let Some((arch, name)) = name.split_once('.') else {
|
||||||
unimplemented!("***** unsupported LLVM intrinsic {}", name)
|
unimplemented!("***** unsupported LLVM intrinsic {}", name)
|
||||||
|
|
@ -11,7 +11,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
match arch {
|
match arch {
|
||||||
"AMDGPU" => {
|
"AMDGPU" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn AMDGPU(name: &str) -> &str {
|
fn AMDGPU(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// AMDGPU
|
// AMDGPU
|
||||||
"div.fixup.f32" => "__builtin_amdgpu_div_fixup",
|
"div.fixup.f32" => "__builtin_amdgpu_div_fixup",
|
||||||
|
|
@ -42,14 +42,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"trig.preop.f64" => "__builtin_amdgpu_trig_preop",
|
"trig.preop.f64" => "__builtin_amdgpu_trig_preop",
|
||||||
"trig.preop.v2f64" => "__builtin_amdgpu_trig_preop",
|
"trig.preop.v2f64" => "__builtin_amdgpu_trig_preop",
|
||||||
"trig.preop.v4f32" => "__builtin_amdgpu_trig_preop",
|
"trig.preop.v4f32" => "__builtin_amdgpu_trig_preop",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AMDGPU(name)
|
AMDGPU(name, full_name)
|
||||||
}
|
}
|
||||||
"aarch64" => {
|
"aarch64" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn aarch64(name: &str) -> &str {
|
fn aarch64(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// aarch64
|
// aarch64
|
||||||
"chkfeat" => "__builtin_arm_chkfeat",
|
"chkfeat" => "__builtin_arm_chkfeat",
|
||||||
|
|
@ -75,14 +75,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"tcommit" => "__builtin_arm_tcommit",
|
"tcommit" => "__builtin_arm_tcommit",
|
||||||
"tstart" => "__builtin_arm_tstart",
|
"tstart" => "__builtin_arm_tstart",
|
||||||
"ttest" => "__builtin_arm_ttest",
|
"ttest" => "__builtin_arm_ttest",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aarch64(name)
|
aarch64(name, full_name)
|
||||||
}
|
}
|
||||||
"amdgcn" => {
|
"amdgcn" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn amdgcn(name: &str) -> &str {
|
fn amdgcn(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// amdgcn
|
// amdgcn
|
||||||
"alignbyte" => "__builtin_amdgcn_alignbyte",
|
"alignbyte" => "__builtin_amdgcn_alignbyte",
|
||||||
|
|
@ -99,6 +99,8 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"cvt.f32.fp8" => "__builtin_amdgcn_cvt_f32_fp8",
|
"cvt.f32.fp8" => "__builtin_amdgcn_cvt_f32_fp8",
|
||||||
"cvt.off.f32.i4" => "__builtin_amdgcn_cvt_off_f32_i4",
|
"cvt.off.f32.i4" => "__builtin_amdgcn_cvt_off_f32_i4",
|
||||||
"cvt.pk.bf8.f32" => "__builtin_amdgcn_cvt_pk_bf8_f32",
|
"cvt.pk.bf8.f32" => "__builtin_amdgcn_cvt_pk_bf8_f32",
|
||||||
|
"cvt.pk.f16.bf8" => "__builtin_amdgcn_cvt_pk_f16_bf8",
|
||||||
|
"cvt.pk.f16.fp8" => "__builtin_amdgcn_cvt_pk_f16_fp8",
|
||||||
"cvt.pk.f32.bf8" => "__builtin_amdgcn_cvt_pk_f32_bf8",
|
"cvt.pk.f32.bf8" => "__builtin_amdgcn_cvt_pk_f32_bf8",
|
||||||
"cvt.pk.f32.fp8" => "__builtin_amdgcn_cvt_pk_f32_fp8",
|
"cvt.pk.f32.fp8" => "__builtin_amdgcn_cvt_pk_f32_fp8",
|
||||||
"cvt.pk.fp8.f32" => "__builtin_amdgcn_cvt_pk_fp8_f32",
|
"cvt.pk.fp8.f32" => "__builtin_amdgcn_cvt_pk_fp8_f32",
|
||||||
|
|
@ -292,6 +294,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"s.sendmsg" => "__builtin_amdgcn_s_sendmsg",
|
"s.sendmsg" => "__builtin_amdgcn_s_sendmsg",
|
||||||
"s.sendmsghalt" => "__builtin_amdgcn_s_sendmsghalt",
|
"s.sendmsghalt" => "__builtin_amdgcn_s_sendmsghalt",
|
||||||
"s.setprio" => "__builtin_amdgcn_s_setprio",
|
"s.setprio" => "__builtin_amdgcn_s_setprio",
|
||||||
|
"s.setprio.inc.wg" => "__builtin_amdgcn_s_setprio_inc_wg",
|
||||||
"s.setreg" => "__builtin_amdgcn_s_setreg",
|
"s.setreg" => "__builtin_amdgcn_s_setreg",
|
||||||
"s.sleep" => "__builtin_amdgcn_s_sleep",
|
"s.sleep" => "__builtin_amdgcn_s_sleep",
|
||||||
"s.sleep.var" => "__builtin_amdgcn_s_sleep_var",
|
"s.sleep.var" => "__builtin_amdgcn_s_sleep_var",
|
||||||
|
|
@ -356,14 +359,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"workitem.id.x" => "__builtin_amdgcn_workitem_id_x",
|
"workitem.id.x" => "__builtin_amdgcn_workitem_id_x",
|
||||||
"workitem.id.y" => "__builtin_amdgcn_workitem_id_y",
|
"workitem.id.y" => "__builtin_amdgcn_workitem_id_y",
|
||||||
"workitem.id.z" => "__builtin_amdgcn_workitem_id_z",
|
"workitem.id.z" => "__builtin_amdgcn_workitem_id_z",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
amdgcn(name)
|
amdgcn(name, full_name)
|
||||||
}
|
}
|
||||||
"arm" => {
|
"arm" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn arm(name: &str) -> &str {
|
fn arm(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// arm
|
// arm
|
||||||
"cdp" => "__builtin_arm_cdp",
|
"cdp" => "__builtin_arm_cdp",
|
||||||
|
|
@ -465,14 +468,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"usub8" => "__builtin_arm_usub8",
|
"usub8" => "__builtin_arm_usub8",
|
||||||
"uxtab16" => "__builtin_arm_uxtab16",
|
"uxtab16" => "__builtin_arm_uxtab16",
|
||||||
"uxtb16" => "__builtin_arm_uxtb16",
|
"uxtb16" => "__builtin_arm_uxtb16",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arm(name)
|
arm(name, full_name)
|
||||||
}
|
}
|
||||||
"bpf" => {
|
"bpf" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn bpf(name: &str) -> &str {
|
fn bpf(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// bpf
|
// bpf
|
||||||
"btf.type.id" => "__builtin_bpf_btf_type_id",
|
"btf.type.id" => "__builtin_bpf_btf_type_id",
|
||||||
|
|
@ -487,25 +490,25 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"preserve.field.info" => "__builtin_bpf_preserve_field_info",
|
"preserve.field.info" => "__builtin_bpf_preserve_field_info",
|
||||||
"preserve.type.info" => "__builtin_bpf_preserve_type_info",
|
"preserve.type.info" => "__builtin_bpf_preserve_type_info",
|
||||||
"pseudo" => "__builtin_bpf_pseudo",
|
"pseudo" => "__builtin_bpf_pseudo",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bpf(name)
|
bpf(name, full_name)
|
||||||
}
|
}
|
||||||
"cuda" => {
|
"cuda" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn cuda(name: &str) -> &str {
|
fn cuda(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// cuda
|
// cuda
|
||||||
"syncthreads" => "__syncthreads",
|
"syncthreads" => "__syncthreads",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cuda(name)
|
cuda(name, full_name)
|
||||||
}
|
}
|
||||||
"hexagon" => {
|
"hexagon" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn hexagon(name: &str) -> &str {
|
fn hexagon(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// hexagon
|
// hexagon
|
||||||
"A2.abs" => "__builtin_HEXAGON_A2_abs",
|
"A2.abs" => "__builtin_HEXAGON_A2_abs",
|
||||||
|
|
@ -2479,14 +2482,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"prefetch" => "__builtin_HEXAGON_prefetch",
|
"prefetch" => "__builtin_HEXAGON_prefetch",
|
||||||
"vmemcpy" => "__builtin_hexagon_vmemcpy",
|
"vmemcpy" => "__builtin_hexagon_vmemcpy",
|
||||||
"vmemset" => "__builtin_hexagon_vmemset",
|
"vmemset" => "__builtin_hexagon_vmemset",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hexagon(name)
|
hexagon(name, full_name)
|
||||||
}
|
}
|
||||||
"loongarch" => {
|
"loongarch" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn loongarch(name: &str) -> &str {
|
fn loongarch(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// loongarch
|
// loongarch
|
||||||
"asrtgt.d" => "__builtin_loongarch_asrtgt_d",
|
"asrtgt.d" => "__builtin_loongarch_asrtgt_d",
|
||||||
|
|
@ -3988,14 +3991,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"movfcsr2gr" => "__builtin_loongarch_movfcsr2gr",
|
"movfcsr2gr" => "__builtin_loongarch_movfcsr2gr",
|
||||||
"movgr2fcsr" => "__builtin_loongarch_movgr2fcsr",
|
"movgr2fcsr" => "__builtin_loongarch_movgr2fcsr",
|
||||||
"syscall" => "__builtin_loongarch_syscall",
|
"syscall" => "__builtin_loongarch_syscall",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loongarch(name)
|
loongarch(name, full_name)
|
||||||
}
|
}
|
||||||
"mips" => {
|
"mips" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn mips(name: &str) -> &str {
|
fn mips(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// mips
|
// mips
|
||||||
"absq.s.ph" => "__builtin_mips_absq_s_ph",
|
"absq.s.ph" => "__builtin_mips_absq_s_ph",
|
||||||
|
|
@ -4669,14 +4672,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"wrdsp" => "__builtin_mips_wrdsp",
|
"wrdsp" => "__builtin_mips_wrdsp",
|
||||||
"xor.v" => "__builtin_msa_xor_v",
|
"xor.v" => "__builtin_msa_xor_v",
|
||||||
"xori.b" => "__builtin_msa_xori_b",
|
"xori.b" => "__builtin_msa_xori_b",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mips(name)
|
mips(name, full_name)
|
||||||
}
|
}
|
||||||
"nvvm" => {
|
"nvvm" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn nvvm(name: &str) -> &str {
|
fn nvvm(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// nvvm
|
// nvvm
|
||||||
"abs.i" => "__nvvm_abs_i",
|
"abs.i" => "__nvvm_abs_i",
|
||||||
|
|
@ -5024,6 +5027,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"nanosleep" => "__nvvm_nanosleep",
|
"nanosleep" => "__nvvm_nanosleep",
|
||||||
"neg.bf16" => "__nvvm_neg_bf16",
|
"neg.bf16" => "__nvvm_neg_bf16",
|
||||||
"neg.bf16x2" => "__nvvm_neg_bf16x2",
|
"neg.bf16x2" => "__nvvm_neg_bf16x2",
|
||||||
|
"pm.event.mask" => "__nvvm_pm_event_mask",
|
||||||
"popc.i" => "__nvvm_popc_i",
|
"popc.i" => "__nvvm_popc_i",
|
||||||
"popc.ll" => "__nvvm_popc_ll",
|
"popc.ll" => "__nvvm_popc_ll",
|
||||||
"prmt" => "__nvvm_prmt",
|
"prmt" => "__nvvm_prmt",
|
||||||
|
|
@ -5448,14 +5452,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"vote.ballot.sync" => "__nvvm_vote_ballot_sync",
|
"vote.ballot.sync" => "__nvvm_vote_ballot_sync",
|
||||||
"vote.uni" => "__nvvm_vote_uni",
|
"vote.uni" => "__nvvm_vote_uni",
|
||||||
"vote.uni.sync" => "__nvvm_vote_uni_sync",
|
"vote.uni.sync" => "__nvvm_vote_uni_sync",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nvvm(name)
|
nvvm(name, full_name)
|
||||||
}
|
}
|
||||||
"ppc" => {
|
"ppc" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn ppc(name: &str) -> &str {
|
fn ppc(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// ppc
|
// ppc
|
||||||
"addex" => "__builtin_ppc_addex",
|
"addex" => "__builtin_ppc_addex",
|
||||||
|
|
@ -5842,7 +5846,10 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"mulhdu" => "__builtin_ppc_mulhdu",
|
"mulhdu" => "__builtin_ppc_mulhdu",
|
||||||
"mulhw" => "__builtin_ppc_mulhw",
|
"mulhw" => "__builtin_ppc_mulhw",
|
||||||
"mulhwu" => "__builtin_ppc_mulhwu",
|
"mulhwu" => "__builtin_ppc_mulhwu",
|
||||||
|
"national2packed" => "__builtin_ppc_national2packed",
|
||||||
"pack.longdouble" => "__builtin_pack_longdouble",
|
"pack.longdouble" => "__builtin_pack_longdouble",
|
||||||
|
"packed2national" => "__builtin_ppc_packed2national",
|
||||||
|
"packed2zoned" => "__builtin_ppc_packed2zoned",
|
||||||
"pdepd" => "__builtin_pdepd",
|
"pdepd" => "__builtin_pdepd",
|
||||||
"pextd" => "__builtin_pextd",
|
"pextd" => "__builtin_pextd",
|
||||||
"qpx.qvfabs" => "__builtin_qpx_qvfabs",
|
"qpx.qvfabs" => "__builtin_qpx_qvfabs",
|
||||||
|
|
@ -6035,14 +6042,15 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"vsx.xxinsertw" => "__builtin_vsx_xxinsertw",
|
"vsx.xxinsertw" => "__builtin_vsx_xxinsertw",
|
||||||
"vsx.xxleqv" => "__builtin_vsx_xxleqv",
|
"vsx.xxleqv" => "__builtin_vsx_xxleqv",
|
||||||
"vsx.xxpermx" => "__builtin_vsx_xxpermx",
|
"vsx.xxpermx" => "__builtin_vsx_xxpermx",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
"zoned2packed" => "__builtin_ppc_zoned2packed",
|
||||||
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ppc(name)
|
ppc(name, full_name)
|
||||||
}
|
}
|
||||||
"ptx" => {
|
"ptx" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn ptx(name: &str) -> &str {
|
fn ptx(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// ptx
|
// ptx
|
||||||
"bar.sync" => "__builtin_ptx_bar_sync",
|
"bar.sync" => "__builtin_ptx_bar_sync",
|
||||||
|
|
@ -6063,14 +6071,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"read.pm3" => "__builtin_ptx_read_pm3",
|
"read.pm3" => "__builtin_ptx_read_pm3",
|
||||||
"read.smid" => "__builtin_ptx_read_smid",
|
"read.smid" => "__builtin_ptx_read_smid",
|
||||||
"read.warpid" => "__builtin_ptx_read_warpid",
|
"read.warpid" => "__builtin_ptx_read_warpid",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ptx(name)
|
ptx(name, full_name)
|
||||||
}
|
}
|
||||||
"r600" => {
|
"r600" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn r600(name: &str) -> &str {
|
fn r600(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// r600
|
// r600
|
||||||
"group.barrier" => "__builtin_r600_group_barrier",
|
"group.barrier" => "__builtin_r600_group_barrier",
|
||||||
|
|
@ -6088,14 +6096,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"read.tidig.x" => "__builtin_r600_read_tidig_x",
|
"read.tidig.x" => "__builtin_r600_read_tidig_x",
|
||||||
"read.tidig.y" => "__builtin_r600_read_tidig_y",
|
"read.tidig.y" => "__builtin_r600_read_tidig_y",
|
||||||
"read.tidig.z" => "__builtin_r600_read_tidig_z",
|
"read.tidig.z" => "__builtin_r600_read_tidig_z",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r600(name)
|
r600(name, full_name)
|
||||||
}
|
}
|
||||||
"riscv" => {
|
"riscv" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn riscv(name: &str) -> &str {
|
fn riscv(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// riscv
|
// riscv
|
||||||
"aes32dsi" => "__builtin_riscv_aes32dsi",
|
"aes32dsi" => "__builtin_riscv_aes32dsi",
|
||||||
|
|
@ -6119,14 +6127,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"sha512sum0r" => "__builtin_riscv_sha512sum0r",
|
"sha512sum0r" => "__builtin_riscv_sha512sum0r",
|
||||||
"sha512sum1" => "__builtin_riscv_sha512sum1",
|
"sha512sum1" => "__builtin_riscv_sha512sum1",
|
||||||
"sha512sum1r" => "__builtin_riscv_sha512sum1r",
|
"sha512sum1r" => "__builtin_riscv_sha512sum1r",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
riscv(name)
|
riscv(name, full_name)
|
||||||
}
|
}
|
||||||
"s390" => {
|
"s390" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn s390(name: &str) -> &str {
|
fn s390(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// s390
|
// s390
|
||||||
"bdepg" => "__builtin_s390_bdepg",
|
"bdepg" => "__builtin_s390_bdepg",
|
||||||
|
|
@ -6313,14 +6321,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"vupllf" => "__builtin_s390_vupllf",
|
"vupllf" => "__builtin_s390_vupllf",
|
||||||
"vupllg" => "__builtin_s390_vupllg",
|
"vupllg" => "__builtin_s390_vupllg",
|
||||||
"vupllh" => "__builtin_s390_vupllh",
|
"vupllh" => "__builtin_s390_vupllh",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s390(name)
|
s390(name, full_name)
|
||||||
}
|
}
|
||||||
"ve" => {
|
"ve" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn ve(name: &str) -> &str {
|
fn ve(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// ve
|
// ve
|
||||||
"vl.andm.MMM" => "__builtin_ve_vl_andm_MMM",
|
"vl.andm.MMM" => "__builtin_ve_vl_andm_MMM",
|
||||||
|
|
@ -7586,14 +7594,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"vl.vxor.vvvvl" => "__builtin_ve_vl_vxor_vvvvl",
|
"vl.vxor.vvvvl" => "__builtin_ve_vl_vxor_vvvvl",
|
||||||
"vl.xorm.MMM" => "__builtin_ve_vl_xorm_MMM",
|
"vl.xorm.MMM" => "__builtin_ve_vl_xorm_MMM",
|
||||||
"vl.xorm.mmm" => "__builtin_ve_vl_xorm_mmm",
|
"vl.xorm.mmm" => "__builtin_ve_vl_xorm_mmm",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ve(name)
|
ve(name, full_name)
|
||||||
}
|
}
|
||||||
"x86" => {
|
"x86" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn x86(name: &str) -> &str {
|
fn x86(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// x86
|
// x86
|
||||||
"aadd32" => "__builtin_ia32_aadd32",
|
"aadd32" => "__builtin_ia32_aadd32",
|
||||||
|
|
@ -10154,25 +10162,25 @@ fn map_arch_intrinsic(name: &str) -> &str {
|
||||||
"xresldtrk" => "__builtin_ia32_xresldtrk",
|
"xresldtrk" => "__builtin_ia32_xresldtrk",
|
||||||
"xsusldtrk" => "__builtin_ia32_xsusldtrk",
|
"xsusldtrk" => "__builtin_ia32_xsusldtrk",
|
||||||
"xtest" => "__builtin_ia32_xtest",
|
"xtest" => "__builtin_ia32_xtest",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x86(name)
|
x86(name, full_name)
|
||||||
}
|
}
|
||||||
"xcore" => {
|
"xcore" => {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn xcore(name: &str) -> &str {
|
fn xcore(name: &str, full_name: &str) -> &'static str {
|
||||||
match name {
|
match name {
|
||||||
// xcore
|
// xcore
|
||||||
"bitrev" => "__builtin_bitrev",
|
"bitrev" => "__builtin_bitrev",
|
||||||
"getid" => "__builtin_getid",
|
"getid" => "__builtin_getid",
|
||||||
"getps" => "__builtin_getps",
|
"getps" => "__builtin_getps",
|
||||||
"setps" => "__builtin_setps",
|
"setps" => "__builtin_setps",
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xcore(name)
|
xcore(name, full_name)
|
||||||
}
|
}
|
||||||
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
|
_ => unimplemented!("***** unsupported LLVM architecture {arch}, intrinsic:{full_name}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -648,6 +648,11 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
|
||||||
new_args.push(handle);
|
new_args.push(handle);
|
||||||
args = new_args.into();
|
args = new_args.into();
|
||||||
}
|
}
|
||||||
|
"__builtin_ia32_rdtscp" => {
|
||||||
|
let result = builder.current_func().new_local(None, builder.u32_type, "result");
|
||||||
|
let new_args = vec![result.get_address(None).to_rvalue()];
|
||||||
|
args = new_args.into();
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -764,6 +769,14 @@ pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
|
||||||
new_args.swap(0, 1);
|
new_args.swap(0, 1);
|
||||||
args = new_args.into();
|
args = new_args.into();
|
||||||
}
|
}
|
||||||
|
"__builtin_ia32_dpps256" => {
|
||||||
|
let mut new_args = args.to_vec();
|
||||||
|
// NOTE: without this cast to u8 (and it needs to be a u8 to fix the issue), we
|
||||||
|
// would get the following error:
|
||||||
|
// the last argument must be an 8-bit immediate
|
||||||
|
new_args[2] = builder.context.new_cast(None, new_args[2], builder.cx.type_u8());
|
||||||
|
args = new_args.into();
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -935,6 +948,19 @@ pub fn adjust_intrinsic_return_value<'a, 'gcc, 'tcx>(
|
||||||
);
|
);
|
||||||
return_value = result.to_rvalue();
|
return_value = result.to_rvalue();
|
||||||
}
|
}
|
||||||
|
"__builtin_ia32_rdtscp" => {
|
||||||
|
let field1 = builder.context.new_field(None, return_value.get_type(), "rdtscpField1");
|
||||||
|
let return2 = args[0].dereference(None).to_rvalue();
|
||||||
|
let field2 = builder.context.new_field(None, return2.get_type(), "rdtscpField2");
|
||||||
|
let struct_type =
|
||||||
|
builder.context.new_struct_type(None, "rdtscpResult", &[field1, field2]);
|
||||||
|
return_value = builder.context.new_struct_constructor(
|
||||||
|
None,
|
||||||
|
struct_type.as_type(),
|
||||||
|
None,
|
||||||
|
&[return_value, return2],
|
||||||
|
);
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1529,6 +1555,17 @@ pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function
|
||||||
"llvm.x86.aesdecwide128kl" => "__builtin_ia32_aesdecwide128kl_u8",
|
"llvm.x86.aesdecwide128kl" => "__builtin_ia32_aesdecwide128kl_u8",
|
||||||
"llvm.x86.aesencwide256kl" => "__builtin_ia32_aesencwide256kl_u8",
|
"llvm.x86.aesencwide256kl" => "__builtin_ia32_aesencwide256kl_u8",
|
||||||
"llvm.x86.aesdecwide256kl" => "__builtin_ia32_aesdecwide256kl_u8",
|
"llvm.x86.aesdecwide256kl" => "__builtin_ia32_aesdecwide256kl_u8",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v8f16.v8i16" => "__builtin_ia32_vcvtuw2ph128_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v16f16.v16i16" => "__builtin_ia32_vcvtuw2ph256_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v32f16.v32i16" => "__builtin_ia32_vcvtuw2ph512_mask_round",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v8f16.v8i32" => "__builtin_ia32_vcvtudq2ph256_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v16f16.v16i32" => "__builtin_ia32_vcvtudq2ph512_mask_round",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v8f16.v8i64" => "__builtin_ia32_vcvtuqq2ph512_mask_round",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v8f64.v8i64" => "__builtin_ia32_cvtuqq2pd512_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v2f64.v2i64" => "__builtin_ia32_cvtuqq2pd128_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v4f64.v4i64" => "__builtin_ia32_cvtuqq2pd256_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v8f32.v8i64" => "__builtin_ia32_cvtuqq2ps512_mask",
|
||||||
|
"llvm.x86.avx512.uitofp.round.v4f32.v4i64" => "__builtin_ia32_cvtuqq2ps256_mask",
|
||||||
|
|
||||||
// TODO: support the tile builtins:
|
// TODO: support the tile builtins:
|
||||||
"llvm.x86.ldtilecfg" => "__builtin_trap",
|
"llvm.x86.ldtilecfg" => "__builtin_trap",
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ fn get_simple_intrinsic<'gcc, 'tcx>(
|
||||||
}
|
}
|
||||||
sym::copysignf32 => "copysignf",
|
sym::copysignf32 => "copysignf",
|
||||||
sym::copysignf64 => "copysign",
|
sym::copysignf64 => "copysign",
|
||||||
sym::copysignf128 => "copysignl",
|
|
||||||
sym::floorf32 => "floorf",
|
sym::floorf32 => "floorf",
|
||||||
sym::floorf64 => "floor",
|
sym::floorf64 => "floor",
|
||||||
sym::ceilf32 => "ceilf",
|
sym::ceilf32 => "ceilf",
|
||||||
|
|
@ -238,6 +237,7 @@ fn get_simple_function_f128_2args<'gcc, 'tcx>(
|
||||||
let func_name = match name {
|
let func_name = match name {
|
||||||
sym::maxnumf128 => "fmaxf128",
|
sym::maxnumf128 => "fmaxf128",
|
||||||
sym::minnumf128 => "fminf128",
|
sym::minnumf128 => "fminf128",
|
||||||
|
sym::copysignf128 => "copysignf128",
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
Some(cx.context.new_function(
|
Some(cx.context.new_function(
|
||||||
|
|
@ -261,6 +261,7 @@ fn f16_builtin<'gcc, 'tcx>(
|
||||||
let f32_type = cx.type_f32();
|
let f32_type = cx.type_f32();
|
||||||
let builtin_name = match name {
|
let builtin_name = match name {
|
||||||
sym::ceilf16 => "__builtin_ceilf",
|
sym::ceilf16 => "__builtin_ceilf",
|
||||||
|
sym::copysignf16 => "__builtin_copysignf",
|
||||||
sym::floorf16 => "__builtin_floorf",
|
sym::floorf16 => "__builtin_floorf",
|
||||||
sym::fmaf16 => "fmaf",
|
sym::fmaf16 => "fmaf",
|
||||||
sym::maxnumf16 => "__builtin_fmaxf",
|
sym::maxnumf16 => "__builtin_fmaxf",
|
||||||
|
|
@ -330,6 +331,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
sym::ceilf16
|
sym::ceilf16
|
||||||
|
| sym::copysignf16
|
||||||
| sym::floorf16
|
| sym::floorf16
|
||||||
| sym::fmaf16
|
| sym::fmaf16
|
||||||
| sym::maxnumf16
|
| sym::maxnumf16
|
||||||
|
|
|
||||||
|
|
@ -176,14 +176,14 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
|
||||||
out.write("// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`\n")
|
out.write("// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`\n")
|
||||||
out.write("// DO NOT EDIT IT!\n")
|
out.write("// DO NOT EDIT IT!\n")
|
||||||
out.write("/// Translate a given LLVM intrinsic name to an equivalent GCC one.\n")
|
out.write("/// Translate a given LLVM intrinsic name to an equivalent GCC one.\n")
|
||||||
out.write("fn map_arch_intrinsic(name:&str)->&str{\n")
|
out.write("fn map_arch_intrinsic(full_name:&str)->&'static str{\n")
|
||||||
out.write('let Some(name) = name.strip_prefix("llvm.") else { unimplemented!("***** unsupported LLVM intrinsic {}", name) };\n')
|
out.write('let Some(name) = full_name.strip_prefix("llvm.") else { unimplemented!("***** unsupported LLVM intrinsic {}", full_name) };\n')
|
||||||
out.write('let Some((arch, name)) = name.split_once(\'.\') else { unimplemented!("***** unsupported LLVM intrinsic {}", name) };\n')
|
out.write('let Some((arch, name)) = name.split_once(\'.\') else { unimplemented!("***** unsupported LLVM intrinsic {}", name) };\n')
|
||||||
out.write("match arch {\n")
|
out.write("match arch {\n")
|
||||||
for arch in archs:
|
for arch in archs:
|
||||||
if len(intrinsics[arch]) == 0:
|
if len(intrinsics[arch]) == 0:
|
||||||
continue
|
continue
|
||||||
out.write("\"{}\" => {{ #[allow(non_snake_case)] fn {}(name: &str) -> &str {{ match name {{".format(arch,arch))
|
out.write("\"{}\" => {{ #[allow(non_snake_case)] fn {}(name: &str,full_name:&str) -> &'static str {{ match name {{".format(arch,arch))
|
||||||
intrinsics[arch].sort(key=lambda x: (x[0], x[2]))
|
intrinsics[arch].sort(key=lambda x: (x[0], x[2]))
|
||||||
out.write(' // {}\n'.format(arch))
|
out.write(' // {}\n'.format(arch))
|
||||||
for entry in intrinsics[arch]:
|
for entry in intrinsics[arch]:
|
||||||
|
|
@ -196,9 +196,9 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
|
||||||
out.write(' // [INVALID CONVERSION]: "{}" => "{}",\n'.format(llvm_name, entry[1]))
|
out.write(' // [INVALID CONVERSION]: "{}" => "{}",\n'.format(llvm_name, entry[1]))
|
||||||
else:
|
else:
|
||||||
out.write(' "{}" => "{}",\n'.format(llvm_name, entry[1]))
|
out.write(' "{}" => "{}",\n'.format(llvm_name, entry[1]))
|
||||||
out.write(' _ => unimplemented!("***** unsupported LLVM intrinsic {}", name),\n')
|
out.write(' _ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),\n')
|
||||||
out.write("}} }} {}(name) }}\n,".format(arch))
|
out.write("}} }} {}(name,full_name) }}\n,".format(arch))
|
||||||
out.write(' _ => unimplemented!("***** unsupported LLVM architecture {}", name),\n')
|
out.write(' _ => unimplemented!("***** unsupported LLVM architecture {arch}, intrinsic:{full_name}"),\n')
|
||||||
out.write("}\n}")
|
out.write("}\n}")
|
||||||
subprocess.call(["rustfmt", output_file])
|
subprocess.call(["rustfmt", output_file])
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue