@@ -131,6 +131,55 @@ unsafe fn test_vpmax_f32() {
131
131
assert_eq ! ( r, e) ;
132
132
}
133
133
134
+ #[ cfg( target_arch = "aarch64" ) ]
135
+ unsafe fn test_vpadd_s16 ( ) {
136
+ let a = i16x4:: from ( [ 1 , 2 , 3 , 4 ] ) ;
137
+ let b = i16x4:: from ( [ 0 , -1 , -2 , -3 ] ) ;
138
+ let r: i16x4 = transmute ( vpadd_s16 ( transmute ( a) , transmute ( b) ) ) ;
139
+ let e = i16x4:: from ( [ 3 , 7 , -1 , -5 ] ) ;
140
+ assert_eq ! ( r, e) ;
141
+ }
142
+ #[ cfg( target_arch = "aarch64" ) ]
143
+ unsafe fn test_vpadd_s32 ( ) {
144
+ let a = i32x2:: from ( [ 1 , 2 ] ) ;
145
+ let b = i32x2:: from ( [ 0 , -1 ] ) ;
146
+ let r: i32x2 = transmute ( vpadd_s32 ( transmute ( a) , transmute ( b) ) ) ;
147
+ let e = i32x2:: from ( [ 3 , -1 ] ) ;
148
+ assert_eq ! ( r, e) ;
149
+ }
150
+ #[ cfg( target_arch = "aarch64" ) ]
151
+ unsafe fn test_vpadd_s8 ( ) {
152
+ let a = i8x8:: from ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ) ;
153
+ let b = i8x8:: from ( [ 0 , -1 , -2 , -3 , -4 , -5 , -6 , -7 ] ) ;
154
+ let r: i8x8 = transmute ( vpadd_s8 ( transmute ( a) , transmute ( b) ) ) ;
155
+ let e = i8x8:: from ( [ 3 , 7 , 11 , 15 , -1 , -5 , -9 , -13 ] ) ;
156
+ assert_eq ! ( r, e) ;
157
+ }
158
+ #[ cfg( target_arch = "aarch64" ) ]
159
+ unsafe fn test_vpadd_u16 ( ) {
160
+ let a = u16x4:: from ( [ 1 , 2 , 3 , 4 ] ) ;
161
+ let b = u16x4:: from ( [ 30 , 31 , 32 , 33 ] ) ;
162
+ let r: u16x4 = transmute ( vpadd_u16 ( transmute ( a) , transmute ( b) ) ) ;
163
+ let e = u16x4:: from ( [ 3 , 7 , 61 , 65 ] ) ;
164
+ assert_eq ! ( r, e) ;
165
+ }
166
+ #[ cfg( target_arch = "aarch64" ) ]
167
+ unsafe fn test_vpadd_u32 ( ) {
168
+ let a = u32x2:: from ( [ 1 , 2 ] ) ;
169
+ let b = u32x2:: from ( [ 30 , 31 ] ) ;
170
+ let r: u32x2 = transmute ( vpadd_u32 ( transmute ( a) , transmute ( b) ) ) ;
171
+ let e = u32x2:: from ( [ 3 , 61 ] ) ;
172
+ assert_eq ! ( r, e) ;
173
+ }
174
+ #[ cfg( target_arch = "aarch64" ) ]
175
+ unsafe fn test_vpadd_u8 ( ) {
176
+ let a = u8x8:: from ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ) ;
177
+ let b = u8x8:: from ( [ 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 ] ) ;
178
+ let r: u8x8 = transmute ( vpadd_u8 ( transmute ( a) , transmute ( b) ) ) ;
179
+ let e = u8x8:: from ( [ 3 , 7 , 11 , 15 , 61 , 65 , 69 , 73 ] ) ;
180
+ assert_eq ! ( r, e) ;
181
+ }
182
+
134
183
#[ cfg( target_arch = "aarch64" ) ]
135
184
fn main ( ) {
136
185
unsafe {
@@ -148,6 +197,13 @@ fn main() {
148
197
test_vpmax_u16 ( ) ;
149
198
test_vpmax_u32 ( ) ;
150
199
test_vpmax_f32 ( ) ;
200
+
201
+ test_vpadd_s16 ( ) ;
202
+ test_vpadd_s32 ( ) ;
203
+ test_vpadd_s8 ( ) ;
204
+ test_vpadd_u16 ( ) ;
205
+ test_vpadd_u32 ( ) ;
206
+ test_vpadd_u8 ( ) ;
151
207
}
152
208
}
153
209
0 commit comments