1 1.1 christos # Hitachi H8 testcase 'divs', 'divu', 'divxs', 'divxu' 2 1.1 christos # mach(): all 3 1.1 christos # as(h8300): --defsym sim_cpu=0 4 1.1 christos # as(h8300h): --defsym sim_cpu=1 5 1.1 christos # as(h8300s): --defsym sim_cpu=2 6 1.1 christos # as(h8sx): --defsym sim_cpu=3 7 1.1 christos # ld(h8300h): -m h8300helf 8 1.1 christos # ld(h8300s): -m h8300self 9 1.1 christos # ld(h8sx): -m h8300sxelf 10 1.1 christos 11 1.1 christos .include "testutils.inc" 12 1.1 christos 13 1.1 christos start 14 1.1 christos 15 1.1 christos .if (sim_cpu == h8sx) 16 1.1 christos divs_w_reg_reg: 17 1.1 christos set_grs_a5a5 18 1.1 christos 19 1.1 christos ;; divs.w rs, rd 20 1.1 christos mov.w #32, r1 21 1.1 christos mov.w #-2, r2 22 1.1 christos set_ccr_zero 23 1.1 christos divs.w r2, r1 24 1.1 christos 25 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 26 1.1 christos test_neg_set 27 1.1 christos test_carry_clear 28 1.1 christos test_zero_clear 29 1.1 christos test_ovf_clear 30 1.1 christos 31 1.1 christos test_gr_a5a5 0 32 1.1 christos test_h_gr16 0xfff0 r1 33 1.1 christos test_h_gr32 0xa5a5fffe er2 34 1.1 christos test_gr_a5a5 3 35 1.1 christos test_gr_a5a5 4 36 1.1 christos test_gr_a5a5 5 37 1.1 christos test_gr_a5a5 6 38 1.1 christos test_gr_a5a5 7 39 1.1 christos 40 1.1 christos divs_w_imm4_reg: 41 1.1 christos set_grs_a5a5 42 1.1 christos 43 1.1 christos ;; divs.w xx:4, rd 44 1.1 christos mov.w #-32, r1 45 1.1 christos set_ccr_zero 46 1.1 christos divs.w #2:4, r1 47 1.1 christos 48 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 49 1.1 christos test_neg_set 50 1.1 christos test_carry_clear 51 1.1 christos test_zero_clear 52 1.1 christos test_ovf_clear 53 1.1 christos 54 1.1 christos test_gr_a5a5 0 55 1.1 christos test_h_gr16 -16 r1 56 1.1 christos test_gr_a5a5 2 57 1.1 christos test_gr_a5a5 3 58 1.1 christos test_gr_a5a5 4 59 1.1 christos test_gr_a5a5 5 60 1.1 christos test_gr_a5a5 6 61 1.1 christos test_gr_a5a5 7 62 1.1 christos 63 1.1 christos divs_l_reg_reg: 64 1.1 christos set_grs_a5a5 65 1.1 christos 66 1.1 christos ;; divs.l ers, erd 67 1.1 christos mov.l #320000, er1 68 1.1 christos mov.l #-2, er2 69 1.1 christos set_ccr_zero 70 1.1 christos divs.l er2, er1 71 1.1 christos 72 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 73 1.1 christos test_neg_set 74 1.1 christos test_carry_clear 75 1.1 christos test_zero_clear 76 1.1 christos test_ovf_clear 77 1.1 christos 78 1.1 christos test_gr_a5a5 0 79 1.1 christos test_h_gr32 -160000 er1 80 1.1 christos test_h_gr32 -2 er2 81 1.1 christos test_gr_a5a5 3 82 1.1 christos test_gr_a5a5 4 83 1.1 christos test_gr_a5a5 5 84 1.1 christos test_gr_a5a5 6 85 1.1 christos test_gr_a5a5 7 86 1.1 christos 87 1.1 christos divs_l_imm4_reg: 88 1.1 christos set_grs_a5a5 89 1.1 christos 90 1.1 christos ;; divs.l xx:4, rd 91 1.1 christos mov.l #-320000, er1 92 1.1 christos set_ccr_zero 93 1.1 christos divs.l #2:4, er1 94 1.1 christos 95 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 96 1.1 christos test_neg_set 97 1.1 christos test_carry_clear 98 1.1 christos test_zero_clear 99 1.1 christos test_ovf_clear 100 1.1 christos 101 1.1 christos test_gr_a5a5 0 102 1.1 christos test_h_gr32 -160000 er1 103 1.1 christos test_gr_a5a5 2 104 1.1 christos test_gr_a5a5 3 105 1.1 christos test_gr_a5a5 4 106 1.1 christos test_gr_a5a5 5 107 1.1 christos test_gr_a5a5 6 108 1.1 christos test_gr_a5a5 7 109 1.1 christos 110 1.1 christos divu_w_reg_reg: 111 1.1 christos set_grs_a5a5 112 1.1 christos 113 1.1 christos ;; divu.w rs, rd 114 1.1 christos mov.w #32, r1 115 1.1 christos mov.w #2, r2 116 1.1 christos set_ccr_zero 117 1.1 christos divu.w r2, r1 118 1.1 christos 119 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 120 1.1 christos test_cc_clear 121 1.1 christos 122 1.1 christos test_gr_a5a5 0 123 1.1 christos test_h_gr16 16 r1 124 1.1 christos test_h_gr32 0xa5a50002 er2 125 1.1 christos test_gr_a5a5 3 126 1.1 christos test_gr_a5a5 4 127 1.1 christos test_gr_a5a5 5 128 1.1 christos test_gr_a5a5 6 129 1.1 christos test_gr_a5a5 7 130 1.1 christos 131 1.1 christos divu_w_imm4_reg: 132 1.1 christos set_grs_a5a5 133 1.1 christos 134 1.1 christos ;; divu.w xx:4, rd 135 1.1 christos mov.w #32, r1 136 1.1 christos set_ccr_zero 137 1.1 christos divu.w #2:4, r1 138 1.1 christos 139 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 140 1.1 christos test_cc_clear 141 1.1 christos 142 1.1 christos test_gr_a5a5 0 143 1.1 christos test_h_gr16 16 r1 144 1.1 christos test_gr_a5a5 2 145 1.1 christos test_gr_a5a5 3 146 1.1 christos test_gr_a5a5 4 147 1.1 christos test_gr_a5a5 5 148 1.1 christos test_gr_a5a5 6 149 1.1 christos test_gr_a5a5 7 150 1.1 christos 151 1.1 christos divu_l_reg_reg: 152 1.1 christos set_grs_a5a5 153 1.1 christos 154 1.1 christos ;; divu.l ers, erd 155 1.1 christos mov.l #320000, er1 156 1.1 christos mov.l #2, er2 157 1.1 christos set_ccr_zero 158 1.1 christos divu.l er2, er1 159 1.1 christos 160 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 161 1.1 christos test_cc_clear 162 1.1 christos 163 1.1 christos test_gr_a5a5 0 164 1.1 christos test_h_gr32 160000 er1 165 1.1 christos test_h_gr32 2 er2 166 1.1 christos test_gr_a5a5 3 167 1.1 christos test_gr_a5a5 4 168 1.1 christos test_gr_a5a5 5 169 1.1 christos test_gr_a5a5 6 170 1.1 christos test_gr_a5a5 7 171 1.1 christos 172 1.1 christos divu_l_imm4_reg: 173 1.1 christos set_grs_a5a5 174 1.1 christos 175 1.1 christos ;; divu.l xx:4, rd 176 1.1 christos mov.l #320000, er1 177 1.1 christos set_ccr_zero 178 1.1 christos divu.l #2:4, er1 179 1.1 christos 180 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 181 1.1 christos test_cc_clear 182 1.1 christos 183 1.1 christos test_gr_a5a5 0 184 1.1 christos test_h_gr32 160000 er1 185 1.1 christos test_gr_a5a5 2 186 1.1 christos test_gr_a5a5 3 187 1.1 christos test_gr_a5a5 4 188 1.1 christos test_gr_a5a5 5 189 1.1 christos test_gr_a5a5 6 190 1.1 christos test_gr_a5a5 7 191 1.1 christos 192 1.1 christos .endif 193 1.1 christos 194 1.1 christos .if (sim_cpu) ; not equal to zero ie. not h8 195 1.1 christos divxs_b_reg_reg: 196 1.1 christos set_grs_a5a5 197 1.1 christos 198 1.1 christos ;; divxs.b rs, rd 199 1.1 christos mov.w #32, r1 200 1.1 christos mov.b #-2, r2l 201 1.1 christos set_ccr_zero 202 1.1 christos divxs.b r2l, r1 203 1.1 christos 204 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 205 1.1 christos test_neg_set 206 1.1 christos test_carry_clear 207 1.1 christos test_zero_clear 208 1.1 christos test_ovf_clear 209 1.1 christos 210 1.1 christos test_gr_a5a5 0 211 1.1 christos test_h_gr16 0x00f0 r1 212 1.1 christos test_h_gr32 0xa5a5a5fe er2 213 1.1 christos test_gr_a5a5 3 214 1.1 christos test_gr_a5a5 4 215 1.1 christos test_gr_a5a5 5 216 1.1 christos test_gr_a5a5 6 217 1.1 christos test_gr_a5a5 7 218 1.1 christos 219 1.1 christos .if (sim_cpu == h8sx) 220 1.1 christos divxs_b_imm4_reg: 221 1.1 christos set_grs_a5a5 222 1.1 christos 223 1.1 christos ;; divxs.b xx:4, rd 224 1.1 christos mov.w #-32, r1 225 1.1 christos set_ccr_zero 226 1.1 christos divxs.b #2:4, r1 227 1.1 christos 228 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 229 1.1 christos test_neg_set 230 1.1 christos test_carry_clear 231 1.1 christos test_zero_clear 232 1.1 christos test_ovf_clear 233 1.1 christos 234 1.1 christos test_gr_a5a5 0 235 1.1 christos test_h_gr16 0x00f0 r1 236 1.1 christos test_gr_a5a5 2 237 1.1 christos test_gr_a5a5 3 238 1.1 christos test_gr_a5a5 4 239 1.1 christos test_gr_a5a5 5 240 1.1 christos test_gr_a5a5 6 241 1.1 christos test_gr_a5a5 7 242 1.1 christos .endif ; h8sx 243 1.1 christos 244 1.1 christos divxs_w_reg_reg: 245 1.1 christos set_grs_a5a5 246 1.1 christos 247 1.1 christos ;; divxs.w ers, erd 248 1.1 christos mov.l #0x1000, er1 249 1.1 christos mov.w #-0x1000, r2 250 1.1 christos set_ccr_zero 251 1.1 christos divxs.w r2, er1 252 1.1 christos 253 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 254 1.1 christos test_neg_set 255 1.1 christos test_carry_clear 256 1.1 christos test_zero_clear 257 1.1 christos test_ovf_clear 258 1.1 christos 259 1.1 christos test_gr_a5a5 0 260 1.1 christos test_h_gr32 0x0000ffff er1 261 1.1 christos test_h_gr32 0xa5a5f000 er2 262 1.1 christos test_gr_a5a5 3 263 1.1 christos test_gr_a5a5 4 264 1.1 christos test_gr_a5a5 5 265 1.1 christos test_gr_a5a5 6 266 1.1 christos test_gr_a5a5 7 267 1.1 christos 268 1.1 christos .if (sim_cpu == h8sx) 269 1.1 christos divxs_w_imm4_reg: 270 1.1 christos set_grs_a5a5 271 1.1 christos 272 1.1 christos ;; divxs.w xx:4, rd 273 1.1 christos mov.l #-4, er1 274 1.1 christos set_ccr_zero 275 1.1 christos divxs.w #2:4, er1 276 1.1 christos 277 1.1 christos ;; test ccr ; H=0 N=1 Z=0 V=0 C=0 278 1.1 christos test_neg_set 279 1.1 christos test_carry_clear 280 1.1 christos test_zero_clear 281 1.1 christos test_ovf_clear 282 1.1 christos 283 1.1 christos test_gr_a5a5 0 284 1.1 christos test_h_gr32 0x0000fffe er1 285 1.1 christos test_gr_a5a5 2 286 1.1 christos test_gr_a5a5 3 287 1.1 christos test_gr_a5a5 4 288 1.1 christos test_gr_a5a5 5 289 1.1 christos test_gr_a5a5 6 290 1.1 christos test_gr_a5a5 7 291 1.1 christos .endif ; h8sx 292 1.1 christos .endif ; not h8 293 1.1 christos 294 1.1 christos divxu_b_reg_reg: 295 1.1 christos set_grs_a5a5 296 1.1 christos 297 1.1 christos ;; divxu.b rs, rd 298 1.1 christos mov.w #32, r1 299 1.1 christos mov.b #2, r2l 300 1.1 christos set_ccr_zero 301 1.1 christos divxu.b r2l, r1 302 1.1 christos 303 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 304 1.1 christos test_cc_clear 305 1.1 christos 306 1.1 christos test_gr_a5a5 0 307 1.1 christos test_h_gr16 0x0010 r1 308 1.1 christos test_h_gr16 0xa502 r2 309 1.1 christos .if (sim_cpu) 310 1.1 christos test_h_gr32 0xa5a5a502 er2 311 1.1 christos .endif 312 1.1 christos test_gr_a5a5 3 313 1.1 christos test_gr_a5a5 4 314 1.1 christos test_gr_a5a5 5 315 1.1 christos test_gr_a5a5 6 316 1.1 christos test_gr_a5a5 7 317 1.1 christos 318 1.1 christos .if (sim_cpu) ; not h8 319 1.1 christos .if (sim_cpu == h8sx) 320 1.1 christos divxu_b_imm4_reg: 321 1.1 christos set_grs_a5a5 322 1.1 christos 323 1.1 christos ;; divxu.b xx:4, rd 324 1.1 christos mov.w #32, r1 325 1.1 christos set_ccr_zero 326 1.1 christos divxu.b #2:4, r1 327 1.1 christos 328 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 329 1.1 christos test_cc_clear 330 1.1 christos 331 1.1 christos test_gr_a5a5 0 332 1.1 christos test_h_gr16 0x0010 r1 333 1.1 christos test_gr_a5a5 2 334 1.1 christos test_gr_a5a5 3 335 1.1 christos test_gr_a5a5 4 336 1.1 christos test_gr_a5a5 5 337 1.1 christos test_gr_a5a5 6 338 1.1 christos test_gr_a5a5 7 339 1.1 christos .endif ; h8sx 340 1.1 christos 341 1.1 christos divxu_w_reg_reg: 342 1.1 christos set_grs_a5a5 343 1.1 christos 344 1.1 christos ;; divxu.w ers, erd 345 1.1 christos mov.l #0x1000, er1 346 1.1 christos mov.w #0x1000, r2 347 1.1 christos set_ccr_zero 348 1.1 christos divxu.w r2, er1 349 1.1 christos 350 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 351 1.1 christos test_cc_clear 352 1.1 christos 353 1.1 christos test_gr_a5a5 0 354 1.1 christos test_h_gr32 0x00000001 er1 355 1.1 christos test_h_gr32 0xa5a51000 er2 356 1.1 christos test_gr_a5a5 3 357 1.1 christos test_gr_a5a5 4 358 1.1 christos test_gr_a5a5 5 359 1.1 christos test_gr_a5a5 6 360 1.1 christos test_gr_a5a5 7 361 1.1 christos 362 1.1 christos .if (sim_cpu == h8sx) 363 1.1 christos divxu_w_imm4_reg: 364 1.1 christos set_grs_a5a5 365 1.1 christos 366 1.1 christos ;; divxu.w xx:4, rd 367 1.1 christos mov.l #0xffff, er1 368 1.1 christos set_ccr_zero 369 1.1 christos divxu.w #2:4, er1 370 1.1 christos 371 1.1 christos ;; test ccr ; H=0 N=0 Z=0 V=0 C=0 372 1.1 christos test_cc_clear 373 1.1 christos 374 1.1 christos test_gr_a5a5 0 375 1.1 christos test_h_gr32 0x00017fff er1 376 1.1 christos test_gr_a5a5 2 377 1.1 christos test_gr_a5a5 3 378 1.1 christos test_gr_a5a5 4 379 1.1 christos test_gr_a5a5 5 380 1.1 christos test_gr_a5a5 6 381 1.1 christos test_gr_a5a5 7 382 1.1 christos .endif ; h8sx 383 1.1 christos .endif ; not h8 384 1.1 christos 385 1.1 christos pass 386 1.1 christos 387 1.1 christos exit 0 388