File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -3139,6 +3139,32 @@ mod tests {
3139
3139
let r = _mm_madd_epi16 ( a, b) ;
3140
3140
let e = _mm_setr_epi32 ( 29 , 81 , 149 , 233 ) ;
3141
3141
assert_eq_m128i ( r, e) ;
3142
+
3143
+ // Test large values.
3144
+ // MIN*MIN+MIN*MIN will overflow into i32::MIN.
3145
+ let a = _mm_setr_epi16 (
3146
+ i16:: MAX ,
3147
+ i16:: MAX ,
3148
+ i16:: MIN ,
3149
+ i16:: MIN ,
3150
+ i16:: MIN ,
3151
+ i16:: MAX ,
3152
+ 0 ,
3153
+ 0 ,
3154
+ ) ;
3155
+ let b = _mm_setr_epi16 (
3156
+ i16:: MAX ,
3157
+ i16:: MAX ,
3158
+ i16:: MIN ,
3159
+ i16:: MIN ,
3160
+ i16:: MAX ,
3161
+ i16:: MIN ,
3162
+ 0 ,
3163
+ 0 ,
3164
+ ) ;
3165
+ let r = _mm_madd_epi16 ( a, b) ;
3166
+ let e = _mm_setr_epi32 ( 0x7FFE0002 , i32:: MIN , -0x7FFF0000 , 0 ) ;
3167
+ assert_eq_m128i ( r, e) ;
3142
3168
}
3143
3169
3144
3170
#[ simd_test( enable = "sse2" ) ]
You can’t perform that action at this time.
0 commit comments