@@ -425,36 +425,17 @@ pub unsafe fn __usada8(a: int8x4_t, b: int8x4_t, c: u32) -> u32 {
425
425
426
426
#[ cfg( test) ]
427
427
mod tests {
428
- use core_arch:: arm:: * ;
429
- use core_arch:: simd:: * ;
428
+ use core_arch:: simd:: { i8x4, i16x2} ;
430
429
use std:: mem;
431
430
use stdsimd_test:: simd_test;
432
431
433
- #[ test]
434
- fn qadd ( ) {
435
- unsafe {
436
- assert_eq ! ( dsp:: __qadd( -10 , 60 ) , 50 ) ;
437
- assert_eq ! ( dsp:: __qadd( :: std:: i32 :: MAX , 10 ) , :: std:: i32 :: MAX ) ;
438
- assert_eq ! ( dsp:: __qadd( :: std:: i32 :: MIN , -10 ) , :: std:: i32 :: MIN ) ;
439
- }
440
- }
441
-
442
- #[ test]
443
- fn qsub ( ) {
444
- unsafe {
445
- assert_eq ! ( dsp:: __qsub( 10 , 60 ) , -50 ) ;
446
- assert_eq ! ( dsp:: __qsub( :: std:: i32 :: MAX , -10 ) , :: std:: i32 :: MAX ) ;
447
- assert_eq ! ( dsp:: __qsub( :: std:: i32 :: MIN , 10 ) , :: std:: i32 :: MIN ) ;
448
- }
449
- }
450
-
451
432
#[ test]
452
433
fn qadd8 ( ) {
453
434
unsafe {
454
435
let a = i8x4:: new ( 1 , 2 , 3 , :: std:: i8:: MAX ) ;
455
436
let b = i8x4:: new ( 2 , -1 , 0 , 1 ) ;
456
437
let c = i8x4:: new ( 3 , 1 , 3 , :: std:: i8:: MAX ) ;
457
- let r: i8x4 = dsp_call ! ( dsp :: __qadd8, a, b) ;
438
+ let r: i8x4 = dsp_call ! ( super :: __qadd8, a, b) ;
458
439
assert_eq ! ( r, c) ;
459
440
}
460
441
}
@@ -465,7 +446,7 @@ mod tests {
465
446
let a = i8x4:: new ( 1 , 2 , 3 , :: std:: i8:: MIN ) ;
466
447
let b = i8x4:: new ( 2 , -1 , 0 , 1 ) ;
467
448
let c = i8x4:: new ( -1 , 3 , 3 , :: std:: i8:: MIN ) ;
468
- let r: i8x4 = dsp_call ! ( dsp :: __qsub8, a, b) ;
449
+ let r: i8x4 = dsp_call ! ( super :: __qsub8, a, b) ;
469
450
assert_eq ! ( r, c) ;
470
451
}
471
452
}
@@ -476,7 +457,7 @@ mod tests {
476
457
let a = i16x2:: new ( 1 , 2 ) ;
477
458
let b = i16x2:: new ( 2 , -1 ) ;
478
459
let c = i16x2:: new ( 3 , 1 ) ;
479
- let r: i16x2 = dsp_call ! ( dsp :: __qadd16, a, b) ;
460
+ let r: i16x2 = dsp_call ! ( super :: __qadd16, a, b) ;
480
461
assert_eq ! ( r, c) ;
481
462
}
482
463
}
@@ -487,7 +468,7 @@ mod tests {
487
468
let a = i16x2:: new ( 10 , 20 ) ;
488
469
let b = i16x2:: new ( 20 , -10 ) ;
489
470
let c = i16x2:: new ( -10 , 30 ) ;
490
- let r: i16x2 = dsp_call ! ( dsp :: __qsub16, a, b) ;
471
+ let r: i16x2 = dsp_call ! ( super :: __qsub16, a, b) ;
491
472
assert_eq ! ( r, c) ;
492
473
}
493
474
}
@@ -498,7 +479,7 @@ mod tests {
498
479
let a = i16x2:: new ( 1 , :: std:: i16:: MAX ) ;
499
480
let b = i16x2:: new ( 2 , 2 ) ;
500
481
let c = i16x2:: new ( -1 , :: std:: i16:: MAX ) ;
501
- let r: i16x2 = dsp_call ! ( dsp :: __qasx, a, b) ;
482
+ let r: i16x2 = dsp_call ! ( super :: __qasx, a, b) ;
502
483
assert_eq ! ( r, c) ;
503
484
}
504
485
}
@@ -509,7 +490,7 @@ mod tests {
509
490
let a = i16x2:: new ( 1 , :: std:: i16:: MAX ) ;
510
491
let b = i16x2:: new ( 2 , 2 ) ;
511
492
let c = i16x2:: new ( 3 , :: std:: i16:: MAX - 2 ) ;
512
- let r: i16x2 = dsp_call ! ( dsp :: __qsax, a, b) ;
493
+ let r: i16x2 = dsp_call ! ( super :: __qsax, a, b) ;
513
494
assert_eq ! ( r, c) ;
514
495
}
515
496
}
@@ -520,7 +501,7 @@ mod tests {
520
501
let a = i16x2:: new ( 1 , :: std:: i16:: MAX ) ;
521
502
let b = i16x2:: new ( 2 , 2 ) ;
522
503
let c = i16x2:: new ( 3 , -:: std:: i16:: MAX ) ;
523
- let r: i16x2 = dsp_call ! ( dsp :: __sadd16, a, b) ;
504
+ let r: i16x2 = dsp_call ! ( super :: __sadd16, a, b) ;
524
505
assert_eq ! ( r, c) ;
525
506
}
526
507
}
@@ -531,7 +512,7 @@ mod tests {
531
512
let a = i8x4:: new ( 1 , 2 , 3 , :: std:: i8:: MAX ) ;
532
513
let b = i8x4:: new ( 4 , 3 , 2 , 2 ) ;
533
514
let c = i8x4:: new ( 5 , 5 , 5 , -:: std:: i8:: MAX ) ;
534
- let r: i8x4 = dsp_call ! ( dsp :: __sadd8, a, b) ;
515
+ let r: i8x4 = dsp_call ! ( super :: __sadd8, a, b) ;
535
516
assert_eq ! ( r, c) ;
536
517
}
537
518
}
@@ -542,7 +523,7 @@ mod tests {
542
523
let a = i16x2:: new ( 1 , 2 ) ;
543
524
let b = i16x2:: new ( 2 , 1 ) ;
544
525
let c = i16x2:: new ( 0 , 4 ) ;
545
- let r: i16x2 = dsp_call ! ( dsp :: __sasx, a, b) ;
526
+ let r: i16x2 = dsp_call ! ( super :: __sasx, a, b) ;
546
527
assert_eq ! ( r, c) ;
547
528
}
548
529
}
@@ -552,7 +533,7 @@ mod tests {
552
533
unsafe {
553
534
let a = i16x2:: new ( 1 , 2 ) ;
554
535
let b = i16x2:: new ( 3 , 4 ) ;
555
- let r = dsp :: __smlad ( :: mem:: transmute ( a) , :: mem:: transmute ( b) , 10 ) ;
536
+ let r = super :: __smlad ( :: mem:: transmute ( a) , :: mem:: transmute ( b) , 10 ) ;
556
537
assert_eq ! ( r, ( 1 * 3 ) + ( 2 * 4 ) + 10 ) ;
557
538
}
558
539
}
@@ -562,7 +543,7 @@ mod tests {
562
543
unsafe {
563
544
let a = i16x2:: new ( 1 , 2 ) ;
564
545
let b = i16x2:: new ( 3 , 4 ) ;
565
- let r = dsp :: __smlsd ( :: mem:: transmute ( a) , :: mem:: transmute ( b) , 10 ) ;
546
+ let r = super :: __smlsd ( :: mem:: transmute ( a) , :: mem:: transmute ( b) , 10 ) ;
566
547
assert_eq ! ( r, ( ( 1 * 3 ) - ( 2 * 4 ) ) + 10 ) ;
567
548
}
568
549
}
@@ -573,9 +554,9 @@ mod tests {
573
554
let a = i8x4:: new ( 1 , 2 , 3 , :: std:: i8:: MAX ) ;
574
555
let b = i8x4:: new ( 4 , 3 , 2 , 2 ) ;
575
556
// call sadd8() to set GE bits
576
- dsp :: __sadd8 ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
557
+ super :: __sadd8 ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
577
558
let c = i8x4:: new ( 1 , 2 , 3 , :: std:: i8:: MAX ) ;
578
- let r: i8x4 = dsp_call ! ( dsp :: __sel, a, b) ;
559
+ let r: i8x4 = dsp_call ! ( super :: __sel, a, b) ;
579
560
assert_eq ! ( r, c) ;
580
561
}
581
562
}
@@ -586,7 +567,7 @@ mod tests {
586
567
let a = i8x4:: new ( 1 , 2 , 3 , 4 ) ;
587
568
let b = i8x4:: new ( 5 , 4 , 3 , 2 ) ;
588
569
let c = i8x4:: new ( 3 , 3 , 3 , 3 ) ;
589
- let r: i8x4 = dsp_call ! ( dsp :: __shadd8, a, b) ;
570
+ let r: i8x4 = dsp_call ! ( super :: __shadd8, a, b) ;
590
571
assert_eq ! ( r, c) ;
591
572
}
592
573
}
@@ -597,7 +578,7 @@ mod tests {
597
578
let a = i16x2:: new ( 1 , 2 ) ;
598
579
let b = i16x2:: new ( 5 , 4 ) ;
599
580
let c = i16x2:: new ( 3 , 3 ) ;
600
- let r: i16x2 = dsp_call ! ( dsp :: __shadd16, a, b) ;
581
+ let r: i16x2 = dsp_call ! ( super :: __shadd16, a, b) ;
601
582
assert_eq ! ( r, c) ;
602
583
}
603
584
}
@@ -608,7 +589,7 @@ mod tests {
608
589
let a = i8x4:: new ( 1 , 2 , 3 , 4 ) ;
609
590
let b = i8x4:: new ( 5 , 4 , 3 , 2 ) ;
610
591
let c = i8x4:: new ( -2 , -1 , 0 , 1 ) ;
611
- let r: i8x4 = dsp_call ! ( dsp :: __shsub8, a, b) ;
592
+ let r: i8x4 = dsp_call ! ( super :: __shsub8, a, b) ;
612
593
assert_eq ! ( r, c) ;
613
594
}
614
595
}
@@ -619,7 +600,7 @@ mod tests {
619
600
let a = i16x2:: new ( 1 , 2 ) ;
620
601
let b = i16x2:: new ( 5 , 4 ) ;
621
602
let c = i16x2:: new ( -2 , -1 ) ;
622
- let r: i16x2 = dsp_call ! ( dsp :: __shsub16, a, b) ;
603
+ let r: i16x2 = dsp_call ! ( super :: __shsub16, a, b) ;
623
604
assert_eq ! ( r, c) ;
624
605
}
625
606
}
@@ -629,7 +610,7 @@ mod tests {
629
610
unsafe {
630
611
let a = i16x2:: new ( 1 , 2 ) ;
631
612
let b = i16x2:: new ( 5 , 4 ) ;
632
- let r = dsp :: __smuad ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
613
+ let r = super :: __smuad ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
633
614
assert_eq ! ( r, 13 ) ;
634
615
}
635
616
}
@@ -639,7 +620,7 @@ mod tests {
639
620
unsafe {
640
621
let a = i16x2:: new ( 1 , 2 ) ;
641
622
let b = i16x2:: new ( 5 , 4 ) ;
642
- let r = dsp :: __smuadx ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
623
+ let r = super :: __smuadx ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
643
624
assert_eq ! ( r, 14 ) ;
644
625
}
645
626
}
@@ -649,7 +630,7 @@ mod tests {
649
630
unsafe {
650
631
let a = i16x2:: new ( 1 , 2 ) ;
651
632
let b = i16x2:: new ( 5 , 4 ) ;
652
- let r = dsp :: __smusd ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
633
+ let r = super :: __smusd ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
653
634
assert_eq ! ( r, -3 ) ;
654
635
}
655
636
}
@@ -659,7 +640,7 @@ mod tests {
659
640
unsafe {
660
641
let a = i16x2:: new ( 1 , 2 ) ;
661
642
let b = i16x2:: new ( 5 , 4 ) ;
662
- let r = dsp :: __smusdx ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
643
+ let r = super :: __smusdx ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
663
644
assert_eq ! ( r, -6 ) ;
664
645
}
665
646
}
@@ -669,7 +650,7 @@ mod tests {
669
650
unsafe {
670
651
let a = i8x4:: new ( 1 , 2 , 3 , 4 ) ;
671
652
let b = i8x4:: new ( 4 , 3 , 2 , 1 ) ;
672
- let r = dsp :: __usad8 ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
653
+ let r = super :: __usad8 ( :: mem:: transmute ( a) , :: mem:: transmute ( b) ) ;
673
654
assert_eq ! ( r, 8 ) ;
674
655
}
675
656
}
@@ -680,7 +661,7 @@ mod tests {
680
661
let a = i8x4:: new ( 1 , 2 , 3 , 4 ) ;
681
662
let b = i8x4:: new ( 4 , 3 , 2 , 1 ) ;
682
663
let c = 10 ;
683
- let r = dsp :: __usad8a ( :: mem:: transmute ( a) , :: mem:: transmute ( b) , c) ;
664
+ let r = super :: __usada8 ( :: mem:: transmute ( a) , :: mem:: transmute ( b) , c) ;
684
665
assert_eq ! ( r, 8 + c) ;
685
666
}
686
667
}
0 commit comments