1 /* Copyright (C) 2000-2020 Free Software Foundation, Inc.
2 Contributed by Alexandre Oliva <aoliva@cygnus.com>
4 This file is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
18 /* Generator of tests for insns introduced in AM33 2.0.
20 See the following file for usage and documentation. */
21 #include "../all/test-gen.c"
23 /* Define any char*[]s you may need here. */
24 char *named_regs
[] = { "a", "b", "c", "d" };
26 /* Define helper macros to generate register accesses here. */
27 #define namedregs(shift) \
28 reg_r (named_regs, shift, 0x3, mk_get_bits (2u))
29 #define numberedregs(shift) \
30 reg_p ("f", shift, mk_get_bits (2u))
32 /* Define helper functions here. */
34 jmp_cond (func_arg
* arg
, insn_data
* data
)
35 #define jmp_cond(shift) { jmp_cond, { i1: shift } }
37 static const char conds
[4][2] = { "z", "n", "g", "l" };
38 unsigned val
= get_bits (2u);
40 data
->as_in
= data
->dis_out
= strdup (conds
[val
]);
41 data
->bits
= val
<< arg
->i1
;
43 /* Do not forget to return 0, otherwise the insn will be skipped. */
47 /* Define convenience wrappers to define_insn. */
48 #define cond_jmp_insn(insname, word, funcs...) \
49 define_insn (insname, \
50 insn_size_bits (insname, 1, word), \
56 cond_jmp_insn (j
, 0x40, numberedregs(2), comma
, namedregs (0));
58 /* Define an insn group. */
65 /* Define the set of all groups. */
69 { "jumps", jmp_insns
},
74 main (int argc
, char *argv
[])
76 FILE *as_in
= stdout
, *dis_out
= stderr
;
78 /* Check whether we're filtering insns. */
82 /* Output assembler header. */
86 /* Output comments for the testsuite-driver and the initial
87 disassembler output. */
88 fputs ("#objdump: -dr --prefix-address --show-raw-insn\n"
89 "#name: Foo Digital Processor\n"
92 "# Test the instructions of FooD\n"
94 ".*: +file format.*food.*\n"
96 "Disassembly of section .text:\n",
99 /* Now emit all (selected) insns. */
100 output_groups (groups
, as_in
, dis_out
);
This page took 0.123266 seconds and 4 git commands to generate.