* features/Makefile, features/arm-with-iwmmxt.xml,
[external/binutils.git] / gdb / testsuite / gdb.arch / iwmmxt-regs.c
1 /* Register test program.
2
3    Copyright 2007 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
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 2 of the License, or
10    (at your option) any later version.
11
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.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 void
23 read_regs (unsigned long long regs[16], unsigned long control_regs[6])
24 {
25   asm volatile ("wstrd wr0, %0" : "=m" (regs[0]));
26   asm volatile ("wstrd wr1, %0" : "=m" (regs[1]));
27   asm volatile ("wstrd wr2, %0" : "=m" (regs[2]));
28   asm volatile ("wstrd wr3, %0" : "=m" (regs[3]));
29   asm volatile ("wstrd wr4, %0" : "=m" (regs[4]));
30   asm volatile ("wstrd wr5, %0" : "=m" (regs[5]));
31   asm volatile ("wstrd wr6, %0" : "=m" (regs[6]));
32   asm volatile ("wstrd wr7, %0" : "=m" (regs[7]));
33   asm volatile ("wstrd wr8, %0" : "=m" (regs[8]));
34   asm volatile ("wstrd wr9, %0" : "=m" (regs[9]));
35   asm volatile ("wstrd wr10, %0" : "=m" (regs[10]));
36   asm volatile ("wstrd wr11, %0" : "=m" (regs[11]));
37   asm volatile ("wstrd wr12, %0" : "=m" (regs[12]));
38   asm volatile ("wstrd wr13, %0" : "=m" (regs[13]));
39   asm volatile ("wstrd wr14, %0" : "=m" (regs[14]));
40   asm volatile ("wstrd wr15, %0" : "=m" (regs[15]));
41
42   asm volatile ("wstrw wcssf, %0" : "=m" (control_regs[0]));
43   asm volatile ("wstrw wcasf, %0" : "=m" (control_regs[1]));
44   asm volatile ("wstrw wcgr0, %0" : "=m" (control_regs[2]));
45   asm volatile ("wstrw wcgr1, %0" : "=m" (control_regs[3]));
46   asm volatile ("wstrw wcgr2, %0" : "=m" (control_regs[4]));
47   asm volatile ("wstrw wcgr3, %0" : "=m" (control_regs[5]));
48 }
49
50 void
51 write_regs (unsigned long long regs[16], unsigned long control_regs[6])
52 {
53   asm volatile ("wldrd wr0, %0" : : "m" (regs[0]));
54   asm volatile ("wldrd wr1, %0" : : "m" (regs[1]));
55   asm volatile ("wldrd wr2, %0" : : "m" (regs[2]));
56   asm volatile ("wldrd wr3, %0" : : "m" (regs[3]));
57   asm volatile ("wldrd wr4, %0" : : "m" (regs[4]));
58   asm volatile ("wldrd wr5, %0" : : "m" (regs[5]));
59   asm volatile ("wldrd wr6, %0" : : "m" (regs[6]));
60   asm volatile ("wldrd wr7, %0" : : "m" (regs[7]));
61   asm volatile ("wldrd wr8, %0" : : "m" (regs[8]));
62   asm volatile ("wldrd wr9, %0" : : "m" (regs[9]));
63   asm volatile ("wldrd wr10, %0" : : "m" (regs[10]));
64   asm volatile ("wldrd wr11, %0" : : "m" (regs[11]));
65   asm volatile ("wldrd wr12, %0" : : "m" (regs[12]));
66   asm volatile ("wldrd wr13, %0" : : "m" (regs[13]));
67   asm volatile ("wldrd wr14, %0" : : "m" (regs[14]));
68   asm volatile ("wldrd wr15, %0" : : "m" (regs[15]));
69
70   asm volatile ("wldrw wcssf, %0" : : "m" (control_regs[0]));
71   asm volatile ("wldrw wcasf, %0" : : "m" (control_regs[1]));
72   asm volatile ("wldrw wcgr0, %0" : : "m" (control_regs[2]));
73   asm volatile ("wldrw wcgr1, %0" : : "m" (control_regs[3]));
74   asm volatile ("wldrw wcgr2, %0" : : "m" (control_regs[4]));
75   asm volatile ("wldrw wcgr3, %0" : : "m" (control_regs[5]));
76 }
77
78 int
79 main ()
80 {
81   unsigned long long regs[16];
82   unsigned long control_regs[6];
83
84   read_regs (regs, control_regs);
85   write_regs (regs, control_regs);
86
87   return 0;
88 }