From: Jakub Jelinek Date: Fri, 24 Jun 2016 18:44:11 +0000 (+0200) Subject: re PR tree-optimization/71647 (aligned(x:32) in #pragma omp simd does not work) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37e373c2b825584243f3d67a31263e5a0f7b9d15;p=gcc.git re PR tree-optimization/71647 (aligned(x:32) in #pragma omp simd does not work) 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. * gcc.target/i386/pr71647.c: New test. From-SVN: r237769 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80048f15a66..71b818167ed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-24 Jakub Jelinek + + 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 * cfgloop.c (flow_loop_dump): Dump average number of loop iterations. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 22e59094e82..b89978f7723 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4475,8 +4475,9 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, 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); @@ -4489,8 +4490,9 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f85270c0646..1ec279cf0eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-24 Jakub Jelinek + + PR tree-optimization/71647 + * gcc.target/i386/pr71647.c: New test. + 2016-06-24 Uros Bizjak * gcc.dg/vect/vect-nb-iter-ub-1.c: Remove default vector diff --git a/gcc/testsuite/gcc.target/i386/pr71647.c b/gcc/testsuite/gcc.target/i386/pr71647.c new file mode 100644 index 00000000000..ab091bd93dd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr71647.c @@ -0,0 +1,32 @@ +/* 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" } } */