1 /* Thumb-2 IT blocks test program.
3 Copyright 2010-2013 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
43 @ One conditional instruction, executed.
49 it eq @ IT instruction, Expected == 1
50 addeq r0, #1 @ Reached
53 @ One conditional instruction, skipped.
59 it ne @ IT instruction, Expected == 0
60 addne r0, #1 @ Not reached
61 bx lr @ Done, Check $r0 == 0
63 @ Block of four, alternating, starting with executed.
69 itete ge @ IT instruction, Expected == 2
70 addge r0, #1 @ Reached
71 addlt r0, #2 @ Not reached
72 addge r0, #4 @ Reached
73 addlt r0, #8 @ Not reached
74 bx lr @ Done, Check $r0 == 5
76 @ Block of four, changing flags.
82 itttt ge @ IT instruction, Expected == 2
83 addge r0, #1 @ Reached
84 cmpge r0, #10 @ Reached
85 addge r0, #4 @ Not reached
86 addge r0, #8 @ Not reached
87 bx lr @ Done, Check $r0 == 1
89 @ Block of two, ending with taken branch.
95 itt ge @ IT instruction, Expected == 2
96 addge r0, #1 @ Reached
98 add r0, #2 @ Never reached
99 .L5: bx lr @ Done, Check $r0 == 1
101 @ Block of two, ending with untaken branch.
107 ite ge @ IT instruction, Expected == 2
108 addge r0, #1 @ Reached
109 blt .L6 @ Not reached
111 .L6: bx lr @ Done, Check $r0 == 3
113 @ Block of four, taken, of different sizes
119 itttt ge @ IT instruction, Expected == 4
120 addge.n r0, #1 @ Reached
121 addge.w r0, #2 @ Reached
122 addge.n r0, #4 @ Reached
123 addge.w r0, #8 @ Reached
124 bx lr @ Done, Check $r0 == 15
126 @ Block of four, only first executed.
132 iteee ge @ IT instruction, Expected == 1
133 addge r0, #1 @ Reached
134 addlt r0, #2 @ Not reached
135 addlt r0, #4 @ Not reached
136 addlt r0, #8 @ Not reached
137 bx lr @ Done, Check $r0 == 1
139 .type it_breakpoints,%function
144 it eq @ Location 1 @ Break 1
148 moveq r0, #0 @ Break 2
151 movne r0, #0 @ Break 3
153 @ An IT block of maximum size.
154 itttt eq @ Location 4
158 moveq.w r0, #0 @ Break 4
160 @ Just outside an IT block.
163 mov r0, #0 @ Location 5 @ Break 5
165 @ After something that looks like an IT block, but
166 @ is the second half of an instruction.
170 b.w .+0xe14 @ 0xf000 0xbf08 -> second half is IT EQ
171 1: mov r0, #0 @ Location 6 @ Break 6
173 @ After something that looks like an IT block, but
178 1: mov r0, #0 @ Location 7 @ Break 7
182 #endif /* __thumb2__ */