1 1.1 christos # Hitachi H8 testcase 'stc' 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 .data 13 1.1 christos byte_dest1: 14 1.1 christos .byte 0 15 1.1 christos .byte 0 16 1.1 christos byte_dest2: 17 1.1 christos .byte 0 18 1.1 christos .byte 0 19 1.1 christos byte_dest3: 20 1.1 christos .byte 0 21 1.1 christos .byte 0 22 1.1 christos byte_dest4: 23 1.1 christos .byte 0 24 1.1 christos .byte 0 25 1.1 christos byte_dest5: 26 1.1 christos .byte 0 27 1.1 christos .byte 0 28 1.1 christos byte_dest6: 29 1.1 christos .byte 0 30 1.1 christos .byte 0 31 1.1 christos byte_dest7: 32 1.1 christos .byte 0 33 1.1 christos .byte 0 34 1.1 christos byte_dest8: 35 1.1 christos .byte 0 36 1.1 christos .byte 0 37 1.1 christos byte_dest9: 38 1.1 christos .byte 0 39 1.1 christos .byte 0 40 1.1 christos byte_dest10: 41 1.1 christos .byte 0 42 1.1 christos .byte 0 43 1.1 christos byte_dest11: 44 1.1 christos .byte 0 45 1.1 christos .byte 0 46 1.1 christos byte_dest12: 47 1.1 christos .byte 0 48 1.1 christos .byte 0 49 1.1 christos 50 1.1 christos start 51 1.1 christos 52 1.1 christos stc_ccr_reg8: 53 1.1 christos set_grs_a5a5 54 1.1 christos set_ccr_zero 55 1.1 christos 56 1.1 christos ldc #0xff, ccr ; test value 57 1.1 christos stc ccr, r0h ; copy test value to r0h 58 1.1 christos 59 1.1 christos test_h_gr16 0xffa5 r0 ; ff in r0h, a5 in r0l 60 1.1 christos .if (sim_cpu) ; h/s/sx 61 1.1 christos test_h_gr32 0xa5a5ffa5 er0 ; ff in r0h, a5 everywhere else 62 1.1 christos .endif 63 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed 64 1.1 christos test_gr_a5a5 2 65 1.1 christos test_gr_a5a5 3 66 1.1 christos test_gr_a5a5 4 67 1.1 christos test_gr_a5a5 5 68 1.1 christos test_gr_a5a5 6 69 1.1 christos test_gr_a5a5 7 70 1.1 christos 71 1.1 christos .if (sim_cpu == h8300s || sim_cpu == h8sx) ; Earlier versions, no exr 72 1.1 christos stc_exr_reg8: 73 1.1 christos set_grs_a5a5 74 1.1 christos set_ccr_zero 75 1.1 christos 76 1.1 christos ldc #0x87, exr ; set exr to 0x87 77 1.1 christos stc exr, r0l ; retrieve and check exr value 78 1.1 christos cmp.b #0x87, r0l 79 1.1 christos beq .L21 80 1.1 christos fail 81 1.1 christos .L21: 82 1.1 christos test_h_gr32 0xa5a5a587 er0 ; Register 0 modified by test procedure. 83 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed 84 1.1 christos test_gr_a5a5 2 85 1.1 christos test_gr_a5a5 3 86 1.1 christos test_gr_a5a5 4 87 1.1 christos test_gr_a5a5 5 88 1.1 christos test_gr_a5a5 6 89 1.1 christos test_gr_a5a5 7 90 1.1 christos 91 1.1 christos stc_ccr_abs16: 92 1.1 christos set_grs_a5a5 93 1.1 christos set_ccr_zero 94 1.1 christos 95 1.1 christos ldc #0xff, ccr 96 1.1 christos stc ccr, @byte_dest1:16 ; abs16 dest 97 1.1 christos 98 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 99 1.1 christos test_gr_a5a5 1 100 1.1 christos test_gr_a5a5 2 101 1.1 christos test_gr_a5a5 3 102 1.1 christos test_gr_a5a5 4 103 1.1 christos test_gr_a5a5 5 104 1.1 christos test_gr_a5a5 6 105 1.1 christos test_gr_a5a5 7 106 1.1 christos 107 1.1 christos stc_exr_abs16: 108 1.1 christos set_grs_a5a5 109 1.1 christos set_ccr_zero 110 1.1 christos 111 1.1 christos ldc #0x87, exr 112 1.1 christos stc exr, @byte_dest2:16 ; abs16 dest 113 1.1 christos 114 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 115 1.1 christos test_gr_a5a5 1 116 1.1 christos test_gr_a5a5 2 117 1.1 christos test_gr_a5a5 3 118 1.1 christos test_gr_a5a5 4 119 1.1 christos test_gr_a5a5 5 120 1.1 christos test_gr_a5a5 6 121 1.1 christos test_gr_a5a5 7 122 1.1 christos 123 1.1 christos stc_ccr_abs32: 124 1.1 christos set_grs_a5a5 125 1.1 christos set_ccr_zero 126 1.1 christos 127 1.1 christos ldc #0xff, ccr 128 1.1 christos stc ccr, @byte_dest3:32 ; abs32 dest 129 1.1 christos 130 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 131 1.1 christos test_gr_a5a5 1 132 1.1 christos test_gr_a5a5 2 133 1.1 christos test_gr_a5a5 3 134 1.1 christos test_gr_a5a5 4 135 1.1 christos test_gr_a5a5 5 136 1.1 christos test_gr_a5a5 6 137 1.1 christos test_gr_a5a5 7 138 1.1 christos 139 1.1 christos stc_exr_abs32: 140 1.1 christos set_grs_a5a5 141 1.1 christos set_ccr_zero 142 1.1 christos 143 1.1 christos ldc #0x87, exr 144 1.1 christos stc exr, @byte_dest4:32 ; abs32 dest 145 1.1 christos 146 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 147 1.1 christos test_gr_a5a5 1 148 1.1 christos test_gr_a5a5 2 149 1.1 christos test_gr_a5a5 3 150 1.1 christos test_gr_a5a5 4 151 1.1 christos test_gr_a5a5 5 152 1.1 christos test_gr_a5a5 6 153 1.1 christos test_gr_a5a5 7 154 1.1 christos 155 1.1 christos stc_ccr_disp16: 156 1.1 christos set_grs_a5a5 157 1.1 christos set_ccr_zero 158 1.1 christos 159 1.1 christos mov #byte_dest5-1, er1 160 1.1 christos ldc #0xff, ccr 161 1.1 christos stc ccr, @(1:16,er1) ; disp16 dest (5) 162 1.1 christos 163 1.1 christos test_h_gr32 byte_dest5-1, er1 ; er1 still contains address 164 1.1 christos 165 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 166 1.1 christos test_gr_a5a5 2 167 1.1 christos test_gr_a5a5 3 168 1.1 christos test_gr_a5a5 4 169 1.1 christos test_gr_a5a5 5 170 1.1 christos test_gr_a5a5 6 171 1.1 christos test_gr_a5a5 7 172 1.1 christos 173 1.1 christos stc_exr_disp16: 174 1.1 christos set_grs_a5a5 175 1.1 christos set_ccr_zero 176 1.1 christos 177 1.1 christos mov #byte_dest6+1, er1 178 1.1 christos ldc #0x87, exr 179 1.1 christos stc exr, @(-1:16,er1) ; disp16 dest (6) 180 1.1 christos 181 1.1 christos test_h_gr32 byte_dest6+1, er1 ; er1 still contains address 182 1.1 christos 183 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 184 1.1 christos test_gr_a5a5 2 185 1.1 christos test_gr_a5a5 3 186 1.1 christos test_gr_a5a5 4 187 1.1 christos test_gr_a5a5 5 188 1.1 christos test_gr_a5a5 6 189 1.1 christos test_gr_a5a5 7 190 1.1 christos 191 1.1 christos stc_ccr_disp32: 192 1.1 christos set_grs_a5a5 193 1.1 christos set_ccr_zero 194 1.1 christos 195 1.1 christos mov #byte_dest7-1, er1 196 1.1 christos ldc #0xff, ccr 197 1.1 christos stc ccr, @(1:32,er1) ; disp32 dest (7) 198 1.1 christos 199 1.1 christos test_h_gr32 byte_dest7-1, er1 ; er1 still contains address 200 1.1 christos 201 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 202 1.1 christos test_gr_a5a5 2 203 1.1 christos test_gr_a5a5 3 204 1.1 christos test_gr_a5a5 4 205 1.1 christos test_gr_a5a5 5 206 1.1 christos test_gr_a5a5 6 207 1.1 christos test_gr_a5a5 7 208 1.1 christos 209 1.1 christos stc_exr_disp32: 210 1.1 christos set_grs_a5a5 211 1.1 christos set_ccr_zero 212 1.1 christos 213 1.1 christos mov #byte_dest8+1, er1 214 1.1 christos ldc #0x87, exr 215 1.1 christos stc exr, @(-1:32,er1) ; disp16 dest (8) 216 1.1 christos 217 1.1 christos test_h_gr32 byte_dest8+1, er1 ; er1 still contains address 218 1.1 christos 219 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed 220 1.1 christos test_gr_a5a5 3 221 1.1 christos test_gr_a5a5 4 222 1.1 christos test_gr_a5a5 5 223 1.1 christos test_gr_a5a5 6 224 1.1 christos test_gr_a5a5 7 225 1.1 christos 226 1.1 christos stc_ccr_predecr: 227 1.1 christos set_grs_a5a5 228 1.1 christos set_ccr_zero 229 1.1 christos 230 1.1 christos mov #byte_dest9+2, er1 231 1.1 christos ldc #0xff, ccr 232 1.1 christos stc ccr, @-er1 ; predecr dest (9) 233 1.1 christos 234 1.1 christos test_h_gr32 byte_dest9 er1 ; er1 still contains address 235 1.1 christos 236 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 237 1.1 christos test_gr_a5a5 2 238 1.1 christos test_gr_a5a5 3 239 1.1 christos test_gr_a5a5 4 240 1.1 christos test_gr_a5a5 5 241 1.1 christos test_gr_a5a5 6 242 1.1 christos test_gr_a5a5 7 243 1.1 christos 244 1.1 christos stc_exr_predecr: 245 1.1 christos set_grs_a5a5 246 1.1 christos set_ccr_zero 247 1.1 christos 248 1.1 christos mov #byte_dest10+2, er1 249 1.1 christos ldc #0x87, exr 250 1.1 christos stc exr, @-er1 ; predecr dest (10) 251 1.1 christos 252 1.1 christos test_h_gr32 byte_dest10, er1 ; er1 still contains address 253 1.1 christos 254 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 255 1.1 christos test_gr_a5a5 2 256 1.1 christos test_gr_a5a5 3 257 1.1 christos test_gr_a5a5 4 258 1.1 christos test_gr_a5a5 5 259 1.1 christos test_gr_a5a5 6 260 1.1 christos test_gr_a5a5 7 261 1.1 christos 262 1.1 christos stc_ccr_ind: 263 1.1 christos set_grs_a5a5 264 1.1 christos set_ccr_zero 265 1.1 christos 266 1.1 christos mov #byte_dest11, er1 267 1.1 christos ldc #0xff, ccr 268 1.1 christos stc ccr, @er1 ; postinc dest (11) 269 1.1 christos 270 1.1 christos test_h_gr32 byte_dest11, er1 ; er1 still contains address 271 1.1 christos 272 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 273 1.1 christos test_gr_a5a5 2 274 1.1 christos test_gr_a5a5 3 275 1.1 christos test_gr_a5a5 4 276 1.1 christos test_gr_a5a5 5 277 1.1 christos test_gr_a5a5 6 278 1.1 christos test_gr_a5a5 7 279 1.1 christos 280 1.1 christos stc_exr_ind: 281 1.1 christos set_grs_a5a5 282 1.1 christos set_ccr_zero 283 1.1 christos 284 1.1 christos mov #byte_dest12, er1 285 1.1 christos ldc #0x87, exr 286 1.1 christos stc exr, @er1, exr ; postinc dest (12) 287 1.1 christos 288 1.1 christos test_h_gr32 byte_dest12, er1 ; er1 still contains address 289 1.1 christos 290 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed 291 1.1 christos test_gr_a5a5 2 292 1.1 christos test_gr_a5a5 3 293 1.1 christos test_gr_a5a5 4 294 1.1 christos test_gr_a5a5 5 295 1.1 christos test_gr_a5a5 6 296 1.1 christos test_gr_a5a5 7 297 1.1 christos 298 1.1 christos .endif 299 1.1 christos 300 1.1 christos .if (sim_cpu == h8sx) ; New vbr and sbr registers for h8sx 301 1.1 christos stc_sbr_reg: 302 1.1 christos set_grs_a5a5 303 1.1 christos set_ccr_zero 304 1.1 christos 305 1.1 christos mov #0xaaaaaaaa, er0 306 1.1 christos ldc er0, sbr ; set sbr to 0xaaaaaaaa 307 1.1.1.2 christos stc sbr, er1 ; retrieve and check sbr value 308 1.1 christos 309 1.1 christos test_h_gr32 0xaaaaaaaa er1 310 1.1 christos test_h_gr32 0xaaaaaaaa er0 ; Register 0 modified by test procedure. 311 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed 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 stc_vbr_reg: 319 1.1 christos set_grs_a5a5 320 1.1 christos set_ccr_zero 321 1.1 christos 322 1.1 christos mov #0xaaaaaaaa, er0 323 1.1 christos ldc er0, vbr ; set sbr to 0xaaaaaaaa 324 1.1.1.2 christos stc vbr, er1 ; retrieve and check sbr value 325 1.1 christos 326 1.1 christos test_h_gr32 0xaaaaaaaa er1 327 1.1 christos test_h_gr32 0xaaaaaaaa er0 ; Register 0 modified by test procedure. 328 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed 329 1.1 christos test_gr_a5a5 3 330 1.1 christos test_gr_a5a5 4 331 1.1 christos test_gr_a5a5 5 332 1.1 christos test_gr_a5a5 6 333 1.1 christos test_gr_a5a5 7 334 1.1 christos 335 1.1 christos check_results: 336 1.1 christos ;; Now check results 337 1.1 christos mov @byte_dest1, r0h 338 1.1 christos cmp.b #0xff, r0h 339 1.1 christos beq .L1 340 1.1 christos fail 341 1.1 christos 342 1.1 christos .L1: mov @byte_dest2, r0h 343 1.1 christos cmp.b #0x87, r0h 344 1.1 christos beq .L2 345 1.1 christos fail 346 1.1 christos 347 1.1 christos .L2: mov @byte_dest3, r0h 348 1.1 christos cmp.b #0xff, r0h 349 1.1 christos beq .L3 350 1.1 christos fail 351 1.1 christos 352 1.1 christos .L3: mov @byte_dest4, r0h 353 1.1 christos cmp.b #0x87, r0h 354 1.1 christos beq .L4 355 1.1 christos fail 356 1.1 christos 357 1.1 christos .L4: mov @byte_dest5, r0h 358 1.1 christos cmp.b #0xff, r0h 359 1.1 christos beq .L5 360 1.1 christos fail 361 1.1 christos 362 1.1 christos .L5: mov @byte_dest6, r0h 363 1.1 christos cmp.b #0x87, r0h 364 1.1 christos beq .L6 365 1.1 christos fail 366 1.1 christos 367 1.1 christos .L6: mov @byte_dest7, r0h 368 1.1 christos cmp.b #0xff, r0h 369 1.1 christos beq .L7 370 1.1 christos fail 371 1.1 christos 372 1.1 christos .L7: mov @byte_dest8, r0h 373 1.1 christos cmp.b #0x87, r0h 374 1.1 christos beq .L8 375 1.1 christos fail 376 1.1 christos 377 1.1 christos .L8: mov @byte_dest9, r0h 378 1.1 christos cmp.b #0xff, r0h 379 1.1 christos beq .L9 380 1.1 christos fail 381 1.1 christos 382 1.1 christos .L9: mov @byte_dest10, r0h 383 1.1 christos cmp.b #0x87, r0h 384 1.1 christos beq .L10 385 1.1 christos fail 386 1.1 christos 387 1.1 christos .L10: mov @byte_dest11, r0h 388 1.1 christos cmp.b #0xff, r0h 389 1.1 christos beq .L11 390 1.1 christos fail 391 1.1 christos 392 1.1 christos .L11: mov @byte_dest12, r0h 393 1.1 christos cmp.b #0x87, r0h 394 1.1 christos beq .L12 395 1.1 christos fail 396 1.1 christos 397 1.1 christos .L12: 398 1.1 christos .endif 399 1.1 christos pass 400 1.1 christos 401 1.1 christos exit 0 402