File tree 3 files changed +54
-0
lines changed
3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -9,5 +9,16 @@ export RUSTFLAGS="$RUSTFLAGS -C codegen-units=1"
9
9
# having only one thread increases debuggability to be worth it.
10
10
export RUST_TEST_THREADS=1
11
11
12
+ # FIXME(rust-lang-nursery/stdsimd#120) run-time feature detection for ARM Neon
13
+ case ${TARGET} in
14
+ aarch* )
15
+ export RUSTFLAGS=" ${RUSTFLAGS} -C target-feature=+neon"
16
+ ;;
17
+ * )
18
+ ;;
19
+ esac
20
+
21
+ echo " RUSTFLAGS=${RUSTFLAGS} "
22
+
12
23
cargo test --target $TARGET
13
24
cargo test --release --target $TARGET
Original file line number Diff line number Diff line change @@ -3,8 +3,13 @@ pub use self::v6::*;
3
3
pub use self :: v7:: * ;
4
4
#[ cfg( target_arch = "aarch64" ) ]
5
5
pub use self :: v8:: * ;
6
+ #[ cfg( target_feature = "neon" ) ]
7
+ pub use self :: neon:: * ;
6
8
7
9
mod v6;
8
10
mod v7;
9
11
#[ cfg( target_arch = "aarch64" ) ]
10
12
mod v8;
13
+
14
+ #[ cfg( target_feature = "neon" ) ]
15
+ mod neon;
Original file line number Diff line number Diff line change
1
+ //! ARM NEON intrinsics
2
+ //!
3
+ //! The references is [ARM's NEON Intrinsics Reference](http://infocenter.arm.com/help/topic/com.arm.doc.ihi0073a/IHI0073A_arm_neon_intrinsics_ref.pdf). [ARM's NEON Intrinsics Online Database](https://developer.arm.com/technologies/neon/intrinsics) is also useful.
4
+
5
+ #[ cfg( test) ]
6
+ use stdsimd_test:: assert_instr;
7
+
8
+ use v64:: { f32x2} ;
9
+
10
+ #[ allow( improper_ctypes) ]
11
+ extern "C" {
12
+ #[ link_name = "llvm.aarch64.neon.frsqrte.v2f32" ]
13
+ fn frsqrte_v2f32 ( a : f32x2 ) -> f32x2 ;
14
+ }
15
+
16
+ /// Reciprocal square-root estimate.
17
+ #[ inline( always) ]
18
+ #[ target_feature = "+neon" ]
19
+ #[ cfg_attr( test, assert_instr( frsqrte) ) ]
20
+ pub unsafe fn vrsqrte_f32 ( a : f32x2 ) -> f32x2 {
21
+ frsqrte_v2f32 ( a)
22
+ }
23
+
24
+ #[ cfg( test) ]
25
+ mod tests {
26
+ use stdsimd_test:: simd_test;
27
+
28
+ use v64:: { f32x2} ;
29
+ use arm:: neon;
30
+
31
+ #[ test]
32
+ fn vrsqrt_f32 ( ) {
33
+ let a = f32x2:: new ( 1.0 , 2.0 ) ;
34
+ let e = f32x2:: new ( 0.9980469 , 0.7050781 ) ;
35
+ let r = unsafe { neon:: vrsqrte_f32 ( a) } ;
36
+ assert_eq ! ( r, e) ;
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments