aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
committerJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
commitb094d6c4bf572654a031ecc4afe675154c886dc5 (patch)
tree89394c56b05e13a5413ee60237d65b0214fd98e2 /gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c
parentdc34721ac3bf7e3c406fba8cfe9d139393345ec5 (diff)
downloadtoolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.gz
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.bz2
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.zip
commit gcc-4.4.3 which is used to build gcc-4.4.3 Android toolchain in master.
The source is based on fsf gcc-4.4.3 and contains local patches which are recorded in gcc-4.4.3/README.google. Change-Id: Id8c6d6927df274ae9749196a1cc24dbd9abc9887
Diffstat (limited to 'gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c')
-rw-r--r--gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c
new file mode 100644
index 000000000..c1bd1006d
--- /dev/null
+++ b/gcc-4.4.3/gcc/testsuite/gcc.target/i386/sse4a-insert.c
@@ -0,0 +1,94 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sse4a } */
+/* { dg-options "-O2 -msse4a" } */
+
+#include "sse4a-check.h"
+
+#include <ammintrin.h>
+
+typedef union
+{
+ long long i[2];
+ __m128i vec;
+} LI;
+
+static long long
+sse4a_test_insert (long long in1, long long in2)
+{
+ __m128i v1,v2;
+ long long index_length, pad;
+ LI v_out;
+ index_length = 0x0000000000000810LL;
+ pad = 0x0;
+ v1 = _mm_set_epi64x (pad, in1);
+ v2 = _mm_set_epi64x (index_length, in2);
+ v_out.vec = _mm_insert_si64 (v1, v2);
+ return (v_out.i[0]);
+}
+
+static long long
+sse4a_test_inserti (long long in1, long long in2)
+{
+ __m128i v1,v2;
+ long long pad = 0x0;
+ LI v_out;
+ v1 = _mm_set_epi64x (pad, in1);
+ v2 = _mm_set_epi64x (pad, in2);
+ v_out.vec = _mm_inserti_si64 (v1, v2, (unsigned int) 0x10, (unsigned int) 0x08);
+ return (v_out.i[0]);
+}
+
+static chk (long long i1, long long i2)
+{
+ int n_fails =0;
+ if (i1 != i2)
+ n_fails +=1;
+ return n_fails;
+}
+
+long long vals_in1[5] =
+ {
+ 0x1234567887654321LL,
+ 0x1456782093002490LL,
+ 0x2340909123990390LL,
+ 0x9595959599595999LL,
+ 0x9099038798000029LL
+ };
+
+long long vals_in2[5] =
+ {
+ 0x9ABCDEF00FEDCBA9LL,
+ 0x234567097289672ALL,
+ 0x45476453097BD342LL,
+ 0x23569012AE586FF0LL,
+ 0x432567ABCDEF765DLL
+ };
+
+long long vals_out[5] =
+ {
+ 0x1234567887CBA921LL,
+ 0x1456782093672A90LL,
+ 0x2340909123D34290LL,
+ 0x95959595996FF099LL,
+ 0x9099038798765D29LL
+ };
+
+static void
+sse4a_test (void)
+{
+ int i;
+ int fail = 0;
+ long long out;
+
+ for (i = 0; i < 5; i += 1)
+ {
+ out = sse4a_test_insert (vals_in1[i], vals_in2[i]);
+ fail += chk(out, vals_out[i]);
+
+ out = sse4a_test_inserti (vals_in1[i], vals_in2[i]);
+ fail += chk(out, vals_out[i]);
+ }
+
+ if (fail != 0)
+ abort ();
+}