* Contribute Hitachi SH5 simulator.
[deliverable/binutils-gdb.git] / sim / testsuite / sim / sh64 / compact / cmpstr.cgs
1 # sh testcase for cmp/str $rm, $rn -*- Asm -*-
2 # mach: all
3 # as: -isa=shcompact
4 # ld: -m shelf32
5
6 .include "compact/testutils.inc"
7
8 .macro rot8
9 rotr r0
10 rotr r0
11 rotr r0
12 rotr r0
13 rotr r0
14 rotr r0
15 rotr r0
16 rotr r0
17 .endm
18
19 start
20
21 # Use multiple "wrong" labels because this program is quite long. It's
22 # likely that some instructions will be too far away from the branch
23 # target to use PC-relative branches.
24
25 match0:
26 # No bytes matching.
27 mov #1, r0
28 neg r0, r0
29 xor #170, r0
30 rot8
31 xor #170, r0
32 rot8
33 xor #170, r0
34 rot8
35 xor #170, r0
36 rot8
37 mov r0, r1
38 mov #1, r0
39 neg r0, r0
40 xor #85, r0
41 rot8
42 xor #85, r0
43 rot8
44 xor #85, r0
45 rot8
46 xor #85, r0
47 rot8
48 cmp/str r0, r1
49 bt wrong0
50
51 bra match1
52 nop
53 wrong0:
54 fail
55
56 match1:
57 # One byte matching.
58 mov #1, r0
59 neg r0, r0
60 xor #170, r0
61 rot8
62 xor #170, r0
63 rot8
64 xor #170, r0
65 rot8
66 mov r0, r1
67 mov #1, r0
68 neg r0, r0
69 xor #85, r0
70 rot8
71 xor #85, r0
72 rot8
73 xor #85, r0
74 rot8
75 cmp/str r0, r1
76 bf wrong1
77
78 bra match2
79 nop
80 wrong1:
81 fail
82
83 match2:
84 # Two bytes matching.
85 mov #1, r0
86 neg r0, r0
87 xor #170, r0
88 rot8
89 xor #170, r0
90 rot8
91 mov r0, r1
92 mov #1, r0
93 neg r0, r0
94 xor #85, r0
95 rot8
96 xor #85, r0
97 rot8
98 cmp/str r0, r1
99 bf wrong2
100
101 bra match3
102 nop
103 wrong2:
104 fail
105
106 byte0:
107 match3:
108 # One byte matching.
109 # This is also the test for byte 0.
110 mov #85, r0
111 mov #85, r1
112 cmp/str r0, r1
113 bf wrong3
114
115 byte1:
116 # Match in byte position 1.
117 mov #85, r0
118 shll8 r0
119 mov #85, r1
120 shll8 r1
121 cmp/str r0, r1
122 bf wrong3
123
124 byte2:
125 # Match in byte position 2.
126 mov #85, r0
127 shll16 r0
128 mov #85, r1
129 shll16 r1
130 cmp/str r0, r1
131 bf wrong3
132
133 byte3:
134 # Match in byte position 3.
135 mov #85, r0
136 shll16 r0
137 shll8 r0
138 mov #85, r1
139 shll16 r1
140 shll8 r1
141 cmp/str r0, r1
142 bf wrong3
143
144 okay:
145 pass
146 wrong3:
147 fail
148
This page took 0.034212 seconds and 4 git commands to generate.