1 1.1 christos # Hitachi H8 testcase 'biand', 'bior', 'bixor', 'bild', 'bist', 'bistz' 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 .data 14 1.1 christos byte_src: .byte 0xa5 15 1.1 christos byte_dst: .byte 0 16 1.1 christos 17 1.1 christos start 18 1.1 christos 19 1.1 christos biand_imm3_reg8: 20 1.1 christos set_grs_a5a5 21 1.1 christos set_ccr_zero 22 1.1 christos ;; biand xx:3, reg8 23 1.1 christos biand #6, r0l ; this should NOT set the carry flag. 24 1.1 christos test_cc_clear 25 1.1 christos biand #7, r0l ; this should NOT set the carry flag. 26 1.1 christos test_cc_clear 27 1.1 christos 28 1.1 christos orc #1, ccr ; set the carry flag 29 1.1 christos biand #6, r0l ; this should NOT clear the carry flag 30 1.1 christos test_carry_set 31 1.1 christos test_ovf_clear 32 1.1 christos test_neg_clear 33 1.1 christos test_zero_clear 34 1.1 christos biand #7, r0l ; this should clear the carry flag 35 1.1 christos test_cc_clear 36 1.1 christos 37 1.1 christos test_grs_a5a5 ; general registers should not be changed. 38 1.1 christos 39 1.1 christos biand_imm3_ind: 40 1.1 christos set_grs_a5a5 41 1.1 christos .if (sim_cpu == h8300) 42 1.1 christos mov #byte_src, r1 43 1.1 christos set_ccr_zero 44 1.1 christos ;; biand xx:3, ind 45 1.1 christos biand #6, @r1 ; this should NOT set the carry flag. 46 1.1 christos test_cc_clear 47 1.1 christos biand #7, @r1 ; this should NOT set the carry flag. 48 1.1 christos test_cc_clear 49 1.1 christos 50 1.1 christos orc #1, ccr ; set the carry flag 51 1.1 christos biand #6, @r1 ; this should NOT clear the carry flag 52 1.1 christos test_carry_set 53 1.1 christos test_ovf_clear 54 1.1 christos test_neg_clear 55 1.1 christos test_zero_clear 56 1.1 christos biand #7, @r1 ; this should clear the carry flag 57 1.1 christos test_cc_clear 58 1.1 christos ;;; test_h_gr16 byte_src r1 ;FIXME 59 1.1 christos .else 60 1.1 christos mov #byte_src, er1 61 1.1 christos set_ccr_zero 62 1.1 christos ;; biand xx:3, ind 63 1.1 christos biand #6, @er1 ; this should NOT set the carry flag. 64 1.1 christos test_cc_clear 65 1.1 christos biand #7, @er1 ; this should NOT set the carry flag. 66 1.1 christos test_cc_clear 67 1.1 christos 68 1.1 christos orc #1, ccr ; set the carry flag 69 1.1 christos biand #6, @er1 ; this should NOT clear the carry flag 70 1.1 christos test_carry_set 71 1.1 christos test_ovf_clear 72 1.1 christos test_neg_clear 73 1.1 christos test_zero_clear 74 1.1 christos biand #7, @er1 ; this should clear the carry flag 75 1.1 christos test_cc_clear 76 1.1 christos test_h_gr32 byte_src er1 77 1.1 christos .endif ; h8300 78 1.1 christos test_gr_a5a5 0 ; general registers should not be changed. 79 1.1 christos test_gr_a5a5 2 80 1.1 christos test_gr_a5a5 3 81 1.1 christos test_gr_a5a5 4 82 1.1 christos test_gr_a5a5 5 83 1.1 christos test_gr_a5a5 6 84 1.1 christos test_gr_a5a5 7 85 1.1 christos 86 1.1 christos biand_imm3_abs8: 87 1.1 christos set_grs_a5a5 88 1.1 christos mov.b r1l, @0x20 89 1.1 christos set_ccr_zero 90 1.1 christos ;; biand xx:3, aa:8 91 1.1 christos biand #6, @0x20:8 ; this should NOT set the carry flag. 92 1.1 christos test_cc_clear 93 1.1 christos biand #7, @0x20:8 ; this should NOT set the carry flag. 94 1.1 christos test_cc_clear 95 1.1 christos 96 1.1 christos orc #1, ccr ; set the carry flag 97 1.1 christos biand #6, @0x20:8 ; this should NOT clear the carry flag 98 1.1 christos test_carry_set 99 1.1 christos test_ovf_clear 100 1.1 christos test_neg_clear 101 1.1 christos test_zero_clear 102 1.1 christos biand #7, @0x20:8 ; this should clear the carry flag 103 1.1 christos test_cc_clear 104 1.1 christos 105 1.1 christos test_grs_a5a5 ; general registers should not be changed. 106 1.1 christos 107 1.1 christos .if (sim_cpu > h8300h) 108 1.1 christos biand_imm3_abs16: 109 1.1 christos set_grs_a5a5 110 1.1 christos set_ccr_zero 111 1.1 christos ;; biand xx:3, aa:16 112 1.1 christos biand #6, @byte_src:16 ; this should NOT set the carry flag. 113 1.1 christos test_cc_clear 114 1.1 christos biand #7, @byte_src:16 ; this should NOT set the carry flag. 115 1.1 christos test_cc_clear 116 1.1 christos 117 1.1 christos orc #1, ccr ; set the carry flag 118 1.1 christos biand #6, @byte_src:16 ; this should NOT clear the carry flag 119 1.1 christos test_carry_set 120 1.1 christos test_ovf_clear 121 1.1 christos test_neg_clear 122 1.1 christos test_zero_clear 123 1.1 christos biand #7, @byte_src:16 ; this should clear the carry flag 124 1.1 christos test_cc_clear 125 1.1 christos 126 1.1 christos test_grs_a5a5 ; general registers should not be changed. 127 1.1 christos 128 1.1 christos biand_imm3_abs32: 129 1.1 christos set_grs_a5a5 130 1.1 christos set_ccr_zero 131 1.1 christos ;; biand xx:3, aa:32 132 1.1 christos biand #6, @byte_src:32 ; this should NOT set the carry flag. 133 1.1 christos test_cc_clear 134 1.1 christos biand #7, @byte_src:32 ; this should NOT set the carry flag. 135 1.1 christos test_cc_clear 136 1.1 christos 137 1.1 christos orc #1, ccr ; set the carry flag 138 1.1 christos biand #6, @byte_src:32 ; this should NOT clear the carry flag 139 1.1 christos test_carry_set 140 1.1 christos test_ovf_clear 141 1.1 christos test_neg_clear 142 1.1 christos test_zero_clear 143 1.1 christos biand #7, @byte_src:32 ; this should clear the carry flag 144 1.1 christos test_cc_clear 145 1.1 christos 146 1.1 christos test_grs_a5a5 ; general registers should not be changed. 147 1.1 christos .endif 148 1.1 christos 149 1.1 christos bior_imm3_reg8: 150 1.1 christos set_grs_a5a5 151 1.1 christos set_ccr_zero 152 1.1 christos ;; bior xx:3, reg8 153 1.1 christos bior #7, r0l ; this should NOT set the carry flag. 154 1.1 christos test_cc_clear 155 1.1 christos 156 1.1 christos bior #6, r0l ; this should set the carry flag. 157 1.1 christos test_carry_set 158 1.1 christos test_ovf_clear 159 1.1 christos test_neg_clear 160 1.1 christos test_zero_clear 161 1.1 christos 162 1.1 christos orc #1, ccr ; set the carry flag 163 1.1 christos bior #6, r0l ; this should NOT clear the carry flag 164 1.1 christos test_carry_set 165 1.1 christos test_ovf_clear 166 1.1 christos test_neg_clear 167 1.1 christos test_zero_clear 168 1.1 christos bior #7, r0l ; this should NOT clear the carry flag 169 1.1 christos test_carry_set 170 1.1 christos test_ovf_clear 171 1.1 christos test_neg_clear 172 1.1 christos test_zero_clear 173 1.1 christos 174 1.1 christos test_grs_a5a5 ; general registers should not be changed. 175 1.1 christos 176 1.1 christos bior_imm3_abs8: 177 1.1 christos set_grs_a5a5 178 1.1 christos mov.b r1l, @0x20 179 1.1 christos set_ccr_zero 180 1.1 christos ;; bior xx:3, aa:8 181 1.1 christos bior #7, @0x20:8 ; this should NOT set the carry flag. 182 1.1 christos test_cc_clear 183 1.1 christos bior #6, @0x20:8 ; this should set the carry flag. 184 1.1 christos test_carry_set 185 1.1 christos test_ovf_clear 186 1.1 christos test_neg_clear 187 1.1 christos test_zero_clear 188 1.1 christos 189 1.1 christos orc #1, ccr ; set the carry flag 190 1.1 christos bior #6, @0x20:8 ; this should NOT clear the carry flag 191 1.1 christos test_carry_set 192 1.1 christos test_ovf_clear 193 1.1 christos test_neg_clear 194 1.1 christos test_zero_clear 195 1.1 christos bior #7, @0x20:8 ; this should NOT clear the carry flag 196 1.1 christos test_carry_set 197 1.1 christos test_ovf_clear 198 1.1 christos test_neg_clear 199 1.1 christos test_zero_clear 200 1.1 christos 201 1.1 christos test_grs_a5a5 ; general registers should not be changed. 202 1.1 christos 203 1.1 christos bixor_imm3_reg8: 204 1.1 christos set_grs_a5a5 205 1.1 christos set_ccr_zero 206 1.1 christos ;; bixor xx:3, reg8 207 1.1 christos bixor #7, r0l ; this should NOT set the carry flag. 208 1.1 christos test_cc_clear 209 1.1 christos 210 1.1 christos bixor #6, r0l ; this should set the carry flag. 211 1.1 christos test_carry_set 212 1.1 christos test_ovf_clear 213 1.1 christos test_neg_clear 214 1.1 christos test_zero_clear 215 1.1 christos 216 1.1 christos orc #1, ccr ; set the carry flag 217 1.1 christos bixor #7, r0l ; this should NOT clear the carry flag 218 1.1 christos test_carry_set 219 1.1 christos test_ovf_clear 220 1.1 christos test_neg_clear 221 1.1 christos test_zero_clear 222 1.1 christos 223 1.1 christos bixor #6, r0l ; this should clear the carry flag 224 1.1 christos test_cc_clear 225 1.1 christos 226 1.1 christos test_grs_a5a5 ; general registers should not be changed. 227 1.1 christos 228 1.1 christos bixor_imm3_abs8: 229 1.1 christos set_grs_a5a5 230 1.1 christos mov.b r1l, @0x20 231 1.1 christos set_ccr_zero 232 1.1 christos ;; bixor xx:3, aa:8 233 1.1 christos bixor #7, @0x20:8 ; this should NOT set the carry flag. 234 1.1 christos test_cc_clear 235 1.1 christos bixor #6, @0x20:8 ; this should set the carry flag. 236 1.1 christos test_carry_set 237 1.1 christos test_ovf_clear 238 1.1 christos test_neg_clear 239 1.1 christos test_zero_clear 240 1.1 christos 241 1.1 christos orc #1, ccr ; set the carry flag 242 1.1 christos bixor #7, @0x20:8 ; this should NOT clear the carry flag 243 1.1 christos test_carry_set 244 1.1 christos test_ovf_clear 245 1.1 christos test_neg_clear 246 1.1 christos test_zero_clear 247 1.1 christos 248 1.1 christos bixor #6, @0x20:8 ; this should clear the carry flag 249 1.1 christos test_cc_clear 250 1.1 christos 251 1.1 christos test_grs_a5a5 ; general registers should not be changed. 252 1.1 christos 253 1.1 christos bild_imm3_reg8: 254 1.1 christos set_grs_a5a5 255 1.1 christos set_ccr_zero 256 1.1 christos ;; bild xx:3, reg8 257 1.1 christos bild #7, r0l ; this should NOT set the carry flag. 258 1.1 christos test_cc_clear 259 1.1 christos bild #6, r0l ; this should set the carry flag. 260 1.1 christos test_carry_set 261 1.1 christos test_ovf_clear 262 1.1 christos test_neg_clear 263 1.1 christos test_zero_clear 264 1.1 christos 265 1.1 christos test_grs_a5a5 ; general registers should not be changed. 266 1.1 christos 267 1.1 christos bild_imm3_ind: 268 1.1 christos set_grs_a5a5 269 1.1 christos .if (sim_cpu == h8300) 270 1.1 christos mov #byte_src, r1 271 1.1 christos set_ccr_zero 272 1.1 christos ;; bild xx:3, ind 273 1.1 christos bild #7, @r1 ; this should NOT set the carry flag. 274 1.1 christos test_cc_clear 275 1.1 christos bild #6, @r1 ; this should set the carry flag. 276 1.1 christos test_carry_set 277 1.1 christos test_ovf_clear 278 1.1 christos test_neg_clear 279 1.1 christos test_zero_clear 280 1.1 christos ;;; test_h_gr16 byte_src r1 ;FIXME 281 1.1 christos .else 282 1.1 christos mov #byte_src, er1 283 1.1 christos set_ccr_zero 284 1.1 christos ;; bild xx:3, ind 285 1.1 christos bild #7, @er1 ; this should NOT set the carry flag. 286 1.1 christos test_cc_clear 287 1.1 christos bild #6, @er1 ; this should NOT set the carry flag. 288 1.1 christos test_carry_set 289 1.1 christos test_ovf_clear 290 1.1 christos test_neg_clear 291 1.1 christos test_zero_clear 292 1.1 christos test_h_gr32 byte_src er1 293 1.1 christos .endif ; h8300 294 1.1 christos test_gr_a5a5 0 ; general registers should not be changed. 295 1.1 christos test_gr_a5a5 2 296 1.1 christos test_gr_a5a5 3 297 1.1 christos test_gr_a5a5 4 298 1.1 christos test_gr_a5a5 5 299 1.1 christos test_gr_a5a5 6 300 1.1 christos test_gr_a5a5 7 301 1.1 christos 302 1.1 christos bild_imm3_abs8: 303 1.1 christos set_grs_a5a5 304 1.1 christos mov.b r1l, @0x20 305 1.1 christos set_ccr_zero 306 1.1 christos ;; bild xx:3, aa:8 307 1.1 christos bild #7, @0x20:8 ; this should NOT set the carry flag. 308 1.1 christos test_cc_clear 309 1.1 christos bild #6, @0x20:8 ; this should set the carry flag. 310 1.1 christos test_carry_set 311 1.1 christos test_ovf_clear 312 1.1 christos test_neg_clear 313 1.1 christos test_zero_clear 314 1.1 christos 315 1.1 christos test_grs_a5a5 ; general registers should not be changed. 316 1.1 christos 317 1.1 christos .if (sim_cpu > h8300h) 318 1.1 christos bild_imm3_abs16: 319 1.1 christos set_grs_a5a5 320 1.1 christos set_ccr_zero 321 1.1 christos ;; bild xx:3, aa:16 322 1.1 christos bild #7, @byte_src:16 ; this should NOT set the carry flag. 323 1.1 christos test_cc_clear 324 1.1 christos bild #6, @byte_src:16 ; this should set the carry flag. 325 1.1 christos test_carry_set 326 1.1 christos test_ovf_clear 327 1.1 christos test_neg_clear 328 1.1 christos test_zero_clear 329 1.1 christos 330 1.1 christos test_grs_a5a5 ; general registers should not be changed. 331 1.1 christos 332 1.1 christos bild_imm3_abs32: 333 1.1 christos set_grs_a5a5 334 1.1 christos set_ccr_zero 335 1.1 christos ;; bild xx:3, aa:32 336 1.1 christos bild #7, @byte_src:32 ; this should NOT set the carry flag. 337 1.1 christos test_cc_clear 338 1.1 christos bild #6, @byte_src:32 ; this should set the carry flag. 339 1.1 christos test_carry_set 340 1.1 christos test_ovf_clear 341 1.1 christos test_neg_clear 342 1.1 christos test_zero_clear 343 1.1 christos 344 1.1 christos test_grs_a5a5 ; general registers should not be changed. 345 1.1 christos .endif 346 1.1 christos 347 1.1 christos bist_imm3_reg8: 348 1.1 christos set_grs_a5a5 349 1.1 christos set_ccr_zero 350 1.1 christos ;; bist xx:3, reg8 351 1.1 christos bist #6, r0l ; this should set bit 6 352 1.1 christos test_cc_clear 353 1.1 christos test_h_gr16 0xa5e5 r0 354 1.1 christos 355 1.1 christos set_ccr_zero 356 1.1 christos orc #1, ccr ; set the carry flag 357 1.1 christos bist #7, r0l ; this should clear bit 7 358 1.1 christos test_carry_set 359 1.1 christos test_ovf_clear 360 1.1 christos test_neg_clear 361 1.1 christos test_zero_clear 362 1.1 christos test_h_gr16 0xa565 r0 363 1.1 christos 364 1.1 christos test_gr_a5a5 1 ; Rest of general regs should not be changed. 365 1.1 christos test_gr_a5a5 2 366 1.1 christos test_gr_a5a5 3 367 1.1 christos test_gr_a5a5 4 368 1.1 christos test_gr_a5a5 5 369 1.1 christos test_gr_a5a5 6 370 1.1 christos test_gr_a5a5 7 371 1.1 christos 372 1.1 christos bist_imm3_abs8: 373 1.1 christos set_grs_a5a5 374 1.1 christos mov.b r1l, @0x20 375 1.1 christos set_ccr_zero 376 1.1 christos ;; bist xx:3, aa:8 377 1.1 christos bist #6, @0x20:8 ; this should set bit 6 378 1.1 christos test_cc_clear 379 1.1 christos mov.b @0x20, r0l 380 1.1 christos test_h_gr16 0xa5e5 r0 381 1.1 christos 382 1.1 christos set_ccr_zero 383 1.1 christos orc #1, ccr ; set the carry flag 384 1.1 christos bist #7, @0x20:8 ; this should clear bit 7 385 1.1 christos test_carry_set 386 1.1 christos test_ovf_clear 387 1.1 christos test_neg_clear 388 1.1 christos test_zero_clear 389 1.1 christos mov.b @0x20, r0l 390 1.1 christos test_h_gr16 0xa565 r0 391 1.1 christos 392 1.1 christos test_gr_a5a5 1 ; general registers should not be changed. 393 1.1 christos test_gr_a5a5 2 394 1.1 christos test_gr_a5a5 3 395 1.1 christos test_gr_a5a5 4 396 1.1 christos test_gr_a5a5 5 397 1.1 christos test_gr_a5a5 6 398 1.1 christos test_gr_a5a5 7 399 1.1 christos 400 1.1 christos .if (sim_cpu == h8sx) 401 1.1 christos bistz_imm3_abs8: 402 1.1 christos set_grs_a5a5 403 1.1 christos mov.b r1l, @0x20 404 1.1 christos set_ccr_zero 405 1.1 christos ;; bistz xx:3, aa:8 406 1.1 christos bistz #6, @0x20:8 ; this should set bit 6 407 1.1 christos test_cc_clear 408 1.1 christos mov.b @0x20, r0l 409 1.1 christos test_h_gr16 0xa5e5 r0 410 1.1 christos 411 1.1 christos set_ccr_zero 412 1.1 christos orc #4, ccr ; set the zero flag 413 1.1 christos bistz #7, @0x20:8 ; this should clear bit 7 414 1.1 christos test_carry_clear 415 1.1 christos test_ovf_clear 416 1.1 christos test_neg_clear 417 1.1 christos test_zero_set 418 1.1 christos mov.b @0x20, r0l 419 1.1 christos test_h_gr16 0xa565 r0 420 1.1 christos 421 1.1 christos test_gr_a5a5 1 ; general registers should not be changed. 422 1.1 christos test_gr_a5a5 2 423 1.1 christos test_gr_a5a5 3 424 1.1 christos test_gr_a5a5 4 425 1.1 christos test_gr_a5a5 5 426 1.1 christos test_gr_a5a5 6 427 1.1 christos test_gr_a5a5 7 428 1.1 christos .endif ; h8sx 429 1.1 christos 430 1.1 christos bnot_imm3_reg8: 431 1.1 christos set_grs_a5a5 432 1.1 christos set_ccr_zero 433 1.1 christos ;; bnot xx:3, reg8 434 1.1 christos bnot #7, r0l 435 1.1 christos test_cc_clear 436 1.1 christos test_h_gr16 0xa525 r0 437 1.1 christos set_ccr_zero 438 1.1 christos bnot #6, r0l 439 1.1 christos test_cc_clear 440 1.1 christos test_h_gr16 0xa565 r0 441 1.1 christos set_ccr_zero 442 1.1 christos bnot #5, r0l 443 1.1 christos test_cc_clear 444 1.1 christos test_h_gr16 0xa545 r0 445 1.1 christos set_ccr_zero 446 1.1 christos bnot #4, r0l 447 1.1 christos test_cc_clear 448 1.1 christos test_h_gr16 0xa555 r0 449 1.1 christos set_ccr_zero 450 1.1 christos 451 1.1 christos bnot #4, r0l 452 1.1 christos bnot #5, r0l 453 1.1 christos bnot #6, r0l 454 1.1 christos bnot #7, r0l 455 1.1 christos test_cc_clear 456 1.1 christos test_grs_a5a5 ; general registers should not be changed. 457 1.1 christos 458 1.1 christos bnot_imm3_abs8: 459 1.1 christos set_grs_a5a5 460 1.1 christos mov.b r1l, @0x20 461 1.1 christos set_ccr_zero 462 1.1 christos ;; bnot xx:3, aa:8 463 1.1 christos bnot #7, @0x20:8 464 1.1 christos bnot #6, @0x20:8 465 1.1 christos bnot #5, @0x20:8 466 1.1 christos bnot #4, @0x20:8 467 1.1 christos test_cc_clear 468 1.1 christos test_grs_a5a5 469 1.1 christos mov @0x20, r0l 470 1.1 christos test_h_gr16 0xa555 r0 471 1.1 christos 472 1.1 christos pass 473 1.1 christos exit 0 474