1 # Hitachi H8 testcase 'not.b, not.w, not.l'
3 # as(h8300): --defsym sim_cpu=0
4 # as(h8300h): --defsym sim_cpu=1
5 # as(h8300s): --defsym sim_cpu=2
6 # as(h8sx): --defsym sim_cpu=3
7 # ld(h8300h): -m h8300helf
8 # ld(h8300s): -m h8300self
9 # ld(h8sx): -m h8300sxelf
11 .include "testutils.inc"
13 # Instructions tested:
15 # not.b @erd ; 7 d rd ???? 1 7 0 ignore
16 # not.b @erd+ ; 0 1 7 4 6 c rd 1??? 1 7 0 ignore
17 # not.b @erd- ; 0 1 7 6 6 c rd 1??? 1 7 0 ignore
18 # not.b @+erd ; 0 1 7 5 6 c rd 1??? 1 7 0 ignore
19 # not.b @-erd ; 0 1 7 7 6 c rd 1??? 1 7 0 ignore
20 # not.b @(d:2, erd) ; 0 1 7 01dd 6 8 rd 8 1 7 0 ignore
21 # not.b @(d:16, erd) ; 0 1 7 4 6 e rd 1??? dd:16 1 7 0 ignore
22 # not.b @(d:32, erd) ; 7 8 rd 4 6 a 2 1??? dd:32 1 7 0 ignore
23 # not.b @aa:16 ; 6 a 1 1??? aa:16 1 7 0 ignore
24 # not.b @aa:32 ; 6 a 3 1??? aa:32 1 7 0 ignore
29 # not.b @aa:8 ; 7 f aaaaaaaa 1 7 0 ignore
35 word_dest: .word 0xa5a5
37 long_dest: .long 0xa5a5a5a5
41 # 8-bit byte operations
45 set_grs_a5a5 ; Fill all general regs with a fixed pattern
49 not r0l ; 8-bit register
52 cmp.b #0x5a, r0l ; result of "not 0xa5"
56 ;; fixme test ccr ; H=0 N=1 Z=0 V=0 C=0
57 test_h_gr16 0xa55a r0 ; r0 changed by 'not'
58 .if (sim_cpu) ; non-zero means h8300h, s, or sx
59 test_h_gr32 0xa5a5a55a er0 ; er0 changed by 'not'
61 test_gr_a5a5 1 ; Make sure other general regs not disturbed
71 set_grs_a5a5 ; Fill all general regs with a fixed pattern
76 not.b @er0 ; register indirect operand
80 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
85 test_h_gr32 byte_dest er0 ; er0 still contains address
86 cmp.b #0x5a:8, @er0 ; memory contents changed
90 test_gr_a5a5 1 ; Make sure other general regs not disturbed
99 set_grs_a5a5 ; Fill all general regs with a fixed pattern
103 mov #byte_dest, er0 ; register post-increment operand
109 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
114 test_h_gr32 byte_dest+1 er0 ; er0 contains address plus one
119 test_gr_a5a5 1 ; Make sure other general regs not disturbed
128 set_grs_a5a5 ; Fill all general regs with a fixed pattern
132 mov #byte_dest, er0 ; register post-decrement operand
138 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
143 test_h_gr32 byte_dest-1 er0 ; er0 contains address minus one
151 test_gr_a5a5 1 ; Make sure other general regs not disturbed
160 set_grs_a5a5 ; Fill all general regs with a fixed pattern
164 mov #byte_dest-1, er0
165 not.b @+er0 ; reg pre-increment operand
170 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
179 test_h_gr32 byte_dest er0 ; er0 contains destination address
180 test_gr_a5a5 1 ; Make sure other general regs not disturbed
189 set_grs_a5a5 ; Fill all general regs with a fixed pattern
193 mov #byte_dest+1, er0
194 not.b @-er0 ; reg pre-decr operand
199 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
208 test_h_gr32 byte_dest er0 ; er0 contains destination address
209 test_gr_a5a5 1 ; Make sure other general regs not disturbed
218 set_grs_a5a5 ; Fill all general regs with a fixed pattern
221 ;; not.b @(dd:2, erd)
222 mov #byte_dest-1, er0
223 not.b @(1:2, er0) ; reg plus 2-bit displacement
228 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
237 test_h_gr32 byte_dest er0 ; er0 contains destination address
238 test_gr_a5a5 1 ; Make sure other general regs not disturbed
247 set_grs_a5a5 ; Fill all general regs with a fixed pattern
250 ;; not.b @(dd:16, erd)
251 mov #byte_dest+100, er0
252 not.b @(-100:16, er0) ; reg plus 16-bit displacement
258 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
263 cmp.b #0x5a:8, @byte_dest
267 test_h_gr32 byte_dest+100 er0 ; er0 contains destination address
268 test_gr_a5a5 1 ; Make sure other general regs not disturbed
277 set_grs_a5a5 ; Fill all general regs with a fixed pattern
280 ;; not.b @(dd:32, erd)
281 mov #byte_dest-0xfffff, er0
282 not.b @(0xfffff:32, er0) ; reg plus 32-bit displacement
288 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
293 cmp.b #0xa5:8, @byte_dest
297 test_h_gr32 byte_dest-0xfffff er0 ; er0 contains destination address
298 test_gr_a5a5 1 ; Make sure other general regs not disturbed
307 set_grs_a5a5 ; Fill all general regs with a fixed pattern
311 not.b @byte_dest:16 ; 16-bit absolute address
316 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
321 cmp.b #0x5a:8, @byte_dest
325 test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
335 set_grs_a5a5 ; Fill all general regs with a fixed pattern
339 not.b @byte_dest:32 ; 32-bit absolute address
344 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
349 cmp.b #0xa5:8, @byte_dest
353 test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
364 # 16-bit word operations
367 .if (sim_cpu) ; any except plain-vanilla h8/300
369 set_grs_a5a5 ; Fill all general regs with a fixed pattern
373 not r1 ; 16-bit register operand
376 cmp.w #0x5a5a, r1 ; result of "not 0xa5a5"
380 ;; fixme test ccr ; H=0 N=1 Z=0 V=0 C=0
381 test_h_gr32 0xa5a55a5a er1 ; er1 changed by 'not'
382 test_gr_a5a5 0 ; Make sure other general regs not disturbed
390 .if (sim_cpu == h8sx)
392 set_grs_a5a5 ; Fill all general regs with a fixed pattern
397 not.w @er1 ; register indirect operand
402 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
407 cmp.w #0x5a5a, @word_dest ; memory contents changed
411 test_h_gr32 word_dest er1 ; er1 still contains address
412 test_gr_a5a5 0 ; Make sure other general regs not disturbed
421 set_grs_a5a5 ; Fill all general regs with a fixed pattern
425 mov #word_dest, er1 ; register post-increment operand
431 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
436 cmp.w #0xa5a5, @word_dest
440 test_h_gr32 word_dest+2 er1 ; er1 contains address plus two
441 test_gr_a5a5 0 ; Make sure other general regs not disturbed
450 set_grs_a5a5 ; Fill all general regs with a fixed pattern
460 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
465 cmp.w #0x5a5a, @word_dest
469 test_h_gr32 word_dest-2 er1 ; er1 contains address minus two
470 test_gr_a5a5 0 ; Make sure other general regs not disturbed
479 set_grs_a5a5 ; Fill all general regs with a fixed pattern
483 mov #word_dest-2, er1
484 not.w @+er1 ; reg pre-increment operand
489 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
494 cmp.w #0xa5a5, @word_dest
498 test_h_gr32 word_dest er1 ; er1 contains destination address
499 test_gr_a5a5 0 ; Make sure other general regs not disturbed
508 set_grs_a5a5 ; Fill all general regs with a fixed pattern
512 mov #word_dest+2, er1
513 not.w @-er1 ; reg pre-decr operand
518 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
523 cmp.w #0x5a5a, @word_dest
527 test_h_gr32 word_dest er1 ; er1 contains destination address
528 test_gr_a5a5 0 ; Make sure other general regs not disturbed
537 set_grs_a5a5 ; Fill all general regs with a fixed pattern
540 ;; not.w @(dd:2, erd)
541 mov #word_dest-2, er1
542 not.w @(2:2, er1) ; reg plus 2-bit displacement
547 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
552 cmp.w #0xa5a5, @word_dest
556 test_h_gr32 word_dest-2 er1 ; er1 contains address minus one
557 test_gr_a5a5 0 ; Make sure other general regs not disturbed
566 set_grs_a5a5 ; Fill all general regs with a fixed pattern
569 ;; not.w @(dd:16, erd)
570 mov #word_dest+100, er1
571 not.w @(-100:16, er1) ; reg plus 16-bit displacement
577 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
582 cmp.w #0x5a5a, @word_dest
586 test_h_gr32 word_dest+100 er1 ; er1 contains destination address
587 test_gr_a5a5 0 ; Make sure other general regs not disturbed
596 set_grs_a5a5 ; Fill all general regs with a fixed pattern
599 ;; not.w @(dd:32, erd)
600 mov #word_dest-0xfffff, er1
601 not.w @(0xfffff:32, er1) ; reg plus 32-bit displacement
607 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
612 cmp.w #0xa5a5, @word_dest
616 test_h_gr32 word_dest-0xfffff er1 ; er1 contains destination address
617 test_gr_a5a5 0 ; Make sure other general regs not disturbed
626 set_grs_a5a5 ; Fill all general regs with a fixed pattern
630 not.w @word_dest:16 ; 16-bit absolute address
635 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
640 cmp.w #0x5a5a, @word_dest
644 test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
654 set_grs_a5a5 ; Fill all general regs with a fixed pattern
658 not.w @word_dest:32 ; 32-bit absolute address
663 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
668 cmp.w #0xa5a5, @word_dest
672 test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
685 # 32-bit word operations
688 .if (sim_cpu) ; any except plain-vanilla h8/300
690 set_grs_a5a5 ; Fill all general regs with a fixed pattern
694 not er1 ; 32-bit register operand
697 cmp.l #0x5a5a5a5a, er1 ; result of "not 0xa5a5a5a5"
701 ;; fixme test ccr ; H=0 N=1 Z=0 V=0 C=0
702 test_h_gr32 0x5a5a5a5a er1 ; er1 changed by 'not'
703 test_gr_a5a5 0 ; Make sure other general regs not disturbed
711 .if (sim_cpu == h8sx)
713 set_grs_a5a5 ; Fill all general regs with a fixed pattern
718 not.l @er1 ; register indirect operand
723 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
728 cmp.l #0x5a5a5a5a, @long_dest ; memory contents changed
732 test_h_gr32 long_dest er1 ; er1 still contains address
733 test_gr_a5a5 0 ; Make sure other general regs not disturbed
742 set_grs_a5a5 ; Fill all general regs with a fixed pattern
746 mov #long_dest, er1 ; register post-increment operand
752 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
757 cmp.l #0xa5a5a5a5, @long_dest
761 test_h_gr32 long_dest+4 er1 ; er1 contains address plus two
762 test_gr_a5a5 0 ; Make sure other general regs not disturbed
771 set_grs_a5a5 ; Fill all general regs with a fixed pattern
781 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
786 cmp.l #0x5a5a5a5a, @long_dest
790 test_h_gr32 long_dest-4 er1 ; er1 contains address minus two
791 test_gr_a5a5 0 ; Make sure other general regs not disturbed
800 set_grs_a5a5 ; Fill all general regs with a fixed pattern
804 mov #long_dest-4, er1
805 not.l @+er1 ; reg pre-increment operand
810 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
815 cmp.l #0xa5a5a5a5, @long_dest
819 test_h_gr32 long_dest er1 ; er1 contains destination address
820 test_gr_a5a5 0 ; Make sure other general regs not disturbed
829 set_grs_a5a5 ; Fill all general regs with a fixed pattern
833 mov #long_dest+4, er1
834 not.l @-er1 ; reg pre-decr operand
839 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
844 cmp.l #0x5a5a5a5a, @long_dest
848 test_h_gr32 long_dest er1 ; er1 contains destination address
849 test_gr_a5a5 0 ; Make sure other general regs not disturbed
858 set_grs_a5a5 ; Fill all general regs with a fixed pattern
861 ;; not.l @(dd:2, erd)
862 mov #long_dest-4, er1
863 not.l @(4:2, er1) ; reg plus 2-bit displacement
868 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
873 cmp.l #0xa5a5a5a5, @long_dest
877 test_h_gr32 long_dest-4 er1 ; er1 contains address minus one
878 test_gr_a5a5 0 ; Make sure other general regs not disturbed
887 set_grs_a5a5 ; Fill all general regs with a fixed pattern
890 ;; not.l @(dd:16, erd)
891 mov #long_dest+100, er1
892 not.l @(-100:16, er1) ; reg plus 16-bit displacement
898 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
903 cmp.l #0x5a5a5a5a, @long_dest
907 test_h_gr32 long_dest+100 er1 ; er1 contains destination address
908 test_gr_a5a5 0 ; Make sure other general regs not disturbed
917 set_grs_a5a5 ; Fill all general regs with a fixed pattern
920 ;; not.l @(dd:32, erd)
921 mov #long_dest-0xfffff, er1
922 not.l @(0xfffff:32, er1) ; reg plus 32-bit displacement
928 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
933 cmp.l #0xa5a5a5a5, @long_dest
937 test_h_gr32 long_dest-0xfffff er1 ; er1 contains destination address
938 test_gr_a5a5 0 ; Make sure other general regs not disturbed
947 set_grs_a5a5 ; Fill all general regs with a fixed pattern
951 not.l @long_dest:16 ; 16-bit absolute address
957 test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
962 cmp.l #0x5a5a5a5a, @long_dest
966 test_gr_a5a5 0 ; Make sure ALL general regs not disturbed
976 set_grs_a5a5 ; Fill all general regs with a fixed pattern
980 not.l @long_dest:32 ; 32-bit absolute address
986 test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
991 cmp.l #0xa5a5a5a5, @long_dest
995 test_gr_a5a5 0 ; Make sure ALL general regs not disturbed