aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2002-03-12 01:24:42 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2002-03-12 01:24:42 +0000
commit55a21c32e7f7b50a50351b4f51d5720bdd1921a1 (patch)
tree3e1505f5bd59a1baa3e638de5d60e473e0ccc4c0 /gcc
parentbc204393c834739e398207f5e5c2e671ef56210f (diff)
downloadgcc-55a21c32e7f7b50a50351b4f51d5720bdd1921a1.zip
gcc-55a21c32e7f7b50a50351b4f51d5720bdd1921a1.tar.gz
gcc-55a21c32e7f7b50a50351b4f51d5720bdd1921a1.tar.bz2
altivec-1.c: Cleanup and use altivec.h.
2002-03-11 Aldy Hernandez <aldyh@redhat.com> * gcc.dg/altivec-1.c: Cleanup and use altivec.h. From-SVN: r50624
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/altivec-1.c90
2 files changed, 27 insertions, 67 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d281943..dc5e87c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-03-11 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/altivec-1.c: Cleanup and use altivec.h.
+
2002-03-11 Richard Henderson <rth@redhat.com>
* g++.old-deja/g++.brendan/crash52.C: Remove return warning marker.
diff --git a/gcc/testsuite/gcc.dg/altivec-1.c b/gcc/testsuite/gcc.dg/altivec-1.c
index 8fd4086..3d37a2e 100644
--- a/gcc/testsuite/gcc.dg/altivec-1.c
+++ b/gcc/testsuite/gcc.dg/altivec-1.c
@@ -3,80 +3,36 @@
/* Program to test PowerPC AltiVec instructions. */
-/* These macros are not analogous to the overloaded functions
- described in Motorola's AltiVec Programming Interface Manual.
- These are just here for readability. Eventually we'll get the
- overloaded functions implemented in an <altivec.h>. */
+#include <altivec.h>
-#define vec_load(src) \
- __builtin_altivec_ld_internal_4si ((int *) src)
+extern void abort (void);
-#define vec_store(dst, src) \
- __builtin_altivec_st_internal_4si ((int *) dst, (int4) src)
+vector int a1 = { 100, 200, 300, 400 };
+vector int a2 = { 500, 600, 700, 800 };
+vector int addi = { 600, 800, 1000, 1200 };
+vector int avgi = { 300, 400, 500, 600 };
-#define vec_add_int4(x, y) \
- __builtin_altivec_vaddsws (x, y)
+vector float f1 = { 1.0, 2.0, 3.0, 4.0 };
+vector float f2 = { 5.0, 6.0, 7.0, 8.0 };
+vector float f3;
+vector float addf = { 6.0, 8.0, 10.0, 12.0 };
-#define vec_add_float4(x, y) \
- __builtin_altivec_vaddfp (x, y)
+vector int k;
+vector float f, g, h;
-#define vec_average_int4(x, y) \
- __builtin_altivec_vavgsw (x, y)
-
-typedef int int4 __attribute__ ((mode(V4SI)));
-typedef float float4 __attribute__ ((mode(V4SF)));
-
-int a1[4] __attribute__((aligned(16))) = { 100, 200, 300, 400 };
-int a2[4] __attribute__((aligned(16))) = { 500, 600, 700, 800 };
-int a3[4] __attribute__((aligned(16)));
-int addi[4] = { 600, 800, 1000, 1200 };
-int avgi[4] = { 300, 400, 500, 600 };
-
-float f1[4] __attribute__((aligned(16))) = { 1.0, 2.0, 3.0, 4.0 };
-float f2[4] __attribute__((aligned(16))) = { 5.0, 6.0, 7.0, 8.0 };
-float f3[4] __attribute__((aligned(16)));
-float addf[4] = { 6.0, 8.0, 10.0, 12.0 };
-
-int4 i, j, k;
-float4 f, g, h;
-
-void
-compare_int4 (int *a, int *b)
-{
- int i;
-
- for (i = 0; i < 4; ++i)
- if (a[i] != b[i])
- exit (1);
-}
-
-void
-compare_float4 (float *a, float *b)
-{
- int i;
-
- for (i = 0; i < 4; ++i)
- if (a[i] != b[i])
- exit (1);
-}
-
-main ()
+int main ()
{
- i = vec_load (a1);
- j = vec_load (a2);
- k = vec_add_int4 (i, j);
- vec_store (a3, k);
- compare_int4 (a3, addi);
+ k = vec_add (a1, a2);
+ if (!vec_all_eq (addi, k))
+ abort ();
- k = vec_average_int4 (i, j);
- vec_store (a3, k);
- compare_int4 (a3, avgi);
+ k = vec_avg (a1, a2);
+ if (!vec_all_eq (k, avgi))
+ abort ();
- f = (float4) vec_load (f1);
- g = (float4) vec_load (f2);
- h = vec_add_float4 (f, g);
- vec_store (f3, h);
- compare_float4 (f3, addf);
+ h = vec_add (f1, f2);
+ if (!vec_all_eq (h, addf))
+ abort ();
- exit (0);
+ return 0;
}