summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vmx/lde.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/vmx/lde.c')
-rw-r--r--gcc/testsuite/gcc.dg/vmx/lde.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vmx/lde.c b/gcc/testsuite/gcc.dg/vmx/lde.c
new file mode 100644
index 0000000000..5594963c76
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vmx/lde.c
@@ -0,0 +1,59 @@
+#include "harness.h"
+
+static unsigned char svuc[16] __attribute__ ((aligned (16)));
+static signed char svsc[16] __attribute__ ((aligned (16)));
+static unsigned short svus[8] __attribute__ ((aligned (16)));
+static signed short svss[8] __attribute__ ((aligned (16)));
+static unsigned int svui[4] __attribute__ ((aligned (16)));
+static signed int svsi[4] __attribute__ ((aligned (16)));
+static float svf[4] __attribute__ ((aligned (16)));
+
+static void init ()
+{
+ unsigned int i;
+ for (i = 0; i < 16; ++i)
+ {
+ svuc[i] = i;
+ svsc[i] = i - 8;
+ }
+ for (i = 0; i < 8; ++i)
+ {
+ svus[i] = i;
+ svss[i] = i - 4;
+ }
+ for (i = 0; i < 4; ++i)
+ {
+ svui[i] = i;
+ svsi[i] = i - 2;
+ svf[i] = i * 1.0f;
+ }
+}
+
+static void test ()
+{
+ vector unsigned char vuc;
+ vector signed char vsc;
+ vector unsigned short vus;
+ vector signed short vss;
+ vector unsigned int vui;
+ vector signed int vsi;
+ vector float vf;
+
+ init ();
+
+ vuc = vec_lde (9*1, (unsigned char *)svuc);
+ vsc = vec_lde (14*1, (signed char *)svsc);
+ vus = vec_lde (7*2, (unsigned short *)svus);
+ vss = vec_lde (1*2, (signed short *)svss);
+ vui = vec_lde (3*4, (unsigned int *)svui);
+ vsi = vec_lde (2*4, (signed int *)svsi);
+ vf = vec_lde (0*4, (float *)svf);
+
+ check (vec_extract (vuc, 9) == 9, "vuc");
+ check (vec_extract (vsc, 14) == 6, "vsc");
+ check (vec_extract (vus, 7) == 7, "vus");
+ check (vec_extract (vss, 1) == -3, "vss");
+ check (vec_extract (vui, 3) == 3, "vui");
+ check (vec_extract (vsi, 2) == 0, "vsi");
+ check (vec_extract (vf, 0) == 0.0, "vf");
+}