Skip to content

Commit fb5b397

Browse files
committed
Fixing spec
1 parent b5ee135 commit fb5b397

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

testable-simd-models/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,15 @@ pub fn _mm256_bsrli_epi128<const IMM8: i32>(a: __m256i) -> __m256i {
159159
let a = BitVec::to_i128x2(a);
160160
let a = i128x2::from_fn(|i| {
161161
let tmp = IMM8 % 256;
162-
let tmp = tmp % 16;
163-
((a[i] as u128) >> (tmp * 8)) as i128
162+
if tmp > 15 {0} else {
163+
((a[i] as u128) >> (tmp * 8)) as i128
164+
}
164165
});
165166
BitVec::from_i128x2(a)
166167
}
167168
```
169+
There is no test for the specification, and thus it has to be manually reviewed to ensure that it perfectly captures the
170+
behaviour described by the documentation.
168171

169172

170173

testable-simd-models/src/core_arch/x86/specs/avx2.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ pub fn _mm256_bsrli_epi128<const IMM8: i32>(a: __m256i) -> __m256i {
1212
let a = BitVec::to_i128x2(a);
1313
let a = i128x2::from_fn(|i| {
1414
let tmp = IMM8 % 256;
15-
let tmp = tmp % 16;
16-
((a[i] as u128) >> (tmp * 8)) as i128
15+
if tmp > 15 {0} else {
16+
((a[i] as u128) >> (tmp * 8)) as i128
17+
}
1718
});
1819
BitVec::from_i128x2(a)
1920
}

0 commit comments

Comments
 (0)