Skip to content

Commit d51c509

Browse files
committed
Correct some wrong uses of LLVM intrinsics
1 parent 6277e35 commit d51c509

8 files changed

Lines changed: 266 additions & 207 deletions

File tree

crates/core_arch/src/aarch64/neon/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11903,7 +11903,7 @@ pub unsafe fn vluti4q_lane_s8<const LANE: i32>(a: int8x16_t, b: uint8x8_t) -> in
1190311903
unsafe extern "unadjusted" {
1190411904
#[cfg_attr(
1190511905
any(target_arch = "aarch64", target_arch = "arm64ec"),
11906-
link_name = "llvm.aarch64.neon.vluti4q.lane.v8i8"
11906+
link_name = "llvm.aarch64.neon.vluti4q.lane.v16i8"
1190711907
)]
1190811908
fn _vluti4q_lane_s8(a: int8x16_t, b: uint8x8_t, n: i32) -> int8x16_t;
1190911909
}

crates/core_arch/src/aarch64/prefetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use stdarch_test::assert_instr;
33

44
unsafe extern "unadjusted" {
5-
#[link_name = "llvm.prefetch"]
5+
#[link_name = "llvm.prefetch.p0"]
66
fn prefetch(p: *const i8, rw: i32, loc: i32, ty: i32);
77
}
88

crates/core_arch/src/aarch64/sve/generated.rs

Lines changed: 205 additions & 181 deletions
Large diffs are not rendered by default.

crates/core_arch/src/nvptx/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub use packed::*;
2020

