aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/apple-altivec-2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/apple-altivec-2.C')
-rw-r--r--gcc/testsuite/g++.dg/apple-altivec-2.C32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/apple-altivec-2.C b/gcc/testsuite/g++.dg/apple-altivec-2.C
new file mode 100644
index 00000000000..4e6d70b483b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/apple-altivec-2.C
@@ -0,0 +1,32 @@
+/* APPLE LOCAL file */
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-options "-maltivec" } */
+
+#include <altivec.h>
+
+extern "C" void abort (void);
+
+int main()
+{
+ vector float tiny = (vector float) ((vector unsigned int) (0x00800000, 0xBF800000, 0x3E800000, 0));
+ unsigned int af[4] = {
+ (unsigned int)(unsigned int)0x00800000,
+ (unsigned int)(unsigned int)0xBF800000,
+ (unsigned int)(unsigned int)0x3E800000,
+ (unsigned int)(unsigned int)0};
+
+ union u {
+ vector float vf;
+ unsigned int ai[4];
+ }vu;
+ int i;
+
+ vu.vf = tiny;
+
+ for (i=0; i < 4; i++)
+ if (af[i] != vu.ai[i])
+ abort();
+
+ return 0;
+}
+