1// MAC test program. 2// Test basic edge values 3// UNSIGNED FRACTIONAL mode U 4// test ops: "+=" "-=" 5# mach: bfin 6 7.include "testutils.inc" 8 start 9 10 11// load r0=0x80007fff 12// load r1=0x80007fff 13// load r2=0xf0000000 14// load r3=0x0000007f 15// load r4=0x00000080 16// load r5=0xffffffff 17 loadsym P0, data0; 18 R0 = [ P0 ++ ]; 19 R1 = [ P0 ++ ]; 20 R2 = [ P0 ++ ]; 21 R3 = [ P0 ++ ]; 22 R4 = [ P0 ++ ]; 23 R5 = [ P0 ++ ]; 24 25 dbga(r0.h, 0x8000); 26 dbga(r0.l, 0x7fff); 27 dbga(r1.h, 0x8000); 28 dbga(r1.l, 0x7fff); 29 dbga(r2.h, 0xf000); 30 dbga(r2.l, 0); 31 32// 0x8000 * 0x7fff = 0x003fff8000 33 A1 = A0 = 0; 34 A1 += R0.H * R1.L, A0 += R0.H * R1.L (FU); 35 R6 = A1.w; 36 R7.L = A1.x; 37 DBGA ( R6.L , 0x8000 ); 38 DBGA ( R6.H , 0x3fff ); 39 DBGA ( R7.L , 0x0000 ); 40 R6 = A0.w; 41 R7.L = A0.x; 42 DBGA ( R6.L , 0x8000 ); 43 DBGA ( R6.H , 0x3fff ); 44 DBGA ( R7.L , 0x0000 ); 45 46// 0x8000 * 0x8000 = 0x0040000000 47 A1 = A0 = 0; 48 A1 += R0.H * R1.H, A0 += R0.H * R1.H (FU); 49 R6 = A1.w; 50 R7.L = A1.x; 51 DBGA ( R6.L , 0x0000 ); 52 DBGA ( R6.H , 0x4000 ); 53 DBGA ( R7.L , 0x0000 ); 54 R6 = A0.w; 55 R7.L = A0.x; 56 DBGA ( R6.L , 0x0000 ); 57 DBGA ( R6.H , 0x4000 ); 58 DBGA ( R7.L , 0x0000 ); 59 60// 0xffff * 0xffff = 0x00fffe0001 61 A1 = A0 = 0; 62 A1 += R5.H * R5.H, A0 += R5.H * R5.H (FU); 63 R6 = A1.w; 64 R7.L = A1.x; 65 DBGA ( R6.L , 0x0001 ); 66 DBGA ( R6.H , 0xfffe ); 67 DBGA ( R7.L , 0x0000 ); 68 R6 = A0.w; 69 R7.L = A0.x; 70 DBGA ( R6.L , 0x0001 ); 71 DBGA ( R6.H , 0xfffe ); 72 DBGA ( R7.L , 0x0000 ); 73 74// saturate high by first loading large value into accums 75// expected value is 0xffffffffff 76 A1 = A0 = 0; 77 A1.w = R5; 78 A1.x = R5.L; 79 A0.w = R5; 80 A0.x = R5.L; 81 A1 += R5.H * R5.H, A0 += R5.H * R5.H (FU); 82 R6 = A1.w; 83 R7.L = A1.x; 84 DBGA ( R6.L , 0xffff ); 85 DBGA ( R6.H , 0xffff ); 86 DBGA ( R7.L , 0xffff ); 87 R6 = A0.w; 88 R7.L = A0.x; 89 DBGA ( R6.L , 0xffff ); 90 DBGA ( R6.H , 0xffff ); 91 DBGA ( R7.L , 0xffff ); 92 93// saturate low with "-=" 94// expected value is 0x0000000000 95 A1 = A0 = 0; 96 A1 -= R4.L * R4.L, A0 -= R4.L * R4.L (FU); 97 R6 = A1.w; 98 R7.L = A1.x; 99 DBGA ( R6.L , 0x0000 ); 100 DBGA ( R6.H , 0x0000 ); 101 DBGA ( R7.L , 0x0000 ); 102 R6 = A0.w; 103 R7.L = A0.x; 104 DBGA ( R6.L , 0x0000 ); 105 DBGA ( R6.H , 0x0000 ); 106 DBGA ( R7.L , 0x0000 ); 107 108// saturate low with "-=" 109// expected value is 0x0000000000 110 A1 = A0 = 0; 111 A1 -= R1.H * R0.H, A0 -= R1.H * R0.H (FU); 112 R6 = A1.w; 113 R7.L = A1.x; 114 DBGA ( R6.L , 0x0000 ); 115 DBGA ( R6.H , 0x0000 ); 116 DBGA ( R7.L , 0x0000 ); 117 R6 = A0.w; 118 R7.L = A0.x; 119 DBGA ( R6.L , 0x0000 ); 120 DBGA ( R6.H , 0x0000 ); 121 DBGA ( R7.L , 0x0000 ); 122 123 pass 124 125 .data 126data0: 127 .dw 0x7fff 128 .dw 0x8000 129 .dw 0x7fff 130 .dw 0x8000 131 .dw 0x0000 132 .dw 0xf000 133 .dw 0x007f 134 .dw 0x0000 135 .dw 0x0080 136 .dw 0x0000 137 .dw 0xffff 138 .dw 0xffff 139