Commit c5735c26 by Zack Weinberg Committed by Aldy Hernandez

1b-01.c: New.

	* gcc.dg/vmx/1b-01.c: New.
	* gcc.dg/vmx/1b-02.c: New.
	* gcc.dg/vmx/1b-03.c: New.
	* gcc.dg/vmx/1b-04.c: New.
	* gcc.dg/vmx/1b-05.c: New.
	* gcc.dg/vmx/1b-06.c: New.
	* gcc.dg/vmx/1b-07.c: New.
	* gcc.dg/vmx/1c-01.c: New.
	* gcc.dg/vmx/1c-02.c: New.
	* gcc.dg/vmx/3a-01a.c: New.
	* gcc.dg/vmx/3a-01.c: New.
	* gcc.dg/vmx/3a-01m.c: New.
	* gcc.dg/vmx/3a-03.c: New.
	* gcc.dg/vmx/3a-03m.c: New.
	* gcc.dg/vmx/3a-04.c: New.
	* gcc.dg/vmx/3a-04m.c: New.
	* gcc.dg/vmx/3a-05.c: New.
	* gcc.dg/vmx/3a-06.c: New.
	* gcc.dg/vmx/3a-06m.c: New.
	* gcc.dg/vmx/3a-07.c: New.
	* gcc.dg/vmx/3b-01.c: New.
	* gcc.dg/vmx/3b-02.c: New.
	* gcc.dg/vmx/3b-10.c: New.
	* gcc.dg/vmx/3b-13.c: New.
	* gcc.dg/vmx/3b-14.c: New.
	* gcc.dg/vmx/3b-15.c: New.
	* gcc.dg/vmx/3c-01a.c: New.
	* gcc.dg/vmx/3c-01.c: New.
	* gcc.dg/vmx/3c-02.c: New.
	* gcc.dg/vmx/3c-03.c: New.
	* gcc.dg/vmx/3d-01.c: New.
	* gcc.dg/vmx/4-01.c: New.
	* gcc.dg/vmx/4-03.c: New.
	* gcc.dg/vmx/5-01.c: New.
	* gcc.dg/vmx/5-02.c: New.
	* gcc.dg/vmx/5-03.c: New.
	* gcc.dg/vmx/5-04.c: New.
	* gcc.dg/vmx/5-05.c: New.
	* gcc.dg/vmx/5-06.c: New.
	* gcc.dg/vmx/5-07.c: New.
	* gcc.dg/vmx/5-07t.c: New.
	* gcc.dg/vmx/5-08.c: New.
	* gcc.dg/vmx/5-10.c: New.
	* gcc.dg/vmx/5-11.c: New.
	* gcc.dg/vmx/7-01a.c: New.
	* gcc.dg/vmx/7-01.c: New.
	* gcc.dg/vmx/7c-01.c: New.
	* gcc.dg/vmx/7d-01.c: New.
	* gcc.dg/vmx/7d-02.c: New.
	* gcc.dg/vmx/8-01.c: New.
	* gcc.dg/vmx/8-02a.c: New.
	* gcc.dg/vmx/8-02.c: New.
	* gcc.dg/vmx/brode-1.c: New.
	* gcc.dg/vmx/bug-1.c: New.
	* gcc.dg/vmx/bug-2.c: New.
	* gcc.dg/vmx/bug-3.c: New.
	* gcc.dg/vmx/cw-bug-1.c: New.
	* gcc.dg/vmx/cw-bug-2.c: New.
	* gcc.dg/vmx/cw-bug-3.c: New.
	* gcc.dg/vmx/dct.c: New.
	* gcc.dg/vmx/debug-1.c: New.
	* gcc.dg/vmx/debug-2.c: New.
	* gcc.dg/vmx/debug-3.c: New.
	* gcc.dg/vmx/debug-4.c: New.
	* gcc.dg/vmx/dos-bug-1-gdb.c: New.
	* gcc.dg/vmx/dos-bug-2-gdb.c: New.
	* gcc.dg/vmx/eg-5.c: New.
	* gcc.dg/vmx/fft.c: New.
	* gcc.dg/vmx/gcc-bug-1.c: New.
	* gcc.dg/vmx/gcc-bug-2.c: New.
	* gcc.dg/vmx/gcc-bug-3.c: New.
	* gcc.dg/vmx/gcc-bug-4.c: New.
	* gcc.dg/vmx/gcc-bug-5.c: New.
	* gcc.dg/vmx/gcc-bug-6.c: New.
	* gcc.dg/vmx/gcc-bug-7.c: New.
	* gcc.dg/vmx/gcc-bug-8.c: New.
	* gcc.dg/vmx/gcc-bug-9.c: New.
	* gcc.dg/vmx/gcc-bug-b.c: New.
	* gcc.dg/vmx/gcc-bug-c.c: New.
	* gcc.dg/vmx/gcc-bug-d.c: New.
	* gcc.dg/vmx/gcc-bug-e.c: New.
	* gcc.dg/vmx/gcc-bug-f.c: New.
	* gcc.dg/vmx/gcc-bug-g.c: New.
	* gcc.dg/vmx/gcc-bug-i.c: New.
	* gcc.dg/vmx/harness.h: New.
	* gcc.dg/vmx/ira1.c: New.
	* gcc.dg/vmx/ira2a.c: New.
	* gcc.dg/vmx/ira2b.c: New.
	* gcc.dg/vmx/ira2.c: New.
	* gcc.dg/vmx/ira2c.c: New.
	* gcc.dg/vmx/mem.c: New.
	* gcc.dg/vmx/newton-1.c: New.
	* gcc.dg/vmx/ops.c: New.
	* gcc.dg/vmx/sn7153.c: New.
	* gcc.dg/vmx/spill2.c: New.
	* gcc.dg/vmx/spill3.c: New.
	* gcc.dg/vmx/spill.c: New.
	* gcc.dg/vmx/t.c: New.
	* gcc.dg/vmx/varargs-1.c: New.
	* gcc.dg/vmx/varargs-2.c: New.
	* gcc.dg/vmx/varargs-3.c: New.
	* gcc.dg/vmx/varargs-4.c: New.
	* gcc.dg/vmx/varargs-5.c: New.
	* gcc.dg/vmx/varargs-6.c: New.
	* gcc.dg/vmx/varargs-7.c: New.
	* gcc.dg/vmx/vmx.exp: New.
	* gcc.dg/vmx/vprint-1.c: New.
	* gcc.dg/vmx/vscan-1.c: New.
	* gcc.dg/vmx/x-01.c: New.
	* gcc.dg/vmx/x-02.c: New.
	* gcc.dg/vmx/x-03.c: New.
	* gcc.dg/vmx/x-04.c: New.
	* gcc.dg/vmx/x-05.c: New.
	* gcc.dg/vmx/yousufi-1.c: New.
	* gcc.dg/vmx/zero-1.c: New.
	* gcc.dg/vmx/zero.c: New.

Co-Authored-By: Aldy Hernandez <aldyh@redhat.com>

