Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 66 additions & 58 deletions src/intrinsic/archs.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`
// DO NOT EDIT IT!
/// Translate a given LLVM intrinsic name to an equivalent GCC one.
fn map_arch_intrinsic(name: &str) -> &str {
let Some(name) = name.strip_prefix("llvm.") else {
unimplemented!("***** unsupported LLVM intrinsic {}", name)
fn map_arch_intrinsic(full_name: &str) -> &'static str {
let Some(name) = full_name.strip_prefix("llvm.") else {
unimplemented!("***** unsupported LLVM intrinsic {}", full_name)
};
let Some((arch, name)) = name.split_once('.') else {
unimplemented!("***** unsupported LLVM intrinsic {}", name)
};
match arch {
"AMDGPU" => {
#[allow(non_snake_case)]
fn AMDGPU(name: &str) -> &str {
fn AMDGPU(name: &str, full_name: &str) -> &'static str {
match name {
// AMDGPU
"div.fixup.f32" => "__builtin_amdgpu_div_fixup",
Expand Down Expand Up @@ -42,14 +42,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"trig.preop.f64" => "__builtin_amdgpu_trig_preop",
"trig.preop.v2f64" => "__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" => {
#[allow(non_snake_case)]
fn aarch64(name: &str) -> &str {
fn aarch64(name: &str, full_name: &str) -> &'static str {
match name {
// aarch64
"chkfeat" => "__builtin_arm_chkfeat",
Expand All @@ -75,14 +75,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"tcommit" => "__builtin_arm_tcommit",
"tstart" => "__builtin_arm_tstart",
"ttest" => "__builtin_arm_ttest",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
aarch64(name)
aarch64(name, full_name)
}
"amdgcn" => {
#[allow(non_snake_case)]
fn amdgcn(name: &str) -> &str {
fn amdgcn(name: &str, full_name: &str) -> &'static str {
match name {
// amdgcn
"alignbyte" => "__builtin_amdgcn_alignbyte",
Expand All @@ -99,6 +99,8 @@ fn map_arch_intrinsic(name: &str) -> &str {
"cvt.f32.fp8" => "__builtin_amdgcn_cvt_f32_fp8",
"cvt.off.f32.i4" => "__builtin_amdgcn_cvt_off_f32_i4",
"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.fp8" => "__builtin_amdgcn_cvt_pk_f32_fp8",
"cvt.pk.fp8.f32" => "__builtin_amdgcn_cvt_pk_fp8_f32",
Expand Down Expand Up @@ -292,6 +294,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
"s.sendmsg" => "__builtin_amdgcn_s_sendmsg",
"s.sendmsghalt" => "__builtin_amdgcn_s_sendmsghalt",
"s.setprio" => "__builtin_amdgcn_s_setprio",
"s.setprio.inc.wg" => "__builtin_amdgcn_s_setprio_inc_wg",
"s.setreg" => "__builtin_amdgcn_s_setreg",
"s.sleep" => "__builtin_amdgcn_s_sleep",
"s.sleep.var" => "__builtin_amdgcn_s_sleep_var",
Expand Down Expand Up @@ -356,14 +359,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"workitem.id.x" => "__builtin_amdgcn_workitem_id_x",
"workitem.id.y" => "__builtin_amdgcn_workitem_id_y",
"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" => {
#[allow(non_snake_case)]
fn arm(name: &str) -> &str {
fn arm(name: &str, full_name: &str) -> &'static str {
match name {
// arm
"cdp" => "__builtin_arm_cdp",
Expand Down Expand Up @@ -465,14 +468,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"usub8" => "__builtin_arm_usub8",
"uxtab16" => "__builtin_arm_uxtab16",
"uxtb16" => "__builtin_arm_uxtb16",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
arm(name)
arm(name, full_name)
}
"bpf" => {
#[allow(non_snake_case)]
fn bpf(name: &str) -> &str {
fn bpf(name: &str, full_name: &str) -> &'static str {
match name {
// bpf
"btf.type.id" => "__builtin_bpf_btf_type_id",
Expand All @@ -487,25 +490,25 @@ fn map_arch_intrinsic(name: &str) -> &str {
"preserve.field.info" => "__builtin_bpf_preserve_field_info",
"preserve.type.info" => "__builtin_bpf_preserve_type_info",
"pseudo" => "__builtin_bpf_pseudo",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
bpf(name)
bpf(name, full_name)
}
"cuda" => {
#[allow(non_snake_case)]
fn cuda(name: &str) -> &str {
fn cuda(name: &str, full_name: &str) -> &'static str {
match name {
// cuda
"syncthreads" => "__syncthreads",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
cuda(name)
cuda(name, full_name)
}
"hexagon" => {
#[allow(non_snake_case)]
fn hexagon(name: &str) -> &str {
fn hexagon(name: &str, full_name: &str) -> &'static str {
match name {
// hexagon
"A2.abs" => "__builtin_HEXAGON_A2_abs",
Expand Down Expand Up @@ -2479,14 +2482,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"prefetch" => "__builtin_HEXAGON_prefetch",
"vmemcpy" => "__builtin_hexagon_vmemcpy",
"vmemset" => "__builtin_hexagon_vmemset",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
hexagon(name)
hexagon(name, full_name)
}
"loongarch" => {
#[allow(non_snake_case)]
fn loongarch(name: &str) -> &str {
fn loongarch(name: &str, full_name: &str) -> &'static str {
match name {
// loongarch
"asrtgt.d" => "__builtin_loongarch_asrtgt_d",
Expand Down Expand Up @@ -3988,14 +3991,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"movfcsr2gr" => "__builtin_loongarch_movfcsr2gr",
"movgr2fcsr" => "__builtin_loongarch_movgr2fcsr",
"syscall" => "__builtin_loongarch_syscall",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
loongarch(name)
loongarch(name, full_name)
}
"mips" => {
#[allow(non_snake_case)]
fn mips(name: &str) -> &str {
fn mips(name: &str, full_name: &str) -> &'static str {
match name {
// mips
"absq.s.ph" => "__builtin_mips_absq_s_ph",
Expand Down Expand Up @@ -4669,14 +4672,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"wrdsp" => "__builtin_mips_wrdsp",
"xor.v" => "__builtin_msa_xor_v",
"xori.b" => "__builtin_msa_xori_b",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
mips(name)
mips(name, full_name)
}
"nvvm" => {
#[allow(non_snake_case)]
fn nvvm(name: &str) -> &str {
fn nvvm(name: &str, full_name: &str) -> &'static str {
match name {
// nvvm
"abs.i" => "__nvvm_abs_i",
Expand Down Expand Up @@ -5024,6 +5027,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
"nanosleep" => "__nvvm_nanosleep",
"neg.bf16" => "__nvvm_neg_bf16",
"neg.bf16x2" => "__nvvm_neg_bf16x2",
"pm.event.mask" => "__nvvm_pm_event_mask",
"popc.i" => "__nvvm_popc_i",
"popc.ll" => "__nvvm_popc_ll",
"prmt" => "__nvvm_prmt",
Expand Down Expand Up @@ -5448,14 +5452,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"vote.ballot.sync" => "__nvvm_vote_ballot_sync",
"vote.uni" => "__nvvm_vote_uni",
"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" => {
#[allow(non_snake_case)]
fn ppc(name: &str) -> &str {
fn ppc(name: &str, full_name: &str) -> &'static str {
match name {
// ppc
"addex" => "__builtin_ppc_addex",
Expand Down Expand Up @@ -5842,7 +5846,10 @@ fn map_arch_intrinsic(name: &str) -> &str {
"mulhdu" => "__builtin_ppc_mulhdu",
"mulhw" => "__builtin_ppc_mulhw",
"mulhwu" => "__builtin_ppc_mulhwu",
"national2packed" => "__builtin_ppc_national2packed",
"pack.longdouble" => "__builtin_pack_longdouble",
"packed2national" => "__builtin_ppc_packed2national",
"packed2zoned" => "__builtin_ppc_packed2zoned",
"pdepd" => "__builtin_pdepd",
"pextd" => "__builtin_pextd",
"qpx.qvfabs" => "__builtin_qpx_qvfabs",
Expand Down Expand Up @@ -6035,14 +6042,15 @@ fn map_arch_intrinsic(name: &str) -> &str {
"vsx.xxinsertw" => "__builtin_vsx_xxinsertw",
"vsx.xxleqv" => "__builtin_vsx_xxleqv",
"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" => {
#[allow(non_snake_case)]
fn ptx(name: &str) -> &str {
fn ptx(name: &str, full_name: &str) -> &'static str {
match name {
// ptx
"bar.sync" => "__builtin_ptx_bar_sync",
Expand All @@ -6063,14 +6071,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"read.pm3" => "__builtin_ptx_read_pm3",
"read.smid" => "__builtin_ptx_read_smid",
"read.warpid" => "__builtin_ptx_read_warpid",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
ptx(name)
ptx(name, full_name)
}
"r600" => {
#[allow(non_snake_case)]
fn r600(name: &str) -> &str {
fn r600(name: &str, full_name: &str) -> &'static str {
match name {
// r600
"group.barrier" => "__builtin_r600_group_barrier",
Expand All @@ -6088,14 +6096,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"read.tidig.x" => "__builtin_r600_read_tidig_x",
"read.tidig.y" => "__builtin_r600_read_tidig_y",
"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" => {
#[allow(non_snake_case)]
fn riscv(name: &str) -> &str {
fn riscv(name: &str, full_name: &str) -> &'static str {
match name {
// riscv
"aes32dsi" => "__builtin_riscv_aes32dsi",
Expand All @@ -6119,14 +6127,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"sha512sum0r" => "__builtin_riscv_sha512sum0r",
"sha512sum1" => "__builtin_riscv_sha512sum1",
"sha512sum1r" => "__builtin_riscv_sha512sum1r",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
riscv(name)
riscv(name, full_name)
}
"s390" => {
#[allow(non_snake_case)]
fn s390(name: &str) -> &str {
fn s390(name: &str, full_name: &str) -> &'static str {
match name {
// s390
"bdepg" => "__builtin_s390_bdepg",
Expand Down Expand Up @@ -6313,14 +6321,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"vupllf" => "__builtin_s390_vupllf",
"vupllg" => "__builtin_s390_vupllg",
"vupllh" => "__builtin_s390_vupllh",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
s390(name)
s390(name, full_name)
}
"ve" => {
#[allow(non_snake_case)]
fn ve(name: &str) -> &str {
fn ve(name: &str, full_name: &str) -> &'static str {
match name {
// ve
"vl.andm.MMM" => "__builtin_ve_vl_andm_MMM",
Expand Down Expand Up @@ -7586,14 +7594,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
"vl.vxor.vvvvl" => "__builtin_ve_vl_vxor_vvvvl",
"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" => {
#[allow(non_snake_case)]
fn x86(name: &str) -> &str {
fn x86(name: &str, full_name: &str) -> &'static str {
match name {
// x86
"aadd32" => "__builtin_ia32_aadd32",
Expand Down Expand Up @@ -10154,25 +10162,25 @@ fn map_arch_intrinsic(name: &str) -> &str {
"xresldtrk" => "__builtin_ia32_xresldtrk",
"xsusldtrk" => "__builtin_ia32_xsusldtrk",
"xtest" => "__builtin_ia32_xtest",
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
}
}
x86(name)
x86(name, full_name)
}
"xcore" => {
#[allow(non_snake_case)]
fn xcore(name: &str) -> &str {
fn xcore(name: &str, full_name: &str) -> &'static str {
match name {
// xcore
"bitrev" => "__builtin_bitrev",
"getid" => "__builtin_getid",
"getps" => "__builtin_getps",
"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}"),
}
}
Loading