aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.reverse/i386-sse-reverse.c
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2010-04-02 05:13:09 +0000
committerHui Zhu <teawater@gmail.com>2010-04-02 05:13:09 +0000
commiteb8e76db62be7f9c66669baa51ba660b445cd835 (patch)
tree2bf621275897f0efd7add5fece01834f05ca3b3b /gdb/testsuite/gdb.reverse/i386-sse-reverse.c
parenta3c4230a6352173ed7b57e835478cbae4e2d8327 (diff)
downloadgdb-eb8e76db62be7f9c66669baa51ba660b445cd835.zip
gdb-eb8e76db62be7f9c66669baa51ba660b445cd835.tar.gz
gdb-eb8e76db62be7f9c66669baa51ba660b445cd835.tar.bz2
2010-04-02 Hui Zhu <teawater@gmail.com>
Michael Snyder <msnyder@vmware.com> * gdb.reverse/i386-sse-reverse.exp: New file. * gdb.reverse/i386-sse-reverse.c: New file.
Diffstat (limited to 'gdb/testsuite/gdb.reverse/i386-sse-reverse.c')
-rw-r--r--gdb/testsuite/gdb.reverse/i386-sse-reverse.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.reverse/i386-sse-reverse.c b/gdb/testsuite/gdb.reverse/i386-sse-reverse.c
new file mode 100644
index 0000000..72e3ad8
--- /dev/null
+++ b/gdb/testsuite/gdb.reverse/i386-sse-reverse.c
@@ -0,0 +1,101 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009, 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Architecture tests for intel i386 platform. */
+
+void
+sse_test (void)
+{
+ char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15};
+ char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31};
+ char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47};
+
+ asm ("movupd %0, %%xmm0":"=m"(buf0));
+ asm ("movupd %0, %%xmm1":"=m"(buf1));
+ asm ("movupd %0, %%xmm2":"=m"(buf2));
+
+ asm ("addpd %xmm0, %xmm1");
+ asm ("addps %xmm1, %xmm2");
+ asm ("addsd %xmm2, %xmm1");
+ asm ("addss %xmm1, %xmm0");
+ asm ("addsubpd %xmm0, %xmm2");
+ asm ("addsubps %xmm0, %xmm1");
+ asm ("andpd %xmm1, %xmm2");
+ asm ("andps %xmm2, %xmm1");
+ asm ("cmppd $3, %xmm0, %xmm1");
+ asm ("cmpps $4, %xmm1, %xmm2");
+ asm ("cmpsd $5, %xmm2, %xmm1");
+ asm ("cmpss $6, %xmm1, %xmm0");
+ asm ("comisd %xmm0, %xmm2");
+ asm ("comiss %xmm0, %xmm1");
+ asm ("cvtdq2pd %xmm1, %xmm2");
+ asm ("cvtdq2ps %xmm2, %xmm1");
+ asm ("cvtpd2dq %xmm1, %xmm0");
+ asm ("cvtpd2ps %xmm0, %xmm1");
+ asm ("divpd %xmm1, %xmm2");
+ asm ("divps %xmm2, %xmm1");
+ asm ("divsd %xmm1, %xmm0");
+ asm ("divss %xmm0, %xmm2");
+ asm ("mulpd %xmm0, %xmm1");
+ asm ("mulps %xmm1, %xmm2");
+ asm ("mulsd %xmm2, %xmm1");
+ asm ("mulss %xmm1, %xmm0");
+ asm ("orpd %xmm2, %xmm0");
+ asm ("orps %xmm0, %xmm1");
+ asm ("pabsb %xmm1, %xmm2");
+ asm ("pabsw %xmm2, %xmm1");
+ asm ("pabsd %xmm1, %xmm0");
+ asm ("packsswb %xmm0, %xmm2");
+ asm ("packssdw %xmm0, %xmm1");
+ asm ("ucomisd %xmm1, %xmm2");
+ asm ("ucomiss %xmm2, %xmm1");
+ asm ("unpckhpd %xmm1, %xmm0");
+ asm ("unpckhps %xmm2, %xmm0");
+ asm ("xorpd %xmm0, %xmm1");
+ asm ("xorps %xmm1, %xmm2");
+} /* end sse_test */
+
+void
+sse4_test (void)
+{
+ char buf0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15};
+ char buf1[] = {16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31};
+ char buf2[] = {32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47};
+
+ asm ("movupd %0, %%xmm0":"=m"(buf0));
+ asm ("movupd %0, %%xmm1":"=m"(buf1));
+ asm ("movupd %0, %%xmm2":"=m"(buf2));
+
+ asm ("blendpd $1, %xmm1, %xmm0");
+ asm ("blendps $2, %xmm2, %xmm0");
+ asm ("blendvpd %xmm0, %xmm1, %xmm2");
+ asm ("blendvps %xmm0, %xmm2, %xmm1");
+} /* end sse4_test */
+
+int
+main ()
+{
+ sse_test ();
+ sse4_test ();
+ return 0; /* end of main */
+}