From-SVN: r80808
parent 7dc57c7c
2004-04-17 Zack Weinberg <zack@codesourcery.com>
Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/vmx/1b-01.c: New.
* gcc.dg/vmx/1b-02.c: New.
* gcc.dg/vmx/1b-03.c: New.
* gcc.dg/vmx/1b-04.c: New.
* gcc.dg/vmx/1b-05.c: New.
* gcc.dg/vmx/1b-06.c: New.
* gcc.dg/vmx/1b-07.c: New.
* gcc.dg/vmx/1c-01.c: New.
* gcc.dg/vmx/1c-02.c: New.
* gcc.dg/vmx/3a-01a.c: New.
* gcc.dg/vmx/3a-01.c: New.
* gcc.dg/vmx/3a-01m.c: New.
* gcc.dg/vmx/3a-03.c: New.
* gcc.dg/vmx/3a-03m.c: New.
* gcc.dg/vmx/3a-04.c: New.
* gcc.dg/vmx/3a-04m.c: New.
* gcc.dg/vmx/3a-05.c: New.
* gcc.dg/vmx/3a-06.c: New.
* gcc.dg/vmx/3a-06m.c: New.
* gcc.dg/vmx/3a-07.c: New.
* gcc.dg/vmx/3b-01.c: New.
* gcc.dg/vmx/3b-02.c: New.
* gcc.dg/vmx/3b-10.c: New.
* gcc.dg/vmx/3b-13.c: New.
* gcc.dg/vmx/3b-14.c: New.
* gcc.dg/vmx/3b-15.c: New.
* gcc.dg/vmx/3c-01a.c: New.
* gcc.dg/vmx/3c-01.c: New.
* gcc.dg/vmx/3c-02.c: New.
* gcc.dg/vmx/3c-03.c: New.
* gcc.dg/vmx/3d-01.c: New.
* gcc.dg/vmx/4-01.c: New.
* gcc.dg/vmx/4-03.c: New.
* gcc.dg/vmx/5-01.c: New.
* gcc.dg/vmx/5-02.c: New.
* gcc.dg/vmx/5-03.c: New.
* gcc.dg/vmx/5-04.c: New.
* gcc.dg/vmx/5-05.c: New.
* gcc.dg/vmx/5-06.c: New.
* gcc.dg/vmx/5-07.c: New.
* gcc.dg/vmx/5-07t.c: New.
* gcc.dg/vmx/5-08.c: New.
* gcc.dg/vmx/5-10.c: New.
* gcc.dg/vmx/5-11.c: New.
* gcc.dg/vmx/7-01a.c: New.
* gcc.dg/vmx/7-01.c: New.
* gcc.dg/vmx/7c-01.c: New.
* gcc.dg/vmx/7d-01.c: New.
* gcc.dg/vmx/7d-02.c: New.
* gcc.dg/vmx/8-01.c: New.
* gcc.dg/vmx/8-02a.c: New.
* gcc.dg/vmx/8-02.c: New.
* gcc.dg/vmx/brode-1.c: New.
* gcc.dg/vmx/bug-1.c: New.
* gcc.dg/vmx/bug-2.c: New.
* gcc.dg/vmx/bug-3.c: New.
* gcc.dg/vmx/cw-bug-1.c: New.
* gcc.dg/vmx/cw-bug-2.c: New.
* gcc.dg/vmx/cw-bug-3.c: New.
* gcc.dg/vmx/dct.c: New.
* gcc.dg/vmx/debug-1.c: New.
* gcc.dg/vmx/debug-2.c: New.
* gcc.dg/vmx/debug-3.c: New.
* gcc.dg/vmx/debug-4.c: New.
* gcc.dg/vmx/dos-bug-1-gdb.c: New.
* gcc.dg/vmx/dos-bug-2-gdb.c: New.
* gcc.dg/vmx/eg-5.c: New.
* gcc.dg/vmx/fft.c: New.
* gcc.dg/vmx/gcc-bug-1.c: New.
* gcc.dg/vmx/gcc-bug-2.c: New.
* gcc.dg/vmx/gcc-bug-3.c: New.
* gcc.dg/vmx/gcc-bug-4.c: New.
* gcc.dg/vmx/gcc-bug-5.c: New.
* gcc.dg/vmx/gcc-bug-6.c: New.
* gcc.dg/vmx/gcc-bug-7.c: New.
* gcc.dg/vmx/gcc-bug-8.c: New.
* gcc.dg/vmx/gcc-bug-9.c: New.
* gcc.dg/vmx/gcc-bug-b.c: New.
* gcc.dg/vmx/gcc-bug-c.c: New.
* gcc.dg/vmx/gcc-bug-d.c: New.
* gcc.dg/vmx/gcc-bug-e.c: New.
* gcc.dg/vmx/gcc-bug-f.c: New.
* gcc.dg/vmx/gcc-bug-g.c: New.
* gcc.dg/vmx/gcc-bug-i.c: New.
* gcc.dg/vmx/harness.h: New.
* gcc.dg/vmx/ira1.c: New.
* gcc.dg/vmx/ira2a.c: New.
* gcc.dg/vmx/ira2b.c: New.
* gcc.dg/vmx/ira2.c: New.
* gcc.dg/vmx/ira2c.c: New.
* gcc.dg/vmx/mem.c: New.
* gcc.dg/vmx/newton-1.c: New.
* gcc.dg/vmx/ops.c: New.
* gcc.dg/vmx/sn7153.c: New.
* gcc.dg/vmx/spill2.c: New.
* gcc.dg/vmx/spill3.c: New.
* gcc.dg/vmx/spill.c: New.
* gcc.dg/vmx/t.c: New.
* gcc.dg/vmx/varargs-1.c: New.
* gcc.dg/vmx/varargs-2.c: New.
* gcc.dg/vmx/varargs-3.c: New.
* gcc.dg/vmx/varargs-4.c: New.
* gcc.dg/vmx/varargs-5.c: New.
* gcc.dg/vmx/varargs-6.c: New.
* gcc.dg/vmx/varargs-7.c: New.
* gcc.dg/vmx/vmx.exp: New.
* gcc.dg/vmx/vprint-1.c: New.
* gcc.dg/vmx/vscan-1.c: New.
* gcc.dg/vmx/x-01.c: New.
* gcc.dg/vmx/x-02.c: New.
* gcc.dg/vmx/x-03.c: New.
* gcc.dg/vmx/x-04.c: New.
* gcc.dg/vmx/x-05.c: New.
* gcc.dg/vmx/yousufi-1.c: New.
* gcc.dg/vmx/zero-1.c: New.
* gcc.dg/vmx/zero.c: New.
2004-04-17 Andrew Pinski <pinskia@physics.uc.edu>
* g++.dg/lookup/java1.C: Update for chage of
......
#include "harness.h"
vector unsigned char a;
static void test()
{
check(sizeof(a) == 16, "sizeof(a)");
check(((int)&a & 15) == 0, "alignof(a)");
check((int)&a != 0, "&a");
check(vec_all_eq(a,((vector unsigned char){0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0})), "value(a)");
}
/* { dg-do compile } */
#include <altivec.h>
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;
vector unsigned char const u8c;
vector signed char const s8c;
vector bool char const b8c;
vector unsigned short const u16c;
vector signed short const s16c;
vector bool short const b16c;
vector unsigned int const u32c;
vector signed int const s32c;
vector bool int const b32c;
vector float const f32c;
vector pixel const p16c;
vector unsigned char volatile u8v;
vector signed char volatile s8v;
vector bool char volatile b8v;
vector unsigned short volatile u16v;
vector signed short volatile s16v;
vector bool short volatile b16v;
vector unsigned int volatile u32v;
vector signed int volatile s32v;
vector bool int volatile b32v;
vector float volatile f32v;
vector pixel volatile p16v;
const vector unsigned char u8c_;
const vector signed char s8c_;
const vector bool char b8c_;
const vector unsigned short u16c_;
const vector signed short s16c_;
const vector bool short b16c_;
const vector unsigned int u32c_;
const vector signed int s32c_;
const vector bool int b32c_;
const vector float f32c_;
const vector pixel p16c_;
volatile vector unsigned char u8v_;
volatile vector signed char s8v_;
volatile vector bool char b8v_;
volatile vector unsigned short u16v_;
volatile vector signed short s16v_;
volatile vector bool short b16v_;
volatile vector unsigned int u32v_;
volatile vector signed int s32v_;
volatile vector bool int b32v_;
volatile vector float f32v_;
volatile vector pixel p16v_;
#include <altivec.h>
int main()
{
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;
vector unsigned char const u8c;
vector signed char const s8c;
vector bool char const b8c;
vector unsigned short const u16c;
vector signed short const s16c;
vector bool short const b16c;
vector unsigned int const u32c;
vector signed int const s32c;
vector bool int const b32c;
vector float const f32c;
vector pixel const p16c;
vector unsigned char volatile u8v;
vector signed char volatile s8v;
vector bool char volatile b8v;
vector unsigned short volatile u16v;
vector signed short volatile s16v;
vector bool short volatile b16v;
vector unsigned int volatile u32v;
vector signed int volatile s32v;
vector bool int volatile b32v;
vector float volatile f32v;
vector pixel volatile p16v;
const vector unsigned char u8c_;
const vector signed char s8c_;
const vector bool char b8c_;
const vector unsigned short u16c_;
const vector signed short s16c_;
const vector bool short b16c_;
const vector unsigned int u32c_;
const vector signed int s32c_;
const vector bool int b32c_;
const vector float f32c_;
const vector pixel p16c_;
volatile vector unsigned char u8v_;
volatile vector signed char s8v_;
volatile vector bool char b8v_;
volatile vector unsigned short u16v_;
volatile vector signed short s16v_;
volatile vector bool short b16v_;
volatile vector unsigned int u32v_;
volatile vector signed int s32v_;
volatile vector bool int b32v_;
volatile vector float f32v_;
volatile vector pixel p16v_;
return 0;
}
#include <altivec.h>
int main()
{
vector unsigned char a,b;
b = (vector unsigned char)a;
return 0;
}
/* { dg-do compile } */
#include <altivec.h>
vector float _0 ;
vector pixel _1 ;
vector bool int _2 ;
vector unsigned int _3 ;
vector signed int _4 ;
vector bool short _5 ;
vector unsigned short _6 ;
vector signed short _7 ;
vector bool char _8 ;
vector unsigned char _9 ;
vector signed char _10 ;
/* { dg-do compile } */
#include <altivec.h>
vector char bool _4 ;
vector char unsigned _31 ;
vector char signed _59 ;
bool _84 ;
vector pixel _89 ;
vector int bool _95 ;
vector short bool _102 ;
vector unsigned int _122 ;
vector unsigned short _129 ;
vector signed int _150 ;
vector signed short _157 ;
vector int bool _179 ;
vector int short bool _186 ;
vector unsigned int _206 ;
vector int unsigned short _213 ;
vector signed int _234 ;
vector int signed short _241 ;
vector float _339 ;
/* { dg-do compile } */
#include <altivec.h>
vector char bool _0 ;
vector bool char _8 ;
vector char unsigned _56 ;
vector unsigned char _64 ;
vector char signed _112 ;
vector signed char _120 ;
bool _168 ;
vector pixel _170 ;
vector int bool _178 ;
vector bool int _186 ;
vector short bool _234 ;
vector bool short _242 ;
vector unsigned int _290 ;
vector int unsigned _298 ;
vector unsigned short _346 ;
vector short unsigned _354 ;
vector signed int _402 ;
vector int signed _410 ;
vector signed short _458 ;
vector short signed _466 ;
vector int bool _514 ;
vector int bool _544 ;
vector int bool _559 ;
vector bool int _589 ;
vector int short bool _874 ;
vector int bool short _889 ;
vector short int bool _904 ;
vector short bool int _919 ;
vector bool int short _934 ;
vector bool short int _949 ;
vector unsigned int _1234 ;
vector int unsigned _1249 ;
vector unsigned int _1279 ;
vector int unsigned _1294 ;
vector unsigned int _1309 ;
vector int unsigned short _1594 ;
vector int short unsigned _1609 ;
vector unsigned int short _1624 ;
vector unsigned short int _1639 ;
vector short int unsigned _1654 ;
vector short unsigned int _1669 ;
vector signed int _1954 ;
vector int signed _1969 ;
vector signed int _1999 ;
vector int signed _2014 ;
vector signed int _2029 ;
vector int signed short _2314 ;
vector int short signed _2329 ;
vector signed int short _2344 ;
vector signed short int _2359 ;
vector short int signed _2374 ;
vector short signed int _2389 ;
vector float _2674 ;
#include "harness.h"
/* Declare vector types. */
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;
vector unsigned char *u8c = &u8;
vector signed char *s8c = &s8;
vector bool char *b8c = &b8;
vector unsigned short *u16c = &u16;
vector signed short *s16c = &s16;
vector bool short *b16c = &b16;
vector unsigned int *u32c = &u32;
vector signed int *s32c = &s32;
vector bool int *b32c = &b32;
vector float *f32c = &f32;
vector pixel *p16c = &p16;
static void test()
{
check(((int)u8c & 15) == 0, "alignof(u8)");
check(((int)u8c & 15) == 0, "alignof(u8)");
check(((int)s8c & 15) == 0, "alignof(s8)");
check(((int)b8c & 15) == 0, "alignof(b8)");
check(((int)u16c & 15) == 0, "alignof(u16)");
check(((int)s16c & 15) == 0, "alignof(s16)");
check(((int)b16c & 15) == 0, "alignof(b16)");
check(((int)u32c & 15) == 0, "alignof(u32)");
check(((int)s32c & 15) == 0, "alignof(s32)");
check(((int)b32c & 15) == 0, "alignof(b32)");
check(((int)f32c & 15) == 0, "alignof(f32)");
check(((int)p16c & 15) == 0, "alignof(p16)");
check((int)u8c == (int)&u8, "u8c == &u8");
check((int)u8c == (int)&u8, "u8c == &u8");
check((int)s8c == (int)&s8, "s8c == &s8");
check((int)b8c == (int)&b8, "b8c == &b8");
check((int)u16c == (int)&u16, "u16c == &u16");
check((int)s16c == (int)&s16, "s16c == &s16");
check((int)b16c == (int)&b16, "b16c == &b16");
check((int)u32c == (int)&u32, "u32c == &u32");
check((int)s32c == (int)&s32, "s32c == &s32");
check((int)b32c == (int)&b32, "b32c == &b32");
check((int)f32c == (int)&f32, "f32c == &f32");
check((int)p16c == (int)&p16, "p16c == &p16");
}
#include "harness.h"
/* Vector types used in aggregates. */
struct { char b; vector unsigned char a; char e; } u8;
struct { char b; vector signed char a; char e; } s8;
struct { char b; vector bool char a; char e; } b8;
struct { char b; vector unsigned short a; char e; } u16;
struct { char b; vector signed short a; char e; } s16;
struct { char b; vector bool short a; char e; } b16;
struct { char b; vector unsigned int a; char e; } u32;
struct { char b; vector signed int a; char e; } s32;
struct { char b; vector bool int a; char e; } b32;
struct { char b; vector float a; char e; } f32;
struct { char b; vector pixel a; char e; } p16;
union { char b; vector unsigned char a; } u8u;
union { char b; vector signed char a; } s8u;
union { char b; vector bool char a; } b8u;
union { char b; vector unsigned short a; } u16u;
union { char b; vector signed short a; } s16u;
union { char b; vector bool short a; } b16u;
union { char b; vector unsigned int a; } u32u;
union { char b; vector signed int a; } s32u;
union { char b; vector bool int a; } b32u;
union { char b; vector float a; } f32u;
union { char b; vector pixel a; } p16u;
static void test()
{
check((int)&u8.a - (int)&u8 == 16, "u8.a");
check((int)&u8.e - (int)&u8 == 32, "u8.e");
check(sizeof(u8) == 48, "sizeof(u8)");
check(sizeof(u8u) == 16, "sizeof(u8u)");
}
#include "harness.h"
/* Simple use of a non-overloaded generic vector intrinsic. */
static vector unsigned int
f(vector unsigned int a, vector unsigned int b)
{
return vec_addc(a,b);
}
static void test()
{
check(vec_all_eq(f(((vector unsigned int){1,1,3,2}),
((vector unsigned int){-1,-2,3,-4})),
((vector unsigned int){1,0,0,0})),
"f");
}
#include "harness.h"
/* Simple use of a non-overloaded specific vector intrinsic. */
vector unsigned int
f(vector unsigned int a, vector unsigned int b)
{
return vec_vaddcuw(a,b);
}
void test()
{
check(vec_all_eq(f(((vector unsigned int){1,1,3,2}),
((vector unsigned int){-1,-2,3,-4})),
((vector unsigned int){1,0,0,0})),
"f");
}
#include "harness.h"
/* Simple use of a non-overloaded specific vector intrinsic. */
vector unsigned int
f(vector unsigned int a, vector unsigned int b)
{
return vec_vaddcuw(a,b);
}
static void test()
{
check(vec_all_eq(f(((vector unsigned int){1,1,3,2}),
((vector unsigned int){-1,-2,3,-4})),
((vector unsigned int){1,0,0,0})),
"f");
}
#include "harness.h"
/* Small expression involving non-overloaded generic vector intrinsics. */
vector float
f(vector float a, vector float b, vector float c)
{
return vec_nmsub(a, vec_re(b), vec_nmsub(b, c, vec_expte(a)));
}
static void test()
{
check(vec_all_eq(f(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37})),
((vector float){-249.181808, -369.230774, -495.294098, -575.368408})),
"f");
}
#include "harness.h"
/* Small expression involving non-overloaded specific vector intrinsics. */
vector float
f(vector float a, vector float b, vector float c)
{
return vec_nmsub(a, vec_vrefp(b), vec_nmsub(b, c, vec_vexptefp(a)));
}
static void test()
{
check(vec_all_eq(f(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37})),
((vector float){-249.181808, -369.230774, -495.294098, -575.368408})),
"f");
}
#include "harness.h"
/* Small expression involving non-overloaded vector intrinsics. */
vector float
f(vector float a, vector float b, vector float c)
{
return vec_vmaddfp(a, vec_re(b), vec_vmaxfp(c, vec_expte(a)));
}
static void test()
{
check(vec_all_eq(f(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37})),
((vector float){23.1818085, 29.2307587, 32.2940826, 128.368393})),
"f");
}
#include "harness.h"
/* Small expression involving non-overloaded specific vector intrinsics. */
vector float
f(vector float a, vector float b, vector float c)
{
return vec_vmaddfp(a, vec_vrefp(b), vec_vmaxfp(c, vec_vexptefp(a)));
}
static void test()
{
check(vec_all_eq(f(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37})),
((vector float){23.1818085, 29.2307587, 32.2940826, 128.368393})),
"f");
}
#include "harness.h"
/* Small expression involving non-overloaded specific vector intrinsics. */
vector float
f(vector float a, vector float b, vector float c)
{
vector float q = vec_expte(a);
vector float r = vec_vsubfp(c, q);
vector float s = vec_re(b);
vector float t = vec_nmsub(s, c, r);
return t;
}
static void test()
{
check(vec_all_eq(f(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37})),
((vector float){16.9092026, 18.7693329, -2.8233242, -92.9472198})),
"f");
}
#include "harness.h"
vector unsigned int
f(vector unsigned int a, vector unsigned int b)
{
return vec_addc(vec_addc(a,b),b);
}
static void test()
{
check(vec_all_eq(f(((vector unsigned int){2,4,6,8}),
((vector unsigned int){-1,-2,-3,-4})),
((vector unsigned int){1,0,0,0})),
"f");
}
#include "harness.h"
vector unsigned int
f(vector unsigned int a, vector unsigned int b)
{
return vec_vaddcuw(vec_vaddcuw(a,b),b);
}
static void test()
{
check(vec_all_eq(f(((vector unsigned int){2,4,6,8}),
((vector unsigned int){-1,-2,-3,-4})),
((vector unsigned int){1,0,0,0})),
"f");
}
#include "harness.h"
static vector unsigned char
zero()
{
/* MCC allocates a stack slot for and loads an uninitialized local
variable. */
vector unsigned char a;
return vec_sub(a,a);
}
static void test()
{
static vector unsigned char zerov;
check(vec_all_eq(zero(), zerov), "zero");
}
#include "harness.h"
/* Simple use of a overloaded generic vector intrinsic. */
vector unsigned int
f(vector unsigned int a, vector unsigned int b)
{
return vec_subs(a,b);
}
static void test()
{
static vector unsigned int zero;
check(vec_all_eq(f(((vector unsigned int){2,4,6,8}),
((vector unsigned int){2,4,6,8})),
zero),
"f");
}
#include "harness.h"
vector unsigned char
f(vector unsigned char a, vector unsigned char b)
{
return vec_vsububs(a,b);
}
static void test()
{
static vector unsigned char zero;
check(vec_all_eq(f(((vector unsigned char){2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}),
((vector unsigned char){2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2})),
zero),
"f");
}
#include "harness.h"
typedef vector unsigned int x;
x f (x a)
{
return vec_addc(a,a);
}
void g (int b)
{
vec_dst(&b, 3, 3);
vec_dst(&b, 1, 1);
}
static void test()
{
check(vec_all_eq(f(((vector unsigned int){0x80000000,0x7fffffff,3,4})),
((vector unsigned int){1,0,0,0})),
"f");
}
#include "harness.h"
vector signed int
f(vector float a, vector signed int b)
{
return vec_splat(vec_cts(vec_ctf(vec_ctu(a, 31),0),9),30);
}
static void test()
{
check(vec_all_eq(f(((vector float){1,2,3,4}),
((vector signed int){2,4,6,8})),
((vector signed int){2147483647, 2147483647, 2147483647, 2147483647})),
"f");
}
#include "harness.h"
static vector bool char x(void);
static void g(void);
static vector bool char
f (void)
{
vector bool char a = x();
g();
return a;
}
static vector bool char
x (void)
{
static vector bool char zero;
return zero;
}
static void g ()
{
}
static void test()
{
static vector bool char zero;
check(vec_all_eq(f(), zero), "f");
}
#include "harness.h"
vector unsigned char
f (vector unsigned char a, vector unsigned char b, vector unsigned char c)
{
return vec_perm(a,b,c);
}
static void test()
{
check(vec_all_eq(f(((vector unsigned char){0,1,2,3,4,5,6,7,
8,9,10,11,12,13,14,15}),
((vector unsigned char){70,71,72,73,74,75,76,77,
78,79,80,81,82,83,84,85}),
((vector unsigned char){0x1,0x14,0x18,0x10,0x16,0x15,0x19,0x1a,
0x1c,0x1c,0x1c,0x12,0x8,0x1d,0x1b,0xe})),
((vector unsigned char){1,74,78,70,76,75,79,80,82,82,82,72,8,83,81,14})),
"f");
}
#include "harness.h"
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;
static void g(void);
static void f(void *p)
{
u8 = vec_ld(16, (unsigned char *)p);
u16 = vec_ld(16, (unsigned short*)p);
u32 = vec_ld(16, (unsigned int*)p);
s8 = vec_ld(16, (signed char *)p);
s16 = vec_ld(16, (short*)p);
s32 = vec_ld(16, (int*)p);
g();
u8 = vec_ld(16, (vector unsigned char*)p);
s8 = vec_ld(16, (vector signed char*)p);
b8 = vec_ld(16, (vector bool char*)p);
g();
u16 = vec_ld(16, (vector unsigned short*)p);
s16 = vec_ld(16, (vector signed short*)p);
b16 = vec_ld(16, (vector bool short*)p);
g();
u32 = vec_ld(16, (vector unsigned int*)p);
s32 = vec_ld(16, (vector signed int*)p);
b32 = vec_ld(16, (vector bool int*)p);
f32 = vec_ld(16, (vector float*)p);
p16 = vec_ld(16, (vector pixel*)p);
g();
u8 = vec_lde(16, (unsigned char *)p);
u16 = vec_lde(16, (unsigned short*)p);
u32 = vec_lde(16, (unsigned int*)p);
s8 = vec_lde(16, (signed char *)p);
s16 = vec_lde(16, (short*)p);
s32 = vec_lde(16, (int*)p);
f32 = vec_ldl(16, (vector float*)p);
p16 = vec_ldl(16, (vector pixel*)p);
g();
u8 = vec_ldl(16, (vector unsigned char*)p);
s8 = vec_ldl(16, (vector signed char*)p);
b8 = vec_ldl(16, (vector bool char*)p);
g();
u16 = vec_ldl(16, (vector unsigned short*)p);
s16 = vec_ldl(16, (vector signed short*)p);
b16 = vec_ldl(16, (vector bool short*)p);
g();
u32 = vec_ldl(16, (vector unsigned int*)p);
s32 = vec_ldl(16, (vector signed int*)p);
b32 = vec_ldl(16, (vector bool int*)p);
f32 = vec_ldl(16, (vector float*)p);
p16 = vec_ldl(16, (vector pixel*)p);
}
static void g ()
{
}
static void test()
{
static vector unsigned int value = {1,-2,3,-4};
static vector unsigned int buffer[2];
#define chek(v, s) check(vec_all_eq(v, value), s)
buffer[1] = value;
f((void *)buffer);
chek((vector unsigned int) u8, "u8");
chek((vector unsigned int) s8, "s8");
chek((vector unsigned int) b8, "b8");
chek((vector unsigned int) u16, "u16");
chek((vector unsigned int) s16, "s16");
chek((vector unsigned int) b16, "b16");
chek((vector unsigned int) u32, "u32");
chek((vector unsigned int) s32, "s32");
chek((vector unsigned int) b32, "b32");
chek((vector unsigned int) f32, "f32");
chek((vector unsigned int) p16, "p16");
}
#include "harness.h"
vector unsigned char u8;
static void f(void *p)
{
u8 = vec_ld(1, (unsigned char *)p);
}
static void test()
{
static vector unsigned int value = {1,-2,3,-4};
static vector unsigned int buffer[2];
buffer[1] = value;
f((void *)(-1+(char*)(buffer+1)));
check(vec_all_eq((vector unsigned int) u8, value), "u8");
}
#include "harness.h"
vector unsigned char u8;
static void f(int i, void *p)
{
u8 = vec_ld(i, (unsigned char *)p);
}
static void test()
{
static vector unsigned int value = {1,-2,3,-4};
static vector unsigned int buffer[2];
buffer[1] = value;
f(37,(void *)(-37+(char*)(buffer+1)));
check(vec_all_eq((vector unsigned int) u8, value), "u8");
}
/* { dg-do compile } */
#include <altivec.h>
int i;
void
test_vec_all_gt(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_all_gt(u8a, u8b))
i = 1;
}
void
test_vec_all_le(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_all_le(u8a, u8b))
i = 1;
}
void
test_vec_any_gt(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_any_gt(u8a, u8b))
i = 1;
}
void
test_vec_any_le(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_any_le(u8a, u8b))
i = 1;
}
void
test_vec_all_lt(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_all_lt(u8a, u8b))
i = 1;
}
void
test_vec_all_ge(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_all_ge(u8a, u8b))
i = 1;
}
void
test_vec_any_lt(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_any_lt(u8a, u8b))
i = 1;
}
void
test_vec_any_ge(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_any_ge(u8a, u8b))
i = 1;
}
void
test_vec_all_eq(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_all_eq(u8a, u8b))
i = 1;
}
void
test_vec_all_ne(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_all_ne(u8a, u8b))
i = 1;
}
void
test_vec_any_eq(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_any_eq(u8a, u8b))
i = 1;
}
void
test_vec_any_ne(vector unsigned char u8a, vector unsigned char u8b)
{
if (vec_any_ne(u8a, u8b))
i = 1;
}
void
test_not_vec_all_gt(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_all_gt(u8a, u8b))
i = 1;
}
void
test_not_vec_all_le(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_all_le(u8a, u8b))
i = 1;
}
void
test_not_vec_any_gt(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_any_gt(u8a, u8b))
i = 1;
}
void
test_not_vec_any_le(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_any_le(u8a, u8b))
i = 1;
}
void
test_not_vec_all_lt(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_all_lt(u8a, u8b))
i = 1;
}
void
test_not_vec_all_ge(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_all_ge(u8a, u8b))
i = 1;
}
void
test_not_vec_any_lt(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_any_lt(u8a, u8b))
i = 1;
}
void
test_not_vec_any_ge(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_any_ge(u8a, u8b))
i = 1;
}
void
test_not_vec_all_eq(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_all_eq(u8a, u8b))
i = 1;
}
void
test_not_vec_all_ne(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_all_ne(u8a, u8b))
i = 1;
}
void
test_not_vec_any_eq(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_any_eq(u8a, u8b))
i = 1;
}
void
test_not_vec_any_ne(vector unsigned char u8a, vector unsigned char u8b)
{
if (!vec_any_ne(u8a, u8b))
i = 1;
}
/* { dg-do compile } */
#include <altivec.h>
vector unsigned int
f(vector signed char a)
{
return (vector unsigned int)(a);
}
/* { dg-do compile } */
#include <altivec.h>
vector unsigned int
f(vector signed char a)
{
return (vector unsigned int)a;
}
/* { dg-do compile } */
#include <altivec.h>
vector unsigned int a = {1,1,1,1};
vector unsigned int b = {1,2,3,4};
/* { dg-do compile } */
#include <altivec.h>
vector float a = {1,1,1,1};
vector float b = {1,2.0,3,4U};
/* { dg-do compile } */
#include <altivec.h>
vector unsigned char u8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vector signed char s8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vector bool char b8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vector unsigned short u16 = {1,1,1,1,1,1,1,1};
vector signed short s16 = {1,1,1,1,1,1,1,1};
vector bool short b16 = {1,1,1,1,1,1,1,1};
vector unsigned int u32 = {1,1,1,1};
vector signed int s32 = {1,1,1,1};
vector bool int b32 = {1,1,1,1};
vector float f32 = {1,1,1,1};
vector pixel p16 = {1,1,1,1,1,1,1,1};
vector unsigned char u8_
= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
vector signed char s8_
= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
vector bool char b8_
= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
vector unsigned short u16_ = {1,2,3,4,5,6,7,8};
vector signed short s16_ = {1,2,3,4,5,6,7,8};
vector bool short b16_ = {1,2,3,4,5,6,7,8};
vector unsigned int u32_ = {1,2,3,4};
vector signed int s32_ = {1,2,3,4};
vector bool int b32_ = {1,2,3,4};
vector float f32_ = {1,2,3,4};
vector pixel p16_ = {1,2,3,4,5,6,7,8};
/* { dg-do compile } */
#include <altivec.h>
vector unsigned int a;
vector unsigned int b;
void
f(void)
{
a = ((vector unsigned int){1,1,1,1});
b = ((vector unsigned int){1,2,3,4});
}
/* { dg-do compile } */
#include <altivec.h>
vector unsigned int a = {1,1,1,1};
vector unsigned int b = {1,2,3,4};
/* { dg-do compile } */
#include <altivec.h>
vector float a = {1,1,1,1};
vector float b = {1,2.0,3,4U};
/* { dg-do compile } */
#include <altivec.h>
vector unsigned char u8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vector signed char s8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vector bool char b8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
vector unsigned short u16 = {1,1,1,1,1,1,1,1};
vector signed short s16 = {1,1,1,1,1,1,1,1};
vector bool short b16 = {1,1,1,1,1,1,1,1};
vector unsigned int u32 = {1,1,1,1};
vector signed int s32 = {1,1,1,1};
vector bool int b32 = {1,1,1,1};
vector float f32 = {1,1,1,1};
vector pixel p16 = {1,1,1,1,1,1,1,1};
vector unsigned char u8_
= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
vector signed char s8_
= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
vector bool char b8_
= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
vector unsigned short u16_ = {1,2,3,4,5,6,7,8};
vector signed short s16_ = {1,2,3,4,5,6,7,8};
vector bool short b16_ = {1,2,3,4,5,6,7,8};
vector unsigned int u32_ = {1,2,3,4};
vector signed int s32_ = {1,2,3,4};
vector bool int b32_ = {1,2,3,4};
vector float f32_ = {1,2,3,4};
vector pixel p16_ = {1,2,3,4,5,6,7,8};
/* { dg-do compile } */
#include <altivec.h>
typedef vector unsigned char t_u8;
typedef vector signed char t_s8;
typedef vector bool char t_b8;
typedef vector unsigned short t_u16;
typedef vector signed short t_s16;
typedef vector bool short t_b16;
typedef vector unsigned int t_u32;
typedef vector signed int t_s32;
typedef vector bool int t_b32;
typedef vector float t_f32;
typedef vector pixel t_p16;
t_u8 u8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
t_s8 s8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
t_b8 b8 = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
t_u16 u16 = {1,1,1,1,1,1,1,1};
t_s16 s16 = {1,1,1,1,1,1,1,1};
t_b16 b16 = {1,1,1,1,1,1,1,1};
t_u32 u32 = {1,1,1,1};
t_s32 s32 = {1,1,1,1};
t_b32 b32 = {1,1,1,1};
t_f32 f32 = {1,1,1,1};
t_p16 p16 = {1,1,1,1,1,1,1,1};
t_u8 u8_ = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
t_s8 s8_ = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
t_b8 b8_ = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
t_u16 u16_ = {1,2,3,4,5,6,7,8};
t_s16 s16_ = {1,2,3,4,5,6,7,8};
t_b16 b16_ = {1,2,3,4,5,6,7,8};
t_u32 u32_ = {1,2,3,4};
t_s32 s32_ = {1,2,3,4};
t_b32 b32_ = {1,2,3,4};
t_f32 f32_ = {1,2,3,4};
t_p16 p16_ = {1,2,3,4,5,6,7,8};
/* { dg-do compile } */
#include <altivec.h>
vector unsigned int a;
vector unsigned int b;
void
f(void)
{
a = ((vector unsigned int){1,1,1,1});
b = ((vector unsigned int){1,2,3,4});
}
/* { dg-do compile } */
#include <altivec.h>
extern vector signed short image[];
extern vector signed short band[];
#define load(a,b) (a[b])
#define store(v,a,b) (a[b]) = (v)
void
haar (vector signed char a, vector signed char b, vector signed char c,
vector signed char d, unsigned int N, int XX)
{
unsigned int i;
vector unsigned char high, low;
vector signed int zero = ((vector signed int){0,0,0,0});
for (i = 0; i < N; i++) {
high = (vector unsigned char) (vec_vmrghh (load(image, i+XX),
load(image, i)));
low = (vector unsigned char) (vec_vmrglh (load(image, i+XX),
load(image, i)));
store (vec_vpkswss (vec_vmsummbm (a, high, zero),
vec_vmsummbm (a, low, zero)),
band, i);
store (vec_vpkswss (vec_vmsummbm (b, high, zero),
vec_vmsummbm (b, low, zero)),
band, i+1);
store(vec_vpkswss (vec_vmsummbm (c, high, zero),
vec_vmsummbm (c, low, zero)),
band, i+2);
store(vec_vpkswss (vec_vmsummbm (d, high, zero),
vec_vmsummbm (d, low, zero)),
band, i+3);
}
}
/* { dg-do compile } */
#include <altivec.h>
extern vector signed short image[];
extern vector signed short band[];
#define load(a,b) vec_ld((b)*16, a)
#define store(v,a,b) vec_st(v,(b)*16,a)
void
haar (vector signed char a, vector signed char b, vector signed char c,
vector signed char d, unsigned int N, int XX)
{
unsigned int i;
vector unsigned char high, low;
vector signed int zero = ((vector signed int){0,0,0,0});
for (i = 0; i < N; i++) {
high = (vector unsigned char) (vec_vmrghh (load(image, i+XX),
load(image, i)));
low = (vector unsigned char) (vec_vmrglh (load(image, i+XX),
load(image, i)));
store (vec_vpkswss (vec_vmsummbm (a, high, zero),
vec_vmsummbm (a, low, zero)),
band, i);
store (vec_vpkswss (vec_vmsummbm (b, high, zero),
vec_vmsummbm (b, low, zero)),
band, i+1);
store(vec_vpkswss (vec_vmsummbm (c, high, zero),
vec_vmsummbm (c, low, zero)),
band, i+2);
store(vec_vpkswss (vec_vmsummbm (d, high, zero),
vec_vmsummbm (d, low, zero)),
band, i+3);
}
}
/* { dg-do compile } */
#include <altivec.h>
vector float
f(int i)
{
switch (i) {
case 0:
return (vector float)(((vector unsigned char){3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}));
}
return ((vector float){0,0,0,0});
}
/* { dg-do compile } */
#include <altivec.h>
extern vector unsigned char a[];
vector unsigned char
f(vector unsigned char *p, int i, int b)
{
if (b)
return p[i];
return vec_ld(i*16,p);
}
vector unsigned char
g(int i, int b)
{
if (b)
return a[i];
return vec_ld(i*16,a);
}
/* { dg-do compile } */
#include <altivec.h>
extern vector unsigned char a[];
void f
(vector unsigned char v, vector unsigned char *p, int i, int b)
{
if (b)
p[i] = v;
else
vec_st(v, i*16,p);
}
void g
(vector unsigned char v, int i, int b)
{
if (b)
a[i] = v;
else
vec_st(v,i*16,a);
}
/* { dg-do compile } */
#include <altivec.h>
int i = vec_step(vector unsigned short);
#include "harness.h"
extern vector pixel p16;
extern vector pixel const p16c;
extern vector pixel volatile p16v;
extern const vector pixel p16c_;
extern volatile vector pixel p16v_;
static void test()
{
int i_p16 = vec_step(p16);
int i_p16c = vec_step(p16c);
int i_p16v = vec_step(p16v);
int i_p16c_ = vec_step(p16c_);
int i_p16v_ = vec_step(p16v_);
check((i_p16 + i_p16c + i_p16v + i_p16c_ + i_p16v_) != 40, "vec_step");
}
#include <altivec.h>
int main( )
{
static int a[3][5][7];
{
vector signed int a4v;
a4v = vec_ldl(0, &a[0][0][0]);
}
return 0;
}
#include <stdlib.h>
#include <stdio.h>
#include <altivec.h>
#define NPAGES 20
#define NSKIP 10
static vector float big[NPAGES*4096/16] = { {1,1,1,1} };
/* NPAGES pages worth. */
static int failed;
static void f(vector float *p)
{
int i = 1;
p = (vector float *)(((int)p + 4095) & ~4095);
i += NSKIP;
p += NSKIP*4096/16;
while (i < NPAGES)
{
if (!vec_all_eq(*p,((vector float){0,0,0,0})))
{
printf("*p isn't zero at 0x%p, page %d\n", p, i);
failed++;
}
i++;
p += 4096/16;
}
}
int main(void)
{
f(big);
if (failed)
abort ();
return 0;
}
#include "harness.h"
static vector unsigned char value =
{ 0x7c, 0x12, 0x1, 0xd5,
0xc3, 0x99, 0x21, 0xe2,
0x12, 0x57, 0xde, 0x6b,
0x39, 0x66, 0xa8, 0x87 };
void initn_c (int p1, int p2, signed char p3, int p4, double p5 ,
vector unsigned char p6, signed char p7)
{
check(p1 == 3, "p1");
check(p2 == 4, "p2");
check(p3 == 5, "p3");
check(p4 == 6, "p4");
check(p5 == 1, "p5");
check(vec_all_eq(p6, value), "p6");
check(p7 == 7, "p7");
}
void test()
{
initn_c (3, 4, 5, 6, 1, value, 7);
}
#include "harness.h"
static vector unsigned int value = { 9, 9, 9, 9 };
void varargsC2 (int p1, int p2, int p3, int p4, int p5, int p6, int p7,
int p8, vector unsigned int p9, int p10)
{
int i1;
int i2;
int i3;
int i4;
int i5;
int i6;
int i7;
int i8;
vector unsigned int i9;
int i10;
i1 = p1;
i2 = p2;
i3 = p3;
i4 = p4;
i5 = p5;
i6 = p6;
i7 = p7;
i8 = p8;
i9 = p9;
i10 = p10;
check(i1 == 1, "i1");
check(i2 == 2, "i2");
check(i3 == 3, "i3");
check(i4 == 4, "i4");
check(i5 == 5, "i5");
check(i6 == 6, "i6");
check(i7 == 7, "i7");
check(i8 == 8, "i8");
check(vec_all_eq(i9, value), "i9");
check(i10 == 10, "i10");
}
void test()
{
varargsC2 (1, 2, 3, 4, 5, 6, 7, 8, ((vector unsigned int){9,9,9,9}), 10);
}
#include <altivec.h>
#include <stdlib.h>
#define ZERO (((vector unsigned char){0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}))
int main(void)
{
vector unsigned char a = ZERO;
if (vec_any_ne(a, ZERO))
abort ();
return 0;
}
#include <altivec.h>
#include <stdlib.h>
int main(void)
{
if (vec_any_ne((vector unsigned short)(((vector unsigned char){0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0})),
vec_mfvscr()))
abort ();
}
/* { dg-do compile } */
#include <altivec.h>
vector signed short hamming_window[1] = {
{2621, 2623, 2629, 2638, 2651, 2668, 2689, 2713}
};
/* { dg-do compile } */
#include <altivec.h>
inline void
transpose_vmx (vector signed short *input, vector signed short *output)
{
vector signed short v0, v1, v2, v3, v4, v5, v6, v7;
vector signed short x0, x1, x2, x3, x4, x5, x6, x7;
/* Matrix transpose */
v0 = vec_mergeh (input[0], input[4]);
v1 = vec_mergel (input[0], input[4]);
v2 = vec_mergeh (input[1], input[5]);
v3 = vec_mergel (input[1], input[5]);
v4 = vec_mergeh (input[2], input[6]);
v5 = vec_mergel (input[2], input[6]);
v6 = vec_mergeh (input[3], input[7]);
v7 = vec_mergel (input[3], input[7]);
x0 = vec_mergeh (v0, v4);
x1 = vec_mergel (v0, v4);
x2 = vec_mergeh (v1, v5);
x3 = vec_mergel (v1, v5);
x4 = vec_mergeh (v2, v6);
x5 = vec_mergel (v2, v6);
x6 = vec_mergeh (v3, v7);
x7 = vec_mergel (v3, v7);
output[0] = vec_mergeh (x0, x4);
output[1] = vec_mergel (x0, x4);
output[2] = vec_mergeh (x1, x5);
output[3] = vec_mergel (x1, x5);
output[4] = vec_mergeh (x2, x6);
output[5] = vec_mergel (x2, x6);
output[6] = vec_mergeh (x3, x7);
output[7] = vec_mergel (x3, x7);
}
void
dct_vmx (vector signed short *input, vector signed short *output,
vector signed short *postscale)
{
vector signed short mul0, mul1, mul2, mul3, mul4, mul5, mul6, mul;
vector signed short v0, v1, v2, v3, v4, v5, v6, v7, v8, v9;
vector signed short v20, v21, v22, v23, v24, v25, v26, v27, v31;
int i;
vector signed short in[8], out[8];
/* Load first eight rows of input data */
/* Load multiplication constants */
/* Splat multiplication constants */
mul0 = vec_splat(input[8],0);
mul1 = vec_splat(input[8],1);
mul2 = vec_splat(input[8],2);
mul3 = vec_splat(input[8],3);
mul4 = vec_splat(input[8],4);
mul5 = vec_splat(input[8],5);
mul6 = vec_splat(input[8],6);
/* Perform DCT on the eight columns */
/*********** Stage 1 ***********/
v8 = vec_adds (input[0], input[7]);
v9 = vec_subs (input[0], input[7]);
v0 = vec_adds (input[1], input[6]);
v7 = vec_subs (input[1], input[6]);
v1 = vec_adds (input[2], input[5]);
v6 = vec_subs (input[2], input[5]);
v2 = vec_adds (input[3], input[4]);
v5 = vec_subs (input[3], input[4]);
/*********** Stage 2 ***********/
/* Top */
v3 = vec_adds (v8, v2); /* (V0+V7) + (V3+V4) */
v4 = vec_subs (v8, v2); /* (V0+V7) - (V3+V4) */
v2 = vec_adds (v0, v1); /* (V1+V6) + (V2+V5) */
v8 = vec_subs (v0, v1); /* (V1+V6) - (V2+V5) */
/* Bottom */
v0 = vec_subs (v7, v6); /* (V1-V6) - (V2-V5) */
v1 = vec_adds (v7, v6); /* (V1-V6) + (V2-V5) */
/*********** Stage 3 ***********/
/* Top */
in[0] = vec_adds (v3, v2); /* y0 = v3 + v2 */
in[4] = vec_subs (v3, v2); /* y4 = v3 - v2 */
in[2] = vec_mradds (v8, mul2, v4); /* y2 = v8 * a0 + v4 */
v6 = vec_mradds (v4, mul2, mul6);
in[6] = vec_subs (v6, v8); /* y6 = v4 * a0 - v8 */
/* Bottom */
v6 = vec_mradds (v0, mul0, v5); /* v6 = v0 * (c4) + v5 */
v7 = vec_mradds (v0, mul4, v5); /* v7 = v0 * (-c4) + v5 */
v2 = vec_mradds (v1, mul4, v9); /* v2 = v1 * (-c4) + v9 */
v3 = vec_mradds (v1, mul0, v9); /* v3 = v1 * (c4) + v9 */
/*********** Stage 4 ***********/
/* Bottom */
in[1] = vec_mradds (v6, mul3, v3); /* y1 = v6 * (a1) + v3 */
v23 = vec_mradds (v3, mul3, mul6);
in[7] = vec_subs (v23, v6); /* y7 = v3 * (a1) - v6 */
in[5] = vec_mradds (v2, mul1, v7); /* y5 = v2 * (a2) + v7 */
in[3] = vec_mradds (v7, mul5, v2); /* y3 = v7 * (-a2) + v2 */
transpose_vmx (in, out);
/* Perform DCT on the eight rows */
/*********** Stage 1 ***********/
v8 = vec_adds (out[0], out[7]);
v9 = vec_subs (out[0], out[7]);
v0 = vec_adds (out[1], out[6]);
v7 = vec_subs (out[1], out[6]);
v1 = vec_adds (out[2], out[5]);
v6 = vec_subs (out[2], out[5]);
v2 = vec_adds (out[3], out[4]);
v5 = vec_subs (out[3], out[4]);
/*********** Stage 2 ***********/
/* Top */
v3 = vec_adds (v8, v2); /* (V0+V7) + (V3+V4) */
v4 = vec_subs (v8, v2); /* (V0+V7) - (V3+V4) */
v2 = vec_adds (v0, v1); /* (V1+V6) + (V2+V5) */
v8 = vec_subs (v0, v1); /* (V1+V6) - (V2+V5) */
/* Bottom */
v0 = vec_subs (v7, v6); /* (V1-V6) - (V2-V5) */
v1 = vec_adds (v7, v6); /* (V1-V6) + (V2-V5) */
/*********** Stage 3 ***********/
/* Top */
v25 = vec_subs (v25, v25); /* reinit v25 = 0 */
v20 = vec_adds (v3, v2); /* y0 = v3 + v2 */
v24 = vec_subs (v3, v2); /* y4 = v3 - v2 */
v22 = vec_mradds (v8, mul2, v4); /* y2 = v8 * a0 + v4 */
v6 = vec_mradds (v4, mul2, v25);
v26 = vec_subs (v6, v8); /* y6 = v4 * a0 - v8 */
/* Bottom */
v6 = vec_mradds (v0, mul0, v5); /* v6 = v0 * (c4) + v5 */
v7 = vec_mradds (v0, mul4, v5); /* v7 = v0 * (-c4) + v5 */
v2 = vec_mradds (v1, mul4, v9); /* v2 = v1 * (-c4) + v9 */
v3 = vec_mradds (v1, mul0, v9); /* v3 = v1 * (c4) + v9 */
/*********** Stage 4 ***********/
/* Bottom */
v21 = vec_mradds (v6, mul3, v3); /* y1 = v6 * (a1) + v3 */
v23 = vec_mradds (v3, mul3, v25);
v27 = vec_subs (v23, v6); /* y7 = v3 * (a1) - v6 */
v25 = vec_mradds (v2, mul1, v7); /* y5 = v2 * (a2) + v7 */
v23 = vec_mradds (v7, mul5, v2); /* y3 = v7 * (-a2) + v2 */
/* Post-scale and store reults */
v31 = vec_subs (v31, v31); /* reinit v25 = 0 */
output[0] = vec_mradds (postscale[0], v20, v31);
output[2] = vec_mradds (postscale[2], v22, v31);
output[4] = vec_mradds (postscale[4], v24, v31);
output[6] = vec_mradds (postscale[6], v26, v31);
output[1] = vec_mradds (postscale[1], v21, v31);
output[3] = vec_mradds (postscale[3], v23, v31);
output[5] = vec_mradds (postscale[5], v25, v31);
output[7] = vec_mradds (postscale[7], v27, v31);
}
#include <altivec.h>
vector unsigned char v;
typedef unsigned char T[16];
T t;
typedef struct { unsigned char a[16]; } R;
R r;
typedef union {
unsigned char u8[16];
signed char s8[16];
unsigned short u16[8];
signed short s16[8];
unsigned long u32[4];
signed long s32[4];
float f32[4];
} U;
U u;
static void use(void *p) {
}
int main() {
use (&v);
use (&t);
use (&r);
use (&u);
return 0;
}
#include <altivec.h>
vector unsigned char u8 = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10,11,12,13,14,15,16};
vector signed char s8 = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10,11,12,13,14,15,16};
vector bool char b8 = {0, -1, 0, -1, 0, 0, 0, 0,
-1, -1, -1, -1, 0, -1, 0, -1};
vector unsigned short u16 = {1, 2, 3, 4, 5, 6, 7, 8};
vector signed short s16 = {1, 2, 3, 4, 5, 6, 7, 8};
vector bool short b16 = {-1, 0, -1, 0, -1, -1, 0, 0};
vector unsigned int u32 = {1, 2, 3, 4};
vector signed int s32 = {1, 2, 3, 4};
vector bool int b32 = {0, -1, -1, 0};
vector float f32 = {1, 2, 3, 4};
vector pixel p16 = {1, 2, 3, 4, 5, 6, 7, 8};
static void f_u8(vector unsigned char *p) {}
static void f_s8(vector signed char *p) {}
static void f_b8(vector bool char *p) {}
static void f_u16(vector unsigned short *p) {}
static void f_s16(vector signed short *p) {}
static void f_b16(vector bool short *p) {}
static void f_u32(vector unsigned int *p) {}
static void f_s32(vector signed int *p) {}
static void f_b32(vector bool int *p) {}
static void f_f32(vector float *p) {}
static void f_p16(vector pixel *p) {}
int main() {
f_u8(&u8);
f_s8(&s8);
f_b8(&b8);
f_u16(&u16);
f_s16(&s16);
f_b16(&b16);
f_u32(&u32);
f_s32(&s32);
f_b32(&b32);
f_f32(&f32);
f_p16(&p16);
return 0;
}
#include <altivec.h>
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;
void f_u8(vector unsigned char *p) {
u8 = *p;
}
void f_s8(vector signed char *p) {
s8 = *p;
}
void f_b8(vector bool char *p) {
b8 = *p;
}
void f_u16(vector unsigned short *p) {
u16 = *p;
}
void f_s16(vector signed short *p) {
s16 = *p;
}
void f_b16(vector bool short *p) {
b16 = *p;
}
void f_u32(vector unsigned int *p) {
u32 = *p;
}
void f_s32(vector signed int *p) {
s32 = *p;
}
void f_b32(vector bool int *p) {
b32 = *p;
}
void f_f32(vector float *p) {
f32 = *p;
}
void f_p16(vector pixel *p) {
p16 = *p;
}
int main() {
vector unsigned char u8 = ((vector unsigned char){1, 2, 3, 4, 5, 6, 7, 8,
9, 10,11,12,13,14,15,16});
vector signed char s8 = ((vector signed char){1, 2, 3, 4, 5, 6, 7, 8,
9, 10,11,12,13,14,15,16});
vector bool char b8 = ((vector bool char){0, -1, 0, -1, 0, 0, 0, 0,
-1, -1, -1, -1, 0, -1, 0, -1});
vector unsigned short u16 = ((vector unsigned short){1, 2, 3, 4, 5, 6, 7, 8});
vector signed short s16 = ((vector signed short){1, 2, 3, 4, 5, 6, 7, 8});
vector bool short b16 = ((vector bool short){-1, 0, -1, 0, -1, -1, 0, 0});
vector unsigned int u32 = ((vector unsigned int){1, 2, 3, 4});
vector signed int s32 = ((vector signed int){1, 2, 3, 4});
vector bool int b32 = ((vector bool int){0, -1, -1, 0});
vector float f32 = ((vector float){1, 2, 3, 4});
vector pixel p16 = ((vector pixel){1, 2, 3, 4, 5, 6, 7, 8});
f_u8(&u8);
f_s8(&s8);
f_b8(&b8);
f_u16(&u16);
f_s16(&s16);
f_b16(&b16);
f_u32(&u32);
f_s32(&s32);
f_b32(&b32);
f_f32(&f32);
f_p16(&p16);
return 0;
}
#include <altivec.h>
vector unsigned char u8;
vector signed char s8;
vector bool char b8;
vector unsigned short u16;
vector signed short s16;
vector bool short b16;
vector unsigned int u32;
vector signed int s32;
vector bool int b32;
vector float f32;
vector pixel p16;
void f_u8(vector unsigned char *p) {
u8 = vec_add(*p, *p);
}
void f_s8(vector signed char *p) {
s8 = vec_add(*p, *p);
}
void f_b8(vector bool char *p) {
b8 = vec_cmpgt(s8, s8);
b8 = vec_xor(b8, *p);
}
void f_u16(vector unsigned short *p) {
u16 = vec_add(*p, *p);
}
void f_s16(vector signed short *p) {
s16 = vec_add(*p, *p);
}
void f_b16(vector bool short *p) {
b16 = vec_cmpgt(s16, s16);
b16 = vec_xor(b16, *p);
}
void f_u32(vector unsigned int *p) {
u32 = vec_add(*p, *p);
}
void f_s32(vector signed int *p) {
s32 = vec_add(*p, *p);
}
void f_b32(vector bool int *p) {
b32 = vec_cmpgt(s32, s32);
b32 = vec_xor(b32, *p);
}
void f_f32(vector float *p) {
f32 = vec_add(*p, *p);
}
void f_p16(vector pixel *p) {
p16 = *p;
}
int main() {
vector unsigned char u8 = ((vector unsigned char){1, 2, 3, 4, 5, 6, 7, 8,
9, 10,11,12,13,14,15,16});
vector signed char s8 = ((vector signed char){1, 2, 3, 4, 5, 6, 7, 8,
9, 10,11,12,13,14,15,16});
vector bool char b8 = ((vector bool char){0, -1, 0, -1, 0, 0, 0, 0,
-1, -1, -1, -1, 0, -1, 0, -1});
vector unsigned short u16 = ((vector unsigned short){1, 2, 3, 4, 5, 6, 7, 8});
vector signed short s16 = ((vector signed short){1, 2, 3, 4, 5, 6, 7, 8});
vector bool short b16 = ((vector bool short){-1, 0, -1, 0, -1, -1, 0, 0});
vector unsigned int u32 = ((vector unsigned int){1, 2, 3, 4});
vector signed int s32 = ((vector signed int){1, 2, 3, 4});
vector bool int b32 = ((vector bool int){0, -1, -1, 0});
vector float f32 = ((vector float){1, 2, 3, 4});
vector pixel p16 = ((vector pixel){1, 2, 3, 4, 5, 6, 7, 8});
f_u8(&u8);
f_s8(&s8);
f_b8(&b8);
f_u16(&u16);
f_s16(&s16);
f_b16(&b16);
f_u32(&u32);
f_s32(&s32);
f_b32(&b32);
f_f32(&f32);
f_p16(&p16);
return 0;
}
#include <altivec.h>
static vector unsigned int v = {0x01020304,0x05060708,0x21324354,0x65768798};
static vector unsigned int f() { return v; }
int main() {
vector unsigned int x = f();
return 0;
}
#include <altivec.h>
static vector unsigned int v = {0x01020304,0x05060708,0x21324354,0x65768798};
static vector unsigned int f() { return vec_splat(v,0); }
int main() {
vector unsigned int x = f();
return 0;
}
#include "harness.h"
static vector float
matvecmul4 (vector float c0, vector float c1, vector float c2,
vector float c3, vector float v)
{
/* Set result to a vector of f32 0's */
vector float result = ((vector float){0.,0.,0.,0.});
result = vec_madd (c0, vec_splat (v, 0), result);
result = vec_madd (c1, vec_splat (v, 1), result);
result = vec_madd (c2, vec_splat (v, 2), result);
result = vec_madd (c3, vec_splat (v, 3), result);
return result;
}
static void test()
{
check(vec_all_eq(matvecmul4(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37}),
((vector float){41,43,47,53}),
((vector float){59,61,67,71})),
((vector float){5241, 5966, 6746, 7814})),
"matvecmul4");
}
/* { dg-do compile } */
#include <altivec.h>
inline void
transpose4x4(vector float *matrix)
{
vector float v0, v1, v2, v3;
v0 = vec_mergeh(matrix[0], matrix[2]);
v1 = vec_mergel(matrix[0], matrix[2]);
v2 = vec_mergeh(matrix[1], matrix[3]);
v3 = vec_mergel(matrix[1], matrix[3]);
matrix[0] = vec_mergeh(v0, v2);
matrix[1] = vec_mergel(v0, v2);
matrix[2] = vec_mergeh(v1, v3);
matrix[3] = vec_mergel(v1, v3);
}
void
vec_ifft64(vector float *x0, vector float *x1)
{
int i;
vector float real[4], imag[4];
vector float c0r, c1r, c2r, c3r, c0i, c1i, c2i, c3i;
vector float d0r, d1r, d2r, d3r, d0i, d1i, d2i, d3i;
/*
* N=64
*
* Stage 1: t=1 => k = 0, j = 0..15
* ================================
* for j = 0:15
* c0 = x0(j+0*16);
* c1 = x0(j+1*16);
* c2 = x0(j+2*16);
* c3 = x0(j+3*16);
*
* d0 = c0 + c2;
* d1 = c0 - c2;
* d2 = c1 + c3;
* d3 = i*(c1 - c3);
*
* x1(4j+0) = d0 + d2;
* x1(4j+1) = d1 + d3;
* x1(4j+2) = d0 - d2;
* x1(4j+3) = d1 - d3;
* end
******************************************************/
for (i=0; i < 4; i++)
{
c0r = x0[i];
c1r = x0[i+4];
c2r = x0[i+8];
c3r = x0[i+12];
c0i = x0[i+16];
c1i = x0[i+20];
c2i = x0[i+24];
c3i = x0[i+28];
d0r = vec_add(c0r, c2r);
d1r = vec_sub(c0r, c2r);
d2r = vec_add(c1r, c3r);
d3r = vec_sub(c3i, c1i);
d0i = vec_add(c0i, c2i);
d1i = vec_sub(c0i, c2i);
d2i = vec_add(c1i, c3i);
d3i = vec_sub(c1r, c3r);
/* Calculate real{x1} */
real[0] = vec_add(d0r, d2r);
real[1] = vec_add(d1r, d3r);
real[2] = vec_sub(d0r, d2r);
real[3] = vec_sub(d1r, d3r);
transpose4x4(real);
/* Calculate imag{x1} */
imag[0] = vec_add(d0i, d2i);
imag[1] = vec_add(d1i, d3i);
imag[2] = vec_sub(d0i, d2i);
imag[3] = vec_sub(d1i, d3i);
transpose4x4(imag);
x1[4*i] = real[0];
x1[4*i+1] = real[1];
x1[4*i+2] = real[2];
x1[4*i+3] = real[3];
x1[4*i+16] = imag[0];
x1[4*i+17] = imag[1];
x1[4*i+18] = imag[2];
x1[4*i+19] = imag[3];
}
}
/* { dg-do compile } */
#include <altivec.h>
typedef struct n_a {
signed char m1;
vector float m2;
} n_a;
typedef struct n_b {
signed char m1;
struct n_a m2;
} n_b;
extern void f(n_b *);
void initn_b(signed char p1, struct n_a p2)
{
n_b _i;
((_i).m1 = p1, (_i).m2 = p2);
f(&_i);
}
/* { dg-do compile } */
#include <altivec.h>
typedef struct n_a {
signed char m1;
vector float m2;
} n_a;
typedef struct n_b {
signed char m1;
struct n_a m2;
} n_b;
extern void f(n_b *);
void initn_b()
{
n_b _i;
f(&_i);
}
/* { dg-do compile } */
#include <altivec.h>
void valuen014(vector float p1, vector float p2, vector float p3,
vector float p4, vector float p5, vector float p6,
vector float p7, vector float p8, vector float p9,
vector float p10, vector float p11, vector float p12,
int p13)
{
}
void f()
{
valuen014(((vector float) {1.83e+09, 5.73e+08, -2.96e+08, -7.46e+08}),
((vector float) {-2.01e+09, 9.89e+08, -1.92e+09, 2.09e+09}),
((vector float) {1.95e+09, -2.41e+08, 2.67e+08, 1.67e+09}),
((vector float) {-2.12e+09, 8.18e+08, 9.47e+08, -1.25e+09}),
((vector float) {-9.47e+08, -9.3e+08, -1.65e+09, 1.64e+09}),
((vector float) {-7.99e+07, 4.86e+08, -3.4e+06, 3.11e+08}),
((vector float) {1.78e+09, 1.22e+09, -1.27e+09, -3.11e+08}),
((vector float) {1.41e+09, -5.38e+07, -2.08e+09, 1.54e+09}),
((vector float) {3.1e+08, -1.49e+09, 5.38e+08, -1.3e+09}),
((vector float) {9.66e+08, 5.5e+08, 1.75e+08, -8.22e+07}),
((vector float) {-1.72e+08, -2.06e+09, 1.14e+09, -4.64e+08}),
((vector float) {-1.25e+09, 8.12e+07, -2.02e+09, 4.71e+08}),
962425441);
}
/* { dg-do compile } */
#include <altivec.h>
extern vector unsigned int gn00111;
int f() { return (int)&gn00111; }
/* { dg-do compile } */
#include <altivec.h>
void valuen014(vector float p1, vector float p2, vector float p3,
vector float p4, vector float p5, vector float p6,
vector float p7, vector float p8, vector float p9,
vector float p10, vector float p11, vector float p12,
vector float px)
{
}
void f()
{
valuen014(((vector float) {1.83e+09, 5.73e+08, -2.96e+08, -7.46e+08}),
((vector float) {-2.01e+09, 9.89e+08, -1.92e+09, 2.09e+09}),
((vector float) {1.95e+09, -2.41e+08, 2.67e+08, 1.67e+09}),
((vector float) {-2.12e+09, 8.18e+08, 9.47e+08, -1.25e+09}),
((vector float) {-9.47e+08, -9.3e+08, -1.65e+09, 1.64e+09}),
((vector float) {-7.99e+07, 4.86e+08, -3.4e+06, 3.11e+08}),
((vector float) {1.78e+09, 1.22e+09, -1.27e+09, -3.11e+08}),
((vector float) {1.41e+09, -5.38e+07, -2.08e+09, 1.54e+09}),
((vector float) {3.1e+08, -1.49e+09, 5.38e+08, -1.3e+09}),
((vector float) {9.66e+08, 5.5e+08, 1.75e+08, -8.22e+07}),
((vector float) {-1.72e+08, -2.06e+09, 1.14e+09, -4.64e+08}),
((vector float) {-1.25e+09, 8.12e+07, -2.02e+09, 4.71e+08}),
((vector float){1,1,1,1}));
}
/* { dg-do compile } */
#include <altivec.h>
void valuen014(vector float p1, vector float p2, vector float p3,
vector float p4, vector float p5, vector float p6,
vector float p7, vector float p8, vector float p9,
vector float p10, vector float p11, vector float p12,
vector float px, vector float py, vector float pz,
int p13)
{
}
void f()
{
valuen014(((vector float) {1.83e+09, 5.73e+08, -2.96e+08, -7.46e+08}),
((vector float) {-2.01e+09, 9.89e+08, -1.92e+09, 2.09e+09}),
((vector float) {1.95e+09, -2.41e+08, 2.67e+08, 1.67e+09}),
((vector float) {-2.12e+09, 8.18e+08, 9.47e+08, -1.25e+09}),
((vector float) {-9.47e+08, -9.3e+08, -1.65e+09, 1.64e+09}),
((vector float) {-7.99e+07, 4.86e+08, -3.4e+06, 3.11e+08}),
((vector float) {1.78e+09, 1.22e+09, -1.27e+09, -3.11e+08}),
((vector float) {1.41e+09, -5.38e+07, -2.08e+09, 1.54e+09}),
((vector float) {3.1e+08, -1.49e+09, 5.38e+08, -1.3e+09}),
((vector float) {9.66e+08, 5.5e+08, 1.75e+08, -8.22e+07}),
((vector float) {-1.72e+08, -2.06e+09, 1.14e+09, -4.64e+08}),
((vector float) {-1.25e+09, 8.12e+07, -2.02e+09, 4.71e+08}),
((vector float){1,1,1,1}),
((vector float){2,2,2,2}),
((vector float){3,3,3,3}),
962425441);
}
/* { dg-do compile } */
#include <altivec.h>
extern void referencen001(int *p1, int *p2, int *p3, int *p4, int *p5, int *p6, int *p7, vector float *p8);
extern int gn0011;
extern int gn0012;
extern int gn0013;
extern int gn0014;
extern int gn0015;
extern int gn0016;
extern int gn0017;
extern vector float gn0018;
void testn001(void)
{
int a1;
int a2;
int a3;
int a4;
int a5;
int a6;
int a7;
vector float a8;
(a1 = -53786696, a2 = -1840132710, a3 = -2130504990, a4 = 1429848501, a5 = 1139248605, a6 = 428762253, a7 = -1581480596, a8 = ((vector float) {1.66e+09, -1.83e+09, -6.79e+08, 1.58e+09}));
referencen001(&a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8);
}
/* { dg-do compile } */
#include <altivec.h>
typedef struct n001 {
signed char m1;
vector float m2;
int m3;
vector signed short m4;
signed char m5;
vector unsigned short m6;
} n001;
n001 _i = {-4, {-1.84e+09, -2.13e+09, 1.43e+09, 1.14e+09}, 428762253, {-24132, 25298, -27969, -10358, 24164, -5157, -18143, -6509}, 40, {0x8737, 0xd7cf, 0xb6a7, 0x948f, 0x790b, 0x9255, 0x872d, 0xe72c}};
/* { dg-do compile } */
#include <altivec.h>
vector signed short _j = {-24132, 25298, -27969, -10358, 24164, -5157, -18143, -6509};
/* { dg-do compile } */
#include <altivec.h>
vector unsigned char u8a, u8b, u8c, u8d, *u8ptr;
vector signed short s16a, s16b, s16c, s16d;
vector unsigned short u16a, u16b, u16c, u16d;
vector unsigned int u32a, u32b, u32c, u32d;
vector float f32a, f32b, f32c, f32d, f32e;
int i, j, *p;
void test()
{
u8c = vec_add(u8a, u8b);
f32c = vec_ceil(f32a);
f32d = vec_vcfux(u32a, 31U);
s16c = vec_splat_s16(-16);
u8d = vec_vsldoi(u8a, u8b, 15);
f32e = vec_vmaddfp(f32a, f32b, f32c);
vec_dss(3);
vec_dssall();
vec_mtvscr(u8a);
u16a = vec_mfvscr();
}
/* { dg-do compile } */
#include <altivec.h>
vector signed short s16ss() { vector signed short a; return vec_subs(a,a); }
vector signed short s16s() { vector signed short a; return vec_sub(a,a); }
vector signed short s16x() { vector signed short a; return vec_xor(a,a); }
vector signed short s16a() { vector signed short a; return vec_andc(a,a); }
vector unsigned char u8;
vector signed short s16;
vector bool int b32;
vector float f32;
vector pixel p16;
void x()
{
u8 = ((vector unsigned char){3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3});
s16 = ((vector signed short){-7,-7,-7,-7,-7,-7,-7,-7});
b32 = ((vector bool int) {10,20,30,40});
f32 = ((vector float) {2,4,6,8});
p16 = ((vector pixel){23,23,23,23,23,23,23,23});
}
vector unsigned int a;
vector unsigned int b;
void f(void) {
a = ((vector unsigned int){1,1,1,1});
b = ((vector unsigned int){1,2,3,4});
}
/* { dg-do compile } */
#include <altivec.h>
static void f() {}
extern void g() {}
extern vector unsigned char permute_128(vector unsigned char);
void foo()
{
vector unsigned char input
= {0,1,2,4,8,16,32,64,128,0,1,2,4,8,16,32};
vector unsigned char result = permute_128(input);
void (*p)() = f;
void (*q)() = g;
}
#include "harness.h"
typedef struct n_a
{
signed char m1;
short m2;
int m3;
double m4;
vector float m5;
}
n_a;
static void
initn_a(signed char p1, short p2, int p3, double p4, vector float p5)
{
n_a i;
static struct
{
n_a b;
char a;
}
x;
i.m1 = p1;
i.m2 = p2;
i.m3 = p3;
i.m4 = p4;
i.m5 = p5;
check(i.m1 == -17, "i.m1");
check(i.m2 == 9165, "i.m2");
check(i.m3 == -1857760764, "i.m3");
check(i.m4 == 7.3e+18, "i.m4");
check(vec_all_eq(i.m5, ((vector float){-5.02e+08,
-4.34e+08,
-1.04e+09,
1.42e+09})), "i.m5");
}
static void test()
{
initn_a(-17, 9165, -1857760764, 7.3e+18,
((vector float){-5.02e+08, -4.34e+08, -1.04e+09, 1.42e+09}));
}
/* { dg-do compile } */
#include <altivec.h>
typedef short Word16;
typedef int Word32;
typedef int Flag;
extern Flag Overflow;
extern Flag Carry;
extern vector signed short table[8];
extern vector signed short slope_cos[8];
void Lsf_lsp(
vector signed short lsfq[],
vector signed short lspq[]
)
{
vector signed short Q17_con = ((vector signed short){20861,20861,20861,20861,20861,20861,20861,20861});
vector unsigned char perm1 = ((vector unsigned char){0, 8, 1, 9, 2, 10, 3,
11, 4, 12, 5 ,13, 6, 14, 7, 15});
vector unsigned char PerIndex, tmpIndex;
vector signed short tmp0, tmp1, tmp2, tmp3;
vector signed short stmp0, stmp1, stmp2, stmp3;
vector signed short index0, index1, offset0, offset1;
vector signed short table0, table1, slope0, slope1;
vector unsigned short select;
vector signed int L_tmp0, L_tmp1, L_tmp2, L_tmp3;
tmp0 = vec_madds(lsfq[0], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
tmp1 = vec_madds(lsfq[1], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
offset0 = vec_and(tmp0, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
offset1 = vec_and(tmp1, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
index0 = vec_min(vec_sra(tmp0, (((vector unsigned short){8,8,8,8,8,8,8,8})) ), (((vector signed short){63,63,63,63,63,63,63,63})) );
index1 = vec_min(vec_sra(tmp1, (((vector unsigned short){8,8,8,8,8,8,8,8})) ), (((vector signed short){63,63,63,63,63,63,63,63})) );
tmp0 = vec_sl(index0, (vector unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = (vector unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = vec_perm(PerIndex, PerIndex, perm1);
tmp0 = vec_perm(table[0], table[1], PerIndex);
stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);
tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[2], table[3], tmpIndex);
stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31})) );
tmp2 = vec_sel(tmp0, tmp1, select);
stmp2 = vec_sel(stmp0, stmp1, select);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp0 = vec_perm(table[4], table[5], tmpIndex);
stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[6], table[7], tmpIndex);
stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95})) );
tmp3 = vec_sel(tmp0, tmp1, select);
stmp3 = vec_sel(stmp0, stmp1, select);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63})) );
table0 = vec_sel(tmp2, tmp3, select);
slope0 = vec_sel(stmp2, stmp3, select);
tmp0 = vec_sl(index1, (vector unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = (vector unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = vec_perm(PerIndex, PerIndex, perm1);
tmp0 = vec_perm(table[0], table[1], PerIndex);
stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);
tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[2], table[3], tmpIndex);
stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31})) );
tmp2 = vec_sel(tmp0, tmp1, select);
stmp2 = vec_sel(stmp0, stmp1, select);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp0 = vec_perm(table[4], table[5], tmpIndex);
stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[6], table[7], tmpIndex);
stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95})) );
tmp3 = vec_sel(tmp0, tmp1, select);
stmp3 = vec_sel(stmp0, stmp1, select);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63})) );
table1 = vec_sel(tmp2, tmp3, select);
slope1 = vec_sel(stmp2, stmp3, select);
L_tmp0 = vec_sra(vec_mule(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
L_tmp1 = vec_sra(vec_mulo(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
L_tmp2 = vec_sra(vec_mule(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
L_tmp3 = vec_sra(vec_mulo(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
tmp0 = vec_packs(L_tmp0, L_tmp2);
tmp1 = vec_packs(L_tmp1, L_tmp3);
tmp2 = vec_mergeh(tmp0, tmp1);
tmp3 = vec_mergel(tmp0, tmp1);
lspq[0] = vec_adds(table0, tmp2);
lspq[1] = vec_adds(table1, tmp3);
return;
}
/* { dg-do compile } */
#include <altivec.h>
extern vector signed short table[8];
extern vector signed short slope_cos[8];
extern vector signed short slope_acos[8];
void Lsf_lsp(
vector signed short lsfq[],
vector signed short lspq[]
)
{
vector signed short Q17_con = ((vector signed short){20861,20861,20861,20861,20861,20861,20861,20861});
vector unsigned char perm1 = ((vector unsigned char){0, 8, 1, 9, 2, 10, 3,
11, 4, 12, 5 ,13, 6, 14, 7, 15});
vector unsigned char PerIndex, tmpIndex;
vector signed short tmp0, tmp1, tmp2, tmp3;
vector signed short stmp0, stmp1, stmp2, stmp3;
vector signed short index0, index1, offset0, offset1;
vector signed short table0, table1, slope0, slope1;
vector unsigned short select;
vector signed int L_tmp0, L_tmp1, L_tmp2, L_tmp3;
tmp0 = vec_madds(lsfq[0], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
tmp1 = vec_madds(lsfq[1], Q17_con, (((vector signed short){0,0,0,0,0,0,0,0})) );
offset0 = vec_and(tmp0, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
offset1 = vec_and(tmp1, (((vector signed short){0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff,0x00ff})) );
index0 = vec_min(vec_sra(tmp0, (((vector unsigned short){8,8,8,8,8,8,8,8})) ), (((vector signed short){63,63,63,63,63,63,63,63})) );
index1 = vec_min(vec_sra(tmp1, (((vector unsigned short){8,8,8,8,8,8,8,8})) ), (((vector signed short){63,63,63,63,63,63,63,63})) );
tmp0 = vec_sl(index0, (vector unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = (vector unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = vec_perm(PerIndex, PerIndex, perm1);
tmp0 = vec_perm(table[0], table[1], PerIndex);
stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);
tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[2], table[3], tmpIndex);
stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31})) );
tmp2 = vec_sel(tmp0, tmp1, select);
stmp2 = vec_sel(stmp0, stmp1, select);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp0 = vec_perm(table[4], table[5], tmpIndex);
stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[6], table[7], tmpIndex);
stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95})) );
tmp3 = vec_sel(tmp0, tmp1, select);
stmp3 = vec_sel(stmp0, stmp1, select);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63})) );
table0 = vec_sel(tmp2, tmp3, select);
slope0 = vec_sel(stmp2, stmp3, select);
tmp0 = vec_sl(index1, (vector unsigned short)((((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = (vector unsigned char)vec_packs(tmp0, vec_add(tmp0, (((vector signed short){1,1,1,1,1,1,1,1})) ));
PerIndex = vec_perm(PerIndex, PerIndex, perm1);
tmp0 = vec_perm(table[0], table[1], PerIndex);
stmp0 = vec_perm(slope_cos[0], slope_cos[1], PerIndex);
tmpIndex = vec_sub(PerIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[2], table[3], tmpIndex);
stmp1 = vec_perm(slope_cos[2], slope_cos[3], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31})) );
tmp2 = vec_sel(tmp0, tmp1, select);
stmp2 = vec_sel(stmp0, stmp1, select);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp0 = vec_perm(table[4], table[5], tmpIndex);
stmp0 = vec_perm(slope_cos[4], slope_cos[5], tmpIndex);
tmpIndex = vec_sub(tmpIndex, (((vector unsigned char){32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32})) );
tmp1 = vec_perm(table[6], table[7], tmpIndex);
stmp1 = vec_perm(slope_cos[6], slope_cos[7], tmpIndex);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95})) );
tmp3 = vec_sel(tmp0, tmp1, select);
stmp3 = vec_sel(stmp0, stmp1, select);
select = (vector unsigned short)vec_cmpgt(PerIndex, (((vector unsigned char){63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63})) );
table1 = vec_sel(tmp2, tmp3, select);
slope1 = vec_sel(stmp2, stmp3, select);
L_tmp0 = vec_sra(vec_mule(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
L_tmp1 = vec_sra(vec_mulo(slope0, offset0), (((vector unsigned int){12,12,12,12})) );
L_tmp2 = vec_sra(vec_mule(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
L_tmp3 = vec_sra(vec_mulo(slope1, offset1), (((vector unsigned int){12,12,12,12})) );
tmp0 = vec_packs(L_tmp0, L_tmp2);
tmp1 = vec_packs(L_tmp1, L_tmp3);
tmp2 = vec_mergeh(tmp0, tmp1);
tmp3 = vec_mergel(tmp0, tmp1);
lspq[0] = vec_adds(table0, tmp2);
lspq[1] = vec_adds(table1, tmp3);
return;
}
#include "harness.h"
/* This problem occurs if a function is inlined. When its local
variables get allocated space on the caller's (the function to
which it is inlined) stack frame, they don't get 16-byte alignment
even if they need it. Here's an example with a union (that's the
first case I uncovered, but it's probably a general occurrence on
inlining). */
#define N 10
/* adjust N = size of buffer to try to get bad alignment for inlined union */
#define DO_INLINE __attribute__ ((always_inline))
#define DONT_INLINE __attribute__ ((noinline))
static DO_INLINE int inline_me(vector signed short data)
{
union {vector signed short v; signed short s[8];} u;
u.v = data;
return u.s[7];
}
static DONT_INLINE int foo(vector signed short data)
{
int c, buffer[N], i;
c = inline_me(data);
for (i=0; i<N; i++) {
if (i == 0)
buffer[i] = c;
else
buffer[i] = buffer[i-1] + c*i;
}
return buffer[N-1];
}
static void test()
{
check(foo((vector signed short)
((vector unsigned char){1,2,3,4,5,6,7,8,
9,10,11,12,13,14,15,16})) == 0x2b4e0,
"foo");
}
/* Common code for most VMX test cases. To use, include this file,
then write a routine named test() that performs a series of calls
to check(). */
#include <stdlib.h>
#include <stdio.h>
#include <altivec.h>
static int failed;
static void test (void);
static void
check (int result, const char *name)
{
if (!result)
{
failed++;
printf ("fail %s\n", name);
}
}
int
main (void)
{
test ();
if (failed)
abort ();
return 0;
}
#include <altivec.h>
#include <stdlib.h>
vector unsigned char u8a, u8b;
int main()
{
if (!vec_all_eq(u8a, u8b))
abort ();
return 0;
}
/* { dg-do compile } */
#include <altivec.h>
vector unsigned char u8a, u8b, u8c, u8d, *u8ptr;
vector signed short s16a, s16b, s16c, s16d;
vector unsigned short u16a, u16b, u16c, u16d;
vector unsigned int u32a, u32b, u32c, u32d;
vector float f32a, f32b, f32c, f32d, f32e;
int i, j, *p;
void test()
{
u8c = vec_add(u8a, u8b);
f32c = vec_ceil(f32a);
f32d = vec_vcfux(u32a, 31U);
s16c = vec_splat_s16(-16);
u8d = vec_vsldoi(u8a, u8b, 15);
f32e = vec_vmaddfp(f32a, f32b, f32c);
/* vec_dstst(u8ptr, i, 3U); */
vec_dss(3);
vec_dssall();
vec_mtvscr(u8a);
u16a = vec_mfvscr();
}
#include <altivec.h>
vector unsigned char *u8ptr;
int i;
int main()
{
vec_dstst(u8ptr, i, 3U);
return 0;
}
#include "harness.h"
static vector float
f(vector float f32a, vector float f32b, vector float f32c)
{
f32c = vec_ceil(f32a);
return vec_vmaddfp(f32a, f32b, f32c);
}
static void test()
{
check(vec_all_eq(f(((vector float){2,3,5,7}),
((vector float){11,13,17,19}),
((vector float){23,29,31,37})),
((vector float){24, 42, 90, 140})),
"test");
}
/* { dg-do compile } */
double __fabs(double a) { return a; }
double __fmadd(double a, double b, double c) { return a*b+c; }
double
test(double f32a, double f32b, double f32c)
{
f32c = __fabs(f32a);
return __fmadd(f32a, f32b, f32c);
}
/* { dg-do compile } */
#include <altivec.h>
void
f(vector unsigned char *a, vector unsigned char *b, vector unsigned char *c)
{
int i;
for (i = 0; i < 16; i++)
c[i] = vec_add(a[i], b[i]);
}
/* { dg-do compile } */
#include <altivec.h>
#define SPLAT76 ((vector unsigned char)\
{0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3})
#define SPLAT54 ((vector unsigned char)\
{4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7})
#define SPLAT32 ((vector unsigned char)\
{8,9,10,11,8,9,10,11,8,9,10,11,8,9,10,11})
#define SPLAT10 ((vector unsigned char)\
{12,13,14,15,12,13,14,15,12,13,14,15,12,13,14,15})
#define INTERLEAVE ((vector unsigned char)\
{0,1,16,17,4,5,20,21,8,9,24,25,12,13,28,29})
long real_32_manytaps (long ntaps, vector signed short *c, long ndat,
vector signed short *x, vector signed short *y)
{
long i, j, op, ndatavec, ncoefvec;
vector signed short x0, x1;
vector signed short coef;
vector signed short cr10, cr32, cr54, cr76;
vector signed int y_even, y_odd;
vector signed short *x1p;
op = 0;
ndatavec = ndat >> 3;
ncoefvec = ntaps >> 3;
for (i = 0; i < ndatavec; i += 1) {
x0 = x[i];
y_even = ((vector signed int){0x8000,0x8000,0x8000,0x8000});
y_odd = ((vector signed int){0x8000,0x8000,0x8000,0x8000});
j = 0;
x1p = x + 1 + i;
do {
coef = c[j];
x1 = x1p[j];
cr10 = vec_perm(coef, coef, SPLAT10);
y_odd = vec_msums(cr10, x1, y_odd);
y_even = vec_msums(cr10, vec_sld(x0, x1, 14), y_even);
cr32 = vec_perm(coef, coef, SPLAT32);
y_odd = vec_msums(cr32, vec_sld(x0, x1, 12), y_odd);
y_even = vec_msums(cr32, vec_sld(x0, x1, 10), y_even);
cr54 = vec_perm(coef, coef, SPLAT54);
y_odd = vec_msums(cr54, vec_sld(x0, x1, 8), y_odd);
y_even = vec_msums(cr54, vec_sld(x0, x1, 6), y_even);
cr76 = vec_perm(coef, coef, SPLAT76);
y_odd = vec_msums(cr76, vec_sld(x0, x1, 4), y_odd);
y_even = vec_msums(cr76, vec_sld(x0, x1, 2), y_even);
x0 = x1;
} while (++j < ncoefvec);
y[op++] = (vector signed short) vec_perm(y_even, y_odd, INTERLEAVE);
}
return op*8;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/* In the source code, the vec_adds appears before the call to
validate_sat(). In the .s code, the vaddubs has been moved to after
the call to validate_sat(). This invalidates the meaning of checking
the saturation bit. */
#include <stdio.h>
#include <stdlib.h>
#include <altivec.h>
static int failed;
void validate_sat();
void validate_u8(vector unsigned char, vector unsigned char);
int
main()
{
vector unsigned char result_u8;
vec_mtvscr(((vector unsigned short){0,0,0,0,0,0,0,0}));
result_u8 = vec_adds(((vector unsigned
char){0,1,2,3,0xfc,0xfd,0xfe,0xff,
0,1,2,3,0xfc,0xfd,0xfe,0xff}),
((vector unsigned
char){0,0xf0,0xfd,0xfd,2,2,2,2,0,
0xf0,0xfd,0xfd,2,2,2,2}));
validate_sat();
validate_u8(result_u8, ((vector unsigned
char){0,0xf1,0xff,0xff,0xfe,0xff,0xff,0xff,
0,0xf1,0xff,0xff,0xfe,0xff,0xff,0xff}));
if (failed)
abort ();
return 0;
}
void validate_sat()
{
if (vec_any_ne(vec_splat(vec_mfvscr(), 7), ((vector unsigned short){1,1,1,1,1,1,1,1})))
{
union {vector unsigned short v; unsigned short s[8];} u;
u.v = vec_mfvscr();
printf("error: vscr == { %d,%d,%d,%d,%d,%d,%d,%d }",
u.s[0], u.s[1], u.s[2], u.s[3],
u.s[4], u.s[5], u.s[6], u.s[7]);
printf("expected { 1,1,1,1,1,1,1,1 }\n");
failed++;
}
}
void validate_u8(vector unsigned char v, vector unsigned char vx)
{
union {vector unsigned char v; unsigned char x[16]; } u, ux;
int i;
u.v = v;
ux.v = vx;
for (i=0; i<16; i++) {
if (u.x[i] != ux.x[i]) {
printf(" error: field %d %#2.2x expected %#2.2x\n",
i, u.x[i], ux.x[i]);
failed++;
}
}
}
#include <altivec.h>
extern vector unsigned char u8(void);
extern vector signed char s8(void);
extern vector bool char b8(void);
extern vector unsigned short u16(void);
extern vector signed short s16(void);
extern vector bool short b16(void);
extern vector unsigned int u32(void);
extern vector signed int s32(void);
extern vector bool int b32(void);
extern vector float f32(void);
extern vector pixel p16(void);
extern void g(vector unsigned char, ...);
void f()
{
vector unsigned char u8l = u8();
vector signed char s8l = s8();
vector bool char b8l = b8();
vector unsigned short u16l = u16();
vector signed short s16l = s16();
vector bool short b16l = b16();
vector unsigned int u32l = u32();
vector signed int s32l = s32();
vector bool int b32l = b32();
vector float f32l = f32();
vector pixel p16l = p16();
vector unsigned char u8lx = u8();
vector signed char s8lx = s8();
vector bool char b8lx = b8();
vector unsigned short u16lx = u16();
vector signed short s16lx = s16();
vector bool short b16lx = b16();
vector unsigned int u32lx = u32();
vector signed int s32lx = s32();
vector bool int b32lx = b32();
vector float f32lx = f32();
vector pixel p16lx = p16();
g(u8l, s8l, b8l, u16l, s16l, b16l, u32l, s32l, b32l, f32l, p16l,
u8lx, s8lx, b8lx, u16lx, s16lx, b16lx, u32lx, s32lx, b32lx, f32lx, p16lx);
}
vector unsigned char
u8(void)
{
static vector unsigned char zero;
return zero;
}
vector signed char
s8(void)
{
static vector signed char zero;
return zero;
}
vector bool char
b8(void)
{
static vector bool char zero;
return zero;
}
vector unsigned short
u16(void)
{
static vector unsigned short zero;
return zero;
}
vector signed short
s16(void)
{
static vector signed short zero;
return zero;
}
vector bool short
b16(void)
{
static vector bool short zero;
return zero;
}
vector unsigned int
u32(void)
{
static vector unsigned int zero;
return zero;
}
vector signed int
s32(void)
{
static vector signed int zero;
return zero;
}
vector bool int
b32(void)
{
static vector bool int zero;
return zero;
}
vector float
f32(void)
{
static vector float zero;
return zero;
}
vector pixel
p16(void)
{
static vector pixel zero;
return zero;
}
void
g(vector unsigned char a, ...)
{
}
int main()
{
f();
return 0;
}
#include <altivec.h>
extern vector unsigned char u8(void);
extern vector signed char s8(void);
extern vector bool char b8(void);
extern vector unsigned short u16(void);
extern vector signed short s16(void);
extern vector bool short b16(void);
extern vector unsigned int u32(void);
extern vector signed int s32(void);
extern vector bool int b32(void);
extern vector float f32(void);
extern vector pixel p16(void);
extern double d(void);
extern int i(void);
extern void g(vector unsigned char, ...);
void f()
{
int i1l = i();
vector unsigned char u8l = u8();
vector signed char s8l = s8();
vector bool char b8l = b8();
int i2l = i();
vector unsigned short u16l = u16();
vector signed short s16l = s16();
vector bool short b16l = b16();
int i3l = i();
vector unsigned int u32l = u32();
vector signed int s32l = s32();
vector bool int b32l = b32();
double d1l = d();
vector float f32l = f32();
vector pixel p16l = p16();
double d2l = d();
vector unsigned char u8lx = u8();
vector signed char s8lx = s8();
vector bool char b8lx = b8();
vector unsigned short u16lx = u16();
vector signed short s16lx = s16();
vector bool short b16lx = b16();
vector unsigned int u32lx = u32();
vector signed int s32lx = s32();
vector bool int b32lx = b32();
vector float f32lx = f32();
vector pixel p16lx = p16();
if (i1l)
g(u8l, s8l, b8l, u16l, s16l, b16l, u32l, s32l, b32l, f32l, p16l,
u8lx, s8lx, b8lx, u16lx, s16lx, b16lx, u32lx, s32lx, b32lx, f32lx, p16lx,
i1l, i2l, i3l, d1l, d2l);
g(u8l, i1l, i2l, i3l, d1l, d2l);
}
double
d(void)
{
static double zero;
return zero;
}
int
i(void)
{
static int non_zero;
return ++non_zero;
}
vector unsigned char
u8(void)
{
static vector unsigned char zero;
return zero;
}
vector signed char
s8(void)
{
static vector signed char zero;
return zero;
}
vector bool char
b8(void)
{
static vector bool char zero;
return zero;
}
vector unsigned short
u16(void)
{
static vector unsigned short zero;
return zero;
}
vector signed short
s16(void)
{
static vector signed short zero;
return zero;
}
vector bool short
b16(void)
{
static vector bool short zero;
return zero;
}
vector unsigned int
u32(void)
{
static vector unsigned int zero;
return zero;
}
vector signed int
s32(void)
{
static vector signed int zero;
return zero;
}
vector bool int
b32(void)
{
static vector bool int zero;
return zero;
}
vector float
f32(void)
{
static vector float zero;
return zero;
}
vector pixel
p16(void)
{
static vector pixel zero;
return zero;
}
void
g(vector unsigned char a, ...)
{
}
int main()
{
f();
return 0;
}
#include <altivec.h>
extern void g(vector unsigned char, ...);
extern vector unsigned char v(void);
extern double d(void);
extern int i(void);
static vector unsigned char v1l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v2l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v3l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v4l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v5l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v6l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v7l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v8l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v9l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v10l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v11l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static vector unsigned char v12l = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static double d1l = 0;
static double d2l = 0;
static double d3l = 0;
static double d4l = 0;
static double d5l = 0;
static double d6l = 0;
static double d7l = 0;
static double d8l = 0;
static double d9l = 0;
static double d10l = 0;
static double d11l = 0;
static double d12l = 0;
static double d13l = 0;
static double d14l = 0;
static double d15l = 0;
static double d16l = 0;
static double d17l = 0;
static double d18l = 0;
static int i1l = 0;
static int i2l = 0;
static int i3l = 0;
static int i4l = 0;
static int i5l = 0;
static int i6l = 0;
static int i7l = 0;
static int i8l = 0;
static int i9l = 0;
static int i10l = 0;
static int i11l = 0;
static int i12l = 0;
static int i13l = 0;
static int i14l = 0;
static int i15l = 0;
static int i16l = 0;
static int i17l = 0;
static int i18l = 0;
static int i19l = 0;
void f()
{
char buffer[23];
vector unsigned char v1l = v();
vector unsigned char v2l = v();
vector unsigned char v3l = v();
vector unsigned char v4l = v();
vector unsigned char v5l = v();
vector unsigned char v6l = v();
vector unsigned char v7l = v();
vector unsigned char v8l = v();
vector unsigned char v9l = v();
vector unsigned char v10l = v();
vector unsigned char v11l = v();
vector unsigned char v12l = v();
double d1l = d();
double d2l = d();
double d3l = d();
double d4l = d();
double d5l = d();
double d6l = d();
double d7l = d();
double d8l = d();
double d9l = d();
double d10l = d();
double d11l = d();
double d12l = d();
double d13l = d();
double d14l = d();
double d15l = d();
double d16l = d();
double d17l = d();
double d18l = d();
int i1l = i();
int i2l = i();
int i3l = i();
int i4l = i();
int i5l = i();
int i6l = i();
int i7l = i();
int i8l = i();
int i9l = i();
int i10l = i();
int i11l = i();
int i12l = i();
int i13l = i();
int i14l = i();
int i15l = i();
int i16l = i();
int i17l = i();
int i18l = i();
int i19l = i();
if (d1l)
g(v1l, v2l, v3l, v4l, v5l, v6l, v7l, v8l, v9l, v10l, v11l, v12l,
d1l, d2l, d3l, d4l, d5l, d6l, d7l, d8l, d9l, d10l, d11l, d12l,
d13l, d14l, d15l, d16l, d17l, d18l,
i1l, i2l, i3l, i4l, i5l, i6l, i7l, i8l, i9l, i10l, i11l, i12l,
i13l, i14l, i15l, i16l, i17l, i18l, i19l);
g(v1l, buffer,
d1l, d2l, d3l, d4l, d5l, d6l, d7l, d8l, d9l, d10l, d11l, d12l,
d13l, d14l, d15l, d16l, d17l, d18l,
i1l, i2l, i3l, i4l, i5l, i6l, i7l, i8l, i9l, i10l, i11l, i12l,
i13l, i14l, i15l, i16l, i17l, i18l, i19l);
}
double
d(void)
{
static double zero;
return zero;
}
int
i(void)
{
static int non_zero;
return ++non_zero;
}
vector unsigned char
v(void)
{
static vector unsigned char zero;
return zero;
}
void
g(vector unsigned char a, ...)
{
}
int main()
{
f();
return 0;
}
/* { dg-do compile } */
#include <altivec.h>
typedef unsigned long size_t;
vector signed int T_vec_s32;
void *T_void_ptr;
const void *T_const_void_ptr;
size_t T_size_t;
char *T_char_ptr;
vector signed short T_vec_s16;
vector signed char T_vec_s8;
vector unsigned short T_vec_u16;
vector unsigned int T_vec_u32;
vector unsigned char T_vec_u8;
vector float T_vec_f32;
int T_int;
float *T_float_ptr;
void f(void);
short *T_short_ptr;
vector signed short *T_vec_s16_ptr;
int *T_int_ptr;
vector signed int *T_vec_s32_ptr;
signed char *T_signed_char_ptr;
vector signed char *T_vec_s8_ptr;
unsigned short *T_unsigned_short_ptr;
vector unsigned short *T_vec_u16_ptr;
unsigned int *T_unsigned_int_ptr;
vector unsigned int *T_vec_u32_ptr;
unsigned char *T_unsigned_char_ptr;
vector unsigned char *T_vec_u8_ptr;
double T_double;
int T_intb;
vector bool short *T_vec_b16_ptr;
vector bool int *T_vec_b32_ptr;
vector bool char *T_vec_b8_ptr;
vector float *T_vec_f32_ptr;
vector pixel *T_vec_p16_ptr;
vector bool short T_vec_b16;
vector pixel T_vec_p16;
vector bool int T_vec_b32;
vector bool char T_vec_b8;
float T_float;
volatile void g(void);
const char *T_const_char_ptr;
#include <altivec.h>
#include <stdarg.h>
#include <stdio.h>
typedef vector unsigned int T;
extern void f1(int, ...);
extern void f2(int, T, ...);
extern void f3(int, T, T, ...);
extern void f4(int, T, T, T);
void printx(T a)
{
union {
T v;
unsigned long a[4];
} u;
u.v = a;
printf("%ld, %ld, %ld, %ld\n", u.a[0], u.a[1], u.a[2], u.a[3]);
}
void f1(int a, ...)
{
va_list ap;
va_start (ap, a);
while (a-- > 0)
printx(va_arg(ap, T));
}
void f2(int a, T b, ...)
{
va_list ap;
printx(b);
a--;
va_start (ap, b);
while (a-- > 0)
printx(va_arg(ap, T));
}
void f3(int a, T b, T c, ...)
{
va_list ap;
printx(b);
a--;
printx(c);
a--;
va_start (ap, c);
while (a-- > 0)
printx(va_arg(ap, T));
}
void f4(int a, T b, T c,
T d)
{
printx(b);
a--;
printx(c);
a--;
printx(d);
a--;
}
int main()
{
f4 (3,
((T){1,1,1,1}),
((T){2,2,2,2}),
((T){3,3,3,3}));
f3 (3,
((T){4,4,4,4}),
((T){5,5,5,5}),
((T){6,6,6,6}));
f2 (3,
((T){7,7,7,7}),
((T){8,8,8,8}),
((T){9,9,9,9}));
f1 (3,
((T){10,10,10,10}),
((T){11,11,11,11}),
((T){12,12,12,12}));
return 0;
}
/* { dg-output "1, 1, 1, 1\n" }
{ dg-output "2, 2, 2, 2\n" }
{ dg-output "3, 3, 3, 3\n" }
{ dg-output "4, 4, 4, 4\n" }
{ dg-output "5, 5, 5, 5\n" }
{ dg-output "6, 6, 6, 6\n" }
{ dg-output "7, 7, 7, 7\n" }
{ dg-output "8, 8, 8, 8\n" }
{ dg-output "9, 9, 9, 9\n" }
{ dg-output "10, 10, 10, 10\n" }
{ dg-output "11, 11, 11, 11\n" }
{ dg-output "12, 12, 12, 12\n" }
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment