@@ -259,6 +259,122 @@ unsafe fn test_vrndnq_f32() {
259259 assert_eq ! ( r, e) ;
260260}
261261
262+ #[ cfg( target_arch = "aarch64" ) ]
263+ #[ target_feature( enable = "aes" ) ]
264+ unsafe fn test_vaeseq_u8 ( ) {
265+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.aese
266+ let a = u8x16:: from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ] ) ;
267+ let b = u8x16:: from ( [ 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ] ) ;
268+ let e = u8x16:: from ( [
269+ 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca , 0xca ,
270+ 0xca ,
271+ ] ) ;
272+ let r: u8x16 = unsafe { transmute ( vaeseq_u8 ( transmute ( a) , transmute ( b) ) ) } ;
273+ assert_eq ! ( r, e) ;
274+ }
275+
276+ #[ cfg( target_arch = "aarch64" ) ]
277+ #[ target_feature( enable = "aes" ) ]
278+ unsafe fn test_vaesdq_u8 ( ) {
279+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.aesd
280+ let a = u8x16:: from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ] ) ;
281+ let b = u8x16:: from ( [ 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 ] ) ;
282+ let e = u8x16:: from ( [
283+ 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c , 0x7c ,
284+ 0x7c ,
285+ ] ) ;
286+ let r: u8x16 = unsafe { transmute ( vaesdq_u8 ( transmute ( a) , transmute ( b) ) ) } ;
287+ assert_eq ! ( r, e) ;
288+ }
289+
290+ #[ cfg( target_arch = "aarch64" ) ]
291+ #[ target_feature( enable = "aes" ) ]
292+ unsafe fn test_vaesmcq_u8 ( ) {
293+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.aesmc
294+ let a = u8x16:: from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ] ) ;
295+ let e = u8x16:: from ( [ 2 , 7 , 0 , 5 , 6 , 3 , 4 , 1 , 10 , 15 , 8 , 13 , 14 , 11 , 12 , 9 ] ) ;
296+ let r: u8x16 = unsafe { transmute ( vaesmcq_u8 ( transmute ( a) ) ) } ;
297+ assert_eq ! ( r, e) ;
298+ }
299+
300+ #[ cfg( target_arch = "aarch64" ) ]
301+ #[ target_feature( enable = "aes" ) ]
302+ unsafe fn test_vaesimcq_u8 ( ) {
303+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.aesimc
304+ let a = u8x16:: from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ] ) ;
305+ let e = u8x16:: from ( [ 10 , 15 , 8 , 13 , 14 , 11 , 12 , 9 , 2 , 7 , 0 , 5 , 6 , 3 , 4 , 1 ] ) ;
306+ let r: u8x16 = unsafe { transmute ( vaesimcq_u8 ( transmute ( a) ) ) } ;
307+ assert_eq ! ( r, e) ;
308+ }
309+
310+ #[ cfg( target_arch = "aarch64" ) ]
311+ #[ target_feature( enable = "sha2" ) ]
312+ unsafe fn test_vsha256hq_u32 ( ) {
313+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256h
314+ let a = u32x4:: from ( [ 0 , 1 , 2 , 3 ] ) ;
315+ let b = u32x4:: from ( [ 4 , 5 , 6 , 7 ] ) ;
316+ let c = u32x4:: from ( [ 8 , 9 , 10 , 11 ] ) ;
317+ let e = u32x4:: from ( [ 0x27bb4ae0 , 0xd8f61f7c , 0xb7c1ecdc , 0x10800215 ] ) ;
318+ let r: u32x4 = unsafe { transmute ( vsha256hq_u32 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) } ;
319+ assert_eq ! ( r, e) ;
320+ }
321+
322+ #[ cfg( target_arch = "aarch64" ) ]
323+ #[ target_feature( enable = "sha2" ) ]
324+ unsafe fn test_vsha256h2q_u32 ( ) {
325+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256h2
326+ let a = u32x4:: from ( [ 0 , 1 , 2 , 3 ] ) ;
327+ let b = u32x4:: from ( [ 4 , 5 , 6 , 7 ] ) ;
328+ let c = u32x4:: from ( [ 8 , 9 , 10 , 11 ] ) ;
329+ let e = u32x4:: from ( [ 0x6989ee0d , 0x4b055920 , 0x52800a12 , 0x00000014 ] ) ;
330+ let r: u32x4 = unsafe { transmute ( vsha256h2q_u32 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) } ;
331+ assert_eq ! ( r, e) ;
332+ }
333+
334+ #[ cfg( target_arch = "aarch64" ) ]
335+ #[ target_feature( enable = "sha2" ) ]
336+ unsafe fn test_vsha256su0q_u32 ( ) {
337+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256su0
338+ let a = u32x4:: from ( [ 0 , 1 , 2 , 3 ] ) ;
339+ let b = u32x4:: from ( [ 4 , 5 , 6 , 7 ] ) ;
340+ let e = u32x4:: from ( [ 0x02004000 , 0x04008001 , 0x0600c002 , 0x08010003 ] ) ;
341+ let r: u32x4 = unsafe { transmute ( vsha256su0q_u32 ( transmute ( a) , transmute ( b) ) ) } ;
342+ assert_eq ! ( r, e) ;
343+ }
344+
345+ #[ cfg( target_arch = "aarch64" ) ]
346+ #[ target_feature( enable = "sha2" ) ]
347+ unsafe fn test_vsha256su1q_u32 ( ) {
348+ // AArch64 llvm intrinsic: llvm.aarch64.crypto.sha256su1
349+ let a = u32x4:: from ( [ 0 , 1 , 2 , 3 ] ) ;
350+ let b = u32x4:: from ( [ 4 , 5 , 6 , 7 ] ) ;
351+ let c = u32x4:: from ( [ 8 , 9 , 10 , 11 ] ) ;
352+ let e = u32x4:: from ( [ 0x00044005 , 0x0004e007 , 0xa802211b , 0xec036145 ] ) ;
353+ let r: u32x4 = unsafe { transmute ( vsha256su1q_u32 ( transmute ( a) , transmute ( b) , transmute ( c) ) ) } ;
354+ assert_eq ! ( r, e) ;
355+ }
356+
357+ #[ cfg( target_arch = "aarch64" ) ]
358+ #[ target_feature( enable = "aes" ) ]
359+ fn test_vmull_p64 ( ) {
360+ // AArch64 llvm intrinsic: llvm.aarch64.neon.pmull64
361+ let a: u64 = 3 ;
362+ let b: u64 = 6 ;
363+ let e: u128 = 10 ;
364+ let r: u128 = vmull_p64 ( a, b) ;
365+ assert_eq ! ( r, e) ;
366+ }
367+
368+ #[ cfg( target_arch = "aarch64" ) ]
369+ unsafe fn test_vmull_p8 ( ) {
370+ // AArch64 llvm intrinsic: llvm.aarch64.neon.pmull.v8i16
371+ let a = u8x8:: from ( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
372+ let b = u8x8:: from ( [ 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 ] ) ;
373+ let e = u16x8:: from ( [ 0x0000 , 0x0009 , 0x0014 , 0x001d , 0x0030 , 0x0039 , 0x0024 , 0x002d ] ) ;
374+ let r: u16x8 = unsafe { transmute ( vmull_p8 ( transmute ( a) , transmute ( b) ) ) } ;
375+ assert_eq ! ( r, e) ;
376+ }
377+
262378#[ cfg( target_arch = "aarch64" ) ]
263379fn main ( ) {
264380 unsafe {
@@ -293,6 +409,19 @@ fn main() {
293409 test_vrndnq_f32 ( ) ;
294410
295411 test_crc32 ( ) ;
412+
413+ test_vaeseq_u8 ( ) ;
414+ test_vaesdq_u8 ( ) ;
415+ test_vaesmcq_u8 ( ) ;
416+ test_vaesimcq_u8 ( ) ;
417+
418+ test_vsha256hq_u32 ( ) ;
419+ test_vsha256h2q_u32 ( ) ;
420+ test_vsha256su0q_u32 ( ) ;
421+ test_vsha256su1q_u32 ( ) ;
422+
423+ test_vmull_p64 ( ) ;
424+ test_vmull_p8 ( ) ;
296425 }
297426}
298427
0 commit comments