+2016-06-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/71647
+ * omp-low.c (lower_rec_input_clauses): Convert
+ omp_clause_aligned_alignment (c) to size_type_node for the
+ last argument of __builtin_assume_aligned.
+
2016-06-24 Martin Liska <mliska@suse.cz>
* cfgloop.c (flow_loop_dump): Dump average number of loop iterations.
if (new_var == NULL_TREE)
new_var = maybe_lookup_decl_in_outer_ctx (var, ctx);
x = builtin_decl_explicit (BUILT_IN_ASSUME_ALIGNED);
- x = build_call_expr_loc (clause_loc, x, 2, new_var,
- omp_clause_aligned_alignment (c));
+ tree alarg = omp_clause_aligned_alignment (c);
+ alarg = fold_convert_loc (clause_loc, size_type_node, alarg);
+ x = build_call_expr_loc (clause_loc, x, 2, new_var, alarg);
x = fold_convert_loc (clause_loc, TREE_TYPE (new_var), x);
x = build2 (MODIFY_EXPR, TREE_TYPE (new_var), new_var, x);
gimplify_and_add (x, ilist);
t = maybe_lookup_decl_in_outer_ctx (var, ctx);
t = build_fold_addr_expr_loc (clause_loc, t);
t2 = builtin_decl_explicit (BUILT_IN_ASSUME_ALIGNED);
- t = build_call_expr_loc (clause_loc, t2, 2, t,
- omp_clause_aligned_alignment (c));
+ tree alarg = omp_clause_aligned_alignment (c);
+ alarg = fold_convert_loc (clause_loc, size_type_node, alarg);
+ t = build_call_expr_loc (clause_loc, t2, 2, t, alarg);
t = fold_convert_loc (clause_loc, ptype, t);
x = create_tmp_var (ptype);
t = build2 (MODIFY_EXPR, ptype, x, t);
--- /dev/null
+/* PR tree-optimization/71647 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fopenmp-simd -mavx -mno-avx512f -fdump-tree-vect-details" } */
+
+void
+foo (double *a, double *b)
+{
+ int i;
+#pragma omp simd aligned(a,b:4*sizeof(double))
+ for (i = 0; i < 32768; i++)
+ a[i] += b[i];
+}
+
+void
+bar (double *a, double *b)
+{
+ int i;
+#pragma omp simd aligned(a,b:32)
+ for (i = 0; i < 32768; i++)
+ a[i] += b[i];
+}
+
+void
+baz (double *a, double *b)
+{
+ int i;
+#pragma omp simd aligned(a,b:32L)
+ for (i = 0; i < 32768; i++)
+ a[i] += b[i];
+}
+
+/* { dg-final { scan-tree-dump-not "Alignment of access forced using peeling" "vect" } } */