]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/i386-sse-reverse.c
2010-04-02 Hui Zhu <teawater@gmail.com>
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / i386-sse-reverse.c
CommitLineData
eb8e76db
HZ
1/* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2009, 2010 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
20void
21sse_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 ("pabsb %xmm1, %xmm2");
63 asm ("pabsw %xmm2, %xmm1");
64 asm ("pabsd %xmm1, %xmm0");
65 asm ("packsswb %xmm0, %xmm2");
66 asm ("packssdw %xmm0, %xmm1");
67 asm ("ucomisd %xmm1, %xmm2");
68 asm ("ucomiss %xmm2, %xmm1");
69 asm ("unpckhpd %xmm1, %xmm0");
70 asm ("unpckhps %xmm2, %xmm0");
71 asm ("xorpd %xmm0, %xmm1");
72 asm ("xorps %xmm1, %xmm2");
73} /* end sse_test */
74
75void
76sse4_test (void)
77{
78 char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
79 9, 10, 11, 12, 13, 14, 15};
80 char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23,
81 24, 25, 26, 27, 28, 29, 30, 31};
82 char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39,
83 40, 41, 42, 43, 44, 45, 46, 47};
84
85 asm ("movupd %0, %%xmm0":"=m"(buf0));
86 asm ("movupd %0, %%xmm1":"=m"(buf1));
87 asm ("movupd %0, %%xmm2":"=m"(buf2));
88
89 asm ("blendpd $1, %xmm1, %xmm0");
90 asm ("blendps $2, %xmm2, %xmm0");
91 asm ("blendvpd %xmm0, %xmm1, %xmm2");
92 asm ("blendvps %xmm0, %xmm2, %xmm1");
93} /* end sse4_test */
94
95int
96main ()
97{
98 sse_test ();
99 sse4_test ();
100 return 0; /* end of main */
101}