1// Test r4 = ROT (r2 by r3); 2# mach: bfin 3 4.include "testutils.inc" 5 start 6 7 8 R0.L = 0x0001; 9 R0.H = 0x8000; 10 11// rot 12// left by 1 13// 8000 0001 -> 0000 0002 cc=1 14 R7 = 0; 15 CC = R7; 16 R1 = 1; 17 R6 = ROT R0 BY R1.L; 18 DBGA ( R6.L , 0x0002 ); 19 DBGA ( R6.H , 0x0000 ); 20 R7 = CC; 21 DBGA ( R7.L , 0x0001 ); 22 23// rot 24// right by -1 25// 8000 0001 -> 4000 0000 cc=1 26 R7 = 0; 27 CC = R7; 28 R1.L = 0xffff; // check alternate mechanism for immediates 29 R1.H = 0xffff; 30 R6 = ROT R0 BY R1.L; 31 DBGA ( R6.L , 0x0000 ); 32 DBGA ( R6.H , 0x4000 ); 33 R7 = CC; 34 DBGA ( R7.L , 0x0001 ); 35 36// rot 37// right by largest positive magnitude of 31 38// 8000 0001 -> a000 0000 cc=0 39 R7 = 0; 40 CC = R7; 41 R1 = 31; 42 R6 = ROT R0 BY R1.L; 43 DBGA ( R6.L , 0x0000 ); 44 DBGA ( R6.H , 0xa000 ); 45 R7 = CC; 46 DBGA ( R7.L , 0x0000 ); 47 48// rot 49// right by largest positive magnitude of 31 with cc=1 50// 8000 0001 cc=1 -> a000 0000 cc=0 51 R7 = 1; 52 CC = R7; 53 R1 = 31; 54 R6 = ROT R0 BY R1.L; 55 DBGA ( R6.L , 0x0000 ); 56 DBGA ( R6.H , 0xe000 ); 57 R7 = CC; 58 DBGA ( R7.L , 0x0000 ); 59 60// rot 61// right by largest negative magnitude of -31 62// 8000 0001 -> 0000 0005 cc=0 63 R7 = 0; 64 CC = R7; 65 R1 = -31; 66 R6 = ROT R0 BY R1.L; 67 DBGA ( R6.L , 0x0005 ); 68 DBGA ( R6.H , 0x0000 ); 69 R7 = CC; 70 DBGA ( R7.L , 0x0000 ); 71 72// rot 73// right by largest negative magnitude of -31 with cc=1 74// 8000 0001 cc=1 -> 0000 0007 cc=0 75 R7 = 1; 76 CC = R7; 77 R1 = -31; 78 R6 = ROT R0 BY R1.L; 79 DBGA ( R6.L , 0x0007 ); 80 DBGA ( R6.H , 0x0000 ); 81 R7 = CC; 82 DBGA ( R7.L , 0x0000 ); 83 84// rot 85// left by 7 86// 8000 0001 cc=1 -> 0000 00e0 cc=0 87 R7 = 1; 88 CC = R7; 89 R1 = 7; 90 R6 = ROT R0 BY R1.L; 91 DBGA ( R6.L , 0x00e0 ); 92 DBGA ( R6.H , 0x0000 ); 93 R7 = CC; 94 DBGA ( R7.L , 0x0000 ); 95 96// rot by zero 97// 8000 0001 -> 8000 0000 98 R7 = 1; 99 CC = R7; 100 R1 = 0; 101 R6 = ROT R0 BY R1.L; 102 DBGA ( R6.L , 0x0001 ); 103 DBGA ( R6.H , 0x8000 ); 104 R7 = CC; 105 DBGA ( R7.L , 0x0001 ); 106 107// rot by 0b1100 0001 is the same as by 1 (mask 6 bits) 108// 8000 0001 -> 0000 0002 cc=1 109 R7 = 0; 110 CC = R7; 111 R1 = 0xc1 (X); 112 R6 = ROT R0 BY R1.L; 113 DBGA ( R6.L , 0x0002 ); 114 DBGA ( R6.H , 0x0000 ); 115 R7 = CC; 116 DBGA ( R7.L , 0x0001 ); 117 118 pass 119