From d4f18ec65299b460a15cc2181a30b79fd31b513f Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Tue, 10 Apr 2018 17:59:52 +0000 Subject: [PATCH] rs6000-c.c (altivec_overloaded_builtins): Remove erroneous entries for "vector int vec_ldl (int... gcc/ChangeLog: 2018-04-10 Kelvin Nilsen * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Remove erroneous entries for "vector int vec_ldl (int, long int *)", and "vector unsigned int vec_ldl (int, unsigned long int *)". Add comments and entries for "vector bool char vec_ldl (int, bool char *)", "vector bool short vec_ldl (int, bool short *)", "vector bool int vec_ldl (int, bool int *)", "vector bool long long vec_ldl (int, bool long long *)", "vector pixel vec_ldl (int, pixel *)", "vector long long vec_ldl (int, long long *)", "vector unsigned long long vec_ldl (int, unsigned long long *)". * config/rs6000/rs6000.c (rs6000_init_builtins): Initialize new type tree bool_long_long_type_node and correct definition of bool_V2DI_type_node to make reference to this new type tree. (rs6000_mangle_type): Replace erroneous reference to bool_long_type_node with bool_long_long_type_node. * config/rs6000/rs6000.h (enum rs6000_builtin_type_index): Add comments to emphasize sign distinctions for char and int types and replace RS6000_BTI_bool_long constant with RS6000_BTI_bool_long_long constant. Also add comment to restrict use of RS6000_BTI_pixel. (bool_long_type_node): Remove this macro definition. (bool_long_long_type_node): New macro definition gcc/testsuite/ChangeLog: 2018-04-10 Kelvin Nilsen * gcc.target/powerpc/vec-ldl-1.c: New test. * gcc.dg/vmx/ops-long-1.c: Correct test programs to reflect corrections to ABI implementation. From-SVN: r259294 --- gcc/ChangeLog | 27 ++++ gcc/config/rs6000/rs6000-c.c | 55 ++++++- gcc/config/rs6000/rs6000.c | 6 +- gcc/config/rs6000/rs6000.h | 20 ++- gcc/testsuite/ChangeLog | 6 + gcc/testsuite/gcc.dg/vmx/ops-long-1.c | 16 +- gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c | 211 +++++++++++++++++++++++++++ 7 files changed, 322 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f50d99a..cb2646b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,30 @@ +2018-04-10 Kelvin Nilsen + + * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Remove + erroneous entries for + "vector int vec_ldl (int, long int *)", and + "vector unsigned int vec_ldl (int, unsigned long int *)". + Add comments and entries for + "vector bool char vec_ldl (int, bool char *)", + "vector bool short vec_ldl (int, bool short *)", + "vector bool int vec_ldl (int, bool int *)", + "vector bool long long vec_ldl (int, bool long long *)", + "vector pixel vec_ldl (int, pixel *)", + "vector long long vec_ldl (int, long long *)", + "vector unsigned long long vec_ldl (int, unsigned long long *)". + * config/rs6000/rs6000.c (rs6000_init_builtins): Initialize new + type tree bool_long_long_type_node and correct definition of + bool_V2DI_type_node to make reference to this new type tree. + (rs6000_mangle_type): Replace erroneous reference to + bool_long_type_node with bool_long_long_type_node. + * config/rs6000/rs6000.h (enum rs6000_builtin_type_index): Add + comments to emphasize sign distinctions for char and int types and + replace RS6000_BTI_bool_long constant with + RS6000_BTI_bool_long_long constant. Also add comment to restrict + use of RS6000_BTI_pixel. + (bool_long_type_node): Remove this macro definition. + (bool_long_long_type_node): New macro definition + 2018-04-10 Jakub Jelinek PR rtl-optimization/85300 diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 8e0834a..b9b4671 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -1655,27 +1655,45 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 }, { ALTIVEC_BUILTIN_VEC_LVEBX, ALTIVEC_BUILTIN_LVEBX, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, + + /* vector float vec_ldl (int, vector float *); + vector float vec_ldl (int, float *); */ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF, RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 }, + + /* vector bool int vec_ldl (int, vector bool int *); + vector bool int vec_ldl (int, bool int *); + vector int vec_ldl (int, vector int *); + vector int vec_ldl (int, int *); + vector unsigned int vec_ldl (int, vector unsigned int *); + vector unsigned int vec_ldl (int, unsigned int *); */ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, + RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_int, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_long, 0 }, - { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V4SI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 }, - { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI, - RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long, 0 }, + + /* vector bool short vec_ldl (int, vector bool short *); + vector bool short vec_ldl (int, bool short *); + vector pixel vec_ldl (int, vector pixel *); + vector short vec_ldl (int, vector short *); + vector short vec_ldl (int, short *); + vector unsigned short vec_ldl (int, vector unsigned short *); + vector unsigned short vec_ldl (int, unsigned short *); */ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, + RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_short, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 }, @@ -1685,9 +1703,18 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V8HI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 }, + + /* vector bool char vec_ldl (int, vector bool char *); + vector bool char vec_ldl (int, bool char *); + vector char vec_ldl (int, vector char *); + vector char vec_ldl (int, char *); + vector unsigned char vec_ldl (int, vector unsigned char *); + vector unsigned char vec_ldl (int, unsigned char *); */ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, + RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_char, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 }, @@ -1696,15 +1723,35 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { ~RS6000_BTI_unsigned_V16QI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, + + /* vector double vec_ldl (int, vector double *); + vector double vec_ldl (int, double *); */ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DF, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DF, + RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double, 0 }, + + /* vector long long vec_ldl (int, vector long long *); + vector long long vec_ldl (int, long long *); + vector unsigned long long vec_ldl (int, vector unsigned long long *); + vector unsigned long long vec_ldl (int, unsigned long long *); + vector bool long long vec_ldl (int, vector bool long long *); + vector bool long long vec_ldl (int, bool long long *); */ { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, + RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V2DI, 0 }, { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, + RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, + ~RS6000_BTI_unsigned_long_long, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V2DI, 0 }, + { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI, + RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_long_long, 0 }, + { ALTIVEC_BUILTIN_VEC_LVSL, ALTIVEC_BUILTIN_LVSL, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 }, { ALTIVEC_BUILTIN_VEC_LVSL, ALTIVEC_BUILTIN_LVSL, diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 49ce4ed..a0c9b5c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -16953,7 +16953,7 @@ rs6000_init_builtins (void) bool_char_type_node = build_distinct_type_copy (unsigned_intQI_type_node); bool_short_type_node = build_distinct_type_copy (unsigned_intHI_type_node); bool_int_type_node = build_distinct_type_copy (unsigned_intSI_type_node); - bool_long_type_node = build_distinct_type_copy (unsigned_intDI_type_node); + bool_long_long_type_node = build_distinct_type_copy (unsigned_intDI_type_node); pixel_type_node = build_distinct_type_copy (unsigned_intHI_type_node); long_integer_type_internal_node = long_integer_type_node; @@ -17070,7 +17070,7 @@ rs6000_init_builtins (void) bool_V2DI_type_node = rs6000_vector_type (TARGET_POWERPC64 ? "__vector __bool long" : "__vector __bool long long", - bool_long_type_node, 2); + bool_long_long_type_node, 2); pixel_V8HI_type_node = rs6000_vector_type ("__vector __pixel", pixel_type_node, 8); @@ -32900,7 +32900,7 @@ rs6000_mangle_type (const_tree type) if (type == bool_short_type_node) return "U6__bools"; if (type == pixel_type_node) return "u7__pixel"; if (type == bool_int_type_node) return "U6__booli"; - if (type == bool_long_type_node) return "U6__booll"; + if (type == bool_long_long_type_node) return "U6__boolx"; /* Use a unique name for __float128 rather than trying to use "e" or "g". Use "g" for IBM extended double, no matter whether it is long double (using diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index d93ba5d..b9b58a8 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2580,7 +2580,7 @@ enum rs6000_builtin_type_index RS6000_BTI_opaque_V2SF, RS6000_BTI_opaque_p_V2SI, RS6000_BTI_opaque_V4SI, - RS6000_BTI_V16QI, + RS6000_BTI_V16QI, /* __vector signed char */ RS6000_BTI_V1TI, RS6000_BTI_V2SI, RS6000_BTI_V2SF, @@ -2590,7 +2590,7 @@ enum rs6000_builtin_type_index RS6000_BTI_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V8HI, - RS6000_BTI_unsigned_V16QI, + RS6000_BTI_unsigned_V16QI, /* __vector unsigned char */ RS6000_BTI_unsigned_V1TI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, @@ -2598,8 +2598,14 @@ enum rs6000_builtin_type_index RS6000_BTI_bool_char, /* __bool char */ RS6000_BTI_bool_short, /* __bool short */ RS6000_BTI_bool_int, /* __bool int */ - RS6000_BTI_bool_long, /* __bool long */ - RS6000_BTI_pixel, /* __pixel */ + RS6000_BTI_bool_long_long, /* __bool long long */ + RS6000_BTI_pixel, /* __pixel (16 bits arranged as 4 + channels of 1, 5, 5, and 5 bits + respectively as packed with the + vpkpx insn. __pixel is only + meaningful as a vector type. + There is no corresponding scalar + __pixel data type.) */ RS6000_BTI_bool_V16QI, /* __vector __bool char */ RS6000_BTI_bool_V8HI, /* __vector __bool short */ RS6000_BTI_bool_V4SI, /* __vector __bool int */ @@ -2609,11 +2615,11 @@ enum rs6000_builtin_type_index RS6000_BTI_unsigned_long, /* long_unsigned_type_node */ RS6000_BTI_long_long, /* long_long_integer_type_node */ RS6000_BTI_unsigned_long_long, /* long_long_unsigned_type_node */ - RS6000_BTI_INTQI, /* intQI_type_node */ + RS6000_BTI_INTQI, /* (signed) intQI_type_node */ RS6000_BTI_UINTQI, /* unsigned_intQI_type_node */ RS6000_BTI_INTHI, /* intHI_type_node */ RS6000_BTI_UINTHI, /* unsigned_intHI_type_node */ - RS6000_BTI_INTSI, /* intSI_type_node */ + RS6000_BTI_INTSI, /* intSI_type_node (signed) */ RS6000_BTI_UINTSI, /* unsigned_intSI_type_node */ RS6000_BTI_INTDI, /* intDI_type_node */ RS6000_BTI_UINTDI, /* unsigned_intDI_type_node */ @@ -2654,7 +2660,7 @@ enum rs6000_builtin_type_index #define bool_char_type_node (rs6000_builtin_types[RS6000_BTI_bool_char]) #define bool_short_type_node (rs6000_builtin_types[RS6000_BTI_bool_short]) #define bool_int_type_node (rs6000_builtin_types[RS6000_BTI_bool_int]) -#define bool_long_type_node (rs6000_builtin_types[RS6000_BTI_bool_long]) +#define bool_long_long_type_node (rs6000_builtin_types[RS6000_BTI_bool_long_long]) #define pixel_type_node (rs6000_builtin_types[RS6000_BTI_pixel]) #define bool_V16QI_type_node (rs6000_builtin_types[RS6000_BTI_bool_V16QI]) #define bool_V8HI_type_node (rs6000_builtin_types[RS6000_BTI_bool_V8HI]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57cf613..de5332e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-04-10 Kelvin Nilsen + + * gcc.target/powerpc/vec-ldl-1.c: New test. + * gcc.dg/vmx/ops-long-1.c: Correct test programs to reflect + corrections to ABI implementation. + 2018-04-10 Thomas Schwinge PR target/85056 diff --git a/gcc/testsuite/gcc.dg/vmx/ops-long-1.c b/gcc/testsuite/gcc.dg/vmx/ops-long-1.c index bceb4fc..5a88f93 100644 --- a/gcc/testsuite/gcc.dg/vmx/ops-long-1.c +++ b/gcc/testsuite/gcc.dg/vmx/ops-long-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx -Wno-deprecated" } */ /* Checks from the original ops.c that pass pointers to long or unsigned long for operations that support that in released versions @@ -10,28 +11,33 @@ extern int *var_int; extern long * *var_long_ptr; extern unsigned long * *var_unsigned_long_ptr; +extern long long int * *var_long_long_ptr; +extern unsigned long long int * *var_unsigned_long_long_ptr; extern vector signed int * *var_vec_s32_ptr; extern vector signed int *var_vec_s32; extern vector unsigned char * *var_vec_u8_ptr; extern vector unsigned char *var_vec_u8; extern vector unsigned int * *var_vec_u32_ptr; extern vector unsigned int *var_vec_u32; +/* Use of long long int types requires -mvsx command-line option. */ +extern vector long long int *var_vec_s64; +extern vector unsigned long long int *var_vec_u64; void f13() { *var_vec_s32++ = vec_ld(var_int[0], var_long_ptr[1]); *var_vec_s32++ = vec_lde(var_int[0], var_long_ptr[1]); - *var_vec_s32++ = vec_ldl(var_int[0], var_long_ptr[1]); + *var_vec_s64++ = vec_ldl(var_int[0], var_long_long_ptr[1]); *var_vec_s32++ = vec_lvewx(var_int[0], var_long_ptr[1]); *var_vec_s32++ = vec_lvx(var_int[0], var_long_ptr[1]); - *var_vec_s32++ = vec_lvxl(var_int[0], var_long_ptr[1]); + *var_vec_s64++ = vec_lvxl(var_int[0], var_long_long_ptr[1]); } void f22() { *var_vec_u32++ = vec_ld(var_int[0], var_unsigned_long_ptr[1]); *var_vec_u32++ = vec_lde(var_int[0], var_unsigned_long_ptr[1]); - *var_vec_u32++ = vec_ldl(var_int[0], var_unsigned_long_ptr[1]); + *var_vec_u64++ = vec_ldl(var_int[0], var_unsigned_long_long_ptr[1]); *var_vec_u32++ = vec_lvewx(var_int[0], var_unsigned_long_ptr[1]); *var_vec_u32++ = vec_lvx(var_int[0], var_unsigned_long_ptr[1]); - *var_vec_u32++ = vec_lvxl(var_int[0], var_unsigned_long_ptr[1]); + *var_vec_u64++ = vec_lvxl(var_int[0], var_unsigned_long_long_ptr[1]); } void f25() { *var_vec_u8++ = vec_lvsl(var_int[0], var_long_ptr[1]); diff --git a/gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c b/gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c new file mode 100644 index 0000000..6240eec --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c @@ -0,0 +1,211 @@ +/* { dg-do run { target powerpc*-*-* } } */ +/* { dg-require-effective-target vmx_hw } */ +/* { dg-options "-maltivec -O0 -Wall" } */ + +#include +#include + +/* vec_ldl and vec_lvxl (an alias for vec_ldl) do an aligned vector + * load from memory, marking the fetched memory as least recently used + * (hinting that we do not anticipate a need to fetch this vector + * again within the near future.) + * + * vector result = vec_ldl (int offset, *address) + * vector result = vec_ldl (int offset, vector *address) + * + * The effect of these instructions is to perform the following: + * + * resuilt = *((vector *)((((char *) address) + offset) & ~0x0f)) + * + * This test exercises the following new prototypes of the vec_ldl + * service which were added in late March 2018: + * + * vector bool int vec_ldl (int, bool int *) + * vector bool short vec_ldl (int, bool short *) + * vector bool char vec_ldl (int, bool char *) + * vector double vec_ldl (int, double *) + * vector long long int vec_ldl (int, long long int *) + * vector unsigned long long int vec_ldl (int, unsigned long long int *) + * vector bool long long vec_ldl (int, bool long long *) + */ + +static signed char ca[64] __attribute__((aligned(16))); +static unsigned char uca[64] __attribute__((aligned(16))); + +static vector signed char *vcp = (vector signed char *) ca; +static unsigned vector char *vucp = (vector unsigned char *) uca; + +static short sa[32] __attribute__((aligned(16))); +static unsigned short usa[32] __attribute__((aligned(16))); + +static vector short *vsp = (vector short *) sa; +static unsigned vector short *vusp = (vector unsigned short *) usa; + +static int ia[16] __attribute__((aligned(16))); +static unsigned int uia[16] __attribute__((aligned(16))); + +static vector int *vip = (vector int *) ia; +static unsigned vector int *vuip = (vector unsigned int *) uia; + +static long long la[8] __attribute__((aligned(16))); +static unsigned long long ula[8] __attribute__((aligned(16))); + +static vector long long *vlp = (vector long long *) la; +static unsigned vector long long *vulp = (vector unsigned long long *) ula; + +static double da[8] __attribute__((aligned(16))); +static vector double *vdp = (vector double *) da; + + +void +doInitialization () +{ + unsigned int i; + + for (i = 0; i < 64; i++) + ca[i] = uca[i] = i; + + for (i = 0; i < 32; i++) + sa[i] = usa[i] = i; + + for (i = 0; i < 16; i++) + ia[i] = uia[i] = i; + + for (i = 0; i < 8; i++) + la[i] = ula[i] = i; + + for (i = 0; i < 8; i++) + da[i] = 0.125 * i; +} + +int +main (int argc, char *argv[]) +{ + vector long long int lv; + vector unsigned long long int ulv; + vector int iv; + vector unsigned int uiv; + vector short sv; + vector unsigned short usv; + vector signed char cv; + vector unsigned char ucv; + vector double dv; + + doInitialization (); + + /* Do vector of char. */ + for (int i = 0; i < 16; i++) { + /* Focus on ca[16] ... ca[31]. */ + cv = vec_ldl (i+16, ca); /* compiler: invalid parameter combination */ + if (cv[4] != ca[20]) + abort (); + /* Focus on uca[32] ... uca[47]. */ + ucv = vec_ldl (i+32, uca); + if (ucv[7] != uca[39]) + abort (); + /* Focus on ca[0] ... ca[15]. */ + cv = vec_ldl (i, vcp); + if (cv[3] != ca[3]) + abort (); + /* Focus on ca[0] ... ca[15] while i <= 8. + Focus on ca[16] ... ca[31] while i > 8. */ + ucv = vec_ldl (i+7, vucp); + if ((i+7 > 15) && (ucv[13] != uca[29])) + abort (); + if ((i + 7 <= 15) && (ucv[13] != uca[13])) + abort (); + } + + /* Do vector of short. */ + for (int i = 0; i < 16; i++) { + /* Focus on sa[8] ... sa[15]. */ + sv = vec_ldl (i+16, sa); + if (sv[4] != sa[12]) + abort (); + /* Focus on usa[24] ... usa[31]. */ + usv = vec_ldl (i+48, usa); + if (usv[7] != usa[31]) + abort (); + /* Focus on sa[0] ... sa[7]. */ + sv = vec_ldl (i, vsp); + if (sv[3] != sa[3]) + abort (); + /* Focus on usa[0] ... usa[7] while i <= 8. + Focus on usa[8] ... usa[15] while i > 8. */ + usv = vec_ldl (i+7, vusp); + if ((i+7 > 15) && (usv[5] != usa[13])) + abort (); + if ((i + 7 <= 15) && (usv[5] != usa[5])) + abort (); + } + + /* Do vector of int. */ + for (int i = 0; i < 16; i++) { + /* Focus on ia[8] ... ia[11]. */ + iv = vec_ldl (i+32, ia); + if (iv[3] != ia[11]) + abort (); + /* Focus on uia[12] ... uia[15]. */ + uiv = vec_ldl (i+48, uia); + if (uiv[2] != uia[14]) + abort (); + /* Focus on ia[0] ... ia[3]. */ + iv = vec_ldl (i, vip); + if (iv[3] != ia[3]) + abort (); + /* Focus on uia[0] ... uia[3] while i <= 8. + Focus on uia[4] ... uia[7] while i > 8. */ + uiv = vec_ldl (i+7, vuip); + if ((i+7 > 15) && (uiv[1] != uia[5])) + abort (); + if ((i + 7 <= 15) && (uiv[1] != uia[1])) + abort (); + } + + /* Do vector of long long int. */ + for (int i = 0; i < 16; i++) { + /* Focus on la[4] ... la[5]. */ + lv = vec_ldl (i+32, la); + if (lv[1] != la[5]) + abort (); + /* Focus on ula[6] ... ula[7]. */ + ulv = vec_ldl (i+48, ula); + if (ulv[0] != uia[6]) + abort (); + /* Focus on la[0] ... la[1]. */ + lv = vec_ldl (i, vlp); + if (iv[1] != la[1]) + abort (); + /* Focus on ula[0] ... uia[1] while i <= 8. + Focus on uia[2] ... uia[3] while i > 8. */ + ulv = vec_ldl (i+7, vulp); + if ((i+7 > 15) && (ulv[1] != ula[3])) + abort (); + if ((i + 7 <= 15) && (ulv[1] != ula[1])) + abort (); + } + + /* Do vector of double. */ + for (int i = 0; i < 16; i++) { + /* Focus on da[2] ... da[3]. */ + dv = vec_ldl (i+16, da); + if (dv[1] != da[3]) + abort (); + /* Focus on da[6] ... da[7]. */ + dv = vec_ldl (i+48, vdp); + if (dv[0] != da[6]) + abort (); + /* Focus on da[0] ... da[1]. */ + dv = vec_ldl (i, da); + if (dv[1] != da[1]) + abort (); + /* Focus on da[0] ... da[1] while i <= 8. + Focus on da[2] ... da[3] while i > 8. */ + dv = vec_ldl (i+7, vdp); + if ((i+7 <= 15) && (dv[1] != da[1])) + abort (); + if ((i + 7 > 15) && (dv[1] != da[3])) + abort (); + } + return 0; +} -- 2.7.4