Skip to content

Commit d69c8d1

Browse files
README
1 parent 1f4b817 commit d69c8d1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

testable-simd-models/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ tests work by testing the models against the intrinsics in the Rust
2323
core, trying out random inputs (generally 1000), and comparing their
2424
outputs.
2525

26+
## Modeling Process
2627
The process of adding a specific intrinsic's model goes as follows.
2728
For this example, let us say the intrinsic we are adding is
2829
`_mm256_bsrli_epi128` from the avx2 feature set.
@@ -106,3 +107,21 @@ pub fn _mm256_bsrli_epi128<const IMM8: i32>(a: __m256i) -> __m256i {
106107
mk!([100]_mm256_bsrli_epi128{<0>,<1>,<2>,<3>,...,<255>}(a: BitVec));
107108
```
108109
Here, the `[100]` means we test 100 random inputs for each constant value. This concludes the necessary steps for implementing an intrinsic.
110+
111+
112+
## Contributing Models
113+
114+
To contribute new models of intrinsics, we expect the author to follow
115+
the above steps and provide comprehensive tests. It is important that
116+
the model author look carefully at both the Intel/ARM specification
117+
and the Rust `stdarch` implementation, because the Rust implementation
118+
may not necessarily be correct.
119+
120+
Indeed, the previous implementation of `_mm256_bsrli_epi128` (and a
121+
similar intrinsic called `_mm512_bsrli_epi128`) in `stdarch` had a
122+
bug, which we found during the process of modeling and testing this
123+
intrinsic. This bug was [reported by
124+
us](https://github.com/rust-lang/stdarch/issues/1822) using a failing
125+
test case generated from the testable model and then fixed by [our
126+
PR](https://github.com/rust-lang/stdarch/pull/1823) in the 2025-06-30
127+
version of `stdarch`.

0 commit comments

Comments
 (0)