OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.arch/] [i386-sse.c] - Blame information for rev 840

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Test program for SSE registers.
2
 
3
   Copyright 2004, 2007, 2008 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 3 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, see <http://www.gnu.org/licenses/>.  */
19
 
20
#include <stdio.h>
21
#include "i386-cpuid.h"
22
 
23
typedef struct {
24
  float f[4];
25
} v4sf_t;
26
 
27
 
28
v4sf_t data[8] =
29
  {
30
    { {  0.0, 0.25, 0.50, 0.75 } },
31
    { {  1.0, 1.25, 1.50, 1.75 } },
32
    { {  2.0, 2.25, 2.50, 2.75 } },
33
    { {  3.0, 3.25, 3.50, 3.75 } },
34
    { {  4.0, 4.25, 4.50, 4.75 } },
35
    { {  5.0, 5.25, 5.50, 5.75 } },
36
    { {  6.0, 6.25, 6.50, 6.75 } },
37
    { {  7.0, 7.25, 7.50, 7.75 } },
38
  };
39
 
40
 
41
int
42
have_sse (void)
43
{
44
  int edx = i386_cpuid ();
45
 
46
  if (edx & bit_SSE)
47
    return 1;
48
  else
49
    return 0;
50
}
51
 
52
int
53
main (int argc, char **argv)
54
{
55
  if (have_sse ())
56
    {
57
      asm ("movaps 0(%0), %%xmm0\n\t"
58
           "movaps 16(%0), %%xmm1\n\t"
59
           "movaps 32(%0), %%xmm2\n\t"
60
           "movaps 48(%0), %%xmm3\n\t"
61
           "movaps 64(%0), %%xmm4\n\t"
62
           "movaps 80(%0), %%xmm5\n\t"
63
           "movaps 96(%0), %%xmm6\n\t"
64
           "movaps 112(%0), %%xmm7\n\t"
65
           : /* no output operands */
66
           : "r" (data)
67
           : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
68
 
69
      puts ("Hi!"); /* first breakpoint here */
70
 
71
      asm (
72
           "movaps %%xmm0, 0(%0)\n\t"
73
           "movaps %%xmm1, 16(%0)\n\t"
74
           "movaps %%xmm2, 32(%0)\n\t"
75
           "movaps %%xmm3, 48(%0)\n\t"
76
           "movaps %%xmm4, 64(%0)\n\t"
77
           "movaps %%xmm5, 80(%0)\n\t"
78
           "movaps %%xmm6, 96(%0)\n\t"
79
           "movaps %%xmm7, 112(%0)\n\t"
80
           : /* no output operands */
81
           : "r" (data)
82
           : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
83
 
84
      puts ("Bye!"); /* second breakpoint here */
85
    }
86
 
87
  return 0;
88
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.