;
; group a, test 1
;
; br
; br.eq
; br.ne
; br.lt
; br.ge
; br.gt
; br.le
;

m4_include(..\tmacros.h)

INIT_TEST(p,0x01)

; declare symbols here
SYM(failhop0)
SYM(failhop1)
SYM(failhop2)
SYM(failhop3)
SYM(failhop4)
SYM(failhop5)
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(next14)
SYM(next15)
SYM(next16)
SYM(next17)
SYM(next18)
SYM(next19)


SUBTEST(1)
; br	taken
    br	next0
    halt
next0:

SUBTEST(2)
; br.eq	<taken>
    ld.8    a,0
    cmp.8   a,0
    br.eq   next1
    FAIL
next1:

SUBTEST(3)
; br.eq <not taken>
    ld.8    a,0
    cmp.8   a,1
    br.eq   failhop0
    br	next2
failhop0:
    FAIL
next2:

SUBTEST(4)
; br.ne	<taken>
    ld.8    a,0
    cmp.8   a,1
    br.ne   next3
    FAIL
next3:

SUBTEST(5)
; br.ne <not taken>
    ld.8    a,0
    cmp.8   a,0
    br.ne   failhop1
    br	next4
failhop1:
    FAIL
next4:

SUBTEST(6)
; br.lt	<taken>
    ld.8    a,-5
    cmp.8   a,-2
    br.lt   next5
    FAIL
next5:

SUBTEST(7)
; br.lt <not taken>
    ld.8    a,5
    cmp.8   a,2
    br.lt   failhop2
    br	next6
failhop2:
    FAIL
next6:

SUBTEST(8)
; br.ge	<taken>
    ld.8    a,-12
    cmp.8   a,-12
    br.ge   next7
    FAIL
next7:

SUBTEST(9)
; br.ge <taken, gt>
    ld.8    a,-4
    cmp.8   a,-5
    br.ge   next8
    FAIL
next8:

SUBTEST(10)
; br.ge <not taken>
    ld.8    a,4
    cmp.8   a,5
    br.ge   failhop3
    br	next9
failhop3:
    FAIL
next9:

SUBTEST(11)
; br.gt	<taken>
    ld.8    a,-2
    cmp.8   a,-5
    br.gt   next10
    FAIL
next10:

SUBTEST(12)
; br.gt <not taken>
    ld.8    a,2
    cmp.8   a,5
    br.gt   failhop4
    br	next11
failhop4:
    FAIL
next11:

SUBTEST(13)
; br.le	<taken>
    ld.8    a,-12
    cmp.8   a,-12
    br.le   next12
    FAIL
next12:

SUBTEST(14)
; br.le <taken, ge>
    ld.8    a,-5
    cmp.8   a,-4
    br.le   next13
    FAIL
next13:

SUBTEST(15)
; br.le <not taken>
    ld.8    a,5
    cmp.8   a,4
    br.le   failhop5
    br	next14
failhop5:
    FAIL
next14:

    br  next15
next15:

    ld.16  a,next16
    br	a
    FAIL
next18:
    nop0
    br	next19
next17:
    br  next18
next16:
    br   next17
next19:

;   Finally, when done branch to pass
    END_TEST
