@@ -374,6 +374,58 @@ static int fp_check_data(struct hwtest_ctx *ctx, uint32_t op1, uint32_t op2, con
374
374
}
375
375
exp = g80_add (true, 0 , false, s1 , s3 , 0 , 0 );
376
376
break ;
377
+ case 0x60 : /* imad u16 */
378
+ exp = g80_mul16 (s1 , s2 , false, false);
379
+ exp = g80_add (true, op2 >> 26 & 3 , false, exp , s3 , scc , & ecc );
380
+ break ;
381
+ case 0x61 : /* imad s16 */
382
+ exp = g80_mul16 (s1 , s2 , true, true);
383
+ exp = g80_add (true, op2 >> 26 & 3 , false, exp , s3 , scc , & ecc );
384
+ break ;
385
+ case 0x62 : /* imad sat s16 */
386
+ exp = g80_mul16 (s1 , s2 , true, true);
387
+ exp = g80_add (true, op2 >> 26 & 3 , true, exp , s3 , scc , & ecc );
388
+ break ;
389
+ case 0x63 : /* imad u24 */
390
+ case 0x71 : /* imad */
391
+ case 0x72 : /* imad */
392
+ case 0x73 : /* imad */
393
+ case 0x74 : /* imad */
394
+ case 0x75 : /* imad */
395
+ case 0x76 : /* imad */
396
+ case 0x77 : /* imad */
397
+ exp = g80_mul24 (s1 , s2 , false, false);
398
+ exp = g80_add (true, op2 >> 26 & 3 , false, exp , s3 , scc , & ecc );
399
+ break ;
400
+ case 0x64 : /* imad s24 */
401
+ exp = g80_mul24 (s1 , s2 , true, false);
402
+ exp = g80_add (true, op2 >> 26 & 3 , false, exp , s3 , scc , & ecc );
403
+ break ;
404
+ case 0x65 : /* imad sat s24 */
405
+ exp = g80_mul24 (s1 , s2 , true, false);
406
+ exp = g80_add (true, op2 >> 26 & 3 , true, exp , s3 , scc , & ecc );
407
+ break ;
408
+ case 0x66 : /* imad high u24 */
409
+ exp = g80_mul24 (s1 , s2 , false, true);
410
+ exp = g80_add (true, op2 >> 26 & 3 , false, exp , s3 , scc , & ecc );
411
+ break ;
412
+ case 0x67 : /* imad high s24 */
413
+ exp = g80_mul24 (s1 , s2 , true, true);
414
+ exp = g80_add (true, op2 >> 26 & 3 , false, exp , s3 , scc , & ecc );
415
+ break ;
416
+ case 0x70 : /* imad sat high s24 */
417
+ exp = g80_mul24 (s1 , s2 , true, true);
418
+ exp = g80_add (true, op2 >> 26 & 3 , true, exp , s3 , scc , & ecc );
419
+ break ;
420
+ case 0x68 :
421
+ case 0x78 :
422
+ sop = (op1 >> 14 & 2 ) | (op1 >> 8 & 1 );
423
+ if (sop == 3 )
424
+ exp = g80_mul24 (s1 , s2 , false, false);
425
+ else
426
+ exp = g80_mul16 (s1 , s2 , sop > 0 , sop > 0 );
427
+ exp = g80_add (true, (op1 >> 22 & 1 ) | (op1 >> 27 & 2 ), sop == 2 , exp , s3 , scc , 0 );
428
+ break ;
377
429
case 0xd0 : /* logop */
378
430
if (op2 >> 16 & 1 )
379
431
s1 = ~s1 ;
@@ -618,6 +670,32 @@ static int test_isad(struct hwtest_ctx *ctx) {
618
670
return HWTEST_RES_PASS ;
619
671
}
620
672
673
+ static int test_imad (struct hwtest_ctx * ctx ) {
674
+ int i ;
675
+ for (i = 0 ; i < 100000 ; i ++ ) {
676
+ uint32_t op1 = 0x6000001d | (jrand48 (ctx -> rand48 ) & 0x1e000000 );
677
+ uint32_t op2 = 0x000187d0 | (jrand48 (ctx -> rand48 ) & 0xffc00004 );
678
+ uint32_t xtra = jrand48 (ctx -> rand48 );
679
+ if (op2 >= 0x60000000 || op1 >> 28 & 1 ) {
680
+ /* 32-bit */
681
+ op1 |= 0x50800 ;
682
+ } else {
683
+ /* 16-bit */
684
+ op1 |= 0xa1000 ;
685
+ }
686
+ if (fp_prep_grid (ctx , xtra ))
687
+ return HWTEST_RES_FAIL ;
688
+ if (fp_prep_code (ctx , op1 , op2 ))
689
+ return HWTEST_RES_FAIL ;
690
+ uint32_t src1 [0x200 ], src2 [0x200 ], src3 [0x200 ];
691
+ uint8_t cc [0x200 ];
692
+ fp_gen (ctx , src1 , src2 , src3 , cc );
693
+ if (fp_test (ctx , op1 , op2 , src1 , src2 , src3 , cc , xtra ))
694
+ return HWTEST_RES_FAIL ;
695
+ }
696
+ return HWTEST_RES_PASS ;
697
+ }
698
+
621
699
static int test_logop (struct hwtest_ctx * ctx ) {
622
700
int i ;
623
701
for (i = 0 ; i < 100000 ; i ++ ) {
@@ -722,6 +800,32 @@ static int test_isad_s(struct hwtest_ctx *ctx) {
722
800
return HWTEST_RES_PASS ;
723
801
}
724
802
803
+ static int test_imad_s (struct hwtest_ctx * ctx ) {
804
+ int i ;
805
+ for (i = 0 ; i < 100000 ; i ++ ) {
806
+ uint32_t op1 = 0x60000018 | (jrand48 (ctx -> rand48 ) & 0x1e408100 );
807
+ uint32_t op2 = 0x10000000 ;
808
+ uint32_t xtra = jrand48 (ctx -> rand48 );
809
+ if (op1 >> 15 & 1 && op1 >> 8 & 1 ) {
810
+ /* 32-bit */
811
+ op1 |= 0x50800 ;
812
+ } else {
813
+ /* 16-bit */
814
+ op1 |= 0xa1000 ;
815
+ }
816
+ if (fp_prep_grid (ctx , xtra ))
817
+ return HWTEST_RES_FAIL ;
818
+ if (fp_prep_code (ctx , op1 , op2 ))
819
+ return HWTEST_RES_FAIL ;
820
+ uint32_t src1 [0x200 ], src2 [0x200 ], src3 [0x200 ];
821
+ uint8_t cc [0x200 ];
822
+ fp_gen (ctx , src1 , src2 , src3 , cc );
823
+ if (fp_test (ctx , op1 , op2 , src1 , src2 , src3 , cc , xtra ))
824
+ return HWTEST_RES_FAIL ;
825
+ }
826
+ return HWTEST_RES_PASS ;
827
+ }
828
+
725
829
static int test_iadd_i (struct hwtest_ctx * ctx ) {
726
830
int i ;
727
831
for (i = 0 ; i < 100000 ; i ++ ) {
@@ -774,6 +878,32 @@ static int test_imul_i(struct hwtest_ctx *ctx) {
774
878
return HWTEST_RES_PASS ;
775
879
}
776
880
881
+ static int test_imad_i (struct hwtest_ctx * ctx ) {
882
+ int i ;
883
+ for (i = 0 ; i < 100000 ; i ++ ) {
884
+ uint32_t op1 = 0x60000019 | (jrand48 (ctx -> rand48 ) & 0x1e7f8100 );
885
+ uint32_t op2 = 0x00000003 | (jrand48 (ctx -> rand48 ) & 0x1ffffffc );
886
+ uint32_t xtra = jrand48 (ctx -> rand48 );
887
+ if (op1 >> 15 & 1 && op1 >> 8 & 1 ) {
888
+ /* 32-bit */
889
+ op1 |= 0x0800 ;
890
+ } else {
891
+ /* 16-bit */
892
+ op1 |= 0x1000 ;
893
+ }
894
+ if (fp_prep_grid (ctx , xtra ))
895
+ return HWTEST_RES_FAIL ;
896
+ if (fp_prep_code (ctx , op1 , op2 ))
897
+ return HWTEST_RES_FAIL ;
898
+ uint32_t src1 [0x200 ], src2 [0x200 ], src3 [0x200 ];
899
+ uint8_t cc [0x200 ];
900
+ fp_gen (ctx , src1 , src2 , src3 , cc );
901
+ if (fp_test (ctx , op1 , op2 , src1 , src2 , src3 , cc , xtra ))
902
+ return HWTEST_RES_FAIL ;
903
+ }
904
+ return HWTEST_RES_PASS ;
905
+ }
906
+
777
907
static int test_logop_i (struct hwtest_ctx * ctx ) {
778
908
int i ;
779
909
for (i = 0 ; i < 100000 ; i ++ ) {
@@ -802,11 +932,14 @@ HWTEST_DEF_GROUP(g80_int,
802
932
HWTEST_TEST (test_shift , 0 ),
803
933
HWTEST_TEST (test_imul , 0 ),
804
934
HWTEST_TEST (test_isad , 0 ),
935
+ HWTEST_TEST (test_imad , 0 ),
805
936
HWTEST_TEST (test_logop , 0 ),
806
937
HWTEST_TEST (test_iadd_s , 0 ),
807
938
HWTEST_TEST (test_imul_s , 0 ),
808
939
HWTEST_TEST (test_isad_s , 0 ),
940
+ HWTEST_TEST (test_imad_s , 0 ),
809
941
HWTEST_TEST (test_iadd_i , 0 ),
810
942
HWTEST_TEST (test_imul_i , 0 ),
943
+ HWTEST_TEST (test_imad_i , 0 ),
811
944
HWTEST_TEST (test_logop_i , 0 ),
812
945
)
0 commit comments