* [RFC C++] Turn on builtin_shuffle for C++.
@ 2012-06-14 9:26 Ramana Radhakrishnan
2012-06-15 1:40 ` Jason Merrill
2012-06-15 17:09 ` Marc Glisse
0 siblings, 2 replies; 10+ messages in thread
From: Ramana Radhakrishnan @ 2012-06-14 9:26 UTC (permalink / raw)
To: gcc-patches; +Cc: marc.glisse, jason
[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]
Hi,
While experimenting with the fixes to allow neon intrinsics to work
with __builtin_shuffle I hit the fact that __builtin_shuffle isn't
really supported by the C++ frontend.I'm keen we use __builtin_shuffle
for these intrinsics, but that means we need this support in the C++
frontend.
I've taken the liberty of pulling Marc's patch from bugzilla, adding
the couple of bits and pieces that were needed, moved all the vshuf*
tests from gcc.c-torture/execute to c-c++-common/torture which means
they run for both the C and C++ compilers, and bootstrapped and
regtested this on x86_64, gcc110(powerpc*-linux) and arm-linux-gnueabi
(with a cross compiler). I've then verified that all the tests pass
and there are no regressions for these targets
Any other place I should be moving these tests to ?
Ok ?
regards,
Ramana
2012-06-14 Marc Glisse <marc.glisse@inria.fr>
* c-typeck.c (c_build_vec_perm_expr): Move to c-family/c-common.c.
* c-tree.h (c_build_vec_perm_expr): Move to c-family/c-common.h.
c-family/
* c-typeck.c (c_build_vec_perm_expr): Move to c-family/c-common.c.
* c-tree.h (c_build_vec_perm_expr): Move to c-family/c-common.h.
cp/
* semantics.c (literal_type_p): Handle VECTOR_TYPE.
(potential_constant_expression_1): Handle VEC_PERM_EXPR.
* parser.c (cp_parser_postfix_expression): Handle RID_BUILTIN_SHUFFLE.
testsuite/
2012-06-14 Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
* c-c++-common/torture/vshuf-16.inc: Move from gcc.c-torture/execute/ to here.
* c-c++-common/torture/vshuf-2.inc: Likewise.
* c-c++-common/torture/vshuf-4.inc: Likewise.
* c-c++-common/torture/vshuf-8.inc: Likewise.
* c-c++-common/torture/vshuf-main.inc: Likewise.
* c-c++-common/torture/vshuf-v16hi.c: Likewise.
* c-c++-common/torture/vshuf-v16qi.c: Likewise.
* c-c++-common/torture/vshuf-v2df.c: Likewise.
* c-c++-common/torture/vshuf-v2di.c: Likewise.
* c-c++-common/torture/vshuf-v2sf.c: Likewise.
* c-c++-common/torture/vshuf-v2si.c: Likewise.
* c-c++-common/torture/vshuf-v4df.c: Likewise.
* c-c++-common/torture/vshuf-v4di.c: Likewise.
* c-c++-common/torture/vshuf-v4hi.c: Likewise.
* c-c++-common/torture/vshuf-v4sf.c: Likewise.
* c-c++-common/torture/vshuf-v4si.c: Likewise.
* c-c++-common/torture/vshuf-v8hi.c: Likewise.
* c-c++-common/torture/vshuf-v8qi.c: Likewise.
* c-c++-common/torture/vshuf-v8si.c: Likewise.
[-- Attachment #2: shuf.patch --]
[-- Type: application/octet-stream, Size: 46404 bytes --]
commit ecbcfcf72c83d35a74a6fdf694afb940aa307262
Author: Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
Date: Wed Jun 13 17:56:48 2012 +0100
Move files and add builtin_shuffle support to the C++ frontend.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 4dd040b..61d7567 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -430,7 +430,7 @@ const struct c_common_resword c_common_reswords[] =
{ "__bases", RID_BASES, D_CXXONLY },
{ "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
{ "__builtin_complex", RID_BUILTIN_COMPLEX, D_CONLY },
- { "__builtin_shuffle", RID_BUILTIN_SHUFFLE, D_CONLY },
+ { "__builtin_shuffle", RID_BUILTIN_SHUFFLE, 0 },
{ "__builtin_offsetof", RID_OFFSETOF, 0 },
{ "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, D_CONLY },
{ "__builtin_va_arg", RID_VA_ARG, 0 },
@@ -1950,6 +1950,101 @@ vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note)
return false;
}
+/* Build a VEC_PERM_EXPR if V0, V1 and MASK are not error_mark_nodes
+ and have vector types, V0 has the same type as V1, and the number of
+ elements of V0, V1, MASK is the same.
+
+ In case V1 is a NULL_TREE it is assumed that __builtin_shuffle was
+ called with two arguments. In this case implementation passes the
+ first argument twice in order to share the same tree code. This fact
+ could enable the mask-values being twice the vector length. This is
+ an implementation accident and this semantics is not guaranteed to
+ the user. */
+tree
+c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask)
+{
+ tree ret;
+ bool wrap = true;
+ bool maybe_const = false;
+ bool two_arguments = false;
+
+ if (v1 == NULL_TREE)
+ {
+ two_arguments = true;
+ v1 = v0;
+ }
+
+ if (v0 == error_mark_node || v1 == error_mark_node
+ || mask == error_mark_node)
+ return error_mark_node;
+
+ if (TREE_CODE (TREE_TYPE (mask)) != VECTOR_TYPE
+ || TREE_CODE (TREE_TYPE (TREE_TYPE (mask))) != INTEGER_TYPE)
+ {
+ error_at (loc, "__builtin_shuffle last argument must "
+ "be an integer vector");
+ return error_mark_node;
+ }
+
+ if (TREE_CODE (TREE_TYPE (v0)) != VECTOR_TYPE
+ || TREE_CODE (TREE_TYPE (v1)) != VECTOR_TYPE)
+ {
+ error_at (loc, "__builtin_shuffle arguments must be vectors");
+ return error_mark_node;
+ }
+
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (v0)) != TYPE_MAIN_VARIANT (TREE_TYPE (v1)))
+ {
+ error_at (loc, "__builtin_shuffle argument vectors must be of "
+ "the same type");
+ return error_mark_node;
+ }
+
+ if (TYPE_VECTOR_SUBPARTS (TREE_TYPE (v0))
+ != TYPE_VECTOR_SUBPARTS (TREE_TYPE (mask))
+ && TYPE_VECTOR_SUBPARTS (TREE_TYPE (v1))
+ != TYPE_VECTOR_SUBPARTS (TREE_TYPE (mask)))
+ {
+ error_at (loc, "__builtin_shuffle number of elements of the "
+ "argument vector(s) and the mask vector should "
+ "be the same");
+ return error_mark_node;
+ }
+
+ if (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (v0))))
+ != GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (mask)))))
+ {
+ error_at (loc, "__builtin_shuffle argument vector(s) inner type "
+ "must have the same size as inner type of the mask");
+ return error_mark_node;
+ }
+
+ if (!c_dialect_cxx ())
+ {
+ /* Avoid C_MAYBE_CONST_EXPRs inside VEC_PERM_EXPR. */
+ v0 = c_fully_fold (v0, false, &maybe_const);
+ wrap &= maybe_const;
+
+ if (two_arguments)
+ v1 = v0 = save_expr (v0);
+ else
+ {
+ v1 = c_fully_fold (v1, false, &maybe_const);
+ wrap &= maybe_const;
+ }
+
+ mask = c_fully_fold (mask, false, &maybe_const);
+ wrap &= maybe_const;
+ }
+
+ ret = build3_loc (loc, VEC_PERM_EXPR, TREE_TYPE (v0), v0, v1, mask);
+
+ if (!c_dialect_cxx () && !wrap)
+ ret = c_wrap_maybe_const (ret, true);
+
+ return ret;
+}
+
/* Like tree.c:get_narrower, but retain conversion from C++0x scoped enum
to integral type. */
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index c8e6ce1..fea41dd 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -919,6 +919,7 @@ extern bool lvalue_p (const_tree);
extern bool vector_targets_convertible_p (const_tree t1, const_tree t2);
extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note);
+extern tree c_build_vec_perm_expr (location_t, tree, tree, tree);
extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 8541747..145df35 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -645,7 +645,6 @@ extern tree c_finish_omp_task (location_t, tree, tree);
extern tree c_finish_omp_clauses (tree);
extern tree c_build_va_arg (location_t, tree, tree);
extern tree c_finish_transaction (location_t, tree, int);
-extern tree c_build_vec_perm_expr (location_t, tree, tree, tree);
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen. */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 00747eb..c2f713e 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2866,98 +2866,6 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
}
return require_complete_type (result);
}
-
-/* Build a VEC_PERM_EXPR if V0, V1 and MASK are not error_mark_nodes
- and have vector types, V0 has the same type as V1, and the number of
- elements of V0, V1, MASK is the same.
-
- In case V1 is a NULL_TREE it is assumed that __builtin_shuffle was
- called with two arguments. In this case implementation passes the
- first argument twice in order to share the same tree code. This fact
- could enable the mask-values being twice the vector length. This is
- an implementation accident and this semantics is not guaranteed to
- the user. */
-tree
-c_build_vec_perm_expr (location_t loc, tree v0, tree v1, tree mask)
-{
- tree ret;
- bool wrap = true;
- bool maybe_const = false;
- bool two_arguments = false;
-
- if (v1 == NULL_TREE)
- {
- two_arguments = true;
- v1 = v0;
- }
-
- if (v0 == error_mark_node || v1 == error_mark_node
- || mask == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (TREE_TYPE (mask)) != VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (TREE_TYPE (mask))) != INTEGER_TYPE)
- {
- error_at (loc, "__builtin_shuffle last argument must "
- "be an integer vector");
- return error_mark_node;
- }
-
- if (TREE_CODE (TREE_TYPE (v0)) != VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (v1)) != VECTOR_TYPE)
- {
- error_at (loc, "__builtin_shuffle arguments must be vectors");
- return error_mark_node;
- }
-
- if (TYPE_MAIN_VARIANT (TREE_TYPE (v0)) != TYPE_MAIN_VARIANT (TREE_TYPE (v1)))
- {
- error_at (loc, "__builtin_shuffle argument vectors must be of "
- "the same type");
- return error_mark_node;
- }
-
- if (TYPE_VECTOR_SUBPARTS (TREE_TYPE (v0))
- != TYPE_VECTOR_SUBPARTS (TREE_TYPE (mask))
- && TYPE_VECTOR_SUBPARTS (TREE_TYPE (v1))
- != TYPE_VECTOR_SUBPARTS (TREE_TYPE (mask)))
- {
- error_at (loc, "__builtin_shuffle number of elements of the "
- "argument vector(s) and the mask vector should "
- "be the same");
- return error_mark_node;
- }
-
- if (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (v0))))
- != GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (mask)))))
- {
- error_at (loc, "__builtin_shuffle argument vector(s) inner type "
- "must have the same size as inner type of the mask");
- return error_mark_node;
- }
-
- /* Avoid C_MAYBE_CONST_EXPRs inside VEC_PERM_EXPR. */
- v0 = c_fully_fold (v0, false, &maybe_const);
- wrap &= maybe_const;
-
- if (two_arguments)
- v1 = v0 = save_expr (v0);
- else
- {
- v1 = c_fully_fold (v1, false, &maybe_const);
- wrap &= maybe_const;
- }
-
- mask = c_fully_fold (mask, false, &maybe_const);
- wrap &= maybe_const;
-
- ret = build3_loc (loc, VEC_PERM_EXPR, TREE_TYPE (v0), v0, v1, mask);
-
- if (!wrap)
- ret = c_wrap_maybe_const (ret, true);
-
- return ret;
-}
\f
/* Convert the argument expressions in the vector VALUES
to the types in the list TYPELIST.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 85e0322..1691f81 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -5448,6 +5448,44 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
}
break;
+ case RID_BUILTIN_SHUFFLE:
+ {
+ VEC(tree,gc)* vec;
+ unsigned int i;
+ tree p;
+ location_t loc = token->location;
+
+ cp_lexer_consume_token (parser->lexer);
+ vec = cp_parser_parenthesized_expression_list (parser, non_attr,
+ /*cast_p=*/false, /*allow_expansion_p=*/true,
+ /*non_constant_p=*/NULL);
+ if (vec == NULL)
+ return error_mark_node;
+
+ FOR_EACH_VEC_ELT (tree, vec, i, p)
+ mark_exp_read (p);
+
+ if (VEC_length (tree, vec) == 2)
+ return
+ c_build_vec_perm_expr
+ (loc, VEC_index (tree, vec, 0),
+ NULL_TREE, VEC_index (tree, vec, 1));
+
+ else if (VEC_length (tree, vec) == 3)
+ return
+ c_build_vec_perm_expr
+ (loc, VEC_index (tree, vec, 0),
+ VEC_index (tree, vec, 1),
+ VEC_index (tree, vec, 2));
+ else
+ {
+ error_at (loc, "wrong number of arguments to "
+ "%<__builtin_shuffle%>");
+ return error_mark_node;
+ }
+ break;
+ }
+
default:
{
tree type;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7769bba..9efe403 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5619,6 +5619,7 @@ bool
literal_type_p (tree t)
{
if (SCALAR_TYPE_P (t)
+ || TREE_CODE (t) == VECTOR_TYPE
|| TREE_CODE (t) == REFERENCE_TYPE)
return true;
if (CLASS_TYPE_P (t))
@@ -8502,6 +8503,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
return true;
case FMA_EXPR:
+ case VEC_PERM_EXPR:
for (i = 0; i < 3; ++i)
if (!potential_constant_expression_1 (TREE_OPERAND (t, i),
true, flags))
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-16.inc b/gcc/testsuite/c-c++-common/torture/vshuf-16.inc
new file mode 100644
index 0000000..68f2646
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-16.inc
@@ -0,0 +1,81 @@
+/* Test fragment for vectors with 16 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, },
+ { 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 },
+ { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87,
+ 0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff },
+ { 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 },
+ { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
+ { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
+ },
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 },
+ { 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 },
+ },
+ {
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
+ { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 },
+ },
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ {
+ { 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 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+ { 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 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 },
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
+ },
+ {
+ { 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 },
+ { 7, 6, 5, 4, 16, 17, 18, 19, 31, 30, 29, 28, 3, 2, 1, 0 },
+ { 17, 16, 15, 14, 30, 31, 32, 33, 45, 44, 43, 42, 13, 12, 11, 10 },
+ },
+ {
+ { 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 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
+ },
+ {
+ { 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 },
+ { 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 },
+ { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 },
+ },
+};
+
+#endif
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-2.inc b/gcc/testsuite/c-c++-common/torture/vshuf-2.inc
new file mode 100644
index 0000000..ef778e5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-2.inc
@@ -0,0 +1,38 @@
+/* Test fragment for vectors of 2 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ { { A, B }, { 0, 1 }, { A, B } },
+ { { A, B }, { -16, -1 }, { A, B } },
+ { { A, B }, { 1, 0 }, { B, A } },
+ { { A, B }, { 0, 0 }, { A, A } },
+ { { X, Y }, { 1, 1 }, { Y, Y } },
+ { { X, Y }, { 1, 0 }, { Y, X } },
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ { { A, B }, { X, Y }, { 0, 1 }, { A, B } },
+ { { A, B }, { X, Y }, { 2, 3 }, { X, Y } },
+ { { A, B }, { X, Y }, { 0, 2 }, { A, X } },
+ { { A, B }, { X, Y }, { 2, 1 }, { X, B } },
+ { { A, B }, { X, Y }, { 3, 0 }, { Y, A } },
+ { { A, B }, { X, Y }, { 0, 0 }, { A, A } },
+ { { A, B }, { X, Y }, { 3, 3 }, { Y, Y } },
+};
+
+#endif
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-4.inc b/gcc/testsuite/c-c++-common/torture/vshuf-4.inc
new file mode 100644
index 0000000..d6e6e10
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-4.inc
@@ -0,0 +1,39 @@
+/* Test fragment for vectors of 4 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ { { A, B, C, D }, { 0, 1, 2, 3 }, { A, B, C, D }, },
+ { { A, B, C, D }, { 0+1*4, 1+2*4, 2+3*4, 3+4*4 }, { A, B, C, D } },
+ { { A, B, C, D }, { 3, 2, 1, 0 }, { D, C, B, A } },
+ { { A, B, C, D }, { 0, 3, 2, 1 }, { A, D, C, B } },
+ { { A, B, C, D }, { 0, 2, 1, 3 }, { A, C, B, D } },
+ { { W, X, Y, Z }, { 3, 1, 2, 0 }, { Z, X, Y, W } },
+ { { W, X, Y, Z }, { 0, 0, 0, 0 }, { W, W, W, W } },
+ { { W, X, Y, Z }, { 1, 2, 1, 2 }, { X, Y, X, Y } },
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 1, 2, 3 }, { A, B, C, D } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 4, 5, 6, 7 }, { W, X, Y, Z } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 4, 1, 5 }, { A, W, B, X } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 7, 4, 3 }, { A, Z, W, D } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 0, 0, 0, 0 }, { A, A, A, A } },
+ { { A, B, C, D }, { W, X, Y, Z }, { 7, 7, 7, 7 }, { Z, Z, Z, Z } },
+};
+
+#endif
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-8.inc b/gcc/testsuite/c-c++-common/torture/vshuf-8.inc
new file mode 100644
index 0000000..e647522
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-8.inc
@@ -0,0 +1,101 @@
+/* Test fragment for vectors of 8 elements. */
+
+#ifndef UNSUPPORTED
+
+struct S
+{
+ V in;
+ VI mask;
+ V out;
+};
+
+struct S tests[] = {
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 7, 6, 5, 4, 3, 2, 1, 0 },
+ { H1, G1, F1, E1, D1, C1, B1, A1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 7, 0, 5, 3, 2, 4, 1, 6 },
+ { H1, A1, F1, D1, C1, E1, B1, G1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { 0, 2, 1, 3, 4, 6, 5, 7 },
+ { A1, C1, B1, D1, E1, G1, F1, H1 },
+ },
+ {
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 3, 1, 2, 0, 7, 5, 6, 4 },
+ { D2, B2, C2, A2, H2, F2, G2, E2 },
+ },
+ {
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 0, 0, 0 },
+ { A2, A2, A2, A2, A2, A2, A2, A2 },
+ },
+ {
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 1, 6, 1, 6, 1, 6, 1, 6 },
+ { B2, G2, B2, G2, B2, G2, B2, G2 },
+ }
+};
+
+struct S2
+{
+ V in1, in2;
+ VI mask;
+ V out;
+};
+
+struct S2 tests2[] = {
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 1, 2, 3, 4, 5, 6, 7 },
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 8, 9, 10, 11, 12, 13, 14, 15 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 8, 1, 9, 2, 10, 3, 11 },
+ { A1, A2, B1, B2, C1, C2, D1, D2 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 15, 4, 11, 12, 3, 7, 8 },
+ { A1, H2, E1, D2, E2, D1, H1, A2 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { A1, A1, A1, A1, A1, A1, A1, A1 },
+ },
+ {
+ { A1, B1, C1, D1, E1, F1, G1, H1 },
+ { A2, B2, C2, D2, E2, F2, G2, H2 },
+ { 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e },
+ { G2, G2, G2, G2, G2, G2, G2, G2 },
+ },
+};
+
+#endif
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-main.inc b/gcc/testsuite/c-c++-common/torture/vshuf-main.inc
new file mode 100644
index 0000000..8487131
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-main.inc
@@ -0,0 +1,26 @@
+/* Driver fragment for __builtin_shuffle of any vector shape. */
+
+extern void abort(void);
+
+int main()
+{
+#ifndef UNSUPPORTED
+ int i;
+
+ for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
+ {
+ V r = __builtin_shuffle(tests[i].in, tests[i].mask);
+ if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0)
+ abort();
+ }
+
+ for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); ++i)
+ {
+ V r = __builtin_shuffle(tests2[i].in1, tests2[i].in2, tests2[i].mask);
+ if (__builtin_memcmp(&r, &tests2[i].out, sizeof(V)) != 0)
+ abort();
+ }
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c b/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c
new file mode 100644
index 0000000..98b329d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v16hi.c
@@ -0,0 +1,5 @@
+typedef unsigned short V __attribute__((vector_size(32)));
+typedef V VI;
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c b/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c
new file mode 100644
index 0000000..dcd1de1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c
@@ -0,0 +1,5 @@
+typedef unsigned char V __attribute__((vector_size(16)));
+typedef V VI;
+
+#include "vshuf-16.inc"
+#include "vshuf-main.inc"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c b/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c
new file mode 100644
index 0000000..e88ec08
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v2df.c
@@ -0,0 +1,15 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c b/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c
new file mode 100644
index 0000000..0985a0d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v2di.c
@@ -0,0 +1,15 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c b/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c
new file mode 100644
index 0000000..f9c40b2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v2sf.c
@@ -0,0 +1,21 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c b/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c
new file mode 100644
index 0000000..414743c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v2si.c
@@ -0,0 +1,18 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c b/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c
new file mode 100644
index 0000000..c4030a7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v4df.c
@@ -0,0 +1,19 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c b/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c
new file mode 100644
index 0000000..a84aebef
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v4di.c
@@ -0,0 +1,19 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c b/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c
new file mode 100644
index 0000000..64a2bb4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v4hi.c
@@ -0,0 +1,15 @@
+typedef unsigned short V __attribute__((vector_size(8)));
+typedef V VI;
+
+#define A 0x1112
+#define B 0x2122
+#define C 0x3132
+#define D 0x4142
+
+#define W 0xc1c2
+#define X 0xd1d2
+#define Y 0xe1e2
+#define Z 0xf1f2
+
+#include "vshuf-4.inc"
+#include "vshuf-main.inc"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c b/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c
new file mode 100644
index 0000000..2836725
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v4sf.c
@@ -0,0 +1,25 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c b/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c
new file mode 100644
index 0000000..289ec1b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v4si.c
@@ -0,0 +1,22 @@
+#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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c b/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c
new file mode 100644
index 0000000..ce442c5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v8hi.c
@@ -0,0 +1,23 @@
+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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c b/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c
new file mode 100644
index 0000000..349ec6d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v8qi.c
@@ -0,0 +1,23 @@
+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"
diff --git a/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c b/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c
new file mode 100644
index 0000000..5b0a2c3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c
@@ -0,0 +1,30 @@
+#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-16.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-16.inc
deleted file mode 100644
index 68f2646..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-16.inc
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Test fragment for vectors with 16 elements. */
-
-#ifndef UNSUPPORTED
-
-struct S
-{
- V in;
- VI mask;
- V out;
-};
-
-struct S tests[] = {
- {
- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, },
- { 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 },
- { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87,
- 0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff },
- { 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 },
- { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
- { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
- },
- {
- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
- { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 },
- { 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 },
- },
- {
- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 },
- { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
- { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 },
- },
-};
-
-struct S2
-{
- V in1, in2;
- VI mask;
- V out;
-};
-
-struct S2 tests2[] = {
- {
- { 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 },
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
- { 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 },
- { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
- { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 },
- { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 },
- },
- {
- { 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 },
- { 7, 6, 5, 4, 16, 17, 18, 19, 31, 30, 29, 28, 3, 2, 1, 0 },
- { 17, 16, 15, 14, 30, 31, 32, 33, 45, 44, 43, 42, 13, 12, 11, 10 },
- },
- {
- { 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 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
- },
- {
- { 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 },
- { 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 },
- { 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 },
- },
-};
-
-#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-2.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-2.inc
deleted file mode 100644
index ef778e5..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-2.inc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Test fragment for vectors of 2 elements. */
-
-#ifndef UNSUPPORTED
-
-struct S
-{
- V in;
- VI mask;
- V out;
-};
-
-struct S tests[] = {
- { { A, B }, { 0, 1 }, { A, B } },
- { { A, B }, { -16, -1 }, { A, B } },
- { { A, B }, { 1, 0 }, { B, A } },
- { { A, B }, { 0, 0 }, { A, A } },
- { { X, Y }, { 1, 1 }, { Y, Y } },
- { { X, Y }, { 1, 0 }, { Y, X } },
-};
-
-struct S2
-{
- V in1, in2;
- VI mask;
- V out;
-};
-
-struct S2 tests2[] = {
- { { A, B }, { X, Y }, { 0, 1 }, { A, B } },
- { { A, B }, { X, Y }, { 2, 3 }, { X, Y } },
- { { A, B }, { X, Y }, { 0, 2 }, { A, X } },
- { { A, B }, { X, Y }, { 2, 1 }, { X, B } },
- { { A, B }, { X, Y }, { 3, 0 }, { Y, A } },
- { { A, B }, { X, Y }, { 0, 0 }, { A, A } },
- { { A, B }, { X, Y }, { 3, 3 }, { Y, Y } },
-};
-
-#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-4.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-4.inc
deleted file mode 100644
index d6e6e10..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-4.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Test fragment for vectors of 4 elements. */
-
-#ifndef UNSUPPORTED
-
-struct S
-{
- V in;
- VI mask;
- V out;
-};
-
-struct S tests[] = {
- { { A, B, C, D }, { 0, 1, 2, 3 }, { A, B, C, D }, },
- { { A, B, C, D }, { 0+1*4, 1+2*4, 2+3*4, 3+4*4 }, { A, B, C, D } },
- { { A, B, C, D }, { 3, 2, 1, 0 }, { D, C, B, A } },
- { { A, B, C, D }, { 0, 3, 2, 1 }, { A, D, C, B } },
- { { A, B, C, D }, { 0, 2, 1, 3 }, { A, C, B, D } },
- { { W, X, Y, Z }, { 3, 1, 2, 0 }, { Z, X, Y, W } },
- { { W, X, Y, Z }, { 0, 0, 0, 0 }, { W, W, W, W } },
- { { W, X, Y, Z }, { 1, 2, 1, 2 }, { X, Y, X, Y } },
-};
-
-struct S2
-{
- V in1, in2;
- VI mask;
- V out;
-};
-
-struct S2 tests2[] = {
- { { A, B, C, D }, { W, X, Y, Z }, { 0, 1, 2, 3 }, { A, B, C, D } },
- { { A, B, C, D }, { W, X, Y, Z }, { 4, 5, 6, 7 }, { W, X, Y, Z } },
- { { A, B, C, D }, { W, X, Y, Z }, { 0, 4, 1, 5 }, { A, W, B, X } },
- { { A, B, C, D }, { W, X, Y, Z }, { 0, 7, 4, 3 }, { A, Z, W, D } },
- { { A, B, C, D }, { W, X, Y, Z }, { 0, 0, 0, 0 }, { A, A, A, A } },
- { { A, B, C, D }, { W, X, Y, Z }, { 7, 7, 7, 7 }, { Z, Z, Z, Z } },
-};
-
-#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-8.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-8.inc
deleted file mode 100644
index e647522..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-8.inc
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Test fragment for vectors of 8 elements. */
-
-#ifndef UNSUPPORTED
-
-struct S
-{
- V in;
- VI mask;
- V out;
-};
-
-struct S tests[] = {
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 },
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { 7, 6, 5, 4, 3, 2, 1, 0 },
- { H1, G1, F1, E1, D1, C1, B1, A1 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { 7, 0, 5, 3, 2, 4, 1, 6 },
- { H1, A1, F1, D1, C1, E1, B1, G1 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { 0, 2, 1, 3, 4, 6, 5, 7 },
- { A1, C1, B1, D1, E1, G1, F1, H1 },
- },
- {
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 3, 1, 2, 0, 7, 5, 6, 4 },
- { D2, B2, C2, A2, H2, F2, G2, E2 },
- },
- {
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 0, 0, 0, 0 },
- { A2, A2, A2, A2, A2, A2, A2, A2 },
- },
- {
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 1, 6, 1, 6, 1, 6, 1, 6 },
- { B2, G2, B2, G2, B2, G2, B2, G2 },
- }
-};
-
-struct S2
-{
- V in1, in2;
- VI mask;
- V out;
-};
-
-struct S2 tests2[] = {
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 0, 1, 2, 3, 4, 5, 6, 7 },
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 8, 9, 10, 11, 12, 13, 14, 15 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 0, 8, 1, 9, 2, 10, 3, 11 },
- { A1, A2, B1, B2, C1, C2, D1, D2 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 0, 15, 4, 11, 12, 3, 7, 8 },
- { A1, H2, E1, D2, E2, D1, H1, A2 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { A1, A1, A1, A1, A1, A1, A1, A1 },
- },
- {
- { A1, B1, C1, D1, E1, F1, G1, H1 },
- { A2, B2, C2, D2, E2, F2, G2, H2 },
- { 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e },
- { G2, G2, G2, G2, G2, G2, G2, G2 },
- },
-};
-
-#endif
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-main.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-main.inc
deleted file mode 100644
index 8487131..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-main.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Driver fragment for __builtin_shuffle of any vector shape. */
-
-extern void abort(void);
-
-int main()
-{
-#ifndef UNSUPPORTED
- int i;
-
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
- {
- V r = __builtin_shuffle(tests[i].in, tests[i].mask);
- if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0)
- abort();
- }
-
- for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); ++i)
- {
- V r = __builtin_shuffle(tests2[i].in1, tests2[i].in2, tests2[i].mask);
- if (__builtin_memcmp(&r, &tests2[i].out, sizeof(V)) != 0)
- abort();
- }
-#endif
-
- return 0;
-}
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v16hi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v16hi.c
deleted file mode 100644
index 98b329d..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v16hi.c
+++ /dev/null
@@ -1,5 +0,0 @@
-typedef unsigned short V __attribute__((vector_size(32)));
-typedef V VI;
-
-#include "vshuf-16.inc"
-#include "vshuf-main.inc"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v16qi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v16qi.c
deleted file mode 100644
index dcd1de1..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v16qi.c
+++ /dev/null
@@ -1,5 +0,0 @@
-typedef unsigned char V __attribute__((vector_size(16)));
-typedef V VI;
-
-#include "vshuf-16.inc"
-#include "vshuf-main.inc"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2df.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2df.c
deleted file mode 100644
index e88ec08..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2df.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2di.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2di.c
deleted file mode 100644
index 0985a0d..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2di.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2sf.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2sf.c
deleted file mode 100644
index f9c40b2..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2sf.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2si.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2si.c
deleted file mode 100644
index 414743c..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2si.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4df.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4df.c
deleted file mode 100644
index c4030a7..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4df.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4di.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4di.c
deleted file mode 100644
index a84aebef..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4di.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4hi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4hi.c
deleted file mode 100644
index 64a2bb4..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4hi.c
+++ /dev/null
@@ -1,15 +0,0 @@
-typedef unsigned short V __attribute__((vector_size(8)));
-typedef V VI;
-
-#define A 0x1112
-#define B 0x2122
-#define C 0x3132
-#define D 0x4142
-
-#define W 0xc1c2
-#define X 0xd1d2
-#define Y 0xe1e2
-#define Z 0xf1f2
-
-#include "vshuf-4.inc"
-#include "vshuf-main.inc"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4sf.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4sf.c
deleted file mode 100644
index 2836725..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4sf.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4si.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4si.c
deleted file mode 100644
index 289ec1b..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4si.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8hi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8hi.c
deleted file mode 100644
index ce442c5..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8hi.c
+++ /dev/null
@@ -1,23 +0,0 @@
-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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8qi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8qi.c
deleted file mode 100644
index 349ec6d..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8qi.c
+++ /dev/null
@@ -1,23 +0,0 @@
-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"
diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8si.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8si.c
deleted file mode 100644
index 5b0a2c3..0000000
--- a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8si.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#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"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-14 9:26 [RFC C++] Turn on builtin_shuffle for C++ Ramana Radhakrishnan
@ 2012-06-15 1:40 ` Jason Merrill
2012-06-15 16:57 ` Ramana Radhakrishnan
2012-06-15 17:09 ` Marc Glisse
1 sibling, 1 reply; 10+ messages in thread
From: Jason Merrill @ 2012-06-15 1:40 UTC (permalink / raw)
To: Ramana Radhakrishnan; +Cc: gcc-patches, marc.glisse
OK.
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 1:40 ` Jason Merrill
@ 2012-06-15 16:57 ` Ramana Radhakrishnan
0 siblings, 0 replies; 10+ messages in thread
From: Ramana Radhakrishnan @ 2012-06-15 16:57 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches, marc.glisse
On 15 June 2012 01:44, Jason Merrill <jason@redhat.com> wrote:
> OK.
Thanks, now committed with the only change being that the PR number is
now referenced in the Changelog.
Ramana
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-14 9:26 [RFC C++] Turn on builtin_shuffle for C++ Ramana Radhakrishnan
2012-06-15 1:40 ` Jason Merrill
@ 2012-06-15 17:09 ` Marc Glisse
2012-06-15 17:18 ` Ramana Radhakrishnan
1 sibling, 1 reply; 10+ messages in thread
From: Marc Glisse @ 2012-06-15 17:09 UTC (permalink / raw)
To: Ramana Radhakrishnan; +Cc: gcc-patches, jason
On Thu, 14 Jun 2012, Ramana Radhakrishnan wrote:
> While experimenting with the fixes to allow neon intrinsics to work
> with __builtin_shuffle I hit the fact that __builtin_shuffle isn't
> really supported by the C++ frontend.I'm keen we use __builtin_shuffle
> for these intrinsics, but that means we need this support in the C++
> frontend.
>
> I've taken the liberty of pulling Marc's patch from bugzilla, adding
> the couple of bits and pieces that were needed, moved all the vshuf*
> tests from gcc.c-torture/execute to c-c++-common/torture which means
> they run for both the C and C++ compilers, and bootstrapped and
> regtested this on x86_64, gcc110(powerpc*-linux) and arm-linux-gnueabi
> (with a cross compiler). I've then verified that all the tests pass
> and there are no regressions for these targets
>
> Any other place I should be moving these tests to ?
>
> Ok ?
>
> regards,
> Ramana
>
>
> 2012-06-14 Marc Glisse <marc.glisse@inria.fr>
>
> * c-typeck.c (c_build_vec_perm_expr): Move to c-family/c-common.c.
> * c-tree.h (c_build_vec_perm_expr): Move to c-family/c-common.h.
>
> c-family/
>
> * c-typeck.c (c_build_vec_perm_expr): Move to c-family/c-common.c.
> * c-tree.h (c_build_vec_perm_expr): Move to c-family/c-common.h.
>
>
> cp/
> * semantics.c (literal_type_p): Handle VECTOR_TYPE.
> (potential_constant_expression_1): Handle VEC_PERM_EXPR.
I just noticed this part. Rereading my comment in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
it seems like this may break things with -std=c++11 and you used the old
version from comment 19. I am unable to test anything these days (taking a
plane tomorrow), sorry.
Thanks again for taking charge of the patch,
--
Marc Glisse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 17:09 ` Marc Glisse
@ 2012-06-15 17:18 ` Ramana Radhakrishnan
2012-06-15 17:53 ` Marc Glisse
0 siblings, 1 reply; 10+ messages in thread
From: Ramana Radhakrishnan @ 2012-06-15 17:18 UTC (permalink / raw)
To: Marc Glisse; +Cc: gcc-patches, jason
> I just noticed this part. Rereading my comment in
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
I haven't been able to make it break with -std=c++11 . Is there
something I'm missing here ?
>
> it seems like this may break things with -std=c++11 and you used the old
> version from comment 19. I am unable to test anything these days (taking a
> plane tomorrow), sorry.
./g++ -B`pwd` /home/ramrad01/cross-build/fsf/src/gcc-rewrite-permute-intrinsics/gcc/testsuite/c-c++-common/torture/vshuf-v8si.c
-std=c++11 -S -O2
appears to work just fine. Am I missing something here ?
A number of tests that pass vector constants to __builtin_shuffle
appear to be working ok .
Can you point out what testcase and how it is broken with std=c++11. I
remember trying some simple tests with that and that appeared to work.
One thing I do notice now is that all the c-c++-common tests are
possibly not running with -std=c++11 . However they appear to be
compiling ok ? My motivation in this stems from being able to rewrite
the Neon permute intrinsics in C and C++ with __builtin_shuffle.
Ramana
>
> Thanks again for taking charge of the patch,
>
> --
> Marc Glisse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 17:18 ` Ramana Radhakrishnan
@ 2012-06-15 17:53 ` Marc Glisse
2012-06-15 18:05 ` Ramana Radhakrishnan
0 siblings, 1 reply; 10+ messages in thread
From: Marc Glisse @ 2012-06-15 17:53 UTC (permalink / raw)
To: Ramana Radhakrishnan; +Cc: gcc-patches, jason
On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>> I just noticed this part. Rereading my comment in
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
>
> I haven't been able to make it break with -std=c++11 . Is there
> something I'm missing here ?
I don't remember. It might just be that trying to create a constexpr
vector variable or calling __builtin_shuffle on it ICEs instead of giving
an error. I can keep a note to make some tests at the end of July (I will
be mostly away until then), but I believe the code from comment 22 is
safer than the one from comment 20, if memory serves.
--
Marc Glisse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 17:53 ` Marc Glisse
@ 2012-06-15 18:05 ` Ramana Radhakrishnan
2012-06-15 19:11 ` Marc Glisse
0 siblings, 1 reply; 10+ messages in thread
From: Ramana Radhakrishnan @ 2012-06-15 18:05 UTC (permalink / raw)
To: Marc Glisse; +Cc: gcc-patches, jason
On 15 June 2012 18:18, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>
>>> I just noticed this part. Rereading my comment in
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
>>
>>
>> I haven't been able to make it break with -std=c++11 . Is there
>> something I'm missing here ?
>
>
> I don't remember. It might just be that trying to create a constexpr vector
> variable or calling __builtin_shuffle on it ICEs instead of giving an error.
> I can keep a note to make some tests at the end of July (I will be mostly
> away until then), but I believe the code from comment 22 is safer than the
> one from comment 20, if memory serves.
I'm not qualified enough to take a call on what's better in this case
and will have to defer to Jason and the C++ maintainers on this one.
Now that you've said this I decided to go back and throw more tests through it
I've tried to chug through most of the testcases for __builtin_shuffle
including a few of my own the simplest of which I show below trying to
trigger this issue but can't seem to do so.
typedef int v4si __attribute__ ((vector_size (16)));
v4si c;
const v4si d = (v4si) { 10, 11, 23, 33};
v4si vs (v4si a, v4si b)
{
c = __builtin_shuffle (a, b, (v4si){0, 4, 1, 5});
return a;
}
Ofcourse it is not complicated C++ in any which way but the frontend
ends up generating something like the following
(void) (c = VEC_PERM_EXPR < a , b , TARGET_EXPR <D.5209, {0, 4, 1,
5}> > ) >>>>>;
rather than anything else but I could be missing something fundamental
here if that's not what you expect the C++ frontend to be doing.
regards,
Ramana
>
> --
> Marc Glisse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 18:05 ` Ramana Radhakrishnan
@ 2012-06-15 19:11 ` Marc Glisse
2012-06-15 20:15 ` Ramana Radhakrishnan
2012-06-18 13:47 ` Ramana Radhakrishnan
0 siblings, 2 replies; 10+ messages in thread
From: Marc Glisse @ 2012-06-15 19:11 UTC (permalink / raw)
To: Ramana Radhakrishnan; +Cc: gcc-patches, jason
On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
> On 15 June 2012 18:18, Marc Glisse <marc.glisse@inria.fr> wrote:
>> On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>>
>>>> I just noticed this part. Rereading my comment in
>>>>
>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
>>>
>>>
>>> I haven't been able to make it break with -std=c++11 . Is there
>>> something I'm missing here ?
>>
>>
>> I don't remember. It might just be that trying to create a constexpr vector
>> variable or calling __builtin_shuffle on it ICEs instead of giving an error.
>> I can keep a note to make some tests at the end of July (I will be mostly
>> away until then), but I believe the code from comment 22 is safer than the
>> one from comment 20, if memory serves.
>
> I'm not qualified enough to take a call on what's better in this case
> and will have to defer to Jason and the C++ maintainers on this one.
>
> Now that you've said this I decided to go back and throw more tests through it
> I've tried to chug through most of the testcases for __builtin_shuffle
> including a few of my own the simplest of which I show below trying to
> trigger this issue but can't seem to do so.
Maybe something like:
#include <x86intrin.h>
int main(){
constexpr __m128d x={1.,2.};
constexpr __m128i y={1,0};
constexpr __m128d z=__builtin_shuffle(x,y);
}
?
(sorry for the x86 specific code, should be easy to adapt)
See also:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53094
Long term, vectors should be literals. But we need something to avoid
crashes on operator[] and __builtin_shuffle (ideally implementing the
constant version of them). Keeping vectors as non-literals (what I was
suggesting) is quite a crude hack. Maybe having them as literals now is a
good thing, but it would be good to avoid the ICEs.
--
Marc Glisse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 19:11 ` Marc Glisse
@ 2012-06-15 20:15 ` Ramana Radhakrishnan
2012-06-18 13:47 ` Ramana Radhakrishnan
1 sibling, 0 replies; 10+ messages in thread
From: Ramana Radhakrishnan @ 2012-06-15 20:15 UTC (permalink / raw)
To: Marc Glisse; +Cc: gcc-patches, jason
On 15 June 2012 20:04, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>
>> On 15 June 2012 18:18, Marc Glisse <marc.glisse@inria.fr> wrote:
>>>
>>> On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>>>
>>>>> I just noticed this part. Rereading my comment in
>>>>>
>>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
>>>>
>>>>
>>>>
>>>> I haven't been able to make it break with -std=c++11 . Is there
>>>> something I'm missing here ?
>>>
>>>
>>>
>>> I don't remember. It might just be that trying to create a constexpr
>>> vector
>>> variable or calling __builtin_shuffle on it ICEs instead of giving an
>>> error.
>>> I can keep a note to make some tests at the end of July (I will be mostly
>>> away until then), but I believe the code from comment 22 is safer than
>>> the
>>> one from comment 20, if memory serves.
>>
>>
>> I'm not qualified enough to take a call on what's better in this case
>> and will have to defer to Jason and the C++ maintainers on this one.
>>
>> Now that you've said this I decided to go back and throw more tests
>> through it
>> I've tried to chug through most of the testcases for __builtin_shuffle
>> including a few of my own the simplest of which I show below trying to
>> trigger this issue but can't seem to do so.
>
>
> Maybe something like:
>
> #include <x86intrin.h>
> int main(){
> constexpr __m128d x={1.,2.};
> constexpr __m128i y={1,0};
> constexpr __m128d z=__builtin_shuffle(x,y);
> }
>
> ?
> (sorry for the x86 specific code, should be easy to adapt)
Thanks for the example and your patience - just shows my ignorance
with C++11 :( .
I'll try to have a look at this later today and see if I can come up
with something and possibly integrating that bit of your patch.
>
> See also:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53094
>
> Long term, vectors should be literals. But we need something to avoid
> crashes on operator[] and __builtin_shuffle (ideally implementing the
> constant version of them). Keeping vectors as non-literals (what I was
> suggesting) is quite a crude hack. Maybe having them as literals now is a
> good thing, but it would be good to avoid the ICEs.
Agreed that the compiler shouldn't crash in these cases now that I
understand finally what you meant. Have a good break.
Thanks,
Ramana
>
> --
> Marc Glisse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC C++] Turn on builtin_shuffle for C++.
2012-06-15 19:11 ` Marc Glisse
2012-06-15 20:15 ` Ramana Radhakrishnan
@ 2012-06-18 13:47 ` Ramana Radhakrishnan
1 sibling, 0 replies; 10+ messages in thread
From: Ramana Radhakrishnan @ 2012-06-18 13:47 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches, Marc Glisse
On 15 June 2012 20:04, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>
>> On 15 June 2012 18:18, Marc Glisse <marc.glisse@inria.fr> wrote:
>>>
>>> On Fri, 15 Jun 2012, Ramana Radhakrishnan wrote:
>>>
>>>>> I just noticed this part. Rereading my comment in
>>>>>
>>>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51033#c22
>>>>
>>>>
>>>>
>>>> I haven't been able to make it break with -std=c++11 . Is there
>>>> something I'm missing here ?
>>>
>>>
>>>
>>> I don't remember. It might just be that trying to create a constexpr
>>> vector
>>> variable or calling __builtin_shuffle on it ICEs instead of giving an
>>> error.
>>> I can keep a note to make some tests at the end of July (I will be mostly
>>> away until then), but I believe the code from comment 22 is safer than
>>> the
>>> one from comment 20, if memory serves.
>>
>>
>> I'm not qualified enough to take a call on what's better in this case
>> and will have to defer to Jason and the C++ maintainers on this one.
>>
>> Now that you've said this I decided to go back and throw more tests
>> through it
>> I've tried to chug through most of the testcases for __builtin_shuffle
>> including a few of my own the simplest of which I show below trying to
>> trigger this issue but can't seem to do so.
>
>
> Maybe something like:
>
> #include <x86intrin.h>
> int main(){
> constexpr __m128d x={1.,2.};
> constexpr __m128i y={1,0};
> constexpr __m128d z=__builtin_shuffle(x,y);
> }
>
> ?
> (sorry for the x86 specific code, should be easy to adapt)
>
> See also:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53094
>
> Long term, vectors should be literals. But we need something to avoid
> crashes on operator[] and __builtin_shuffle (ideally implementing the
> constant version of them). Keeping vectors as non-literals (what I was
> suggesting) is quite a crude hack. Maybe having them as literals now is a
> good thing, but it would be good to avoid the ICEs.
I've submitted a fresh patch for that over at
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01165.html . thought it
better than conflating the 2 threads.
regards,
Ramana
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-06-18 13:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-14 9:26 [RFC C++] Turn on builtin_shuffle for C++ Ramana Radhakrishnan
2012-06-15 1:40 ` Jason Merrill
2012-06-15 16:57 ` Ramana Radhakrishnan
2012-06-15 17:09 ` Marc Glisse
2012-06-15 17:18 ` Ramana Radhakrishnan
2012-06-15 17:53 ` Marc Glisse
2012-06-15 18:05 ` Ramana Radhakrishnan
2012-06-15 19:11 ` Marc Glisse
2012-06-15 20:15 ` Ramana Radhakrishnan
2012-06-18 13:47 ` Ramana Radhakrishnan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).