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