@@ -227,6 +227,7 @@ enum tree_code {
CONVERT0,
CONVERT1,
CONVERT2,
+CONVERT3,
VIEW_CONVERT0,
VIEW_CONVERT1,
VIEW_CONVERT2,
@@ -1176,6 +1177,7 @@ lower_opt_convert (operand *o)
= { CONVERT0, CONVERT_EXPR,
CONVERT1, CONVERT_EXPR,
CONVERT2, CONVERT_EXPR,
+ CONVERT3, CONVERT_EXPR,
VIEW_CONVERT0, VIEW_CONVERT_EXPR,
VIEW_CONVERT1, VIEW_CONVERT_EXPR,
VIEW_CONVERT2, VIEW_CONVERT_EXPR };
@@ -4145,8 +4147,8 @@ parser::record_operlist (location_t loc, user_id *p)
}
}
-/* Parse the operator ID, special-casing convert?, convert1? and
- convert2? */
+/* Parse the operator ID, special-casing convert?, convert1?, convert2? and
+ convert3? */
id_base *
parser::parse_operation ()
@@ -4167,6 +4169,8 @@ parser::parse_operation ()
;
else if (strcmp (id, "convert2") == 0)
;
+ else if (strcmp (id, "convert3") == 0)
+ ;
else if (strcmp (id, "view_convert") == 0)
id = "view_convert0";
else if (strcmp (id, "view_convert1") == 0)
@@ -4183,6 +4187,7 @@ parser::parse_operation ()
}
else if (strcmp (id, "convert1") == 0
|| strcmp (id, "convert2") == 0
+ || strcmp (id, "convert3") == 0
|| strcmp (id, "view_convert1") == 0
|| strcmp (id, "view_convert2") == 0)
fatal_at (id_tok, "expected '?' after conditional operator");
@@ -4723,9 +4728,9 @@ parser::parse_for (location_t)
id_base *idb = get_operator (oper, true);
if (idb == NULL)
fatal_at (token, "no such operator '%s'", oper);
- if (*idb == CONVERT0 || *idb == CONVERT1 || *idb == CONVERT2
- || *idb == VIEW_CONVERT0 || *idb == VIEW_CONVERT1
- || *idb == VIEW_CONVERT2)
+ if (*idb == CONVERT0 || *idb == VIEW_CONVERT0
+ || *idb == CONVERT1 || *idb == CONVERT2|| *idb == CONVERT3
+ || *idb == VIEW_CONVERT1 || *idb == VIEW_CONVERT2)
fatal_at (token, "conditional operators cannot be used inside for");
if (arity == -1)
@@ -5136,6 +5141,7 @@ main (int argc, char **argv)
add_operator (CONVERT0, "convert0", "tcc_unary", 1);
add_operator (CONVERT1, "convert1", "tcc_unary", 1);
add_operator (CONVERT2, "convert2", "tcc_unary", 1);
+add_operator (CONVERT3, "convert3", "tcc_unary", 1);
add_operator (VIEW_CONVERT0, "view_convert0", "tcc_unary", 1);
add_operator (VIEW_CONVERT1, "view_convert1", "tcc_unary", 1);
add_operator (VIEW_CONVERT2, "view_convert2", "tcc_unary", 1);
@@ -1461,8 +1461,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x */
(simplify
- (bit_ior:c (bit_and:cs @0 (bit_not @2)) (bit_and:cs @1 @2))
- (bit_xor (bit_and (bit_xor @0 @1) @2) @0))
+ (bit_ior:c
+ (convert? (bit_and:cs @0 (bit_not (convert2? @2))))
+ (convert1? (bit_and:cs @1 (convert3? @2))))
+ (if (tree_nop_conversion_p (type, TREE_TYPE (@0))
+ && tree_nop_conversion_p (type, TREE_TYPE (@1)))
+ (bit_xor (bit_and
+ (bit_xor (convert @0) (convert @1)) (convert @2)) (convert @0))))
/* Fold A - (A & B) into ~B & A. */
(simplify
@@ -7,27 +7,31 @@
#define OP(x,y,z) (((x) & (z)) | ((y) & ~(z)))
#endif
-#define TYPE(N) int##N##_t
-
-#define TEMPLATE(SIZE) \
-void __attribute__ ((noinline, noclone)) \
-f_##SIZE##_##OP \
- (TYPE(SIZE) *restrict a, TYPE(SIZE) *restrict b, \
- TYPE(SIZE) *restrict c, TYPE(SIZE) *restrict d, int n) \
-{ \
- for (int i = 0; i < n; i++) \
- a[i] = OP (b[i], c[i], d[i]); \
+#define TYPE(S,N) S##int##N##_t
+
+#define TEMPLATE(SIGN,SIZE) \
+void __attribute__ ((noinline, noclone)) \
+f_##SIGN##_##SIZE##_##OP \
+ (TYPE(SIGN,SIZE) *restrict a, TYPE(SIGN,SIZE) *restrict b, \
+ TYPE(SIGN,SIZE) *restrict c, TYPE(SIGN,SIZE) *restrict d, int n) \
+{ \
+ for (int i = 0; i < n; i++) \
+ a[i] = OP (b[i], c[i], d[i]); \
}
-TEMPLATE (8);
-TEMPLATE (16);
-TEMPLATE (32);
-TEMPLATE (64);
+TEMPLATE (,8);
+TEMPLATE (,16);
+TEMPLATE (,32);
+TEMPLATE (,64);
+TEMPLATE (u,8);
+TEMPLATE (u,16);
+TEMPLATE (u,32);
+TEMPLATE (u,64);
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 8 "vect" } } */
/* { dg-final { scan-assembler-not {\teor\tz[0-9]+\.[bhsd]} } } */
/* { dg-final { scan-assembler-not {\tand\tz[0-9]+\.[bhsd]} } } */
-/* { dg-final { scan-assembler-times {\tbsl\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tbsl\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 8 } } */
@@ -5,11 +5,11 @@
#include "bitsel_1.c"
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 8 "vect" } } */
/* { dg-final { scan-assembler-not {\teor\tz[0-9]+\.[bhsd]} } } */
/* { dg-final { scan-assembler-not {\tand\tz[0-9]+\.[bhsd]} } } */
/* { dg-final { scan-assembler-not {\tnot\tz[0-9]+\.[bhsd]} } } */
-/* { dg-final { scan-assembler-times {\tnbsl\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tnbsl\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 8 } } */
@@ -5,10 +5,10 @@
#include "bitsel_1.c"
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 8 "vect" } } */
/* { dg-final { scan-assembler-not {\teor\tz[0-9]+\.[bhsd]} } } */
/* { dg-final { scan-assembler-not {\tbic\tz[0-9]+\.[bhsd]} } } */
-/* { dg-final { scan-assembler-times {\tbsl1n\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tbsl1n\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 8 } } */
@@ -5,11 +5,11 @@
#include "bitsel_1.c"
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 8 "vect" } } */
/* { dg-final { scan-assembler-not {\torr\tz[0-9]+\.[bhsd]} } } */
/* { dg-final { scan-assembler-not {\tand\tz[0-9]+\.[bhsd]} } } */
/* { dg-final { scan-assembler-not {\tnot\tz[0-9]+\.[bhsd]} } } */
-/* { dg-final { scan-assembler-times {\tbsl2n\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tbsl2n\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 8 } } */
@@ -5,9 +5,9 @@
#include "bitsel_1.c"
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 8 "vect" } } */
/* { dg-final { scan-assembler-not {\teor\tz[0-9]+\.[bhsd]} } } */
-/* { dg-final { scan-assembler-times {\teor3\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */
+/* { dg-final { scan-assembler-times {\teor3\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 8 } } */