Home | History | Annotate | Line # | Download | only in bfin
      1 //  Test result extraction of mac instructions.
      2 //  Test basic edge values
      3 //  UNSIGNED FRACTIONAL mode into SINGLE destination register
      4 //  test ops: "+="
      5 # mach: bfin
      6 
      7 .include "testutils.inc"
      8 	start
      9 
     10 
     11 // load r0=0x80000001
     12 // load r1=0x80007fff
     13 // load r2=0xf000ffff
     14 // load r3=0x0000007f
     15 // load r4=0x00000080
     16 	loadsym P0, data0;
     17 	R0 = [ P0 ++ ];
     18 	R1 = [ P0 ++ ];
     19 	R2 = [ P0 ++ ];
     20 	R3 = [ P0 ++ ];
     21 	R4 = [ P0 ++ ];
     22 
     23 // extraction with no saturation (truncate)
     24 // 0x8000 * 0x7fff = 0x003fff8000 -> 0x3fff
     25 	A1 = A0 = 0;
     26 	R5.H = (A1 += R0.H * R1.L), R5.L = (A0 += R0.H * R1.L) (TFU);
     27 	DBGA ( R5.L , 0x3fff );
     28 	DBGA ( R5.H , 0x3fff );
     29 
     30 // extraction with no saturation (round)
     31 // 0x8000 * 0x7fff = 0x003fff8000 -> 0x4000
     32 	A1 = A0 = 0;
     33 	R5.H = (A1 += R0.H * R1.L), R5.L = (A0 += R0.H * R1.L) (FU);
     34 	DBGA ( R5.L , 0x4000 );
     35 	DBGA ( R5.H , 0x4000 );
     36 
     37 // extraction with no saturation
     38 // 0xffff * 0xffff = 0x00fffe0001 -> 0xfffe
     39 	A1 = A0 = 0;
     40 	R5.H = (A1 += R2.L * R2.L), R5.L = (A0 += R2.L * R2.L) (FU);
     41 	DBGA ( R5.L , 0xfffe );
     42 	DBGA ( R5.H , 0xfffe );
     43 
     44 // extraction with saturation
     45 //0x7ffffe0001 -> 0xffff
     46 	A1 = A0 = 0;
     47 	A1.x = R3.L;
     48 	A0.x = R3.L;
     49 	R5.H = (A1 += R2.L * R2.L), R5.L = (A0 += R2.L * R2.L) (FU);
     50 	DBGA ( R5.L , 0xffff );
     51 	DBGA ( R5.H , 0xffff );
     52 
     53 	pass
     54 
     55 	.data
     56 data0:
     57 	.dw 0x0001
     58 	.dw 0x8000
     59 	.dw 0x7fff
     60 	.dw 0x8000
     61 	.dw 0xffff
     62 	.dw 0xf000
     63 	.dw 0x007f
     64 	.dw 0x0000
     65 	.dw 0x0080
     66 	.dw 0x0000
     67