mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 15:31:09 +08:00
re PR c++/51033 (generic vector subscript and shuffle support was not added to C++)
2012-06-27 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> PR C++/51033 * semantics.c (constexpr_call): Fix typo in comment. (cxx_eval_vec_perm_expr): New. (cxx_eval_constant_expression): Fold VEC_PERM_EXPRs. 2012-06-27 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org> PR c++/51033. * g++.dg/torture/vshuf-16.inc: New test. * g++.dg/torture/vshuf-2.inc: New test. * g++.dg/torture/vshuf-4.inc: New test. * g++.dg/torture/vshuf-8.inc: New test. * g++.dg/torture/vshuf-main.inc: New test. * g++.dg/torture/vshuf-v16hi.C: New test. * g++.dg/torture/vshuf-v16qi.C: New test. * g++.dg/torture/vshuf-v2df.C: New test. * g++.dg/torture/vshuf-v2di.C: New test. * g++.dg/torture/vshuf-v2sf.C: New test. * g++.dg/torture/vshuf-v2si.C: New test. * g++.dg/torture/vshuf-v4df.C: New test. * g++.dg/torture/vshuf-v4di.C: New test. * g++.dg/torture/vshuf-v4sf.C: New test. * g++.dg/torture/vshuf-v4si.C: New test. * g++.dg/torture/vshuf-v8hi.C: New test. * g++.dg/torture/vshuf-v8qi.C: New test. * g++.dg/torture/vshuf-v8si.C: New test. From-SVN: r189017
This commit is contained in:
parent
6f3a2e2390
commit
c523fc894c
@ -1,3 +1,10 @@
|
||||
2012-06-27 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
|
||||
|
||||
PR C++/51033
|
||||
* semantics.c (constexpr_call): Fix typo in comment.
|
||||
(cxx_eval_vec_perm_expr): New.
|
||||
(cxx_eval_constant_expression): Fold VEC_PERM_EXPRs.
|
||||
|
||||
2012-06-26 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR c++/53752
|
||||
|
@ -6209,7 +6209,7 @@ explain_invalid_constexpr_fn (tree fun)
|
||||
typedef struct GTY(()) constexpr_call {
|
||||
/* Description of the constexpr function definition. */
|
||||
constexpr_fundef *fundef;
|
||||
/* Parameter bindings enironment. A TREE_LIST where each TREE_PURPOSE
|
||||
/* Parameter bindings environment. A TREE_LIST where each TREE_PURPOSE
|
||||
is a parameter _DECL and the TREE_VALUE is the value of the parameter.
|
||||
Note: This arrangement is made to accomodate the use of
|
||||
iterative_hash_template_arg (see pt.c). If you change this
|
||||
@ -6233,6 +6233,9 @@ static GTY ((param_is (constexpr_call))) htab_t constexpr_call_table;
|
||||
|
||||
static tree cxx_eval_constant_expression (const constexpr_call *, tree,
|
||||
bool, bool, bool *);
|
||||
static tree cxx_eval_vec_perm_expr (const constexpr_call *, tree, bool, bool,
|
||||
bool *);
|
||||
|
||||
|
||||
/* Compute a hash value for a constexpr call representation. */
|
||||
|
||||
@ -7495,6 +7498,39 @@ non_const_var_error (tree r)
|
||||
}
|
||||
}
|
||||
|
||||
/* Evaluate VEC_PERM_EXPR (v1, v2, mask). */
|
||||
static tree
|
||||
cxx_eval_vec_perm_expr (const constexpr_call *call, tree t,
|
||||
bool allow_non_constant, bool addr,
|
||||
bool * non_constant_p)
|
||||
{
|
||||
int i;
|
||||
tree args[3];
|
||||
tree val;
|
||||
tree elttype = TREE_TYPE (t);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
args[i] = cxx_eval_constant_expression (call, TREE_OPERAND (t, i),
|
||||
allow_non_constant, addr,
|
||||
non_constant_p);
|
||||
if (*non_constant_p)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gcc_assert (TREE_CODE (TREE_TYPE (args[0])) == VECTOR_TYPE);
|
||||
gcc_assert (TREE_CODE (TREE_TYPE (args[1])) == VECTOR_TYPE);
|
||||
gcc_assert (TREE_CODE (TREE_TYPE (args[2])) == VECTOR_TYPE);
|
||||
|
||||
val = fold_ternary_loc (EXPR_LOCATION (t), VEC_PERM_EXPR, elttype,
|
||||
args[0], args[1], args[2]);
|
||||
if (val != NULL_TREE)
|
||||
return val;
|
||||
|
||||
fail:
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Attempt to reduce the expression T to a constant value.
|
||||
On failure, issue diagnostic and return error_mark_node. */
|
||||
/* FIXME unify with c_fully_fold */
|
||||
@ -7773,6 +7809,11 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
|
||||
non_constant_p);
|
||||
break;
|
||||
|
||||
case VEC_PERM_EXPR:
|
||||
r = cxx_eval_vec_perm_expr (call, t, allow_non_constant, addr,
|
||||
non_constant_p);
|
||||
break;
|
||||
|
||||
case CONVERT_EXPR:
|
||||
case VIEW_CONVERT_EXPR:
|
||||
case NOP_EXPR:
|
||||
|
@ -1,3 +1,25 @@
|
||||
2012-06-27 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
|
||||
|
||||
PR c++/51033.
|
||||
* g++.dg/torture/vshuf-16.inc: New test.
|
||||
* g++.dg/torture/vshuf-2.inc: New test.
|
||||
* g++.dg/torture/vshuf-4.inc: New test.
|
||||
* g++.dg/torture/vshuf-8.inc: New test.
|
||||
* g++.dg/torture/vshuf-main.inc: New test.
|
||||
* g++.dg/torture/vshuf-v16hi.C: New test.
|
||||
* g++.dg/torture/vshuf-v16qi.C: New test.
|
||||
* g++.dg/torture/vshuf-v2df.C: New test.
|
||||
* g++.dg/torture/vshuf-v2di.C: New test.
|
||||
* g++.dg/torture/vshuf-v2sf.C: New test.
|
||||
* g++.dg/torture/vshuf-v2si.C: New test.
|
||||
* g++.dg/torture/vshuf-v4df.C: New test.
|
||||
* g++.dg/torture/vshuf-v4di.C: New test.
|
||||
* g++.dg/torture/vshuf-v4sf.C: New test.
|
||||
* g++.dg/torture/vshuf-v4si.C: New test.
|
||||
* g++.dg/torture/vshuf-v8hi.C: New test.
|
||||
* g++.dg/torture/vshuf-v8qi.C: New test.
|
||||
* g++.dg/torture/vshuf-v8si.C: New test.
|
||||
|
||||
2012-06-27 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/53676
|
||||
|
50
gcc/testsuite/g++.dg/torture/vshuf-16.inc
Normal file
50
gcc/testsuite/g++.dg/torture/vshuf-16.inc
Normal file
@ -0,0 +1,50 @@
|
||||
/* Test fragment for vectors with 16 elements. */
|
||||
|
||||
#ifndef UNSUPPORTED
|
||||
|
||||
constexpr V in1[] = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
constexpr VI mask1[] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, },
|
||||
{ 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87,
|
||||
0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff } ,
|
||||
{ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 },
|
||||
{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }};
|
||||
|
||||
constexpr V out1[] = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
|
||||
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
|
||||
{ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
|
||||
{ 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 },
|
||||
{ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 },
|
||||
};
|
||||
|
||||
constexpr V in2[] = { { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
|
||||
{ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
|
||||
{ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
|
||||
{ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
|
||||
{ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }};
|
||||
|
||||
|
||||
constexpr V in3 = { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 };
|
||||
|
||||
constexpr VI mask2[] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
|
||||
{ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 },
|
||||
{ 7, 6, 5, 4, 16, 17, 18, 19, 31, 30, 29, 28, 3, 2, 1, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }};
|
||||
constexpr V out2[] = { { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
|
||||
{ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
|
||||
{ 17, 16, 15, 14, 30, 31, 32, 33, 45, 44, 43, 42, 13, 12, 11, 10 },
|
||||
{ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
|
||||
{ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 },
|
||||
};
|
||||
|
||||
#endif
|
22
gcc/testsuite/g++.dg/torture/vshuf-2.inc
Normal file
22
gcc/testsuite/g++.dg/torture/vshuf-2.inc
Normal file
@ -0,0 +1,22 @@
|
||||
/* Test fragment for vectors of 2 elements. */
|
||||
|
||||
#ifndef UNSUPPORTED
|
||||
|
||||
constexpr V in1[] = { { A, B}, {A, B}, { A, B},
|
||||
{ A, B}, {X, Y}, { X, Y}};
|
||||
constexpr VI mask1[] = { {0, 1}, {(unsigned)-16, 1}, {1, 0},
|
||||
{0, 0}, { 1, 1}, {1, 0}};
|
||||
constexpr V out1[] = { {A, B}, {A, B}, {B, A},
|
||||
{A, A}, {Y, Y}, {Y, X}};
|
||||
|
||||
constexpr V in2[] = { { A, B}, {A, B}, {A, B}, {A, B},
|
||||
{ A, B}, {A, B}, {A, B}};
|
||||
constexpr V in3 = {X, Y};
|
||||
constexpr VI mask2[] = { {0, 1}, {2, 3}, {0, 2}, {2, 1},
|
||||
{3, 0}, {0, 0}, {3, 3}};
|
||||
|
||||
constexpr V out2[] = { {A, B}, {X, Y}, {A, X}, {X, B},
|
||||
{Y, A}, {A, A}, {Y, Y}};
|
||||
|
||||
|
||||
#endif
|
25
gcc/testsuite/g++.dg/torture/vshuf-4.inc
Normal file
25
gcc/testsuite/g++.dg/torture/vshuf-4.inc
Normal file
@ -0,0 +1,25 @@
|
||||
/* Test fragment for vectors of 4 elements. */
|
||||
|
||||
#ifndef UNSUPPORTED
|
||||
|
||||
constexpr V in1[] = { {A, B, C, D}, {A, B, C, D}, {A, B, C, D}, {A, B, C, D},
|
||||
{A, B, C, D}, {W, X, Y, Z}, {W, X, Y, Z}, {W, X, Y, Z}};
|
||||
|
||||
constexpr VI mask1[] = { {0, 1, 2, 3}, {0+1*4, 1+2*4, 2+3*4, 3+4*4}, {3, 2, 1, 0},
|
||||
{0, 3, 2, 1}, {0, 2, 1, 3}, {3, 1, 2, 0}, {0, 0, 0, 0},
|
||||
{1, 2, 1, 2}};
|
||||
|
||||
constexpr V out1[] = { { A, B, C, D}, {A, B, C, D}, {D, C, B, A}, {A, D, C, B},
|
||||
{ A, C, B, D}, {Z, X, Y, W}, {W, W, W, W}, {X, Y, X, Y}};
|
||||
|
||||
|
||||
constexpr V in2[] = { {A, B, C, D}, {A, B, C, D}, {A, B, C, D}, {A, B, C, D},
|
||||
{A, B, C, D}, {A, B, C, D}};
|
||||
constexpr V in3 = {W, X, Y, Z};
|
||||
constexpr VI mask2[] = { {0, 1, 2, 3}, {4, 5, 6, 7}, {0, 4, 1, 5}, {0, 7, 4, 3},
|
||||
{0, 0, 0, 0}, {7, 7, 7, 7}};
|
||||
constexpr V out2[] = { {A, B, C, D}, {W, X, Y, Z}, {A, W, B, X}, {A, Z, W, D},
|
||||
{A, A, A, A}, {Z, Z, Z, Z}};
|
||||
|
||||
|
||||
#endif
|
56
gcc/testsuite/g++.dg/torture/vshuf-8.inc
Normal file
56
gcc/testsuite/g++.dg/torture/vshuf-8.inc
Normal file
@ -0,0 +1,56 @@
|
||||
/* Test fragment for vectors of 8 elements. */
|
||||
|
||||
#ifndef UNSUPPORTED
|
||||
|
||||
constexpr V in1[] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A2, B2, C2, D2, E2, F2, G2, H2 },
|
||||
{ A2, B2, C2, D2, E2, F2, G2, H2 },
|
||||
{ A2, B2, C2, D2, E2, F2, G2, H2 }};
|
||||
|
||||
constexpr VI mask1[] = { { 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
{ 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 7, 0, 5, 3, 2, 4, 1, 6 },
|
||||
{ 0, 2, 1, 3, 4, 6, 5, 7 },
|
||||
{ 3, 1, 2, 0, 7, 5, 6, 4 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 1, 6, 1, 6, 1, 6, 1, 6 }};
|
||||
|
||||
constexpr V out1[] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ H1, G1, F1, E1, D1, C1, B1, A1 },
|
||||
{ H1, A1, F1, D1, C1, E1, B1, G1 },
|
||||
{ A1, C1, B1, D1, E1, G1, F1, H1 },
|
||||
{ D2, B2, C2, A2, H2, F2, G2, E2 },
|
||||
{ A2, A2, A2, A2, A2, A2, A2, A2 },
|
||||
{ B2, G2, B2, G2, B2, G2, B2, G2 }};
|
||||
|
||||
constexpr V in2 [] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A1, B1, C1, D1, E1, F1, G1, H1 }};
|
||||
|
||||
|
||||
constexpr V in3 = { A2, B2, C2, D2, E2, F2, G2, H2};
|
||||
|
||||
constexpr VI mask2[] = { { 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
{ 8, 9, 10, 11, 12, 13, 14, 15 },
|
||||
{ 0, 8, 1, 9, 2, 10, 3, 11 },
|
||||
{ 0, 15, 4, 11, 12, 3, 7, 8 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e }};
|
||||
|
||||
constexpr V out2[] = { { A1, B1, C1, D1, E1, F1, G1, H1 },
|
||||
{ A2, B2, C2, D2, E2, F2, G2, H2 },
|
||||
{ A1, A2, B1, B2, C1, C2, D1, D2 },
|
||||
{ A1, H2, E1, D2, E2, D1, H1, A2 },
|
||||
{ A1, A1, A1, A1, A1, A1, A1, A1 },
|
||||
{ G2, G2, G2, G2, G2, G2, G2, G2 }};
|
||||
|
||||
#endif
|
29
gcc/testsuite/g++.dg/torture/vshuf-main.inc
Normal file
29
gcc/testsuite/g++.dg/torture/vshuf-main.inc
Normal file
@ -0,0 +1,29 @@
|
||||
/* Driver fragment for __builtin_shuffle of any vector shape. */
|
||||
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
extern "C" void abort(void);
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef UNSUPPORTED
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(in1)/sizeof(in1[0]); ++i)
|
||||
{
|
||||
V r = __builtin_shuffle(in1[i], mask1[i]);
|
||||
if (__builtin_memcmp(&r, &out1[i], sizeof(V)) != 0)
|
||||
abort();
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(in2)/sizeof(in2[0]); ++i)
|
||||
{
|
||||
V r = __builtin_shuffle(in2[i], in3, mask2[i]);
|
||||
if (__builtin_memcmp(&r, &out2[i], sizeof(V)) != 0)
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
8
gcc/testsuite/g++.dg/torture/vshuf-v16hi.C
Normal file
8
gcc/testsuite/g++.dg/torture/vshuf-v16hi.C
Normal file
@ -0,0 +1,8 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
typedef unsigned short V __attribute__((vector_size(32)));
|
||||
typedef V VI;
|
||||
|
||||
#include "vshuf-16.inc"
|
||||
#include "vshuf-main.inc"
|
8
gcc/testsuite/g++.dg/torture/vshuf-v16qi.C
Normal file
8
gcc/testsuite/g++.dg/torture/vshuf-v16qi.C
Normal file
@ -0,0 +1,8 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
typedef unsigned char V __attribute__((vector_size(16)));
|
||||
typedef V VI;
|
||||
|
||||
#include "vshuf-16.inc"
|
||||
#include "vshuf-main.inc"
|
17
gcc/testsuite/g++.dg/torture/vshuf-v2df.C
Normal file
17
gcc/testsuite/g++.dg/torture/vshuf-v2df.C
Normal file
@ -0,0 +1,17 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// // { dg-do run }
|
||||
#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
|
||||
typedef double V __attribute__((vector_size(16)));
|
||||
typedef unsigned long long VI __attribute__((vector_size(16)));
|
||||
#else
|
||||
#define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0.69314718055994530942
|
||||
#define B 2.7182818284590452354
|
||||
|
||||
#define X 3.14159265358979323846
|
||||
#define Y 1.41421356237309504880
|
||||
|
||||
#include "vshuf-2.inc"
|
||||
#include "vshuf-main.inc"
|
18
gcc/testsuite/g++.dg/torture/vshuf-v2di.C
Normal file
18
gcc/testsuite/g++.dg/torture/vshuf-v2di.C
Normal file
@ -0,0 +1,18 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// // { dg-do run }
|
||||
|
||||
#if __SIZEOF_LONG_LONG__ == 8
|
||||
typedef unsigned long long V __attribute__((vector_size(16)));
|
||||
typedef V VI;
|
||||
#else
|
||||
#define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0x1112131415161718
|
||||
#define B 0x2122232425262728
|
||||
|
||||
#define X 0xc1c2c3c4c5c6c7c8
|
||||
#define Y 0xd1d2d3d4d5d6d7d8
|
||||
|
||||
#include "vshuf-2.inc"
|
||||
#include "vshuf-main.inc"
|
23
gcc/testsuite/g++.dg/torture/vshuf-v2sf.C
Normal file
23
gcc/testsuite/g++.dg/torture/vshuf-v2sf.C
Normal file
@ -0,0 +1,23 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// // { dg-do run }
|
||||
#if __SIZEOF_FLOAT__ == 4
|
||||
typedef float V __attribute__((vector_size(8)));
|
||||
# if __SIZEOF_INT__ == 4
|
||||
typedef unsigned int VI __attribute__((vector_size(8)));
|
||||
# elif __SIZEOF_LONG__ == 4
|
||||
typedef unsigned long VI __attribute__((vector_size(8)));
|
||||
# else
|
||||
# define UNSUPPORTED
|
||||
# endif
|
||||
#else
|
||||
# define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0.69314718055994530942f
|
||||
#define B 2.7182818284590452354f
|
||||
|
||||
#define X 3.14159265358979323846f
|
||||
#define Y 1.41421356237309504880f
|
||||
|
||||
#include "vshuf-2.inc"
|
||||
#include "vshuf-main.inc"
|
20
gcc/testsuite/g++.dg/torture/vshuf-v2si.C
Normal file
20
gcc/testsuite/g++.dg/torture/vshuf-v2si.C
Normal file
@ -0,0 +1,20 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
#if __SIZEOF_INT__ == 4
|
||||
typedef unsigned int V __attribute__((vector_size(8)));
|
||||
typedef V VI;
|
||||
#elif __SIZEOF_LONG__ == 4
|
||||
typedef unsigned long V __attribute__((vector_size(8)));
|
||||
typedef V VI;
|
||||
#else
|
||||
#define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0x11121314
|
||||
#define B 0x21222324
|
||||
|
||||
#define X 0xd1d2d3d4
|
||||
#define Y 0xe1e2e3e4
|
||||
|
||||
#include "vshuf-2.inc"
|
||||
#include "vshuf-main.inc"
|
22
gcc/testsuite/g++.dg/torture/vshuf-v4df.C
Normal file
22
gcc/testsuite/g++.dg/torture/vshuf-v4df.C
Normal file
@ -0,0 +1,22 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8
|
||||
typedef double V __attribute__((vector_size(32)));
|
||||
typedef unsigned long long VI __attribute__((vector_size(32)));
|
||||
#else
|
||||
#define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0.69314718055994530942
|
||||
#define B 2.7182818284590452354
|
||||
#define C 2.30258509299404568402
|
||||
#define D 1.4426950408889634074
|
||||
|
||||
#define W 0.31830988618379067154
|
||||
#define X 3.14159265358979323846
|
||||
#define Y 1.41421356237309504880
|
||||
#define Z 0.70710678118654752440
|
||||
|
||||
#include "vshuf-4.inc"
|
||||
#include "vshuf-main.inc"
|
22
gcc/testsuite/g++.dg/torture/vshuf-v4di.C
Normal file
22
gcc/testsuite/g++.dg/torture/vshuf-v4di.C
Normal file
@ -0,0 +1,22 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
#if __SIZEOF_LONG_LONG__ == 8
|
||||
typedef unsigned long long V __attribute__((vector_size(32)));
|
||||
typedef V VI;
|
||||
#else
|
||||
#define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0x1112131415161718
|
||||
#define B 0x2122232425262728
|
||||
#define C 0x3132333435363738
|
||||
#define D 0x4142434445464748
|
||||
|
||||
#define W 0xc1c2c3c4c5c6c7c8
|
||||
#define X 0xd1d2d3d4d5d6d7d8
|
||||
#define Y 0xe1e2e3e4e5e6e7e8
|
||||
#define Z 0xf1f2f3f4f5f6f7f8
|
||||
|
||||
#include "vshuf-4.inc"
|
||||
#include "vshuf-main.inc"
|
29
gcc/testsuite/g++.dg/torture/vshuf-v4sf.C
Normal file
29
gcc/testsuite/g++.dg/torture/vshuf-v4sf.C
Normal file
@ -0,0 +1,29 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
|
||||
#if __SIZEOF_FLOAT__ == 4
|
||||
typedef float V __attribute__((vector_size(16)));
|
||||
# if __SIZEOF_INT__ == 4
|
||||
typedef unsigned int VI __attribute__((vector_size(16)));
|
||||
# elif __SIZEOF_LONG__ == 4
|
||||
typedef unsigned long VI __attribute__((vector_size(16)));
|
||||
# else
|
||||
# define UNSUPPORTED
|
||||
# endif
|
||||
#else
|
||||
# define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0.69314718055994530942f
|
||||
#define B 2.7182818284590452354f
|
||||
#define C 2.30258509299404568402f
|
||||
#define D 1.4426950408889634074f
|
||||
|
||||
#define W 0.31830988618379067154f
|
||||
#define X 3.14159265358979323846f
|
||||
#define Y 1.41421356237309504880f
|
||||
#define Z 0.70710678118654752440f
|
||||
|
||||
#include "vshuf-4.inc"
|
||||
#include "vshuf-main.inc"
|
25
gcc/testsuite/g++.dg/torture/vshuf-v4si.C
Normal file
25
gcc/testsuite/g++.dg/torture/vshuf-v4si.C
Normal file
@ -0,0 +1,25 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
#if __SIZEOF_INT__ == 4
|
||||
typedef unsigned int V __attribute__((vector_size(16)));
|
||||
typedef V VI;
|
||||
#elif __SIZEOF_LONG__ == 4
|
||||
typedef unsigned long V __attribute__((vector_size(16)));
|
||||
typedef V VI;
|
||||
#else
|
||||
# define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A 0x11121314
|
||||
#define B 0x21222324
|
||||
#define C 0x31323334
|
||||
#define D 0x41424344
|
||||
|
||||
#define W 0xc1c2c3c4
|
||||
#define X 0xd1d2d3d4
|
||||
#define Y 0xe1e2e3e4
|
||||
#define Z 0xf1f2f3f4
|
||||
|
||||
#include "vshuf-4.inc"
|
||||
#include "vshuf-main.inc"
|
26
gcc/testsuite/g++.dg/torture/vshuf-v8hi.C
Normal file
26
gcc/testsuite/g++.dg/torture/vshuf-v8hi.C
Normal file
@ -0,0 +1,26 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
typedef unsigned short V __attribute__((vector_size(16)));
|
||||
typedef V VI;
|
||||
|
||||
#define A1 0x1112
|
||||
#define B1 0x2122
|
||||
#define C1 0x3132
|
||||
#define D1 0x4142
|
||||
#define E1 0x5152
|
||||
#define F1 0x6162
|
||||
#define G1 0x7172
|
||||
#define H1 0x8182
|
||||
|
||||
#define A2 0x9192
|
||||
#define B2 0xa1a2
|
||||
#define C2 0xb1b2
|
||||
#define D2 0xc1c2
|
||||
#define E2 0xd1d2
|
||||
#define F2 0xe1e2
|
||||
#define G2 0xf1f2
|
||||
#define H2 0x0102
|
||||
|
||||
#include "vshuf-8.inc"
|
||||
#include "vshuf-main.inc"
|
26
gcc/testsuite/g++.dg/torture/vshuf-v8qi.C
Normal file
26
gcc/testsuite/g++.dg/torture/vshuf-v8qi.C
Normal file
@ -0,0 +1,26 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
typedef unsigned char V __attribute__((vector_size(8)));
|
||||
typedef V VI;
|
||||
|
||||
#define A1 0x11
|
||||
#define B1 0x12
|
||||
#define C1 0x13
|
||||
#define D1 0x14
|
||||
#define E1 0x15
|
||||
#define F1 0x16
|
||||
#define G1 0x17
|
||||
#define H1 0x18
|
||||
|
||||
#define A2 0xf1
|
||||
#define B2 0xf2
|
||||
#define C2 0xf3
|
||||
#define D2 0xf4
|
||||
#define E2 0xf5
|
||||
#define F2 0xf6
|
||||
#define G2 0xf7
|
||||
#define H2 0xf8
|
||||
|
||||
#include "vshuf-8.inc"
|
||||
#include "vshuf-main.inc"
|
33
gcc/testsuite/g++.dg/torture/vshuf-v8si.C
Normal file
33
gcc/testsuite/g++.dg/torture/vshuf-v8si.C
Normal file
@ -0,0 +1,33 @@
|
||||
// { dg-options "-std=c++11" }
|
||||
// { dg-do run }
|
||||
|
||||
#if __SIZEOF_INT__ == 4
|
||||
typedef unsigned int V __attribute__((vector_size(32)));
|
||||
typedef V VI;
|
||||
#elif __SIZEOF_LONG__ == 4
|
||||
typedef unsigned long V __attribute__((vector_size(32)));
|
||||
typedef V VI;
|
||||
#else
|
||||
# define UNSUPPORTED
|
||||
#endif
|
||||
|
||||
#define A1 0x11121314
|
||||
#define B1 0x21222324
|
||||
#define C1 0x31323334
|
||||
#define D1 0x41424344
|
||||
#define E1 0x51525354
|
||||
#define F1 0x61626364
|
||||
#define G1 0x71727374
|
||||
#define H1 0x81828384
|
||||
|
||||
#define A2 0x91929394
|
||||
#define B2 0xa1a2a3a4
|
||||
#define C2 0xb1b2b3b4
|
||||
#define D2 0xc1c2c3c4
|
||||
#define E2 0xd1d2d3d4
|
||||
#define F2 0xe1e2e3e4
|
||||
#define G2 0xf1f2f3f4
|
||||
#define H2 0x01020304
|
||||
|
||||
#include "vshuf-8.inc"
|
||||
#include "vshuf-main.inc"
|
Loading…
x
Reference in New Issue
Block a user