+2018-01-22 Carl Love <cel@us.ibm.com>
+
+ * config/rs6000/rs6000-builtin.def (ST_ELEMREV_V1TI, LD_ELEMREV_V1TI,
+ LVX_V1TI): Add macro expansion.
+ * config/rs6000/rs6000-c.c (altivec_builtin_types): Add argument
+ definitions for VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_VEC_ST,
+ VSX_BUILTIN_VEC_XL, LD_ELEMREV_V1TI builtins.
+ * config/rs6000/rs6000-p8swap.c (insn_is_swappable_p);
+ Change check to determine if the instruction is a byte reversing
+ entry. Fix typo in comment.
+ * config/rs6000/rs6000.c (altivec_expand_builtin): Add case entry
+ for VSX_BUILTIN_ST_ELEMREV_V1TI and VSX_BUILTIN_LD_ELEMREV_V1TI.
+ Add def_builtin calls for new builtins.
+ * config/rs6000/vsx.md (vsx_st_elemrev_v1ti, vsx_ld_elemrev_v1ti):
+ Add define_insn expansion.
+
2018-01-22 Sebastian Perta <sebastian.perta@renesas.com>
* config/rl78/rl78.md: New define_expand "umaxdi3".
BU_ALTIVEC_X (LVXL_V16QI, "lvxl_v16qi", MEM)
BU_ALTIVEC_X (LVX, "lvx", MEM)
BU_ALTIVEC_X (LVX_V2DF, "lvx_v2df", MEM)
+BU_ALTIVEC_X (LVX_V1TI, "lvx_v1ti", MEM)
BU_ALTIVEC_X (LVX_V2DI, "lvx_v2di", MEM)
BU_ALTIVEC_X (LVX_V4SF, "lvx_v4sf", MEM)
BU_ALTIVEC_X (LVX_V4SI, "lvx_v4si", MEM)
BU_VSX_X (STXVW4X_V4SI, "stxvw4x_v4si", MEM)
BU_VSX_X (STXVW4X_V8HI, "stxvw4x_v8hi", MEM)
BU_VSX_X (STXVW4X_V16QI, "stxvw4x_v16qi", MEM)
+BU_VSX_X (LD_ELEMREV_V1TI, "ld_elemrev_v1ti", MEM)
BU_VSX_X (LD_ELEMREV_V2DF, "ld_elemrev_v2df", MEM)
BU_VSX_X (LD_ELEMREV_V2DI, "ld_elemrev_v2di", MEM)
BU_VSX_X (LD_ELEMREV_V4SF, "ld_elemrev_v4sf", MEM)
BU_VSX_X (LD_ELEMREV_V4SI, "ld_elemrev_v4si", MEM)
BU_VSX_X (LD_ELEMREV_V8HI, "ld_elemrev_v8hi", MEM)
BU_VSX_X (LD_ELEMREV_V16QI, "ld_elemrev_v16qi", MEM)
+BU_VSX_X (ST_ELEMREV_V1TI, "st_elemrev_v1ti", MEM)
BU_VSX_X (ST_ELEMREV_V2DF, "st_elemrev_v2df", MEM)
BU_VSX_X (ST_ELEMREV_V2DI, "st_elemrev_v2di", MEM)
BU_VSX_X (ST_ELEMREV_V4SF, "st_elemrev_v4sf", MEM)
RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF, 0 },
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DF,
RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double, 0 },
+ { VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V1TI,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTTI, 0 },
+ { VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V1TI,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_V1TI, 0 },
+ { VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V1TI,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTTI, 0 },
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 },
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long, 0 },
+ { VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_INTDI, 0 },
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI,
~RS6000_BTI_unsigned_V2DI, 0 },
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI,
~RS6000_BTI_unsigned_long_long, 0 },
+ { VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTDI, 0 },
+
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVW4X_V4SF,
RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
{ VSX_BUILTIN_VEC_XL, VSX_BUILTIN_LXVW4X_V4SF,
RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF, 0 },
{ VSX_BUILTIN_VEC_XL_BE, VSX_BUILTIN_LD_ELEMREV_V2DF,
RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double, 0 },
+ { VSX_BUILTIN_VEC_XL_BE, VSX_BUILTIN_LD_ELEMREV_V1TI,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTTI, 0 },
+ { VSX_BUILTIN_VEC_XL_BE, VSX_BUILTIN_LD_ELEMREV_V1TI,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTTI, 0 },
{ VSX_BUILTIN_VEC_XL_BE, VSX_BUILTIN_LD_ELEMREV_V2DI,
RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 },
{ VSX_BUILTIN_VEC_XL_BE, VSX_BUILTIN_LD_ELEMREV_V2DI,
RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF },
{ VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_ST_ELEMREV_V2DF,
RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double },
+ { VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_ST_ELEMREV_V1TI,
+ RS6000_BTI_void, RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTTI },
+ { VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_ST_ELEMREV_V1TI,
+ RS6000_BTI_void, RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTTI },
{ VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_ST_ELEMREV_V2DI,
RS6000_BTI_void, RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI },
{ VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_ST_ELEMREV_V2DI,
RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double, 0 },
{ VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 },
+ { VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTTI, 0 },
+ { VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long, 0 },
+ { VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long, 0 },
+ { VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTTI, 0 },
{ VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI,
~RS6000_BTI_unsigned_V2DI, 0 },
+ { VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long_long, 0 },
{ VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVD2X_V2DI,
RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V2DI, 0 },
{ VSX_BUILTIN_VEC_LD, VSX_BUILTIN_LXVW4X_V4SF,
RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF },
{ VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V2DF,
RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double },
+ { VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V2DI,
+ RS6000_BTI_void, RS6000_BTI_V2DI, RS6000_BTI_INTDI,
+ ~RS6000_BTI_long_long },
+ { VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V2DI,
+ RS6000_BTI_void, RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTDI,
+ ~RS6000_BTI_unsigned_long_long },
+ { VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V1TI,
+ RS6000_BTI_void, RS6000_BTI_V1TI, RS6000_BTI_INTDI, ~RS6000_BTI_INTTI },
+ { VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V1TI,
+ RS6000_BTI_void, RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTDI, ~RS6000_BTI_UINTTI },
{ VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V2DI,
RS6000_BTI_void, RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI },
{ VSX_BUILTIN_VEC_ST, VSX_BUILTIN_STXVD2X_V2DI,
if (insn_entry[i].is_store)
{
if (GET_CODE (body) == SET
- && GET_CODE (SET_SRC (body)) != UNSPEC)
+ && GET_CODE (SET_SRC (body)) != UNSPEC
+ && GET_CODE (SET_SRC (body)) != VEC_SELECT)
{
rtx lhs = SET_DEST (body);
- /* Even without a swap, the LHS might be a vec_select for, say,
+ /* Even without a swap, the RHS might be a vec_select for, say,
a byte-reversing store. */
if (GET_CODE (lhs) != MEM)
return 0;
unaligned-supporting store, so use a generic expander. For
little-endian, the exact element-reversing instruction must
be used. */
+ case VSX_BUILTIN_ST_ELEMREV_V1TI:
+ {
+ enum insn_code code = (BYTES_BIG_ENDIAN ? CODE_FOR_vsx_store_v1ti
+ : CODE_FOR_vsx_st_elemrev_v1ti);
+ return altivec_expand_stv_builtin (code, exp);
+ }
case VSX_BUILTIN_ST_ELEMREV_V2DF:
{
enum insn_code code = (BYTES_BIG_ENDIAN ? CODE_FOR_vsx_store_v2df
: CODE_FOR_vsx_ld_elemrev_v2df);
return altivec_expand_lv_builtin (code, exp, target, false);
}
+ case VSX_BUILTIN_LD_ELEMREV_V1TI:
+ {
+ enum insn_code code = (BYTES_BIG_ENDIAN ? CODE_FOR_vsx_load_v1ti
+ : CODE_FOR_vsx_ld_elemrev_v1ti);
+ return altivec_expand_lv_builtin (code, exp, target, false);
+ }
case VSX_BUILTIN_LD_ELEMREV_V2DI:
{
enum insn_code code = (BYTES_BIG_ENDIAN ? CODE_FOR_vsx_load_v2di
= build_function_type_list (void_type_node,
V2DF_type_node, long_integer_type_node,
pvoid_type_node, NULL_TREE);
+ tree void_ftype_v1ti_long_pvoid
+ = build_function_type_list (void_type_node,
+ V1TI_type_node, long_integer_type_node,
+ pvoid_type_node, NULL_TREE);
tree void_ftype_v2di_long_pvoid
= build_function_type_list (void_type_node,
V2DI_type_node, long_integer_type_node,
VSX_BUILTIN_LD_ELEMREV_V16QI);
def_builtin ("__builtin_vsx_st_elemrev_v2df", void_ftype_v2df_long_pvoid,
VSX_BUILTIN_ST_ELEMREV_V2DF);
+ def_builtin ("__builtin_vsx_st_elemrev_v1ti", void_ftype_v1ti_long_pvoid,
+ VSX_BUILTIN_ST_ELEMREV_V1TI);
def_builtin ("__builtin_vsx_st_elemrev_v2di", void_ftype_v2di_long_pvoid,
VSX_BUILTIN_ST_ELEMREV_V2DI);
def_builtin ("__builtin_vsx_st_elemrev_v4sf", void_ftype_v4sf_long_pvoid,
= build_function_type_list (void_type_node,
V1TI_type_node, long_integer_type_node,
pvoid_type_node, NULL_TREE);
+ def_builtin ("__builtin_vsx_ld_elemrev_v1ti", v1ti_ftype_long_pcvoid,
+ VSX_BUILTIN_LD_ELEMREV_V1TI);
def_builtin ("__builtin_vsx_lxvd2x_v1ti", v1ti_ftype_long_pcvoid,
VSX_BUILTIN_LXVD2X_V1TI);
def_builtin ("__builtin_vsx_stxvd2x_v1ti", void_ftype_v1ti_long_pvoid,
"lxvd2x %x0,%y1"
[(set_attr "type" "vecload")])
+(define_insn "vsx_ld_elemrev_v1ti"
+ [(set (match_operand:V1TI 0 "vsx_register_operand" "=wa")
+ (vec_select:V1TI
+ (match_operand:V1TI 1 "memory_operand" "Z")
+ (parallel [(const_int 0)])))]
+ "VECTOR_MEM_VSX_P (V1TImode) && !BYTES_BIG_ENDIAN"
+{
+ return "lxvd2x %x0,%y1\;xxpermdi %x0,%x0,%x0,2";
+}
+ [(set_attr "type" "vecload")])
+
(define_insn "vsx_ld_elemrev_v2df"
[(set (match_operand:V2DF 0 "vsx_register_operand" "=wa")
(vec_select:V2DF
"lxvb16x %x0,%y1"
[(set_attr "type" "vecload")])
+(define_insn "vsx_st_elemrev_v1ti"
+ [(set (match_operand:V1TI 0 "memory_operand" "=Z")
+ (vec_select:V1TI
+ (match_operand:V1TI 1 "vsx_register_operand" "+wa")
+ (parallel [(const_int 0)])))
+ (clobber (match_dup 1))]
+ "VECTOR_MEM_VSX_P (V2DImode) && !BYTES_BIG_ENDIAN"
+{
+ return "xxpermdi %x1,%x1,%x1,2\;stxvd2x %x1,%y0";
+}
+ [(set_attr "type" "vecstore")])
+
(define_insn "vsx_st_elemrev_v2df"
[(set (match_operand:V2DF 0 "memory_operand" "=Z")
(vec_select:V2DF
{
if (!TARGET_P9_VECTOR)
{
- rtx subreg, perm[16], pcv;
+ rtx mem_subreg, subreg, perm[16], pcv;
rtx tmp = gen_reg_rtx (V8HImode);
/* 2 is leftmost element in register */
unsigned int reorder[16] = {13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2};
emit_insn (gen_altivec_vperm_v8hi_direct (tmp, operands[1],
operands[1], pcv));
subreg = simplify_gen_subreg (V4SImode, tmp, V8HImode, 0);
- emit_insn (gen_vsx_st_elemrev_v4si (subreg, operands[0]));
+ mem_subreg = simplify_gen_subreg (V4SImode, operands[0], V8HImode, 0);
+ emit_insn (gen_vsx_st_elemrev_v4si (mem_subreg, subreg));
DONE;
}
})
+(define_insn "*vsx_st_elemrev_v2di_internal"
+ [(set (match_operand:V2DI 0 "memory_operand" "=Z")
+ (vec_select:V2DI
+ (match_operand:V2DI 1 "vsx_register_operand" "wa")
+ (parallel [(const_int 1) (const_int 0)])))]
+ "VECTOR_MEM_VSX_P (V2DImode) && !BYTES_BIG_ENDIAN && TARGET_P9_VECTOR"
+ "stxvd2x %x1,%y0"
+ [(set_attr "type" "vecstore")])
+
(define_insn "*vsx_st_elemrev_v8hi_internal"
[(set (match_operand:V8HI 0 "memory_operand" "=Z")
(vec_select:V8HI
{
if (!TARGET_P9_VECTOR)
{
- rtx subreg, perm[16], pcv;
+ rtx mem_subreg, subreg, perm[16], pcv;
rtx tmp = gen_reg_rtx (V16QImode);
/* 3 is leftmost element in register */
unsigned int reorder[16] = {12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3};
emit_insn (gen_altivec_vperm_v16qi_direct (tmp, operands[1],
operands[1], pcv));
subreg = simplify_gen_subreg (V4SImode, tmp, V16QImode, 0);
- emit_insn (gen_vsx_st_elemrev_v4si (subreg, operands[0]));
+ mem_subreg = simplify_gen_subreg (V4SImode, operands[0], V16QImode, 0);
+ emit_insn (gen_vsx_st_elemrev_v4si (mem_subreg, subreg));
DONE;
}
})
+2018-01-22 Carl Love <cel@us.ibm.com>
+ * gcc.target/powerpc/powerpc.exp: Add torture tests for
+ builtins-4-runnable.c, builtins-6-runnable.c,
+ builtins-5-p9-runnable.c, builtins-6-p9-runnable.c.
+ * gcc.target/powerpc/builtins-6-runnable.c: New test file.
+ * gcc.target/powerpc/builtins-4-runnable.c: Add additional tests
+ for signed/unsigned 128-bit and long long int loads.
+
2018-01-22 Marek Polacek <polacek@redhat.com>
PR c++/81933
/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
-/* { dg-options "-maltivec -mvsx" } */
+/* { dg-options "-maltivec -mvsx" } */
#include <inttypes.h>
#include <altivec.h> // vector
+
+#ifdef DEBUG
#include <stdio.h>
+#endif
void abort (void);
float data_f[100];
double data_d[100];
-
+ __uint128_t data_u128[100];
+ __int128_t data_128[100];
+
signed long long disp;
-
+
vector signed char vec_c_expected1, vec_c_expected2, vec_c_result1, vec_c_result2;
vector unsigned char vec_uc_expected1, vec_uc_expected2,
vec_uc_result1, vec_uc_result2;
vec_sll_result1, vec_sll_result2;
vector unsigned long long vec_ull_expected1, vec_ull_expected2,
vec_ull_result1, vec_ull_result2;
+ vector __int128_t vec_128_expected1, vec_128_result1;
+ vector __uint128_t vec_u128_expected1, vec_u128_result1;
vector float vec_f_expected1, vec_f_expected2, vec_f_result1, vec_f_result2;
vector double vec_d_expected1, vec_d_expected2, vec_d_result1, vec_d_result2;
char buf[20];
signed long long zero = (signed long long) 0;
-
+
for (i = 0; i < 100; i++)
{
data_c[i] = i;
data_ull[i] = i+1001;
data_f[i] = i+100000.0;
data_d[i] = i+1000000.0;
+ data_128[i] = i + 12800000;
+ data_u128[i] = i + 12800001;
}
-
- disp = 0;
+
+ // vec_xl() tests
+ disp = 1;
+
+ vec_c_expected1 = (vector signed char){0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15};
+ vec_c_result1 = vec_xl (0, data_c);
+
+ vec_c_expected2 = (vector signed char){1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16};
+ vec_c_result2 = vec_xl (disp, data_c);
+
+ vec_uc_expected1 = (vector unsigned char){1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16};
+ vec_uc_result1 = vec_xl (0, data_uc);
+
+ vec_uc_expected2 = (vector unsigned char){2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17};
+ vec_uc_result2 = vec_xl (disp, data_uc);
+
+ for (i = 0; i < 16; i++)
+ {
+ if (vec_c_result1[i] != vec_c_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_c_result1[%d] = %d; vec_c_expected1[%d] = %d\n",
+ i, vec_c_result1[i], i, vec_c_expected1[i]);
+#else
+ abort ();
+#endif
+ if (vec_c_result2[i] != vec_c_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_c_result2[%d] = %d; vec_c_expected2[%d] = %d\n",
+ i, vec_c_result2[i], i, vec_c_expected2[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_uc_result1[i] != vec_uc_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_uc_result1[%d] = %d; vec_uc_expected1[%d] = %d\n",
+ i, vec_uc_result1[i], i, vec_uc_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_uc_result2[i] != vec_uc_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_uc_result2[%d] = %d; vec_uc_expected2[%d] = %d\n",
+ i, vec_uc_result2[i], i, vec_uc_expected2[i]);
+#else
+ abort ();
+#endif
+ }
+
+ disp = 2;
+ vec_ssi_expected1 = (vector signed short){10, 11, 12, 13, 14, 15, 16, 17};
+
+ vec_ssi_result1 = vec_xl (0, data_ssi);
+
+ vec_ssi_expected2 = (vector signed short){11, 12, 13, 14, 15, 16, 17, 18};
+ vec_ssi_result2 = vec_xl (disp, data_ssi);
+
+ vec_usi_expected1 = (vector unsigned short){11, 12, 13, 14, 15, 16, 17, 18};
+ vec_usi_result1 = vec_xl (0, data_usi);
+
+ vec_usi_expected2 = (vector unsigned short){12, 13, 14, 15, 16, 17, 18, 19};
+ vec_usi_result2 = vec_xl (disp, data_usi);
+
+
+ for (i = 0; i < 8; i++)
+ {
+ if (vec_ssi_result1[i] != vec_ssi_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_ssi_result1[%d] = %d; vec_ssi_expected1[%d] = %d\n",
+ i, vec_ssi_result1[i], i, vec_ssi_expected1[i]);
+#else
+ abort ();
+#endif
+ if (vec_ssi_result2[i] != vec_ssi_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_ssi_result2[%d] = %d; vec_ssi_expected2[%d] = %d\n",
+ i, vec_ssi_result2[i], i, vec_ssi_expected2[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_usi_result1[i] != vec_usi_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_usi_result1[%d] = %d; vec_usi_expected1[%d] = %d\n",
+ i, vec_usi_result1[i], i, vec_usi_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_usi_result2[i] != vec_usi_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_usi_result2[%d] = %d; vec_usi_expected2[%d] = %d\n",
+ i, vec_usi_result2[i], i, vec_usi_expected2[i]);
+#else
+ abort ();
+#endif
+ }
+
+ disp = 4;
+ vec_si_result1 = vec_xl (zero, data_si);
+ vec_si_expected1 = (vector int){100, 101, 102, 103};
+
+ vec_si_result2 = vec_xl (disp, data_si);
+ vec_si_expected2 = (vector int){101, 102, 103, 104};
+
+ vec_ui_result1 = vec_xl (zero, data_ui);
+ vec_ui_expected1 = (vector unsigned int){101, 102, 103, 104};
+
+ vec_ui_result2 = vec_xl (disp, data_ui);
+ vec_ui_expected2 = (vector unsigned int){102, 103, 104, 105};
+
+ for (i = 0; i < 4; i++)
+ {
+ if (vec_si_result1[i] != vec_si_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_si_result1[%d] = %d; vec_si_expected1[%d] = %d\n",
+ i, vec_si_result1[i], i, vec_si_expected1[i]);
+#else
+ abort ();
+#endif
+ if (vec_si_result2[i] != vec_si_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_si_result2[%d] = %d; vec_si_expected2[%d] = %d\n",
+ i, vec_si_result2[i], i, vec_si_expected2[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_ui_result1[i] != vec_ui_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_ui_result1[%d] = %d; vec_ui_expected1[%d] = %d\n",
+ i, vec_ui_result1[i], i, vec_ui_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_ui_result2[i] != vec_ui_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_ui_result2[%d] = %d; vec_ui_expected1[%d] = %d\n",
+ i, vec_si_result2[i], i, vec_ui_expected1[i]);
+#else
+ abort ();
+#endif
+ }
+
+ disp = 8;
+ vec_sll_result1 = vec_xl (zero, data_sll);
+ vec_sll_expected1 = (vector signed long long){1000, 1001};
+
+ vec_sll_result2 = vec_xl (disp, data_sll);
+ vec_sll_expected2 = (vector signed long long){1001, 1002};
+
+ vec_ull_result1 = vec_xl (zero, data_ull);
+ vec_ull_expected1 = (vector unsigned long long){1001, 1002};
+
+ vec_ull_result2 = vec_xl (disp, data_ull);
+ vec_ull_expected2 = (vector unsigned long long){1002, 1003};
+
+ for (i = 0; i < 2; i++)
+ {
+ if (vec_sll_result1[i] != vec_sll_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_sll_result1[%d] = %lld; vec_sll_expected1[%d] = %lld\n",
+ i, vec_sll_result1[i], i, vec_sll_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_sll_result2[i] != vec_sll_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_sll_result2[%d] = %lld; vec_sll_expected2[%d] = %lld\n",
+ i, vec_sll_result2[i], i, vec_sll_expected2[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_ull_result1[i] != vec_ull_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_ull_result1[%d] = %lld; vec_ull_expected1[%d] = %lld\n",
+ i, vec_ull_result1[i], i, vec_ull_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_ull_result2[i] != vec_ull_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_ull_result2[%d] = %lld; vec_ull_expected2[%d] = %lld\n",
+ i, vec_ull_result2[i], i, vec_ull_expected2[i]);
+#else
+ abort ();
+#endif
+ }
+
+ disp = 4;
+ vec_f_result1 = vec_xl (zero, data_f);
+ vec_f_expected1 = (vector float){100000.0, 100001.0, 100002.0, 100003.0};
+
+ vec_f_result2 = vec_xl (disp, data_f);
+ vec_f_expected2 = (vector float){100001.0, 100002.0, 100003.0, 100004.0};
+
+ for (i = 0; i < 4; i++)
+ {
+ if (vec_f_result1[i] != vec_f_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_f_result1[%d] = %f; vec_f_expected1[%d] = %f\n",
+ i, vec_f_result1[i], i, vec_f_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_f_result2[i] != vec_f_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_f_result2[%d] = %f; vec_f_expected2[%d] = %f\n",
+ i, vec_f_result2[i], i, vec_f_expected2[i]);
+#else
+ abort ();
+#endif
+ }
+
+ disp = 8;
+ vec_d_result1 = vec_xl (zero, data_d);
+ vec_d_expected1 = (vector double){1000000.0, 1000001.0};
+
+ vec_d_result2 = vec_xl (disp, data_d);
+ vec_d_expected2 = (vector double){1000001.0, 1000002.0};
+
+ for (i = 0; i < 2; i++)
+ {
+ if (vec_d_result1[i] != vec_d_expected1[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_d_result1[%d] = %f; vec_f_expected1[%d] = %f\n",
+ i, vec_d_result1[i], i, vec_d_expected1[i]);
+#else
+ abort ();
+#endif
+
+ if (vec_d_result2[i] != vec_d_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_d_result2[%d] = %f; vec_f_expected2[%d] = %f\n",
+ i, vec_d_result2[i], i, vec_d_expected2[i]);
+#else
+ abort ();
+#endif
+ }
+
+ vec_128_expected1 = (vector __int128_t){12800000};
+ vec_128_result1 = vec_xl (zero, data_128);
+
+ if (vec_128_expected1[0] != vec_128_result1[0])
+ {
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
+ vec_128_result1[0] >> 64,
+ vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+ printf("vec_128_expected1[0] = %lld %llu\n",
+ vec_128_expected1[0] >> 64,
+ vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+#else
+ abort ();
+#endif
+ }
+
+ vec_u128_result1 = vec_xl (zero, data_u128);
+ vec_u128_expected1 = (vector __uint128_t){12800001};
+ if (vec_u128_expected1[0] != vec_u128_result1[0])
+ {
+#ifdef DEBUG
+ printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
+ vec_u128_result1[0] >> 64,
+ vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+ printf("vec_u128_expected1[0] = %lld\n",
+ vec_u128_expected1[0] >> 64,
+ vec_u128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+#else
+ abort ();
+#endif
+ }
+
+ // vec_xl_be() tests
+ disp = 1;
#ifdef __BIG_ENDIAN__
- printf("BIG ENDIAN\n");
vec_c_expected1 = (vector signed char){0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15};
#else
- printf("LITTLE ENDIAN\n");
vec_c_expected1 = (vector signed char){15, 14, 13, 12, 11, 10, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0};
#endif
vec_c_result1 = vec_xl_be (0, data_c);
- disp = 1;
+
#ifdef __BIG_ENDIAN__
vec_c_expected2 = (vector signed char){1, 2, 3, 4, 5, 6, 7, 8,
for (i = 0; i < 16; i++)
{
if (vec_c_result1[i] != vec_c_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_c_result1[%d] = %d; vec_c_expected1[%d] = %d\n",
+ i, vec_c_result1[i], i, vec_c_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_c_result2[i] != vec_c_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_c_result2[%d] = %d; vec_c_expected2[%d] = %d\n",
+ i, vec_c_result2[i], i, vec_c_expected2[i]);
+#else
+ abort ();
+#endif
if (vec_uc_result1[i] != vec_uc_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_uc_result1[%d] = %d; vec_uc_expected1[%d] = %d\n",
+ i, vec_uc_result1[i], i, vec_uc_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_uc_result2[i] != vec_uc_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_uc_result2[%d] = %d; vec_uc_expected2[%d] = %d\n",
+ i, vec_uc_result1[i], i, vec_uc_expected1[i]);
+#else
+ abort ();
+#endif
}
vec_ssi_result1 = vec_xl_be (zero, data_ssi);
#else
vec_usi_expected1 = (vector unsigned short){18, 17, 16, 15, 14, 13, 12, 11};
#endif
-
+
disp = 2;
vec_usi_result2 = vec_xl_be (disp, data_usi);
for (i = 0; i < 8; i++)
{
if (vec_ssi_result1[i] != vec_ssi_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_ssi_result1[%d] = %d; vec_ssi_expected1[%d] = %d\n",
+ i, vec_ssi_result1[i], i, vec_ssi_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_ssi_result2[i] != vec_ssi_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_ssi_result2[%d] = %d; vec_ssi_expected2[%d] = %d\n",
+ i, vec_ssi_result2[i], i, vec_ssi_expected2[i]);
+#else
+ abort ();
+#endif
if (vec_usi_result1[i] != vec_usi_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_usi_result1[%d] = %d; vec_usi_expected1[%d] = %d\n",
+ i, vec_usi_result1[i], i, vec_usi_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_usi_result2[i] != vec_usi_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_usi_result2[%d] = %d; vec_usi_expected2[%d] = %d\n",
+ i, vec_usi_result2[i], i, vec_usi_expected2[i]);
+#else
+ abort ();
+#endif
}
vec_si_result1 = vec_xl_be (zero, data_si);
for (i = 0; i < 4; i++)
{
if (vec_si_result1[i] != vec_si_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_si_result1[%d] = %d; vec_si_expected1[%d] = %d\n",
+ i, vec_si_result1[i], i, vec_si_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_si_result2[i] != vec_si_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_si_result2[%d] = %d; vec_si_expected2[%d] = %d\n",
+ i, vec_si_result2[i], i, vec_si_expected2[i]);
+#else
+ abort ();
+#endif
if (vec_ui_result1[i] != vec_ui_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_ui_result1[%d] = %d; vec_ui_expected1[%d] = %d\n",
+ i, vec_ui_result1[i], i, vec_ui_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_ui_result2[i] != vec_ui_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_ui_result2[%d] = %d; vec_ui_expected2[%d] = %d\n",
+ i, vec_ui_result2[i], i, vec_ui_expected2[i]);
+#else
+ abort ();
+#endif
}
vec_sll_result1 = vec_xl_be (zero, data_sll);
for (i = 0; i < 2; i++)
{
if (vec_sll_result1[i] != vec_sll_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_sll_result1[%d] = %lld; vec_sll_expected1[%d] = %d\n",
+ i, vec_sll_result1[i], i, vec_sll_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_sll_result2[i] != vec_sll_expected2[i])
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_sll_result2[%d] = %lld; vec_sll_expected2[%d] = %d\n",
+ i, vec_sll_result2[i], i, vec_sll_expected2[i]);
+#else
abort ();
+#endif
if (vec_ull_result1[i] != vec_ull_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_ull_result1[%d] = %lld; vec_ull_expected1[%d] = %d\n",
+ i, vec_ull_result1[i], i, vec_ull_expected1[i]);
+#else
+ abort ();
+#endif
if (vec_ull_result2[i] != vec_ull_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_ull_result2[%d] = %lld; vec_ull_expected2[%d] = %d\n",
+ i, vec_ull_result2[i], i, vec_sll_expected2[i]);
+#else
+ abort ();
+#endif
}
vec_f_result1 = vec_xl_be (zero, data_f);
for (i = 0; i < 4; i++)
{
if (vec_f_result1[i] != vec_f_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_f_result1[%d] = %f; vec_f_expected1[%d] = %f\n",
+ i, vec_f_result1[i], i, vec_f_expected1[i]);
+#else
+ abort ();
+#endif
+
if (vec_f_result2[i] != vec_f_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_f_result2[%d] = %f; vec_f_expected2[%d] = %f\n",
+ i, vec_f_result2[i], i, vec_f_expected2[i]);
+#else
+ abort ();
+#endif
}
vec_d_result1 = vec_xl_be (zero, data_d);
for (i = 0; i < 2; i++)
{
if (vec_d_result1[i] != vec_d_expected1[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_d_result2[%d] = %f; vec_d_expected2[%d] = %f\n",
+ i, vec_d_result2[i], i, vec_d_expected2[i]);
+#else
+ abort ();
+#endif
+
if (vec_d_result2[i] != vec_d_expected2[i])
- abort ();
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_d_result2[%d] = %f; vec_d_expected2[%d] = %f\n",
+ i, vec_d_result2[i], i, vec_d_expected2[i]);
+#else
+ abort ();
+#endif
+ }
+
+ disp = 0;
+ vec_128_result1 = vec_xl_be (zero, data_128);
+#ifdef __BIG_ENDIAN__
+ vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
+#else
+ vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
+#endif
+
+ if (vec_128_expected1[0] != vec_128_result1[0])
+ {
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
+ vec_128_result1[0] >> 64,
+ vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
+ printf(" vec_128_expected1[0] = %llu %llu\n",
+ vec_128_expected1[0] >> 64,
+ vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
+#else
+ abort ();
+#endif
+ }
+
+#ifdef __BIG_ENDIAN__
+ vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
+#else
+ vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
+#endif
+
+ vec_u128_result1 = vec_xl_be (zero, data_u128);
+
+ if (vec_u128_expected1[0] != vec_u128_result1[0])
+ {
+#ifdef DEBUG
+ printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
+ vec_u128_result1[0] >> 64,
+ vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
+ printf(" vec_u128_expected1[0] = %llu %llu\n",
+ vec_u128_expected1[0] >> 64,
+ vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
+#else
+ abort ();
+#endif
}
}
--- /dev/null
+/* { dg-do run { target { powerpc*-*-* && { lp64 && p8vector_hw } } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O3" } */
+
+#include <stdint.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <altivec.h>
+
+#define TRUE 1
+#define FALSE 0
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+void abort (void);
+
+int result_wrong_sc (vector signed char vec_expected,
+ vector signed char vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_sc (vector signed char vec_expected,
+ vector signed char vec_actual)
+{
+ int i;
+
+ printf("expected signed char data\n");
+ for (i = 0; i < 16; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual signed char data\n");
+ for (i = 0; i < 16; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_uc (vector unsigned char vec_expected,
+ vector unsigned char vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_uc (vector unsigned char vec_expected,
+ vector unsigned char vec_actual)
+{
+ int i;
+
+ printf("expected signed char data\n");
+ for (i = 0; i < 16; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual signed char data\n");
+ for (i = 0; i < 16; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_us (vector unsigned short vec_expected,
+ vector unsigned short vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_us (vector unsigned short vec_expected,
+ vector unsigned short vec_actual)
+{
+ int i;
+
+ printf("expected unsigned short data\n");
+ for (i = 0; i < 8; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual unsigned short data\n");
+ for (i = 0; i < 8; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_ss (vector signed short vec_expected,
+ vector signed short vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_ss (vector signed short vec_expected,
+ vector signed short vec_actual)
+{
+ int i;
+
+ printf("expected signed short data\n");
+ for (i = 0; i < 8; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual signed short data\n");
+ for (i = 0; i < 8; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_ui (vector unsigned int vec_expected,
+ vector unsigned int vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_ui (vector unsigned int vec_expected,
+ vector unsigned int vec_actual)
+{
+ int i;
+
+ printf("expected unsigned int data\n");
+ for (i = 0; i < 4; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual unsigned int data\n");
+ for (i = 0; i < 4; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_si (vector signed int vec_expected,
+ vector signed int vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_si (vector signed int vec_expected,
+ vector signed int vec_actual)
+{
+ int i;
+
+ printf("expected signed int data\n");
+ for (i = 0; i < 4; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual signed int data\n");
+ for (i = 0; i < 4; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_ull (vector unsigned long long vec_expected,
+ vector unsigned long long vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_ull (vector unsigned long long vec_expected,
+ vector unsigned long long vec_actual)
+{
+ int i;
+
+ printf("expected unsigned long long data\n");
+ for (i = 0; i < 2; i++)
+ // printf(" %llu,", vec_expected[i]);
+ printf(" 0x%llx,", vec_expected[i]);
+
+ printf("\nactual unsigned long long data\n");
+ for (i = 0; i < 2; i++)
+ // printf(" %llu,", vec_actual[i]);
+ printf("0x %llx,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_sll (vector signed long long vec_expected,
+ vector signed long long vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_sll (vector signed long long vec_expected,
+ vector signed long long vec_actual)
+{
+ int i;
+
+ printf("expected signed long long data\n");
+ for (i = 0; i < 2; i++)
+ printf(" %lld,", vec_expected[i]);
+
+ printf("\nactual signed long long data\n");
+ for (i = 0; i < 2; i++)
+ printf(" %lld,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_u128 (vector __uint128_t vec_expected,
+ vector __uint128_t vec_actual)
+{
+ int i;
+
+ if (vec_expected[0] != vec_actual[0])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_u128 (vector __uint128_t vec_expected,
+ vector __uint128_t vec_actual)
+{
+ printf("expected uint128 data\n");
+ printf(" %llu%llu\n", (unsigned long long)(vec_expected[0] >> 64),
+ (unsigned long long)(vec_expected[0] & 0xFFFFFFFFFFFFFFFF));
+
+ printf("\nactual uint128 data\n");
+ printf(" %llu%llu\n", (unsigned long long)(vec_actual[0] >> 64),
+ (unsigned long long)(vec_actual[0] & 0xFFFFFFFFFFFFFFFF));
+}
+
+
+int result_wrong_s128 (vector __int128_t vec_expected,
+ vector __int128_t vec_actual)
+{
+ int i;
+
+ if (vec_expected[0] != vec_actual[0])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_s128 (vector __int128 vec_expected,
+ vector __int128 vec_actual)
+{
+ printf("expected int128 data\n");
+ printf(" %lld%llu\n", (signed long long)(vec_expected[0] >> 64),
+ (unsigned long long)(vec_expected[0] & 0xFFFFFFFFFFFFFFFF));
+
+ printf("\nactual int128 data\n");
+ printf(" %lld%llu\n", (signed long long)(vec_actual[0] >> 64),
+ (unsigned long long)(vec_actual[0] & 0xFFFFFFFFFFFFFFFF));
+}
+
+int result_wrong_d (vector double vec_expected,
+ vector double vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_d (vector double vec_expected,
+ vector double vec_actual)
+{
+ int i;
+
+ printf("expected double data\n");
+ for (i = 0; i < 2; i++)
+ printf(" %f,", vec_expected[i]);
+
+ printf("\nactual double data\n");
+ for (i = 0; i < 2; i++)
+ printf(" %f,", vec_actual[i]);
+ printf("\n");
+}
+
+int result_wrong_f (vector float vec_expected,
+ vector float vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+void print_f (vector float vec_expected,
+ vector float vec_actual)
+{
+ int i;
+
+ printf("expected float data\n");
+ for (i = 0; i < 4; i++)
+ printf(" %f,", vec_expected[i]);
+
+ printf("\nactual float data\n");
+ for (i = 0; i < 4; i++)
+ printf(" %f,", vec_actual[i]);
+ printf("\n");
+}
+
+int main() {
+ int i, j;
+ size_t len;
+ vector signed char store_data_sc;
+ vector unsigned char store_data_uc;
+ vector signed int store_data_si;
+ vector unsigned int store_data_ui;
+ vector __int128_t store_data_s128;
+ vector __uint128_t store_data_u128;
+ vector signed long long int store_data_sll;
+ vector unsigned long long int store_data_ull;
+ vector signed short store_data_ss;
+ vector unsigned short store_data_us;
+ vector double store_data_d;
+ vector float store_data_f;
+
+ signed char *address_sc;
+ unsigned char *address_uc;
+ signed int *address_si;
+ unsigned int *address_ui;
+ __int128_t *address_s128;
+ __uint128_t *address_u128;
+ signed long long int *address_sll;
+ unsigned long long int *address_ull;
+ signed short int *address_ss;
+ unsigned short int *address_us;
+ double *address_d;
+ float *address_f;
+
+ vector unsigned char *datap;
+
+ vector unsigned char vec_uc_expected1, vec_uc_result1;
+ vector signed char vec_sc_expected1, vec_sc_result1;
+ vector signed int vec_si_expected1, vec_si_result1;
+ vector unsigned int vec_ui_expected1, vec_ui_result1;
+ vector __int128_t vec_s128_expected1, vec_s128_result1;
+ vector __uint128_t vec_u128_expected1, vec_u128_result1;
+ vector signed long long int vec_sll_expected1, vec_sll_result1;
+ vector unsigned long long int vec_ull_expected1, vec_ull_result1;
+ vector signed short int vec_ss_expected1, vec_ss_result1;
+ vector unsigned short int vec_us_expected1, vec_us_result1;
+ vector double vec_d_expected1, vec_d_result1;
+ vector float vec_f_expected1, vec_f_result1;
+
+ signed long long disp;
+
+ /* VEC_XST */
+ disp = 0;
+ vec_sc_expected1 = (vector signed char){ -7, -6, -5, -4, -3, -2, -1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+ store_data_sc = (vector signed char){ -7, -6, -5, -4, -3, -2, -1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+
+ for (i=0; i<16; i++)
+ vec_sc_result1[i] = 0;
+
+ address_sc = &vec_sc_result1[0];
+
+ vec_xst (store_data_sc, disp, address_sc);
+
+ if (result_wrong_sc (vec_sc_expected1, vec_sc_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, sc disp = 0, result does not match expected result\n");
+ print_sc (vec_sc_expected1, vec_sc_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 2;
+ vec_sc_expected1 = (vector signed char){ 0, 0, -7, -6, -5, -4, -3, -2,
+ -1, 0, 1, 2, 3, 4, 5, 6 };
+ store_data_sc = (vector signed char){ -7, -6, -5, -4, -3, -2, -1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+
+ for (i=0; i<16; i++)
+ vec_sc_result1[i] = 0;
+
+ address_sc = &vec_sc_result1[0];
+
+ vec_xst (store_data_sc, disp, address_sc);
+
+ if (result_wrong_sc (vec_sc_expected1, vec_sc_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, sc disp = 2, result does not match expected result\n");
+ print_sc (vec_sc_expected1, vec_sc_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_uc_expected1 = (vector unsigned char){ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15 };
+ store_data_uc = (vector unsigned char){ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15 };
+
+ for (i=0; i<16; i++)
+ vec_uc_result1[i] = 0;
+
+ address_uc = &vec_uc_result1[0];
+
+ vec_xst (store_data_uc, disp, address_uc);
+
+ if (result_wrong_uc (vec_uc_expected1, vec_uc_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, uc disp = 0, result does not match expected result\n");
+ print_uc (vec_uc_expected1, vec_uc_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_ss_expected1 = (vector signed short int){ -4, -3, -2, -1, 0, 1, 2, 3 };
+ store_data_ss = (vector signed short int){ -4, -3, -2, -1, 0, 1, 2, 3 };
+
+ for (i=0; i<8; i++)
+ vec_ss_result1[i] = 0;
+
+ address_ss = &vec_ss_result1[0];
+
+ vec_xst (store_data_ss, disp, address_ss);
+
+ if (result_wrong_ss (vec_ss_expected1, vec_ss_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, ss disp = 0, result does not match expected result\n");
+ print_ss (vec_ss_expected1, vec_ss_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_us_expected1 = (vector unsigned short int){ 0, 1, 2, 3, 4, 5, 6, 7 };
+ store_data_us = (vector unsigned short int){ 0, 1, 2, 3, 4, 5, 6, 7 };
+
+ for (i=0; i<8; i++)
+ vec_us_result1[i] = 0;
+
+ address_us = &vec_us_result1[0];
+
+ vec_xst (store_data_us, disp, address_us);
+
+ if (result_wrong_us (vec_us_expected1, vec_us_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, us disp = 0, result does not match expected result\n");
+ print_us (vec_us_expected1, vec_us_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_si_expected1 = (vector signed int){ -2, -1, 0, 1 };
+ store_data_si = (vector signed int){ -2, -1, 0, 1 };
+
+ for (i=0; i<4; i++)
+ vec_si_result1[i] = 0;
+
+ address_si = &vec_si_result1[0];
+
+ vec_xst (store_data_si, disp, address_si);
+
+ if (result_wrong_si (vec_si_expected1, vec_si_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, si disp = 0, result does not match expected result\n");
+ print_si (vec_si_expected1, vec_si_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_ui_expected1 = (vector unsigned int){ -2, -1, 0, 1 };
+ store_data_ui = (vector unsigned int){ -2, -1, 0, 1 };
+
+ for (i=0; i<4; i++)
+ vec_ui_result1[i] = 0;
+
+ address_ui = &vec_ui_result1[0];
+
+ vec_xst (store_data_ui, disp, address_ui);
+
+ if (result_wrong_ui (vec_ui_expected1, vec_ui_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, ui disp = 0, result does not match expected result\n");
+ print_ui (vec_ui_expected1, vec_ui_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_sll_expected1 = (vector signed long long){ -1, 0 };
+ store_data_sll = (vector signed long long ){ -1, 0 };
+
+ for (i=0; i<2; i++)
+ vec_sll_result1[i] = 0;
+
+ address_sll = (signed long long *)(&vec_sll_result1[0]);
+
+ vec_xst (store_data_sll, disp, address_sll);
+
+ if (result_wrong_sll (vec_sll_expected1, vec_sll_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, sll disp = 0, result does not match expected result\n");
+ print_sll (vec_sll_expected1, vec_sll_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_ull_expected1 = (vector unsigned long long){ 0, 1 };
+ store_data_ull = (vector unsigned long long){ 0, 1 };
+
+ for (i=0; i<2; i++)
+ vec_ull_result1[i] = 0;
+
+ address_ull = (unsigned long long int *)(&vec_ull_result1[0]);
+
+ vec_xst (store_data_ull, disp, address_ull);
+
+ if (result_wrong_ull (vec_ull_expected1, vec_ull_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, ull disp = 0, result does not match expected result\n");
+ print_ull (vec_ull_expected1, vec_ull_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_s128_expected1 = (vector __int128_t){ 12345 };
+ store_data_s128 = (vector __int128_t){ 12345 };
+
+ vec_s128_result1[0] = 0;
+
+ address_s128 = (__int128_t *)(&vec_s128_result1[0]);
+
+ vec_xst (store_data_s128, disp, address_s128);
+
+ if (result_wrong_s128 (vec_s128_expected1, vec_s128_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, s128 disp = 0, result does not match expected result\n");
+ print_s128 (vec_s128_expected1, vec_s128_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_u128_expected1 = (vector __uint128_t){ 12345 };
+ store_data_u128 = (vector __uint128_t){ 12345 };
+
+ vec_u128_result1[0] = 0;
+
+ address_u128 = (__int128_t *)(&vec_u128_result1[0]);
+
+ vec_xst (store_data_u128, disp, address_u128);
+
+ if (result_wrong_u128 (vec_u128_expected1, vec_u128_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, u128 disp = 0, result does not match expected result\n");
+ print_u128 (vec_u128_expected1, vec_u128_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_d_expected1 = (vector double){ 0, 1 };
+ store_data_d = (vector double){ 0, 1 };
+
+ for (i=0; i<2; i++)
+ vec_d_result1[i] = 0;
+
+ address_d = (double *)(&vec_d_result1[0]);
+
+ vec_xst (store_data_d, disp, address_d);
+
+ if (result_wrong_d (vec_d_expected1, vec_d_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, double disp = 0, result does not match expected result\n");
+ print_d (vec_d_expected1, vec_d_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+ vec_f_expected1 = (vector float){ 0, 1 };
+ store_data_f = (vector float){ 0, 1 };
+
+ for (i=0; i<4; i++)
+ vec_f_result1[i] = 0;
+
+ address_f = (float *)(&vec_f_result1[0]);
+
+ vec_xst (store_data_f, disp, address_f);
+
+ if (result_wrong_f (vec_f_expected1, vec_f_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst, float disp = 0, result does not match expected result\n");
+ print_f (vec_f_expected1, vec_f_result1);
+#else
+ abort();
+#endif
+ }
+
+ /* VEC_XST_BE, these always load in BE order regardless of
+ machine endianess. */
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_sc_expected1 = (vector signed char){ -7, -6, -5, -4, -3, -2, -1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+#else
+ vec_sc_expected1 = (vector signed char){ 8, 7, 6, 5, 4, 3, 2, 1,
+ 0, -1, -2, -3, -4, -5, -6, -7 };
+#endif
+ store_data_sc = (vector signed char){ -7, -6, -5, -4, -3, -2, -1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+
+ for (i=0; i<16; i++)
+ vec_sc_result1[i] = 0;
+
+ address_sc = &vec_sc_result1[0];
+
+ vec_xst_be (store_data_sc, disp, address_sc);
+
+ if (result_wrong_sc (vec_sc_expected1, vec_sc_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, sc disp = 0, result does not match expected result\n");
+ print_sc (vec_sc_expected1, vec_sc_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 2;
+#ifdef __BIG_ENDIAN__
+ vec_sc_expected1 = (vector signed char){ 0, 0, -7, -6, -5, -4, -3, -2,
+ -1, 0, 1, 2, 3, 4, 5, 6 };
+#else
+ vec_sc_expected1 = (vector signed char){ 0, 0, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0, -1, -2, -3, -4, -5 };
+#endif
+ store_data_sc = (vector signed char){ -7, -6, -5, -4, -3, -2, -1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+
+ for (i=0; i<16; i++)
+ vec_sc_result1[i] = 0;
+
+ address_sc = &vec_sc_result1[0];
+
+ vec_xst_be (store_data_sc, disp, address_sc);
+
+ if (result_wrong_sc (vec_sc_expected1, vec_sc_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, sc disp = 2, result does not match expected result\n");
+ print_sc (vec_sc_expected1, vec_sc_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_uc_expected1 = (vector unsigned char){ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15 };
+#else
+ vec_uc_expected1 = (vector unsigned char){ 15, 14, 13, 12, 11, 10, 9, 8,
+ 7, 6, 5, 4, 3, 2, 1 };
+#endif
+ store_data_uc = (vector unsigned char){ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15 };
+
+ for (i=0; i<16; i++)
+ vec_uc_result1[i] = 0;
+
+ address_uc = &vec_uc_result1[0];
+
+ vec_xst_be (store_data_uc, disp, address_uc);
+
+ if (result_wrong_uc (vec_uc_expected1, vec_uc_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, uc disp = 0, result does not match expected result\n");
+ print_uc (vec_uc_expected1, vec_uc_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_ss_expected1 = (vector signed short int){ -4, -3, -2, -1, 0, 1, 2, 3 };
+#else
+ vec_ss_expected1 = (vector signed short int){ 3, 2, 1, 0, -1, -2, -3, -4 };
+#endif
+ store_data_ss = (vector signed short int){ -4, -3, -2, -1, 0, 1, 2, 3 };
+
+ for (i=0; i<8; i++)
+ vec_ss_result1[i] = 0;
+
+ address_ss = &vec_ss_result1[0];
+
+ vec_xst_be (store_data_ss, disp, address_ss);
+
+ if (result_wrong_ss (vec_ss_expected1, vec_ss_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, ss disp = 0, result does not match expected result\n");
+ print_ss (vec_ss_expected1, vec_ss_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_us_expected1 = (vector unsigned short int){ 0, 1, 2, 3, 4, 5, 6, 7 };
+#else
+ vec_us_expected1 = (vector unsigned short int){ 7, 6, 5, 4, 3, 2, 1, 0 };
+#endif
+ store_data_us = (vector unsigned short int){ 0, 1, 2, 3, 4, 5, 6, 7 };
+
+ for (i=0; i<8; i++)
+ vec_us_result1[i] = 0;
+
+ address_us = &vec_us_result1[0];
+
+ vec_xst_be (store_data_us, disp, address_us);
+
+ if (result_wrong_us (vec_us_expected1, vec_us_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, us disp = 0, result does not match expected result\n");
+ print_us (vec_us_expected1, vec_us_result1);
+#else
+ abort();
+#endif
+ }
+
+#if 0
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_si_expected1 = (vector signed int){ -2, -1, 0, 1 };
+#else
+ vec_si_expected1 = (vector signed int){ 1, 0, -1, -2 };
+#endif
+ store_data_si = (vector signed int){ -2, -1, 0, 1 };
+
+ for (i=0; i<4; i++)
+ vec_si_result1[i] = 0;
+
+ address_si = &vec_si_result1[0];
+
+ vec_xst_be (store_data_si, disp, address_si);
+ if (result_wrong_si (vec_si_expected1, vec_si_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, si disp = 0, result does not match expected result\n");
+ print_si (vec_si_expected1, vec_si_result1);
+#else
+ abort();
+#endif
+ }
+#endif
+
+#if 0
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_ui_expected1 = (vector unsigned int){ -2, -1, 0, 1 };
+#else
+ vec_ui_expected1 = (vector unsigned int){ 1, 0, -1, -2 };
+#endif
+ store_data_ui = (vector unsigned int){ -2, -1, 0, 1 };
+
+ for (i=0; i<4; i++)
+ vec_ui_result1[i] = 0;
+
+ address_ui = &vec_ui_result1[0];
+
+ vec_xst_be (store_data_ui, disp, address_ui);
+
+ if (result_wrong_ui (vec_ui_expected1, vec_ui_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, ui disp = 0, result does not match expected result\n");
+ print_ui (vec_ui_expected1, vec_ui_result1);
+#else
+ abort();
+#endif
+ }
+#endif
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_sll_expected1 = (vector signed long long){ -1, 0 };
+#else
+ vec_sll_expected1 = (vector signed long long){ 0, -1 };
+#endif
+ store_data_sll = (vector signed long long ){ -1, 0 };
+
+ for (i=0; i<2; i++)
+ vec_sll_result1[i] = 0;
+
+ address_sll = (signed long long *)(&vec_sll_result1[0]);
+
+ vec_xst_be (store_data_sll, disp, address_sll);
+
+ if (result_wrong_sll (vec_sll_expected1, vec_sll_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, sll disp = 0, result does not match expected result\n");
+ print_sll (vec_sll_expected1, vec_sll_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_ull_expected1 = (vector unsigned long long){ 0, 1234567890123456 };
+#else
+ vec_ull_expected1 = (vector unsigned long long){1234567890123456, 0 };
+#endif
+ store_data_ull = (vector unsigned long long){ 0, 1234567890123456 };
+
+ for (i=0; i<2; i++)
+ vec_ull_result1[i] = 0;
+
+ address_ull = (unsigned long long int *)(&vec_ull_result1[0]);
+
+ vec_xst_be (store_data_ull, disp, address_ull);
+
+ if (result_wrong_ull (vec_ull_expected1, vec_ull_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, ull disp = 0, result does not match expected result\n");
+ print_ull (vec_ull_expected1, vec_ull_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+
+#ifdef __BIG_ENDIAN__
+ vec_s128_expected1 = (vector __int128_t){ (__uint128_t)12345678911121314 };
+#else
+ vec_s128_expected1 = (vector __int128_t){ (__uint128_t)12345678911121314 };
+#endif
+ store_data_s128 = (vector __int128_t)(__uint128_t){ 12345678911121314 };
+
+ vec_s128_result1[0] = 0;
+
+ address_s128 = (__int128_t *)(&vec_s128_result1[0]);
+
+ vec_xst_be (store_data_s128, disp, address_s128);
+
+ if (result_wrong_s128 (vec_s128_expected1, vec_s128_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, s128 disp = 0, result does not match expected result\n");
+ print_s128 (vec_s128_expected1, vec_s128_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)1234567891112131415 };
+#else
+ vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)1234567891112131415 };
+#endif
+ store_data_u128 = (vector __uint128_t){ (__uint128_t)1234567891112131415 };
+
+ vec_u128_result1[0] = 0;
+
+ address_u128 = (__int128_t *)(&vec_u128_result1[0]);
+
+ vec_xst_be (store_data_u128, disp, address_u128);
+
+ if (result_wrong_u128 (vec_u128_expected1, vec_u128_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, u128 disp = 0, result does not match expected result\n");
+ print_u128 (vec_u128_expected1, vec_u128_result1);
+#else
+ abort();
+#endif
+ }
+
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_d_expected1 = (vector double){ 0.0, 1.1 };
+#else
+ vec_d_expected1 = (vector double){ 1.1, 0.0 };
+#endif
+ store_data_d = (vector double){ 0.0, 1.1 };
+
+ for (i=0; i<2; i++)
+ vec_d_result1[i] = 0;
+
+ address_d = (double *)(&vec_d_result1[0]);
+
+ vec_xst_be (store_data_d, disp, address_d);
+
+ if (result_wrong_d (vec_d_expected1, vec_d_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, double disp = 0, result does not match expected result\n");
+ print_d (vec_d_expected1, vec_d_result1);
+#else
+ abort();
+#endif
+ }
+
+#if 0
+ disp = 0;
+#ifdef __BIG_ENDIAN__
+ vec_f_expected1 = (vector float){ 0.0, 1.2, 2.3, 3.4 };
+#else
+ vec_f_expected1 = (vector float){ 3.4, 2.3, 1.2, 0.0 };
+#endif
+ store_data_f = (vector float){ 0.0, 1.2, 2.3, 3.4 };
+
+ for (i=0; i<4; i++)
+ vec_f_result1[i] = 0;
+
+ address_f = (float *)(&vec_f_result1[0]);
+
+ vec_xst_be (store_data_f, disp, address_f);
+
+ if (result_wrong_f (vec_f_expected1, vec_f_result1))
+ {
+#ifdef DEBUG
+ printf("Error: vec_xst_be, float disp = 0, result does not match expected result\n");
+ print_f (vec_f_expected1, vec_f_result1);
+#else
+ abort();
+#endif
+ }
+#endif
+}
# All done.
torture-finish
+
+torture-init
+# Test load/store builtins at multiple optimizations
+set-torture-options [list -O0 -Os -O1 -O2 -O3]
+gcc-dg-runtest [list $srcdir/$subdir/builtins-4-runnable.c \
+ $srcdir/$subdir/builtins-6-runnable.c \
+ $srcdir/$subdir/builtins-5-p9-runnable.c \
+ $srcdir/$subdir/builtins-6-p9-runnable.c] "" $DEFAULT_CFLAGS
+
+# All done.
+torture-finish
+
dg-finish