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
|
# v850 sar
# mach: all
.include "testutils.inc"
# CY is set to 1 if the bit shifted out last is 1, else 0
# OV is set to zero.
# Z is set if the result is 0, else 0
noflags
seti 4, r1
seti 0x00000000, r2
sar r1, r2
flags z
reg r2, 0
noflags
seti 4, r1
seti 0x00000001, r2
sar r1, r2
flags z
reg r2, 0
noflags
seti 4, r1
seti 0x00000008, r2
sar r1, r2
flags c + z
reg r2, 0
noflags
seti 0x00000000, r2
sar 4, r2
flags z
reg r2, 0
noflags
seti 0x00000001, r2
sar 4, r2
flags z
reg r2, 0
noflags
seti 0x00000008, r2
sar 4, r2
flags c + z
reg r2, 0
# However, if the number of shifts is 0, CY is 0.
noflags
seti 0, r1
seti 0xffffffff, r2
sar r1, r2
flags s
reg r2, 0xffffffff
noflags
seti 0xffffffff, r2
sar 0, r2
flags s
reg r2, 0xffffffff
# Old MSB is copied as new MSB after shift
# S is 1 if the result is negative, else 0
noflags
seti 1, r1
seti 0x80000000, r2
sar r1, r2
flags s
reg r2, 0xc0000000
noflags
seti 1, r1
seti 0x40000000, r2
sar r1, r2
flags 0
reg r2, 0x20000000
pass
|