Skip to content

Commit 4b5c44b

Browse files
authored
Merge pull request rust-lang#725 from FractalFir/intrinsic_fix
Fixes rust-lang#724
2 parents ce73bab + c57393e commit 4b5c44b

File tree

2 files changed

+72
-64
lines changed

2 files changed

+72
-64
lines changed

src/intrinsic/archs.rs

Lines changed: 66 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// File generated by `rustc_codegen_gcc/tools/generate_intrinsics.py`
22
// DO NOT EDIT IT!
33
/// Translate a given LLVM intrinsic name to an equivalent GCC one.
4-
fn map_arch_intrinsic(name: &str) -> &str {
5-
let Some(name) = name.strip_prefix("llvm.") else {
6-
unimplemented!("***** unsupported LLVM intrinsic {}", name)
4+
fn map_arch_intrinsic(full_name: &str) -> &'static str {
5+
let Some(name) = full_name.strip_prefix("llvm.") else {
6+
unimplemented!("***** unsupported LLVM intrinsic {}", full_name)
77
};
88
let Some((arch, name)) = name.split_once('.') else {
99
unimplemented!("***** unsupported LLVM intrinsic {}", name)
1010
};
1111
match arch {
1212
"AMDGPU" => {
1313
#[allow(non_snake_case)]
14-
fn AMDGPU(name: &str) -> &str {
14+
fn AMDGPU(name: &str, full_name: &str) -> &'static str {
1515
match name {
1616
// AMDGPU
1717
"div.fixup.f32" => "__builtin_amdgpu_div_fixup",
@@ -42,14 +42,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
4242
"trig.preop.f64" => "__builtin_amdgpu_trig_preop",
4343
"trig.preop.v2f64" => "__builtin_amdgpu_trig_preop",
4444
"trig.preop.v4f32" => "__builtin_amdgpu_trig_preop",
45-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
45+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
4646
}
4747
}
48-
AMDGPU(name)
48+
AMDGPU(name, full_name)
4949
}
5050
"aarch64" => {
5151
#[allow(non_snake_case)]
52-
fn aarch64(name: &str) -> &str {
52+
fn aarch64(name: &str, full_name: &str) -> &'static str {
5353
match name {
5454
// aarch64
5555
"chkfeat" => "__builtin_arm_chkfeat",
@@ -75,14 +75,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
7575
"tcommit" => "__builtin_arm_tcommit",
7676
"tstart" => "__builtin_arm_tstart",
7777
"ttest" => "__builtin_arm_ttest",
78-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
78+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
7979
}
8080
}
81-
aarch64(name)
81+
aarch64(name, full_name)
8282
}
8383
"amdgcn" => {
8484
#[allow(non_snake_case)]
85-
fn amdgcn(name: &str) -> &str {
85+
fn amdgcn(name: &str, full_name: &str) -> &'static str {
8686
match name {
8787
// amdgcn
8888
"alignbyte" => "__builtin_amdgcn_alignbyte",
@@ -99,6 +99,8 @@ fn map_arch_intrinsic(name: &str) -> &str {
9999
"cvt.f32.fp8" => "__builtin_amdgcn_cvt_f32_fp8",
100100
"cvt.off.f32.i4" => "__builtin_amdgcn_cvt_off_f32_i4",
101101
"cvt.pk.bf8.f32" => "__builtin_amdgcn_cvt_pk_bf8_f32",
102+
"cvt.pk.f16.bf8" => "__builtin_amdgcn_cvt_pk_f16_bf8",
103+
"cvt.pk.f16.fp8" => "__builtin_amdgcn_cvt_pk_f16_fp8",
102104
"cvt.pk.f32.bf8" => "__builtin_amdgcn_cvt_pk_f32_bf8",
103105
"cvt.pk.f32.fp8" => "__builtin_amdgcn_cvt_pk_f32_fp8",
104106
"cvt.pk.fp8.f32" => "__builtin_amdgcn_cvt_pk_fp8_f32",
@@ -292,6 +294,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
292294
"s.sendmsg" => "__builtin_amdgcn_s_sendmsg",
293295
"s.sendmsghalt" => "__builtin_amdgcn_s_sendmsghalt",
294296
"s.setprio" => "__builtin_amdgcn_s_setprio",
297+
"s.setprio.inc.wg" => "__builtin_amdgcn_s_setprio_inc_wg",
295298
"s.setreg" => "__builtin_amdgcn_s_setreg",
296299
"s.sleep" => "__builtin_amdgcn_s_sleep",
297300
"s.sleep.var" => "__builtin_amdgcn_s_sleep_var",
@@ -356,14 +359,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
356359
"workitem.id.x" => "__builtin_amdgcn_workitem_id_x",
357360
"workitem.id.y" => "__builtin_amdgcn_workitem_id_y",
358361
"workitem.id.z" => "__builtin_amdgcn_workitem_id_z",
359-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
362+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
360363
}
361364
}
362-
amdgcn(name)
365+
amdgcn(name, full_name)
363366
}
364367
"arm" => {
365368
#[allow(non_snake_case)]
366-
fn arm(name: &str) -> &str {
369+
fn arm(name: &str, full_name: &str) -> &'static str {
367370
match name {
368371
// arm
369372
"cdp" => "__builtin_arm_cdp",
@@ -465,14 +468,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
465468
"usub8" => "__builtin_arm_usub8",
466469
"uxtab16" => "__builtin_arm_uxtab16",
467470
"uxtb16" => "__builtin_arm_uxtb16",
468-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
471+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
469472
}
470473
}
471-
arm(name)
474+
arm(name, full_name)
472475
}
473476
"bpf" => {
474477
#[allow(non_snake_case)]
475-
fn bpf(name: &str) -> &str {
478+
fn bpf(name: &str, full_name: &str) -> &'static str {
476479
match name {
477480
// bpf
478481
"btf.type.id" => "__builtin_bpf_btf_type_id",
@@ -487,25 +490,25 @@ fn map_arch_intrinsic(name: &str) -> &str {
487490
"preserve.field.info" => "__builtin_bpf_preserve_field_info",
488491
"preserve.type.info" => "__builtin_bpf_preserve_type_info",
489492
"pseudo" => "__builtin_bpf_pseudo",
490-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
493+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
491494
}
492495
}
493-
bpf(name)
496+
bpf(name, full_name)
494497
}
495498
"cuda" => {
496499
#[allow(non_snake_case)]
497-
fn cuda(name: &str) -> &str {
500+
fn cuda(name: &str, full_name: &str) -> &'static str {
498501
match name {
499502
// cuda
500503
"syncthreads" => "__syncthreads",
501-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
504+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
502505
}
503506
}
504-
cuda(name)
507+
cuda(name, full_name)
505508
}
506509
"hexagon" => {
507510
#[allow(non_snake_case)]
508-
fn hexagon(name: &str) -> &str {
511+
fn hexagon(name: &str, full_name: &str) -> &'static str {
509512
match name {
510513
// hexagon
511514
"A2.abs" => "__builtin_HEXAGON_A2_abs",
@@ -2479,14 +2482,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
24792482
"prefetch" => "__builtin_HEXAGON_prefetch",
24802483
"vmemcpy" => "__builtin_hexagon_vmemcpy",
24812484
"vmemset" => "__builtin_hexagon_vmemset",
2482-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
2485+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
24832486
}
24842487
}
2485-
hexagon(name)
2488+
hexagon(name, full_name)
24862489
}
24872490
"loongarch" => {
24882491
#[allow(non_snake_case)]
2489-
fn loongarch(name: &str) -> &str {
2492+
fn loongarch(name: &str, full_name: &str) -> &'static str {
24902493
match name {
24912494
// loongarch
24922495
"asrtgt.d" => "__builtin_loongarch_asrtgt_d",
@@ -3988,14 +3991,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
39883991
"movfcsr2gr" => "__builtin_loongarch_movfcsr2gr",
39893992
"movgr2fcsr" => "__builtin_loongarch_movgr2fcsr",
39903993
"syscall" => "__builtin_loongarch_syscall",
3991-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
3994+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
39923995
}
39933996
}
3994-
loongarch(name)
3997+
loongarch(name, full_name)
39953998
}
39963999
"mips" => {
39974000
#[allow(non_snake_case)]
3998-
fn mips(name: &str) -> &str {
4001+
fn mips(name: &str, full_name: &str) -> &'static str {
39994002
match name {
40004003
// mips
40014004
"absq.s.ph" => "__builtin_mips_absq_s_ph",
@@ -4669,14 +4672,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
46694672
"wrdsp" => "__builtin_mips_wrdsp",
46704673
"xor.v" => "__builtin_msa_xor_v",
46714674
"xori.b" => "__builtin_msa_xori_b",
4672-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
4675+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
46734676
}
46744677
}
4675-
mips(name)
4678+
mips(name, full_name)
46764679
}
46774680
"nvvm" => {
46784681
#[allow(non_snake_case)]
4679-
fn nvvm(name: &str) -> &str {
4682+
fn nvvm(name: &str, full_name: &str) -> &'static str {
46804683
match name {
46814684
// nvvm
46824685
"abs.i" => "__nvvm_abs_i",
@@ -5024,6 +5027,7 @@ fn map_arch_intrinsic(name: &str) -> &str {
50245027
"nanosleep" => "__nvvm_nanosleep",
50255028
"neg.bf16" => "__nvvm_neg_bf16",
50265029
"neg.bf16x2" => "__nvvm_neg_bf16x2",
5030+
"pm.event.mask" => "__nvvm_pm_event_mask",
50275031
"popc.i" => "__nvvm_popc_i",
50285032
"popc.ll" => "__nvvm_popc_ll",
50295033
"prmt" => "__nvvm_prmt",
@@ -5448,14 +5452,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
54485452
"vote.ballot.sync" => "__nvvm_vote_ballot_sync",
54495453
"vote.uni" => "__nvvm_vote_uni",
54505454
"vote.uni.sync" => "__nvvm_vote_uni_sync",
5451-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
5455+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
54525456
}
54535457
}
5454-
nvvm(name)
5458+
nvvm(name, full_name)
54555459
}
54565460
"ppc" => {
54575461
#[allow(non_snake_case)]
5458-
fn ppc(name: &str) -> &str {
5462+
fn ppc(name: &str, full_name: &str) -> &'static str {
54595463
match name {
54605464
// ppc
54615465
"addex" => "__builtin_ppc_addex",
@@ -5842,7 +5846,10 @@ fn map_arch_intrinsic(name: &str) -> &str {
58425846
"mulhdu" => "__builtin_ppc_mulhdu",
58435847
"mulhw" => "__builtin_ppc_mulhw",
58445848
"mulhwu" => "__builtin_ppc_mulhwu",
5849+
"national2packed" => "__builtin_ppc_national2packed",
58455850
"pack.longdouble" => "__builtin_pack_longdouble",
5851+
"packed2national" => "__builtin_ppc_packed2national",
5852+
"packed2zoned" => "__builtin_ppc_packed2zoned",
58465853
"pdepd" => "__builtin_pdepd",
58475854
"pextd" => "__builtin_pextd",
58485855
"qpx.qvfabs" => "__builtin_qpx_qvfabs",
@@ -6035,14 +6042,15 @@ fn map_arch_intrinsic(name: &str) -> &str {
60356042
"vsx.xxinsertw" => "__builtin_vsx_xxinsertw",
60366043
"vsx.xxleqv" => "__builtin_vsx_xxleqv",
60376044
"vsx.xxpermx" => "__builtin_vsx_xxpermx",
6038-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
6045+
"zoned2packed" => "__builtin_ppc_zoned2packed",
6046+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
60396047
}
60406048
}
6041-
ppc(name)
6049+
ppc(name, full_name)
60426050
}
60436051
"ptx" => {
60446052
#[allow(non_snake_case)]
6045-
fn ptx(name: &str) -> &str {
6053+
fn ptx(name: &str, full_name: &str) -> &'static str {
60466054
match name {
60476055
// ptx
60486056
"bar.sync" => "__builtin_ptx_bar_sync",
@@ -6063,14 +6071,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
60636071
"read.pm3" => "__builtin_ptx_read_pm3",
60646072
"read.smid" => "__builtin_ptx_read_smid",
60656073
"read.warpid" => "__builtin_ptx_read_warpid",
6066-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
6074+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
60676075
}
60686076
}
6069-
ptx(name)
6077+
ptx(name, full_name)
60706078
}
60716079
"r600" => {
60726080
#[allow(non_snake_case)]
6073-
fn r600(name: &str) -> &str {
6081+
fn r600(name: &str, full_name: &str) -> &'static str {
60746082
match name {
60756083
// r600
60766084
"group.barrier" => "__builtin_r600_group_barrier",
@@ -6088,14 +6096,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
60886096
"read.tidig.x" => "__builtin_r600_read_tidig_x",
60896097
"read.tidig.y" => "__builtin_r600_read_tidig_y",
60906098
"read.tidig.z" => "__builtin_r600_read_tidig_z",
6091-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
6099+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
60926100
}
60936101
}
6094-
r600(name)
6102+
r600(name, full_name)
60956103
}
60966104
"riscv" => {
60976105
#[allow(non_snake_case)]
6098-
fn riscv(name: &str) -> &str {
6106+
fn riscv(name: &str, full_name: &str) -> &'static str {
60996107
match name {
61006108
// riscv
61016109
"aes32dsi" => "__builtin_riscv_aes32dsi",
@@ -6119,14 +6127,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
61196127
"sha512sum0r" => "__builtin_riscv_sha512sum0r",
61206128
"sha512sum1" => "__builtin_riscv_sha512sum1",
61216129
"sha512sum1r" => "__builtin_riscv_sha512sum1r",
6122-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
6130+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
61236131
}
61246132
}
6125-
riscv(name)
6133+
riscv(name, full_name)
61266134
}
61276135
"s390" => {
61286136
#[allow(non_snake_case)]
6129-
fn s390(name: &str) -> &str {
6137+
fn s390(name: &str, full_name: &str) -> &'static str {
61306138
match name {
61316139
// s390
61326140
"bdepg" => "__builtin_s390_bdepg",
@@ -6313,14 +6321,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
63136321
"vupllf" => "__builtin_s390_vupllf",
63146322
"vupllg" => "__builtin_s390_vupllg",
63156323
"vupllh" => "__builtin_s390_vupllh",
6316-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
6324+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
63176325
}
63186326
}
6319-
s390(name)
6327+
s390(name, full_name)
63206328
}
63216329
"ve" => {
63226330
#[allow(non_snake_case)]
6323-
fn ve(name: &str) -> &str {
6331+
fn ve(name: &str, full_name: &str) -> &'static str {
63246332
match name {
63256333
// ve
63266334
"vl.andm.MMM" => "__builtin_ve_vl_andm_MMM",
@@ -7586,14 +7594,14 @@ fn map_arch_intrinsic(name: &str) -> &str {
75867594
"vl.vxor.vvvvl" => "__builtin_ve_vl_vxor_vvvvl",
75877595
"vl.xorm.MMM" => "__builtin_ve_vl_xorm_MMM",
75887596
"vl.xorm.mmm" => "__builtin_ve_vl_xorm_mmm",
7589-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
7597+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
75907598
}
75917599
}
7592-
ve(name)
7600+
ve(name, full_name)
75937601
}
75947602
"x86" => {
75957603
#[allow(non_snake_case)]
7596-
fn x86(name: &str) -> &str {
7604+
fn x86(name: &str, full_name: &str) -> &'static str {
75977605
match name {
75987606
// x86
75997607
"aadd32" => "__builtin_ia32_aadd32",
@@ -10154,25 +10162,25 @@ fn map_arch_intrinsic(name: &str) -> &str {
1015410162
"xresldtrk" => "__builtin_ia32_xresldtrk",
1015510163
"xsusldtrk" => "__builtin_ia32_xsusldtrk",
1015610164
"xtest" => "__builtin_ia32_xtest",
10157-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
10165+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
1015810166
}
1015910167
}
10160-
x86(name)
10168+
x86(name, full_name)
1016110169
}
1016210170
"xcore" => {
1016310171
#[allow(non_snake_case)]
10164-
fn xcore(name: &str) -> &str {
10172+
fn xcore(name: &str, full_name: &str) -> &'static str {
1016510173
match name {
1016610174
// xcore
1016710175
"bitrev" => "__builtin_bitrev",
1016810176
"getid" => "__builtin_getid",
1016910177
"getps" => "__builtin_getps",
1017010178
"setps" => "__builtin_setps",
10171-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
10179+
_ => unimplemented!("***** unsupported LLVM intrinsic {full_name}"),
1017210180
}
1017310181
}
10174-
xcore(name)
10182+
xcore(name, full_name)
1017510183
}
10176-
_ => unimplemented!("***** unsupported LLVM intrinsic {}", name),
10184+
_ => unimplemented!("***** unsupported LLVM architecture {arch}, intrinsic:{full_name}"),
1017710185
}
1017810186
}

0 commit comments

Comments
 (0)