2121
#[allow(improper_ctypes)]
2222
unsafe extern "C" {
23-
#[link_name = "llvm.nvvm.barrier0"]
24-
fn syncthreads() -> ();
23+
#[link_name = "llvm.nvvm.barrier.cta.sync.aligned.all"]
24+
fn syncthreads(a: u32) -> ();
2525
#[link_name = "llvm.nvvm.read.ptx.sreg.ntid.x"]
2626
fn block_dim_x() -> u32;
2727
#[link_name = "llvm.nvvm.read.ptx.sreg.ntid.y"]
@@ -54,7 +54,7 @@ unsafe extern "C" {
5454
#[inline]
5555
#[unstable(feature = "stdarch_nvptx", issue = "111199")]
5656
pub unsafe fn _syncthreads() -> () {
57-
syncthreads()
57+
syncthreads(0)
5858
}
5959

6060
/// x-th thread-block dimension.

crates/core_arch/src/wasm32/memory.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
use stdarch_test::assert_instr;
33

44
unsafe extern "unadjusted" {
5-
#[link_name = "llvm.wasm.memory.grow"]
6-
fn llvm_memory_grow(mem: u32, pages: usize) -> usize;
7-
#[link_name = "llvm.wasm.memory.size"]
8-
fn llvm_memory_size(mem: u32) -> usize;
5+
#[link_name = "llvm.wasm.memory.grow.i32"]
6+
fn llvm_memory_grow(mem: u32, pages: u32) -> u32;
7+
#[link_name = "llvm.wasm.memory.size.i32"]
8+
fn llvm_memory_size(mem: u32) -> u32;
99
}
1010

1111
/// Corresponding intrinsic to wasm's [`memory.size` instruction][instr]
@@ -27,7 +27,7 @@ unsafe extern "unadjusted" {
2727
#[doc(alias("memory.size"))]
2828
pub fn memory_size<const MEM: u32>() -> usize {
2929
static_assert!(MEM == 0);
30-
unsafe { llvm_memory_size(MEM) }
30+
unsafe { llvm_memory_size(MEM) as usize }
3131
}
3232

3333
/// Corresponding intrinsic to wasm's [`memory.grow` instruction][instr]
@@ -53,6 +53,6 @@ pub fn memory_size<const MEM: u32>() -> usize {
5353
pub fn memory_grow<const MEM: u32>(delta: usize) -> usize {
5454
unsafe {
5555
static_assert!(MEM == 0);
56-
llvm_memory_grow(MEM, delta)
56+
llvm_memory_grow(MEM, delta as u32) as usize
5757
}
5858
}

crates/core_arch/src/x86/sse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ unsafe extern "C" {
20402040
fn stmxcsr(p: *mut i8);
20412041
#[link_name = "llvm.x86.sse.ldmxcsr"]
20422042
fn ldmxcsr(p: *const i8);
2043-
#[link_name = "llvm.prefetch"]
2043+
#[link_name = "llvm.prefetch.p0"]
20442044
fn prefetch(p: *const i8, rw: i32, loc: i32, ty: i32);
20452045
#[link_name = "llvm.x86.sse.cmp.ss"]
20462046
fn cmpss(a: __m128, b: __m128, imm8: i8) -> __m128;

crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13951,7 +13951,7 @@ intrinsics:
1395113951
- 'b: {neon_type[1]}'
1395213952
- 'n: i32'
1395313953
links:
13954-
- link: "llvm.aarch64.neon.vluti4q.lane.{neon_type[1]}"
13954+
- link: "llvm.aarch64.neon.vluti4q.lane.{neon_type[0]}"
1395513955
arch: aarch64,arm64ec
1395613956
- FnCall: ['_vluti4{neon_type[0].lane_nox}', [a, b, LANE]]
1395713957

@@ -14002,7 +14002,7 @@ intrinsics:
1400214002
- 'b: {neon_type[1]}'
1400314003
- 'n: i32'
1400414004
links:
14005-
- link: "llvm.aarch64.neon.vluti4q.laneq.{neon_type[1]}"
14005+
- link: "llvm.aarch64.neon.vluti4q.laneq.{neon_type[0]}"
1400614006
arch: aarch64,arm64ec
1400714007
- FnCall: ['_vluti4{neon_type[0].laneq_nox}', [a, b, LANE]]
1400814008

crates/stdarch-gen-arm/spec/sve/aarch64.spec.yml

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ intrinsics:
115115
assert_instr: [[fcmla, "IMM_INDEX = 0, IMM_ROTATION = 90"]]
116116
compose:
117117
- LLVMLink:
118-
name: fcmla.lane.x.{sve_type}
118+
name: fcmla.lane.{sve_type}
119119
arguments:
120120
- "op1: {sve_type}"
121121
- "op2: {sve_type}"
@@ -4179,14 +4179,32 @@ intrinsics:
41794179
["inactive: {sve_type[0]}", "pg: {max_predicate}", "op: {sve_type[1]}"]
41804180
return_type: "{sve_type[0]}"
41814181
types:
4182-
- [[f32, f64], [i32, u32, i64, u64]]
4182+
- [f32, [i64, u64]]
4183+
- [f64, [i32, u32]]
41834184
zeroing_method: { drop: inactive }
41844185
substitutions:
41854186
convert_from: { match_kind: "{type[1]}", default: s, unsigned: u }
41864187
assert_instr: ["{convert_from}cvtf"]
41874188
compose:
41884189
- LLVMLink:
41894190
name: "{convert_from}cvtf.{type[0]}{type[1]}"
4191+
4192+
- name: svcvt_{type[0]}[_{type[1]}]{_mxz}
4193+
attr: [*sve-unstable]
4194+
doc: Floating-point convert
4195+
arguments:
4196+
["inactive: {sve_type[0]}", "pg: {max_predicate}", "op: {sve_type[1]}"]
4197+
return_type: "{sve_type[0]}"
4198+
types:
4199+
- [f32, [i32, u32]]
4200+
- [f64, [i64, u64]]
4201+
zeroing_method: { drop: inactive }
4202+
substitutions:
4203+
convert_from: { match_kind: "{type[1]}", default: s, unsigned: u }
4204+
assert_instr: ["{convert_from}cvtf"]
4205+
compose:
4206+
- LLVMLink:
4207+
name: "{convert_from}cvtf.{sve_type[0]}.{sve_type[1]}"
41904208

41914209
- name: svcvt_{type[0]}[_{type[1]}]{_mxz}
41924210
attr: [*sve-unstable]
@@ -4195,13 +4213,30 @@ intrinsics:
41954213
["inactive: {sve_type[0]}", "pg: {max_predicate}", "op: {sve_type[1]}"]
41964214
return_type: "{sve_type[0]}"
41974215
types:
4198-
- [[i32, u32, i64, u64], [f32, f64]]
4216+
- [[i32, u32], f64]
4217+
- [[i64, u64], f32]
41994218
zeroing_method: { drop: inactive }
42004219
substitutions:
42014220
convert_to: { match_kind: "{type[0]}", default: s, unsigned: u }
42024221
assert_instr: ["fcvtz{convert_to}"]
42034222
compose:
42044223
- LLVMLink: { name: "fcvtz{convert_to}.{type[0]}{type[1]}" }
4224+
4225+
- name: svcvt_{type[0]}[_{type[1]}]{_mxz}
4226+
attr: [*sve-unstable]
4227+
doc: Floating-point convert
4228+
arguments:
4229+
["inactive: {sve_type[0]}", "pg: {max_predicate}", "op: {sve_type[1]}"]
4230+
return_type: "{sve_type[0]}"
4231+
types:
4232+
- [[i32, u32], f32]
4233+
- [[i64, u64], f64]
4234+
zeroing_method: { drop: inactive }
4235+
substitutions:
4236+
convert_to: { match_kind: "{type[0]}", default: s, unsigned: u }
4237+
assert_instr: ["fcvtz{convert_to}"]
4238+
compose:
4239+
- LLVMLink: { name: "fcvtz{convert_to}.{sve_type[0]}.{sve_type[1]}" }
42054240

42064241
- name: svcvt_{type[0]}[_{type[1]}]{_mxz}
42074242
attr: [*sve-unstable]
@@ -4356,7 +4391,7 @@ intrinsics:
43564391
return_type: svbool_t
43574392
assert_instr: [and]
43584393
compose:
4359-
- LLVMLink: { name: "and.z.nvx16i1" }
4394+
- LLVMLink: { name: "and.z.nxv16i1" }
43604395

43614396
- name: svmov[_b]_z
43624397
attr: [*sve-unstable]
@@ -4386,7 +4421,7 @@ intrinsics:
43864421
return_type: svbool_t
43874422
assert_instr: [bic]
43884423
compose:
4389-
- LLVMLink: { name: "bic.z.nvx16i1" }
4424+
- LLVMLink: { name: "bic.z.nxv16i1" }
43904425

43914426
- name: sveor[{_n}_{type}]{_mxz}
43924427
attr: [*sve-unstable]
@@ -4417,7 +4452,7 @@ intrinsics:
44174452
return_type: svbool_t
44184453
assert_instr: [eor]
44194454
compose:
4420-
- LLVMLink: { name: "eor.z.nvx16i1" }
4455+
- LLVMLink: { name: "eor.z.nxv16i1" }
44214456

44224457
- name: svnot[_{type}]{_mxz}
44234458
attr: [*sve-unstable]
@@ -4497,7 +4532,7 @@ intrinsics:
44974532
return_type: svbool_t
44984533
assert_instr: [orr]
44994534
compose:
4500-
- LLVMLink: { name: "orr.z.nvx16i1" }
4535+
- LLVMLink: { name: "orr.z.nxv16i1" }
45014536

45024537
- name: svorn[_b]_z
45034538
attr: [*sve-unstable]
@@ -4506,7 +4541,7 @@ intrinsics:
45064541
return_type: svbool_t
45074542
assert_instr: [orn]
45084543
compose:
4509-
- LLVMLink: { name: "orn.z.nvx16i1" }
4544+
- LLVMLink: { name: "orn.z.nxv16i1" }
45104545

45114546
- name: svlsl[{_n}_{type[0]}]{_mxz}
45124547
attr: [*sve-unstable]
@@ -4749,7 +4784,7 @@ intrinsics:
47494784
assert_instr: [frecpx]
47504785
zeroing_method: { drop: inactive }
47514786
compose:
4752-
- LLVMLink: { name: "frecpx.x.{sve_type}" }
4787+
- LLVMLink: { name: "frecpx.{sve_type}" }
47534788

47544789
- name: svrsqrte[_{type}]
47554790
attr: [*sve-unstable]
@@ -5115,7 +5150,7 @@ intrinsics:
51155150
types: [[f32, u32], [f64, u64]]
51165151
assert_instr: [fexpa]
51175152
compose:
5118-
- LLVMLink: { name: "fexpa.x.{sve_type[0]} " }
5153+
- LLVMLink: { name: "fexpa.x.{sve_type[0]}" }
51195154

51205155
- name: svscale[{_n}_{type[0]}]{_mxz}
51215156
attr: [*sve-unstable]
@@ -5139,7 +5174,7 @@ intrinsics:
51395174
types: [f32]
51405175
assert_instr: [fmmla]
51415176
compose:
5142-
- LLVMLink: { name: "fmmla.{sve_type}" }
5177+
- LLVMLink: { name: "fmmla.{sve_type}.{sve_type}" }
51435178

51445179
- name: svmmla[_{type}]
51455180
attr: [*sve-unstable]
@@ -5150,7 +5185,7 @@ intrinsics:
51505185
types: [f64]
51515186
assert_instr: [fmmla]
51525187
compose:
5153-
- LLVMLink: { name: "fmmla.{sve_type}" }
5188+
- LLVMLink: { name: "fmmla.{sve_type}.{sve_type}" }
51545189

51555190
- name: svmmla[_{type[0]}]
51565191
attr: [*sve-unstable]

0 commit comments

Comments
 (0)