]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.reverse/i386-sse-reverse.c
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / i386-sse-reverse.c
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2009-2013 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 /* Architecture tests for intel i386 platform. */
19
20 void
21 sse_test (void)
22 {
23 char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
24 9, 10, 11, 12, 13, 14, 15};
25 char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23,
26 24, 25, 26, 27, 28, 29, 30, 31};
27 char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39,
28 40, 41, 42, 43, 44, 45, 46, 47};
29
30 asm ("movupd %0, %%xmm0":"=m"(buf0));
31 asm ("movupd %0, %%xmm1":"=m"(buf1));
32 asm ("movupd %0, %%xmm2":"=m"(buf2));
33
34 asm ("addpd %xmm0, %xmm1");
35 asm ("addps %xmm1, %xmm2");
36 asm ("addsd %xmm2, %xmm1");
37 asm ("addss %xmm1, %xmm0");
38 asm ("addsubpd %xmm0, %xmm2");
39 asm ("addsubps %xmm0, %xmm1");
40 asm ("andpd %xmm1, %xmm2");
41 asm ("andps %xmm2, %xmm1");
42 asm ("cmppd $3, %xmm0, %xmm1");
43 asm ("cmpps $4, %xmm1, %xmm2");
44 asm ("cmpsd $5, %xmm2, %xmm1");
45 asm ("cmpss $6, %xmm1, %xmm0");
46 asm ("comisd %xmm0, %xmm2");
47 asm ("comiss %xmm0, %xmm1");
48 asm ("cvtdq2pd %xmm1, %xmm2");
49 asm ("cvtdq2ps %xmm2, %xmm1");
50 asm ("cvtpd2dq %xmm1, %xmm0");
51 asm ("cvtpd2ps %xmm0, %xmm1");
52 asm ("divpd %xmm1, %xmm2");
53 asm ("divps %xmm2, %xmm1");
54 asm ("divsd %xmm1, %xmm0");
55 asm ("divss %xmm0, %xmm2");
56 asm ("mulpd %xmm0, %xmm1");
57 asm ("mulps %xmm1, %xmm2");
58 asm ("mulsd %xmm2, %xmm1");
59 asm ("mulss %xmm1, %xmm0");
60 asm ("orpd %xmm2, %xmm0");
61 asm ("orps %xmm0, %xmm1");
62 asm ("packsswb %xmm0, %xmm2");
63 asm ("packssdw %xmm0, %xmm1");
64 asm ("ucomisd %xmm1, %xmm2");
65 asm ("ucomiss %xmm2, %xmm1");
66 asm ("unpckhpd %xmm1, %xmm0");
67 asm ("unpckhps %xmm2, %xmm0");
68 asm ("xorpd %xmm0, %xmm1");
69 asm ("xorps %xmm1, %xmm2");
70 } /* end sse_test */
71
72 void
73 ssse3_test (void)
74 {
75 char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
76 9, 10, 11, 12, 13, 14, 15};
77 char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23,
78 24, 25, 26, 27, 28, 29, 30, 31};
79 char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39,
80 40, 41, 42, 43, 44, 45, 46, 47};
81
82 asm ("movupd %0, %%xmm0":"=m"(buf0));
83 asm ("movupd %0, %%xmm1":"=m"(buf1));
84 asm ("movupd %0, %%xmm2":"=m"(buf2));
85
86 asm ("pabsb %xmm1, %xmm2");
87 asm ("pabsw %xmm2, %xmm1");
88 asm ("pabsd %xmm1, %xmm0");
89 } /* end ssse3_test */
90
91 void
92 sse4_test (void)
93 {
94 char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
95 9, 10, 11, 12, 13, 14, 15};
96 char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23,
97 24, 25, 26, 27, 28, 29, 30, 31};
98 char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39,
99 40, 41, 42, 43, 44, 45, 46, 47};
100
101 asm ("movupd %0, %%xmm0":"=m"(buf0));
102 asm ("movupd %0, %%xmm1":"=m"(buf1));
103 asm ("movupd %0, %%xmm2":"=m"(buf2));
104
105 asm ("blendpd $1, %xmm1, %xmm0");
106 asm ("blendps $2, %xmm2, %xmm0");
107 asm ("blendvpd %xmm0, %xmm1, %xmm2");
108 asm ("blendvps %xmm0, %xmm2, %xmm1");
109 } /* end sse4_test */
110
111 int
112 main ()
113 {
114 sse_test ();
115 ssse3_test ();
116 sse4_test ();
117 return 0; /* end of main */
118 }