File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -466,3 +466,21 @@ unsafe fn fdct_avx2_internal(data: &mut [i16; 64]) {
466466 _mm256_storeu_si256 ( out_data. add ( 2 ) , ymm6) ;
467467 _mm256_storeu_si256 ( out_data. add ( 3 ) , ymm7) ;
468468}
469+
470+ /// Safe wrapper for an unaligned AVX load
471+ #[ target_feature( enable = "avx2" ) ]
472+ #[ inline]
473+ fn avx_load ( input : & [ i16 ; 16 ] ) -> __m256i {
474+ assert ! ( core:: mem:: size_of:: <[ i16 ; 16 ] >( ) == core:: mem:: size_of:: <__m256i>( ) ) ;
475+ // SAFETY: we've checked sizes above. The load is unaligned, so no alignment requirements.
476+ unsafe { _mm256_loadu_si256 ( input. as_ptr ( ) as * const __m256i ) }
477+ }
478+
479+ /// Safe wrapper for an unaligned AVX store
480+ #[ target_feature( enable = "avx2" ) ]
481+ #[ inline]
482+ fn avx_store ( input : __m256i , output : & mut [ i16 ; 16 ] ) {
483+ assert ! ( core:: mem:: size_of:: <[ i16 ; 16 ] >( ) == core:: mem:: size_of:: <__m256i>( ) ) ;
484+ // SAFETY: we've checked sizes above. The load is unaligned, so no alignment requirements.
485+ unsafe { _mm256_storeu_si256 ( output. as_mut_ptr ( ) as * mut __m256i , input) }
486+ }
You can’t perform that action at this time.
0 commit comments