@@ -23,6 +23,7 @@ tests work by testing the models against the intrinsics in the Rust
2323core, trying out random inputs (generally 1000), and comparing their
2424outputs.
2525
26+ ## Modeling Process
2627The process of adding a specific intrinsic's model goes as follows.
2728For 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