1 1.1 christos // Test extraction from accumulators: 2 1.1 christos // ROUND/TRUNCATE in SIGNED FRACTIONAL mode 3 1.1 christos // test ops: "+=" 4 1.1 christos # mach: bfin 5 1.1 christos 6 1.1 christos .include "testutils.inc" 7 1.1 christos start 8 1.1 christos 9 1.1 christos 10 1.1 christos // load r0=0x7ffef000 11 1.1 christos // load r1=0x7ffff000 12 1.1 christos // load r2=0x00008000 13 1.1 christos // load r3=0x00018000 14 1.1 christos // load r4=0x0000007f 15 1.1 christos loadsym P0, data0; 16 1.1 christos R0 = [ P0 ++ ]; 17 1.1 christos R1 = [ P0 ++ ]; 18 1.1 christos R2 = [ P0 ++ ]; 19 1.1 christos R3 = [ P0 ++ ]; 20 1.1 christos R4 = [ P0 ++ ]; 21 1.1 christos 22 1.1 christos // round 23 1.1 christos // 0x007ffef00 -> 0x7fff 24 1.1 christos A1 = A0 = 0; 25 1.1 christos A1.w = R0; 26 1.1 christos A0.w = R0; 27 1.1 christos R5.H = A1, R5.L = A0; 28 1.1 christos DBGA ( R5.L , 0x7fff ); 29 1.1 christos DBGA ( R5.H , 0x7fff ); 30 1.1 christos 31 1.1 christos // round with ovflw 32 1.1 christos // 0x007ffff00 -> 0x7fff 33 1.1 christos A1 = A0 = 0; 34 1.1 christos A1.w = R1; 35 1.1 christos A0.w = R1; 36 1.1 christos R5.H = A1, R5.L = A0; 37 1.1 christos DBGA ( R5.L , 0x7fff ); 38 1.1 christos DBGA ( R5.H , 0x7fff ); 39 1.1 christos 40 1.1 christos // trunc 41 1.1 christos // 0x007ffef00 -> 0x7ffe 42 1.1 christos A1 = A0 = 0; 43 1.1 christos A1.w = R0; 44 1.1 christos A0.w = R0; 45 1.1 christos R5.H = A1, R5.L = A0 (T); 46 1.1 christos DBGA ( R5.L , 0x7ffe ); 47 1.1 christos DBGA ( R5.H , 0x7ffe ); 48 1.1 christos 49 1.1 christos // round with ovflw 50 1.1 christos // 0x7f7ffff00 -> 0x7fff 51 1.1 christos A1 = A0 = 0; 52 1.1 christos A1.w = R1; 53 1.1 christos A1.x = R4.L; 54 1.1 christos A0.w = R1; 55 1.1 christos A0.x = R4.L; 56 1.1 christos R5.H = A1, R5.L = A0; 57 1.1 christos DBGA ( R5.L , 0x7fff ); 58 1.1 christos DBGA ( R5.H , 0x7fff ); 59 1.1 christos 60 1.1 christos // round, nearest even is zero 61 1.1 christos // 0x0000008000 -> 0x0000 62 1.1 christos A1 = A0 = 0; 63 1.1 christos A1.w = R2; 64 1.1 christos A0.w = R2; 65 1.1 christos R5.H = A1, R5.L = A0; 66 1.1 christos DBGA ( R5.L , 0x0 ); 67 1.1 christos DBGA ( R5.H , 0x0 ); 68 1.1 christos 69 1.1 christos // round, nearest even is 2 70 1.1 christos // 0x00000018000 -> 0x0002 71 1.1 christos A1 = A0 = 0; 72 1.1 christos A1.w = R3; 73 1.1 christos A0.w = R3; 74 1.1 christos R5.H = A1, R5.L = A0; 75 1.1 christos DBGA ( R5.L , 0x2 ); 76 1.1 christos DBGA ( R5.H , 0x2 ); 77 1.1 christos 78 1.1 christos pass 79 1.1 christos 80 1.1 christos .data 81 1.1 christos data0: 82 1.1 christos .dw 0xf000 83 1.1 christos .dw 0x7ffe 84 1.1 christos .dw 0xf000 85 1.1 christos .dw 0x7ffe 86 1.1 christos .dw 0x8000 87 1.1 christos .dw 0x0000 88 1.1 christos .dw 0x8000 89 1.1 christos .dw 0x0001 90 1.1 christos .dw 0x007f 91 1.1 christos .dw 0x0000 92