1 # Hitachi H8 testcase 'exts.l, extu.l'
2 # mach(): h8300h h8300s h8sx
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"
20 pos2: .long 0xffffff01
21 neg2: .long 0x00000080
32 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
35 test_h_gr32 0x00000001 er0 ; result of sign extend
36 test_gr_a5a5 1 ; Make sure other general regs not disturbed
51 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
57 test_h_gr32 0xffffffff er0 ; result of sign extend
58 test_gr_a5a5 1 ; Make sure other general regs not disturbed
73 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
76 test_h_gr32 0x0000ffff er0 ; result of zero extend
77 test_gr_a5a5 1 ; Make sure other general regs not disturbed
93 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
96 test_h_gr32 pos er1 ; er1 still contains target address
97 test_gr_a5a5 0 ; Make sure other general regs not disturbed
104 cmp.l #0x00000001, @pos
108 mov.l #0xffff0001, @pos ; Restore initial value
117 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
123 test_h_gr32 neg er1 ; er1 still contains target address
124 test_gr_a5a5 0 ; Make sure other general regs not disturbed
131 cmp.l #0xffff8000, @neg
135 ;;; Note: leave the value as 0xffff8000, so that extu has work to do.
144 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
147 test_h_gr32 neg er1 ; er1 still contains target address
148 test_gr_a5a5 0 ; Make sure other general regs not disturbed
155 cmp.l #0x00008000, @neg
159 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
168 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
171 test_h_gr32 pos+4 er1 ; er1 still contains target address
172 test_gr_a5a5 0 ; Make sure other general regs not disturbed
179 cmp.l #0x00000001, @pos
183 mov.l #0xffff0001, @pos ; Restore initial value
192 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
198 test_h_gr32 neg+4 er1 ; er1 still contains target address
199 test_gr_a5a5 0 ; Make sure other general regs not disturbed
206 cmp.l #0xffff8000, @neg
210 ;;; Note: leave the value as 0xffff8000, so that extu has work to do.
219 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
222 test_h_gr32 neg+4 er1 ; er1 still contains target address
223 test_gr_a5a5 0 ; Make sure other general regs not disturbed
230 cmp.l #0x00008000, @neg
234 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
243 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
246 test_h_gr32 pos-4 er1 ; er1 still contains target address
247 test_gr_a5a5 0 ; Make sure other general regs not disturbed
254 cmp.l #0x00000001, @pos
258 mov.l #0xffff0001, @pos ; Restore initial value
267 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
273 test_h_gr32 neg-4 er1 ; er1 still contains target address
274 test_gr_a5a5 0 ; Make sure other general regs not disturbed
281 cmp.l #0xffff8000, @neg
285 ;;; Note: leave the value as 0xffff8000, so that extu has work to do.
294 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
297 test_h_gr32 neg-4 er1 ; er1 still contains target address
298 test_gr_a5a5 0 ; Make sure other general regs not disturbed
305 cmp.l #0x00008000, @neg
309 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
318 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
321 test_h_gr32 pos er1 ; er1 still contains target address
322 test_gr_a5a5 0 ; Make sure other general regs not disturbed
329 cmp.l #0x00000001, @pos
333 mov.l #0xffff0001, @pos ; Restore initial value
342 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
348 test_h_gr32 neg er1 ; er1 still contains target address
349 test_gr_a5a5 0 ; Make sure other general regs not disturbed
356 cmp.l #0xffff8000, @neg
360 ;;; Note: leave the value as 0xffff8000, so that extu has work to do.
369 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
372 test_h_gr32 neg er1 ; er1 still contains target address
373 test_gr_a5a5 0 ; Make sure other general regs not disturbed
380 cmp.l #0x00008000, @neg
384 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
393 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
396 test_h_gr32 pos er1 ; er1 still contains target address
397 test_gr_a5a5 0 ; Make sure other general regs not disturbed
404 cmp.l #0x00000001, @pos
408 mov.l #0xffff0001, @pos ; Restore initial value
417 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
423 test_h_gr32 neg er1 ; er1 still contains target address
424 test_gr_a5a5 0 ; Make sure other general regs not disturbed
431 cmp.l #0xffff8000, @neg
435 ;;; Note: leave the value as 0xffff8000, so that extu has work to do.
444 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
447 test_h_gr32 neg er1 ; er1 still contains target address
448 test_gr_a5a5 0 ; Make sure other general regs not disturbed
455 cmp.l #0x00008000, @neg
459 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
464 ;; extu.l @(dd:2, ern32)
468 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
471 test_h_gr32 neg-8 er1 ; er1 still contains target address
472 test_gr_a5a5 0 ; Make sure other general regs not disturbed
479 cmp.l #0x00008000, @neg
483 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
488 ;; extu.l @(dd:16, ern32)
492 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
495 test_h_gr32 neg-44 er1 ; er1 still contains target address
496 test_gr_a5a5 0 ; Make sure other general regs not disturbed
503 cmp.l #0x00008000, @neg
507 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
512 ;; extu.l @(dd:32, ern32)
514 extu.l @(-444:32, er1)
516 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
519 test_h_gr32 neg+444 er1 ; er1 still contains target address
520 test_gr_a5a5 0 ; Make sure other general regs not disturbed
527 cmp.l #0x00008000, @neg
531 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
539 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
542 test_gr_a5a5 0 ; Make sure other general regs not disturbed
550 cmp.l #0x00008000, @neg
554 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
562 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
565 test_gr_a5a5 0 ; Make sure other general regs not disturbed
573 cmp.l #0x00008000, @neg
577 ;;; Note: leave the value as 0x00008000, so that extu has work to do.
592 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
595 test_h_gr32 0x00000001 er0 ; result of sign extend
596 test_gr_a5a5 1 ; Make sure other general regs not disturbed
611 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
617 test_h_gr32 0xffffffff er0 ; result of sign extend
618 test_gr_a5a5 1 ; Make sure other general regs not disturbed
633 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
636 test_h_gr32 0x000000ff er0 ; result of zero extend
637 test_gr_a5a5 1 ; Make sure other general regs not disturbed
652 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
655 test_h_gr32 pos2 er1 ; result of sign extend
656 test_gr_a5a5 0 ; Make sure other general regs not disturbed
663 cmp.l #0x00000001, @pos2
667 mov.l #0xffffff01, @pos2 ; Restore initial value
676 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
682 test_h_gr32 neg2 er1 ; result of sign extend
683 test_gr_a5a5 0 ; Make sure other general regs not disturbed
690 cmp.l #0xffffff80, @neg2
694 ;;; Note: leave the value as 0xffffff80, so that extu has work to do.
703 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
706 test_h_gr32 neg2 er1 ; result of zero extend
707 test_gr_a5a5 0 ; Make sure other general regs not disturbed
714 cmp.l #0x00000080, @neg2
718 ;;; Note: leave the value as 0x00000080, like it started out.
723 ;; exts.l #2, @ern32+
727 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
730 test_h_gr32 pos2+4 er1 ; result of sign extend
731 test_gr_a5a5 0 ; Make sure other general regs not disturbed
738 cmp.l #0x00000001, @pos2
742 mov.l #0xffffff01, @pos2 ; Restore initial value
747 ;; exts.l #2, @ern32+
751 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
757 test_h_gr32 neg2+4 er1 ; result of sign extend
758 test_gr_a5a5 0 ; Make sure other general regs not disturbed
765 cmp.l #0xffffff80, @neg2
769 ;;; Note: leave the value as 0xffffff80, so that extu has work to do.
774 ;; extu.l #2, @ern32+
778 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
781 test_h_gr32 neg2+4 er1 ; result of zero extend
782 test_gr_a5a5 0 ; Make sure other general regs not disturbed
789 cmp.l #0x00000080, @neg2
793 ;;; Note: leave the value as 0x00000080, like it started out.
798 ;; exts.l #2, @ern32-
802 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
805 test_h_gr32 pos2-4 er1 ; result of sign extend
806 test_gr_a5a5 0 ; Make sure other general regs not disturbed
813 cmp.l #0x00000001, @pos2
817 mov.l #0xffffff01, @pos2 ; Restore initial value
822 ;; exts.l #2, @ern32-
826 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
832 test_h_gr32 neg2-4 er1 ; result of sign extend
833 test_gr_a5a5 0 ; Make sure other general regs not disturbed
840 cmp.l #0xffffff80, @neg2
844 ;;; Note: leave the value as 0xffffff80, so that extu has work to do.
849 ;; extu.l #2, @ern32-
853 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
856 test_h_gr32 neg2-4 er1 ; result of zero extend
857 test_gr_a5a5 0 ; Make sure other general regs not disturbed
864 cmp.l #0x00000080, @neg2
868 ;;; Note: leave the value as 0x00000080, like it started out.
873 ;; exts.l #2, @+ern32
877 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
880 test_h_gr32 pos2 er1 ; result of sign extend
881 test_gr_a5a5 0 ; Make sure other general regs not disturbed
888 cmp.l #0x00000001, @pos2
892 mov.l #0xffffff01, @pos2 ; Restore initial value
897 ;; exts.l #2, @+ern32
901 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
907 test_h_gr32 neg2 er1 ; result of sign extend
908 test_gr_a5a5 0 ; Make sure other general regs not disturbed
915 cmp.l #0xffffff80, @neg2
919 ;;; Note: leave the value as 0xffffff80, so that extu has work to do.
924 ;; extu.l #2, @+ern32
928 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
931 test_h_gr32 neg2 er1 ; result of zero extend
932 test_gr_a5a5 0 ; Make sure other general regs not disturbed
939 cmp.l #0x00000080, @neg2
943 ;;; Note: leave the value as 0x00000080, like it started out.
948 ;; exts.l #2, @-ern32
952 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
955 test_h_gr32 pos2 er1 ; result of sign extend
956 test_gr_a5a5 0 ; Make sure other general regs not disturbed
963 cmp.l #0x00000001, @pos2
967 mov.l #0xffffff01, @pos2 ; Restore initial value
972 ;; exts.l #2, @-ern32
976 ;; Test ccr H=0 N=1 Z=0 V=0 C=0
982 test_h_gr32 neg2 er1 ; result of sign extend
983 test_gr_a5a5 0 ; Make sure other general regs not disturbed
990 cmp.l #0xffffff80, @neg2
994 ;;; Note: leave the value as 0xffffff80, so that extu has work to do.
999 ;; extu.l #2, @-ern32
1003 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
1006 test_h_gr32 neg2 er1 ; result of zero extend
1007 test_gr_a5a5 0 ; Make sure other general regs not disturbed
1014 cmp.l #0x00000080, @neg2
1018 ;;; Note: leave the value as 0x00000080, like it started out.
1023 ;; extu.l #2, @(dd:2, ern32)
1025 extu.l #2, @(8:2, er1)
1027 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
1030 test_h_gr32 neg2-8 er1 ; result of zero extend
1031 test_gr_a5a5 0 ; Make sure other general regs not disturbed
1038 cmp.l #0x00000080, @neg2
1042 ;;; Note: leave the value as 0x00000080, like it started out.
1047 ;; extu.l #2, @(dd:16, ern32)
1049 extu.l #2, @(44:16, er1)
1051 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
1054 test_h_gr32 neg2-44 er1 ; result of zero extend
1055 test_gr_a5a5 0 ; Make sure other general regs not disturbed
1062 cmp.l #0x00000080, @neg2
1066 ;;; Note: leave the value as 0x00000080, like it started out.
1071 ;; extu.l #2, @(dd:32, ern32)
1072 mov.l #neg2+444, er1
1073 extu.l #2, @(-444:32, er1)
1075 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
1078 test_h_gr32 neg2+444 er1 ; result of zero extend
1079 test_gr_a5a5 0 ; Make sure other general regs not disturbed
1086 cmp.l #0x00000080, @neg2
1090 ;;; Note: leave the value as 0x00000080, like it started out.
1095 ;; extu.l #2, @aa:16
1098 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
1101 test_gr_a5a5 0 ; Make sure other general regs not disturbed
1109 cmp.l #0x00000080, @neg2
1113 ;;; Note: leave the value as 0x00000080, like it started out.
1118 ;; extu.l #2, @aa:32
1121 ;; Test ccr H=0 N=0 Z=0 V=0 C=0
1124 test_gr_a5a5 0 ; Make sure other general regs not disturbed
1132 cmp.l #0x00000080, @neg2
1136 ;;; Note: leave the value as 0x00000080, like it started out.