;
; group s, test 3
;
; cmpb.lt.16 a,u16(dp),e8
; cmpb.lt.16 a,u8(sp),d8
; cmpb.lt.16 a,u8(b),d8
; cmpb.lt.16 a,i16
; cmpb.lt.16 a,extii8
; cmpb.lt.16 a,0
; cmpb.lt.16 a,b
;

m4_include(..\tmacros.h)

INIT_TEST(s,0x03)

; declare symbols here
SYM(hop)
SYM(d1)
SYM(d2)
SYM(d3)
SYM(next0)
SYM(next1)
SYM(next2)
SYM(next3)
SYM(next4)
SYM(next5)
SYM(next6)
SYM(next7)
SYM(next8)
SYM(next9)
SYM(next10)
SYM(next11)
SYM(next12)
SYM(next13)
SYM(fail0)
SYM(fail1)
SYM(fail2)
SYM(fail3)
SYM(fail4)
SYM(fail5)
SYM(fail6)

    br	hop

d1:
    defw    0xf000
    defw    0xff00
    defw    0x8000
d2:
    defw    0x0000
    defw    0x7000
    defw    0x8400
d3:
    defw    0x0f00
    defw    0x1700
    defw    0xf000

hop:
; Begin test here

SUBTEST(1)
;   cmpb.lt.16  a,u16(dp),d8
    ld.16   a,d1
    lea	    a,-555(a)
    copy    dp,a
    ld.16    a,555(dp)
    cmpb.lt.16	a,555+2(dp),next0
    FAIL
next0:
    cmpb.lt.16	a,555+4(dp),fail0
    br	next2
fail0:
    FAIL
next2:

SUBTEST(2)
;   cmpb.lt.16	a,u8(sp),d8
    ld.16   a,d2
    lea	a,-44(a)
    copy    sp,a
    ld.16    a,44(sp)
    cmpb.lt.16	a,44+2(sp),next3
    FAIL
next3:
    cmpb.lt.16	a,44+4(sp),fail1
    br	next4
fail1:
    FAIL
next4:
    ld.16   a,0x7000
    copy    sp,a

SUBTEST(3)
;   cmpb.lt.16	a,u8(b),d8
    ld.16   b,d3
    lea	    b,-200(b)
    ld.16    a,200(b)
    cmpb.lt.16	a,200+2(b),next5
    FAIL
next5:
    cmpb.lt.16	a,200+4(b),fail2
    br	next6
fail2:
    FAIL
next6:

SUBTEST(4)
;   cmpb.lt.16	a,i16,d8
    ld.16    a,2020
    cmpb.lt.16	a,2021,next7
    FAIL
next7:
    cmpb.lt.16	a,1030,fail3
    br	next8
fail3:
    FAIL
next8:

SUBTEST(5)
;   cmpb.lt.16	a,i8,d8
    ld.16    a,-12
    cmpb.lt.16	a,-11,next8
    FAIL
next8:
    cmpb.lt.16	a,-13,fail4
    br	next9
fail4:
    FAIL
next9:

SUBTEST(6)
;   cmpb.lt.16	a,0,d8
    ld.16    a,0
    cmpb.lt.16	a,1,next10
    FAIL
next10:
    cmpb.lt.16	a,0xff00,fail5
    br	next11
fail5:
    FAIL
next11:

SUBTEST(7)
;   cmpb.lt.16	a,b,d8
    ld.16    a,1000
    ld.16    b,1100
    cmpb.lt.16	a,b,next12
    FAIL
next12:
    ld.16    b,-1200
    cmpb.lt.16	a,b,fail6
    br	next13
fail6:
    FAIL
next13:





;   Finally, when done branch to pass
    END_TEST
