Skip to content

Commit fa2fcef

Browse files
japaricgnzlbg
authored andcommitted
acle: move arm/dsp into acle/{dsp,simd32}
addresses #557 (comment)
1 parent bd71133 commit fa2fcef

File tree

4 files changed

+720
-729
lines changed

4 files changed

+720
-729
lines changed

crates/core_arch/src/acle/dsp.rs

+42-15
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,45 @@
44
//!
55
//! Intrinsics that could live here:
66
//!
7-
//! - __smulbb
8-
//! - __smulbt
9-
//! - __smultb
10-
//! - __smultt
11-
//! - __smulwb
12-
//! - __smulwt
13-
//! - __qadd
14-
//! - __qsub
15-
//! - __qdbl
16-
//! - __smlabb
17-
//! - __smlabt
18-
//! - __smlatb
19-
//! - __smlatt
20-
//! - __smlawb
21-
//! - __smlawt
7+
//! - [ ] __smulbb
8+
//! - [ ] __smulbt
9+
//! - [ ] __smultb
10+
//! - [ ] __smultt
11+
//! - [ ] __smulwb
12+
//! - [ ] __smulwt
13+
//! - [x] __qadd
14+
//! - [x] __qsub
15+
//! - [ ] __qdbl
16+
//! - [ ] __smlabb
17+
//! - [ ] __smlabt
18+
//! - [ ] __smlatb
19+
//! - [ ] __smlatt
20+
//! - [ ] __smlawb
21+
//! - [ ] __smlawt
22+
23+
extern "C" {
24+
#[link_name = "llvm.arm.qadd"]
25+
fn arm_qadd(a: i32, b: i32) -> i32;
26+
27+
#[link_name = "llvm.arm.qsub"]
28+
fn arm_qsub(a: i32, b: i32) -> i32;
29+
30+
}
31+
32+
/// Signed saturating addition
33+
///
34+
/// Returns the 32-bit saturating signed equivalent of a + b.
35+
#[inline]
36+
#[cfg_attr(test, assert_instr(qadd))]
37+
pub unsafe fn qadd(a: i32, b: i32) -> i32 {
38+
arm_qadd(a, b)
39+
}
40+
41+
/// Signed saturating subtraction
42+
///
43+
/// Returns the 32-bit saturating signed equivalent of a - b.
44+
#[inline]
45+
#[cfg_attr(test, assert_instr(qsub))]
46+
pub unsafe fn qsub(a: i32, b: i32) -> i32 {
47+
arm_qsub(a, b)
48+
}

0 commit comments

Comments
 (0)