+2019-05-17 Richard Biener <rguenther@suse.de>
+
+ * gimple-pretty-print.c (dump_ternary_rhs): Handle dumping
+ VEC_PERM_EXPR as __VEC_PERM with -gimple.
+
2019-05-17 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390-builtins.def (s390_vec_sldw_*): Use the
+2019-05-17 Richard Biener <rguenther@suse.de>
+
+ * gimple-parser.c (c_parser_gimple_statement): Handle __VEC_PERM.
+ (c_parser_gimple_unary_expression): Likewise.
+ (c_parser_gimple_parentized_ternary_expression): New function.
+
2019-05-16 Richard Biener <rguenther@suse.de>
* gimple-parser.c (c_parser_gimple_statement): Handle __BIT_INSERT.
if (strcmp (IDENTIFIER_POINTER (id), "__ABS") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__ABSU") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__MIN") == 0
+ || strcmp (IDENTIFIER_POINTER (id), "__MAX") == 0
|| strcmp (IDENTIFIER_POINTER (id), "__BIT_INSERT") == 0
- || strcmp (IDENTIFIER_POINTER (id), "__MAX") == 0)
+ || strcmp (IDENTIFIER_POINTER (id), "__VEC_PERM") == 0)
goto build_unary_expr;
break;
}
return ret;
}
+/* Parse a gimple parentized binary expression. */
+
+static c_expr
+c_parser_gimple_parentized_ternary_expression (gimple_parser &parser,
+ location_t op_loc,
+ tree_code code)
+{
+ struct c_expr ret;
+ ret.set_error ();
+
+ c_parser_consume_token (parser);
+ if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
+ return ret;
+ c_expr op1 = c_parser_gimple_postfix_expression (parser);
+ if (!c_parser_require (parser, CPP_COMMA, "expected %<,%>"))
+ return ret;
+ c_expr op2 = c_parser_gimple_postfix_expression (parser);
+ if (!c_parser_require (parser, CPP_COMMA, "expected %<)%>"))
+ return ret;
+ c_expr op3 = c_parser_gimple_postfix_expression (parser);
+ if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
+ return ret;
+
+ if (op1.value != error_mark_node
+ && op2.value != error_mark_node
+ && op3.value != error_mark_node)
+ ret.value = build3_loc (op_loc,
+ code, TREE_TYPE (op1.value),
+ op1.value, op2.value, op3.value);
+ return ret;
+}
+
/* Parse gimple unary expression.
gimple-unary-expression:
return c_parser_gimple_parentized_binary_expression (parser,
op_loc,
MAX_EXPR);
+ else if (strcmp (IDENTIFIER_POINTER (id), "__VEC_PERM") == 0)
+ return c_parser_gimple_parentized_ternary_expression
+ (parser, op_loc, VEC_PERM_EXPR);
else if (strcmp (IDENTIFIER_POINTER (id), "__BIT_INSERT") == 0)
{
/* __BIT_INSERT '(' postfix-expression, postfix-expression,
break;
case VEC_PERM_EXPR:
- pp_string (buffer, "VEC_PERM_EXPR <");
+ if (flags & TDF_GIMPLE)
+ pp_string (buffer, "__VEC_PERM (");
+ else
+ pp_string (buffer, "VEC_PERM_EXPR <");
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
- pp_greater (buffer);
+ if (flags & TDF_GIMPLE)
+ pp_right_paren (buffer);
+ else
+ pp_greater (buffer);
break;
case REALIGN_LOAD_EXPR:
+2019-05-17 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/gimplefe-41.c: New testcase.
+
2019-05-17 Jun Ma <JunMa@linux.alibaba.com>
PR tree-optimization/90106
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fgimple -Wno-psabi -w" } */
+
+typedef double __v2df __attribute__ ((__vector_size__ (16)));
+typedef unsigned long __v2di __attribute__ ((__vector_size__ (16)));
+
+__v2df __GIMPLE (ssa)
+_mm_add_sd (__v2df x, __v2df y)
+{
+ __v2df z;
+ double _1;
+ double _2;
+ double _3;
+ __v2df _7;
+
+ __BB(2):
+ _1 = __BIT_FIELD_REF <double> (x_4(D), 64u, 0u);
+ _2 = __BIT_FIELD_REF <double> (y_5(D), 64u, 0u);
+ _3 = _1 + _2;
+ _7 = _Literal (__v2df) {_3, _3};
+ z_6 = __VEC_PERM (x_4(D), _7, _Literal (__v2di) { 2ul, 1ul });
+ return z_6;
+}
+
+__v2df __GIMPLE (ssa)
+_mm_add_sd2 (__v2df x, __v2df y)
+{
+ __v2df z;
+ double _1;
+ double _2;
+ double _3;
+
+ __BB(2):
+ _1 = __BIT_FIELD_REF <double> (x_4(D), 64u, 0u);
+ _2 = __BIT_FIELD_REF <double> (y_5(D), 64u, 0u);
+ _3 = _1 + _2;
+ z_6 = __BIT_INSERT (x_4(D), _3, 0);
+ return z_6;
+}