]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/testsuite/sim/arm/thumb/testutils.inc
config:
[thirdparty/binutils-gdb.git] / sim / testsuite / sim / arm / thumb / testutils.inc
1 # FIXME: wip, copied from ../testutils.inc
2 # r0-r3 are used as tmps, consider them call clobbered by these macros.
3 # This uses the angel rom monitor calls.
4 # ??? How do we use the \@ facility of .macros ???
5 # @ is the comment char!
6
7 .macro a_mvi_h_gr reg, val
8 ldr \reg,[pc]
9 b . + 8
10 .word \val
11 .endm
12
13 .macro mvaddr_h_gr reg, addr
14 ldr \reg,[pc]
15 b . + 8
16 .word \val
17 .endm
18
19 .macro start
20 .data
21 failmsg:
22 .asciz "fail\n"
23 passmsg:
24 .asciz "pass\n"
25 .text
26
27 do_pass:
28 ldr r1, passmsg_addr
29 mov r0, #4
30 swi #0x123456
31 exit 0
32 passmsg_addr:
33 .word passmsg
34
35 do_fail:
36 ldr r1, failmsg_addr
37 mov r0, #4
38 swi #0x123456
39 exit 1
40 failmsg_addr:
41 .word failmsg
42
43 .global _start
44 _start:
45 .endm
46
47 # *** Other macros know pass/fail are 4 bytes in size! Yuck.
48
49 .macro pass
50 b do_pass
51 .endm
52
53 .macro fail
54 b do_fail
55 .endm
56
57 .macro exit rc
58 mov r1, #\rc
59 mov r0, #0x2a @ decimal 42
60 swi #1
61 # If that returns, punt with a sigill.
62 stc 0,cr0,[r0]
63 .endm
64
65 # Other macros know this only clobbers r0.
66 .macro test_h_gr reg, val
67 mvaddr_h_gr r0, \val
68 cmp \reg, r0
69 beq . + 8
70 fail
71 .endm
72
73 .macro mvi_h_cc c, n, v, z
74 ldi8 r0, 0
75 ldi8 r1, 1
76 .if xxx
77 cmp r0, r1
78 .else
79 cmp r1, r0
80 .endif
81 .endm
82
83 .macro test_h_cc c, n, v, z
84 .if xxx
85 bc . + 8
86 fail
87 .else
88 bnc . + 8
89 fail
90 .endif
91 .endm