Imported Upstream version 3.0
[debian/gnuradio] / gnuradio-core / src / lib / filter / sse_debug.c
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2002 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio 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, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 #include <stdio.h>
23 #include <sse_debug.h>
24 #include <string.h>
25
26 void
27 format_xmm_regs (FILE *f, struct xmm_regs *r)
28 {
29   int   i;
30
31   for (i = 0; i < 8; i++){
32     union xmm_register *x = &r->xmm[i];
33     fprintf (f, "xmm%d: %08lx %08lx %08lx %08lx", i,
34              x->ul[0], x->ul[1], x->ul[2], x->ul[3]);
35     fprintf (f, "  %12g %12g %12g %12g\n",
36              x->f[0],  x->f[1],  x->f[2],  x->f[3]);
37   }
38 }
39
40
41 void
42 get_xmm_regs (struct xmm_regs *x)
43 {
44   asm ("movups %%xmm0,0x00(%0); \n"
45        "movups %%xmm1,0x10(%0); \n"
46        "movups %%xmm2,0x20(%0); \n"
47        "movups %%xmm3,0x30(%0); \n"
48        "movups %%xmm4,0x40(%0); \n"
49        "movups %%xmm5,0x50(%0); \n"
50        "movups %%xmm6,0x60(%0); \n"
51        "movups %%xmm7,0x70(%0); \n" : : "r" (x));
52 }
53
54 void 
55 dump_xmm_regs (void)
56 {
57   struct xmm_regs       r;
58
59   get_xmm_regs (&r);
60   format_xmm_regs (stderr, &r);
61 }
62