Skip to content

Commit 31823d7

Browse files
author
TheIronBorn
committed
always inline rotates
1 parent 86b1f48 commit 31823d7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

coresimd/ppsv/api/rotates.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Implements integer rotates.
22
#![allow(unused)]
33

4+
// inline(always) to encourage the compiler to generate rotate instructions
5+
// where available
46
macro_rules! impl_vector_rotates {
57
($id:ident, $elem_ty:ident) => {
68
impl $id {
@@ -11,7 +13,7 @@ macro_rules! impl_vector_rotates {
1113
/// Please note this isn't the same operation as `<<`!. Also note it
1214
/// isn't equivalent to `slice::rotate_left`, it doesn't move the vector's
1315
/// lanes around. (that can be implemented with vector shuffles).
14-
#[inline]
16+
#[inline(always)]
1517
pub fn rotate_left(self, n: $id) -> $id {
1618
const LANE_WIDTH: $elem_ty = ::mem::size_of::<$elem_ty>() as $elem_ty * 8;
1719
// Protect against undefined behavior for over-long bit shifts
@@ -26,7 +28,7 @@ macro_rules! impl_vector_rotates {
2628
/// Please note this isn't the same operation as `>>`!. Also note it
2729
/// isn't similar to `slice::rotate_right`, it doesn't move the vector's
2830
/// lanes around. (that can be implemented with vector shuffles).
29-
#[inline]
31+
#[inline(always)]
3032
pub fn rotate_right(self, n: $id) -> $id {
3133
const LANE_WIDTH: $elem_ty = ::mem::size_of::<$elem_ty>() as $elem_ty * 8;
3234
// Protect against undefined behavior for over-long bit shifts

crates/coresimd/tests/rotate_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#![feature(avx512_target_feature)]
66
#![feature(abi_vectorcall)]
77

8-
extern crate stdsimd_test;
98
extern crate stdsimd;
9+
extern crate stdsimd_test;
1010

1111
use stdsimd::simd::*;
1212
use stdsimd_test::assert_instr;

0 commit comments

Comments
 (0)