Re: [PATCH, loop2_invariant, 2/2] Change heuristics for identical invariants
On 10 June 2014 19:16, Steven Bosscher wrote: > On Tue, Jun 10, 2014 at 11:23 AM, Zhenqiang Chen wrote: >> * loop-invariant.c (struct invariant): Add a new member: eqno; >> (find_identical_invariants): Update eqno; >> (create_new_invariant): Init eqno; >> (get_inv_cost): Compute comp_cost wiht eqno; >> (gain_for_invariant): Take spill cost into account. > > Look OK except ... > >> @@ -1243,7 +1256,13 @@ gain_for_invariant (struct invariant *inv, >> unsigned *regs_needed, >> + IRA_LOOP_RESERVED_REGS >> - ira_class_hard_regs_num[cl]; >>if (size_cost > 0) >> - return -1; >> + { >> + int spill_cost = target_spill_cost [speed] * (int) regs_needed[cl]; >> + if (comp_cost <= spill_cost) >> + return -1; >> + >> + return 2; >> + } >>else >> size_cost = 0; >> } > > ... why "return 2", instead of just falling through to "return > comp_cost - size_cost;"? The updated patch removes the check on spill cost since the check seams not sound and tests show it does not help much on the result. Bootstrap and no make check regression on X86-64. OK for trunk? Thanks! -Zhenqiang ChangeLog: 2014-07-01 Zhenqiang Chen * loop-invariant.c (struct invariant): Add a new member: eqno; (find_identical_invariants): Update eqno; (create_new_invariant): Init eqno; (get_inv_cost): Compute comp_cost wiht eqno; diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index d47d461..bd67eb9 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -104,6 +104,9 @@ struct invariant /* The number of the invariant with the same value. */ unsigned eqto; + /* The number of invariants which eqto this. */ + unsigned eqno; + /* If we moved the invariant out of the loop, the register that contains its value. */ rtx reg; @@ -498,6 +501,7 @@ find_identical_invariants (invariant_htab_type *eq, struct invariant *inv) struct invariant *dep; rtx expr, set; enum machine_mode mode; + struct invariant *tmp; if (inv->eqto != ~0u) return; @@ -513,7 +517,12 @@ find_identical_invariants (invariant_htab_type *eq, struct invariant *inv) mode = GET_MODE (expr); if (mode == VOIDmode) mode = GET_MODE (SET_DEST (set)); - inv->eqto = find_or_insert_inv (eq, expr, mode, inv)->invno; + + tmp = find_or_insert_inv (eq, expr, mode, inv); + inv->eqto = tmp->invno; + + if (tmp->invno != inv->invno && inv->always_executed) +tmp->eqno++; if (dump_file && inv->eqto != inv->invno) fprintf (dump_file, @@ -722,6 +731,10 @@ create_new_invariant (struct def *def, rtx insn, bitmap depends_on, inv->invno = invariants.length (); inv->eqto = ~0u; + + /* Itself. */ + inv->eqno = 1; + if (def) def->invno = inv->invno; invariants.safe_push (inv); @@ -1136,7 +1149,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed, if (!inv->cheap_address || inv->def->n_addr_uses < inv->def->n_uses) -(*comp_cost) += inv->cost; +(*comp_cost) += inv->cost * inv->eqno; #ifdef STACK_REGS {
Re: [PATCH, 4/10] expand ccmp
On 25 June 2014 23:16, Richard Earnshaw wrote: > On 23/06/14 07:59, Zhenqiang Chen wrote: >> Hi, >> >> This patch includes the main logic to expand ccmp instructions. >> >> In the patch, >> * ccmp_candidate_p is used to identify the CCMP candidate >> * expand_ccmp_expr is the main entry, which calls expand_ccmp_expr_1 >> to expand CCMP. >> * expand_ccmp_expr_1 uses a recursive algorithm to expand CCMP. >> It calls gen_ccmp_first and gen_ccmp_next to generate CCMP instructions. >> >> During expanding, we must make sure that no instruction can clobber the >> CC reg except the compares. So clobber_cc_p and check_clobber_cc are >> introduced to do the check. >> >> * If the final result is not used in a COND_EXPR (checked by function >> used_in_cond_stmt_p), it calls cstorecc4 pattern to store the CC to a >> general register. >> >> Bootstrap and no make check regression on X86-64. >> >> OK for trunk? >> >> Thanks! >> -Zhenqiang >> >> ChangeLog: >> 2014-06-23 Zhenqiang Chen >> >> * ccmp.c (ccmp_candidate_p, used_in_cond_stmt_p, check_clobber_cc, >> clobber_cc_p, expand_ccmp_next, expand_ccmp_expr_1, >> expand_ccmp_expr): >> New functions to expand ccmp. >> * ccmp.h (expand_ccmp_expr): New prototype. >> * expr.c: #include "ccmp.h" >> (expand_expr_real_1): Try to expand ccmp. >> >> diff --git a/gcc/ccmp.c b/gcc/ccmp.c >> index 665c2a5..97b3910 100644 >> --- a/gcc/ccmp.c >> +++ b/gcc/ccmp.c >> @@ -47,6 +47,262 @@ along with GCC; see the file COPYING3. If not see >> #include "expmed.h" >> #include "ccmp.h" >> >> +/* The following functions expand conditional compare (CCMP) instructions. >> + Here is a short description about the over all algorithm: >> + * ccmp_candidate_p is used to identify the CCMP candidate >> + >> + * expand_ccmp_expr is the main entry, which calls expand_ccmp_expr_1 >> + to expand CCMP. >> + >> + * expand_ccmp_expr_1 uses a recursive algorithm to expand CCMP. >> + It calls two target hooks gen_ccmp_first and gen_ccmp_next to >> generate >> + CCMP instructions. >> +- gen_ccmp_first expands the first compare in CCMP. >> +- gen_ccmp_next expands the following compares. >> + >> + During expanding, we must make sure that no instruction can clobber >> the >> + CC reg except the compares. So clobber_cc_p and check_clobber_cc are >> + introduced to do the check. >> + >> + * If the final result is not used in a COND_EXPR (checked by function >> + used_in_cond_stmt_p), it calls cstorecc4 pattern to store the CC to a >> + general register. */ >> + >> +/* Check whether G is a potential conditional compare candidate. */ >> +static bool >> +ccmp_candidate_p (gimple g) >> +{ >> + tree rhs = gimple_assign_rhs_to_tree (g); >> + tree lhs, op0, op1; >> + gimple gs0, gs1; >> + enum tree_code tcode, tcode0, tcode1; >> + tcode = TREE_CODE (rhs); >> + >> + if (tcode != BIT_AND_EXPR && tcode != BIT_IOR_EXPR) >> +return false; >> + >> + lhs = gimple_assign_lhs (g); >> + op0 = TREE_OPERAND (rhs, 0); >> + op1 = TREE_OPERAND (rhs, 1); >> + >> + if ((TREE_CODE (op0) != SSA_NAME) || (TREE_CODE (op1) != SSA_NAME) >> + || !has_single_use (lhs)) >> +return false; >> + >> + gs0 = get_gimple_for_ssa_name (op0); >> + gs1 = get_gimple_for_ssa_name (op1); >> + if (!gs0 || !gs1 || !is_gimple_assign (gs0) || !is_gimple_assign (gs1) >> + /* g, gs0 and gs1 must be in the same basic block, since current stage >> +is out-of-ssa. We can not guarantee the correctness when forwording >> +the gs0 and gs1 into g whithout DATAFLOW analysis. */ >> + || gimple_bb (gs0) != gimple_bb (gs1) >> + || gimple_bb (gs0) != gimple_bb (g)) >> +return false; >> + >> + if (!(INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (gs0))) >> + || POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (gs0 >> + || !(INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (gs1))) >> + || POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (gs1) >> +return false; >> + >> + tcode0 = gimple_assign_rhs_code (gs0); >> + tcode1 = gimple_assign_rhs_code (gs1); >> + if (TREE_CODE_CLASS (tcode0) == tcc_comparison >> + && TREE_CODE_CLASS (tcode1) == tcc_comparison) >> +return true; >> + if (TREE_CODE_CLASS (tcode0) == tcc_comparison >> + && ccmp_candidate_p (gs1)) >> +return true; >> + else if (TREE_CODE_CLASS (tcode1) == tcc_comparison >> + && ccmp_candidate_p (gs0)) >> +return true; >> + /* We skip ccmp_candidate_p (gs1) && ccmp_candidate_p (gs0) since >> + there is no way to set the CC flag. */ >> + return false; >> +} >> + >> +/* Check whether EXP is used in a GIMPLE_COND statement or not. */ >> +static bool >> +used_in_cond_stmt_p (tree exp) >> +{ >> + bool expand_cond = false; >> + imm_use_iterator ui; >> + gimple use_stmt; >> + FOR_EACH_IMM_USE_STMT (use_stmt, ui, exp) >> +i
Re: [PATCH 1/2] Enable setting sign and unsigned promoted mode (SPR_SIGNED_AND_UNSIGNED)
On 26/06/14 20:12, Jakub Jelinek wrote: > On Thu, Jun 26, 2014 at 07:41:22PM +1000, Kugan wrote: >> 2014-06-26 Kugan Vivekanandarajah >> >> * calls.c (precompute_arguments): Use new SUBREG_PROMOTED_SET >> instead of SUBREG_PROMOTED_UNSIGNED_SET > > Missing full stop. > >> --- a/gcc/cfgexpand.c >> +++ b/gcc/cfgexpand.c >> @@ -3297,7 +3297,7 @@ expand_gimple_stmt_1 (gimple stmt) >>; >> else if (promoted) >>{ >> -int unsignedp = SUBREG_PROMOTED_UNSIGNED_P (target); >> +int unsignedp = SUBREG_PROMOTED_GET (target) & SRP_UNSIGNED; > > From what I understand, here you want the -1/0/1 value and not 2, > so that is > int unsignedp = SUBREG_PROMOTED_GET (target); > if (unsignedp == SRP_SIGNED_AND_UNSIGNED) unsignedp = SRP_UNSIGNED; > I think. Do you agree? I agree. > BTW, the final patch will probably need to be tested on one of the weirdo > ptr_extend targets (ia64-hpux or x86_64-linux -mx32). I am now looking at testing on such targets. I just want to double check that x86_64-linux -mx32 is OK for this. When I looked at the src, it looked to me #define POINTERS_EXTEND_UNSIGNED -1 is needed for this to happen. x86_64-linux -mx32 doesnt seem to fall into thss. In addition, I will also test AArch64 ILP32 (#define POINTERS_EXTEND_UNSIGNED 1), ARM and x86_64 before posting the patch. >> --- a/gcc/expr.c >> +++ b/gcc/expr.c >> @@ -329,7 +329,7 @@ convert_move (rtx to, rtx from, int unsignedp) >>if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from) >>&& (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (from))) >>>= GET_MODE_PRECISION (to_mode)) >> - && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp) >> + && SUBREG_CHECK_PROMOTED_SIGN (from, unsignedp)) > > I think unsignedp (misnamed) may be -1/0/1 here, so either > SUBREG_CHECK_PROMOTED_SIGN needs to handle those 3, or you need to use > something else. If it handles all 3 values, then it would be say > ((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER > : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) > : SUBREG_PROMOTED_UNSIGNED_P (RTX)) > or so. I have changed it. I have defined a macro SUBREG_PROMOTED_SIGN for this. > >> from = gen_lowpart (to_mode, from), from_mode = to_mode; >> >>gcc_assert (GET_CODE (to) != SUBREG || !SUBREG_PROMOTED_VAR_P (to)); >> @@ -703,7 +703,7 @@ convert_modes (enum machine_mode mode, enum machine_mode >> oldmode, rtx x, int uns >> >>if (GET_CODE (x) == SUBREG && SUBREG_PROMOTED_VAR_P (x) >>&& GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) >= GET_MODE_SIZE (mode) >> - && SUBREG_PROMOTED_UNSIGNED_P (x) == unsignedp) >> + && SUBREG_CHECK_PROMOTED_SIGN (x, unsignedp)) >> x = gen_lowpart (mode, SUBREG_REG (x)); > > Similarly. I have changed it too. > >> @@ -5203,24 +5203,25 @@ store_expr (tree exp, rtx target, int call_param_p, >> bool nontemporal) >> == TYPE_PRECISION (TREE_TYPE (exp))) >> { >>if (TYPE_UNSIGNED (TREE_TYPE (exp)) >> - != SUBREG_PROMOTED_UNSIGNED_P (target)) >> + != SUBREG_PROMOTED_GET (target) & SRP_UNSIGNED) > > Here TYPE_UNSIGNED is 0 or 1, so if you define SUBREG_PROMOTED_CHECK_SIGN > the way suggested above, this would be SUBREG_PROMOTED_CHECK_SIGN then, > or if (TYPE_UNSIGNED (TREE_TYPE (exp)) >? SUBREG_PROMOTED_UNSIGNED_P (target) >: SUBREG_PROMOTED_SIGNED_P (target)) > >> { >>/* Some types, e.g. Fortran's logical*4, won't have a signed >> version, so use the mode instead. */ >>tree ntype >> = (signed_or_unsigned_type_for >> - (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp))); >> + (SUBREG_PROMOTED_GET (target) & SRP_UNSIGNED, > > I'd just use TYPE_UNSIGNED (TREE_TYPE (exp)) here instead, > no reason to repeat what the guarding condition did. Did you mean !TYPE_UNSIGNED (TREE_TYPE (exp))?. isn’t it better to use the macro SUBREG_PROMOTED_SIGN (defined earlier as you suggested) here? It might be more readable. I am happy to do what you like. > >> +TREE_TYPE (exp))); >>if (ntype == NULL) >> ntype = lang_hooks.types.type_for_mode >>(TYPE_MODE (TREE_TYPE (exp)), >> - SUBREG_PROMOTED_UNSIGNED_P (target)); >> + SUBREG_PROMOTED_GET (target) & SRP_UNSIGNED); >> >>exp = fold_convert_loc (loc, ntype, exp); >> } >> >>exp = fold_convert_loc (loc, lang_hooks.types.type_for_mode >>(GET_MODE (SUBREG_REG (target)), >> - SUBREG_PROMOTED_UNSIGNED_P (target)), >> + SUBREG_PROMOTED_GET (target) & SRP_UNSIGNED), >>exp); > > I believe fold_convert only considers zero and non-zero, so no idea > what we want here for SRP_POINTER. Doing what we used to do would > be SUBREG
Re: [C PATCH] Add -Wincompatible-pointer-types option (PR c/58286)
On Mon, Jun 30, 2014 at 08:14:52PM +, Joseph S. Myers wrote: > On Mon, 30 Jun 2014, Marek Polacek wrote: > > > This patch adds the -Wincompatible-pointer-types option for a warning > > we already have, so it's possible to suppress this specific warning, or > > use it with -Werror= and so on. > > As a followup change, I'm considering printing the types of the pointers; > > saying merely e.g. "assignment from incompatible pointer type" seems to be > > too > > austere. (We say "expected T but argument is of type U" when passing > > arguments.) > > This is for C/ObjC only, since in C++, we'd issue "cannot convert" error. > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > OK with the documentation amended to make clear this is for the cases not > covered by -Wno-pointer-sign (which in ISO C terms are just as > incompatible as the cases covered by the new option). Thanks, I'm applying the following then: 2014-07-01 Marek Polacek PR c/58286 * doc/invoke.texi: Document -Wincompatible-pointer-types. c-family/ * c.opt (Wincompatible-pointer-types): New option. c/ * c-typeck.c (convert_for_assignment): Pass OPT_Wincompatible_pointer_types instead of 0 to WARN_FOR_ASSIGNMENT. testsuite/ * gcc.dg/Wincompatible-pointer-types.c: New test. diff --git gcc/c-family/c.opt gcc/c-family/c.opt index 1d02bae..6448b1b 100644 --- gcc/c-family/c.opt +++ gcc/c-family/c.opt @@ -443,6 +443,10 @@ Wignored-qualifiers C C++ Var(warn_ignored_qualifiers) Warning EnabledBy(Wextra) Warn whenever type qualifiers are ignored. +Wincompatible-pointer-types +C ObjC Var(warn_incompatible_pointer_types) Init(1) Warning +Warn when there is a conversion between pointers that have incompatible types + Winit-self C ObjC C++ ObjC++ Var(warn_init_self) Warning LangEnabledBy(C++ ObjC++,Wall) Warn about variables which are initialized to themselves diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index b62e830..fff26a3 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -6189,7 +6189,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, else /* Avoid warning about the volatile ObjC EH puts on decls. */ if (!objc_ok) - WARN_FOR_ASSIGNMENT (location, expr_loc, 0, + WARN_FOR_ASSIGNMENT (location, expr_loc, + OPT_Wincompatible_pointer_types, G_("passing argument %d of %qE from " "incompatible pointer type"), G_("assignment from incompatible pointer type"), diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index dbc1132..409fa17 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}. -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol -Wformat-security -Wformat-signedness -Wformat-y2k @gol -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol --Wignored-qualifiers @gol +-Wignored-qualifiers -Wincompatible-pointer-types @gol -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol -Winit-self -Winline @gol -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol @@ -4199,14 +4199,20 @@ This option is only active when @option{-ftree-vrp} is active (default for @option{-O2} and above). It warns about subscripts to arrays that are always out of bounds. This warning is enabled by @option{-Wall}. -@item -Wno-discarded-qualifiers +@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} @opindex Wno-discarded-qualifiers @opindex Wdiscarded-qualifiers Do not warn if type qualifiers on pointers are being discarded. Typically, the compiler will warn if a @code{const char *} variable is passed to a function that takes @code{char *} parameter. This option -can be used to suppress such a warning. This warning is only supported -for C. +can be used to suppress such a warning. + +@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} +@opindex Wno-incompatible-pointer-types +@opindex Wincompatible-pointer-types +Do not warn when there is a conversion between pointers that have incompatible +types. This warning is for cases not covered by @option{-Wno-pointer-sign}, +which warns for pointer argument passing or assignment with different signedness @item -Wno-div-by-zero @opindex Wno-div-by-zero diff --git gcc/testsuite/gcc.dg/Wincompatible-pointer-types.c gcc/testsuite/gcc.dg/Wincompatible-pointer-types.c index e69de29..e765b27 100644 --- gcc/testsuite/gcc.dg/Wincompatible-pointer-types.c +++ gcc/testsuite/gcc.dg/Wincompatible-pointer-types.c @@ -0,0 +1,21 @@ +/* PR c/58286 */ +/* { dg-do compile } */ +/* { dg-options "-Wno-incompatible-pointer-types" } */ + +void +fn2 (short *s, long *l) +{ +} + +unsigned * +fn1 (void) +{ + int (*fpi) (int); + int (*fpd) (double) = fpi; + fpi = fpd; + char *di; + float *dp = &di; + di = dp; + fn2 (dp, di); + r
Re: [PATCH 1/2] Enable setting sign and unsigned promoted mode (SPR_SIGNED_AND_UNSIGNED)
On 26/06/14 20:25, Andreas Schwab wrote: > Kugan writes: > >> @@ -5203,24 +5203,25 @@ store_expr (tree exp, rtx target, int call_param_p, >> bool nontemporal) >> == TYPE_PRECISION (TREE_TYPE (exp))) >> { >>if (TYPE_UNSIGNED (TREE_TYPE (exp)) >> - != SUBREG_PROMOTED_UNSIGNED_P (target)) >> + != SUBREG_PROMOTED_GET (target) & SRP_UNSIGNED) > > & has lower precedence than !=. You should have got a warning that > fails bootstrap. Thanks for spotting it. I did a cross bootstrap and it dose not fail on warning. I should have mentioned clearly that I intend to do the full testing on all the targets necessary after getting feedback. Thanks, Kugan
Re: [PR 61424] std::regex matches right to left, not leftmost longest
On 30/06/14 19:17 -0700, Tim Shen wrote: On Sat, Jun 28, 2014 at 2:45 AM, Jonathan Wakely wrote: On 28/06/14 00:18 -0700, Tim Shen wrote: Please put a space above this new function, otherwise it looks like the "Dummy implementations" comment applies to this function, but in fact that function is used for dfs mode. Similarly, maybe there should be a "Dummy implementation" comment on the _State_info<__bfs, RV>::_M_get_sol_pos function. OK with that change, thanks for the fix. Committed. Great, thanks again.
Re: [C PATCH] Add -Wint-conversion option
On Mon, Jun 30, 2014 at 08:16:01PM +, Joseph S. Myers wrote: > On Mon, 30 Jun 2014, Marek Polacek wrote: > > > Basically everything I wrote in the patch for -Wincompatible-pointer-types > > applies here as well. A new option, -Wint-conversion (to be compatible > > with clang), is added to allow more fine-grained control over the warnings. > > I think we should print the types here as well, and moreover, we could hint > > the > > user that & or * may be used to fix the code. > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > OK with the documentation amended to make clear this is about *implicit* > conversions, not the cases covered by -Wno-int-to-pointer-cast and > -Wno-pointer-to-int-cast. Right, I'm applying the following then: 2014-07-01 Marek Polacek * doc/invoke.texi: Document -Wint-conversion. c-family/ * c.opt (Wint-conversion): New option. c/ * c-typeck.c (convert_for_assignment): Pass OPT_Wint_conversion instead of 0 to WARN_FOR_ASSIGNMENT. testsuite/ * gcc.dg/Wint-conversion.c: New test. diff --git gcc/c-family/c.opt gcc/c-family/c.opt index 6448b1b..c89040a 100644 --- gcc/c-family/c.opt +++ gcc/c-family/c.opt @@ -474,6 +474,10 @@ Winherited-variadic-ctor C++ ObjC++ Var(warn_inh_var_ctor) Init(1) Warning Warn about C++11 inheriting constructors when the base has a variadic constructor +Wint-conversion +C ObjC Var(warn_int_conversion) Init(1) Warning +Warn about incompatible integer to pointer and pointer to integer conversions + Wint-to-pointer-cast C ObjC C++ ObjC++ Var(warn_int_to_pointer_cast) Init(1) Warning Warn when there is a cast to a pointer from an integer of a different size diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index fff26a3..35bfd14 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -6213,7 +6213,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, or one that results from arithmetic, even including a cast to integer type. */ if (!null_pointer_constant) - WARN_FOR_ASSIGNMENT (location, expr_loc, 0, + WARN_FOR_ASSIGNMENT (location, expr_loc, +OPT_Wint_conversion, G_("passing argument %d of %qE makes " "pointer from integer without a cast"), G_("assignment makes pointer from integer " @@ -6227,7 +6228,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, } else if (codel == INTEGER_TYPE && coder == POINTER_TYPE) { - WARN_FOR_ASSIGNMENT (location, expr_loc, 0, + WARN_FOR_ASSIGNMENT (location, expr_loc, + OPT_Wint_conversion, G_("passing argument %d of %qE makes integer " "from pointer without a cast"), G_("assignment makes integer from pointer " diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index 409fa17..b1f6f4b 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -253,7 +253,7 @@ Objective-C and Objective-C++ Dialects}. -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol -Wignored-qualifiers -Wincompatible-pointer-types @gol -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol --Winit-self -Winline @gol +-Winit-self -Winline -Wno-int-conversion @gol -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol @@ -4214,6 +4214,14 @@ Do not warn when there is a conversion between pointers that have incompatible types. This warning is for cases not covered by @option{-Wno-pointer-sign}, which warns for pointer argument passing or assignment with different signedness +@item -Wno-int-conversion @r{(C and Objective-C only)} +@opindex Wno-int-conversion +@opindex Wint-conversion +Do not warn about incompatible integer to pointer and pointer to integer +conversions. This warning is about implicit conversions; for explicit +conversions the warnings @option{-Wno-int-to-pointer-cast} and +@option{-Wno-pointer-to-int-cast} may be used. + @item -Wno-div-by-zero @opindex Wno-div-by-zero @opindex Wdiv-by-zero diff --git gcc/testsuite/gcc.dg/Wint-conversion.c gcc/testsuite/gcc.dg/Wint-conversion.c index e69de29..1b7a03e 100644 --- gcc/testsuite/gcc.dg/Wint-conversion.c +++ gcc/testsuite/gcc.dg/Wint-conversion.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Wno-int-conversion" } */ + +int fn1 (int *), *fn2 (int); + +int +fn1 (int *p) +{ + int i = p; + i = p; + fn2 (p); + return p; +} + +int * +fn2 (int i) +{ + int *p = i; + p = i; + fn1 (i); + return i; +} Marek
Re: [PATCH]Enable elimination of IV use with unsigned type candidate
Sorry for this late reply, I spent some time in understanding the problem. On Tue, Jun 24, 2014 at 12:36 PM, Richard Biener wrote: > On Mon, Jun 23, 2014 at 11:49 AM, Bin Cheng wrote: >> expressions. It's possible to have iv_elimination_compare_lt to do some >> undo transformation on may_be_zero, but I found it's difficult for cases >> involving signed/unsigned conversion like case loop-41.c. Since I think >> there is no obvious benefit to fold may_be_zero here (somehow because the >> two operands are already in folded forms), this patch just calls build2_loc >> instead. > > But it may fold to true/false, no? You are right, it can be folded to false in many cases. Thus I managed to check specific folded forms of may_be_zero, as in attached patch. So far it works for tests I added, but there are some other folded forms not handled. > >> >> When GCC trying to eliminate use 0 with cand 0, the miscellaneous trees in >> iv_elimination_compare_lt are like below with i_1 of signed type: >> B: i_1 + 1 >> A: 0 >> niter->niter: (unsigned int)i_1 >> >> Apparently, (B-A-1) is "i_1", which doesn't equal to "(unsigned int)i_1". >> Without this patch, it is considered equal to each other. > > just looking at this part. Do you have a testcase that exhibits a difference > when just applying patch A? So I can have a look here? > > From the code in iv_elimination_compare_lt I can't figure why we'd > end up with i_1 instead of (unsigned int)i_1 as we convert to a common > type. > > I suppose the issue may be that at tree_to_aff_combination time > we strip all nops with STRIP_NOPS but when operating on ->rest > via convert/scale or add we do not strip them again. > > But then 'nit' should be i_1, not (unsigned int)i_1. So the analysis above > really doesn't look correct. > > Just to make sure we don't paper over an issue in tree-affine.c. > > Thus - testcase? On x86 we don't run into this place in > iv_elimination_compare_lt (on an unpatched tree). > > CCing Zdenek for the meat of patch B. I am more and more convinced that check of overflow in function iv_elimination_compare_lt is not sufficient. Considering example given by comments just before the function: /* Tries to replace loop exit by one formulated in terms of a LT_EXPR comparison with CAND. NITER describes the number of iterations of the loops. If successful, the comparison in COMP_P is altered accordingly. We aim to handle the following situation: sometype *base, *p; int a, b, i; i = a; p = p_0 = base + a; do { bla (*p); p++; i++; } while (i < b); Here, the number of iterations of the loop is (a + 1 > b) ? 0 : b - a - 1. We aim to optimize this to p = p_0 = base + a; do { bla (*p); p++; } while (p < p_0 - a + b); This preserves the correctness, since the pointer arithmetics does not overflow. More precisely: 1) if a + 1 <= b, then p_0 - a + b is the final value of p, hence there is no overflow in computing it or the values of p. 2) if a + 1 > b, then we need to verify that the expression p_0 - a does not overflow. To prove this, we use the fact that p_0 = base + a. */ The example seems wrong to me, because the statement only stands for unsigned case like ivopts-lt.c: #include "stdint.h" void f1 (char *p, uintptr_t i, uintptr_t n) { p += i; do { *p = '\0'; p += 1; i++; } while (i < n); } If i/n are of signed type, the 2nd point for "a+1>b" scenario in the comment isn't right, because of below facts: a) niter of loop are calculated in unsigned type as in function number_of_iterations_lt. So loop information for this case is like: Analyzing # of iterations of loop 1 exit condition [i_4(D) + 1, + , 1](no_overflow) < n_12(D) bounds on difference of bases: -4294967295 ... 4294967294 result: zero if i_4(D) >= n_12(D) # of iterations ((unsigned int) n_12(D) - (unsigned int) i_4(D)) - 1, bounded by 4294967294 number of iterations ((unsigned int) n_12(D) - (unsigned int) i_4(D)) - 1; zero if i_4(D) >= n_12(D) b) The (unsigned int)n_12(D) could overflow, the check in iv_elimination_compare_lt doesn't take this fact into consideration. Tricky thing is GCC now doesn't eliminate "i < n" with point P for signed version of case. The reason behind is again the may_be_zero information. The original form of may_be_zero is like "i_4(D) + 1> n_12(D)", which is folded into "i_4(D) >= n_12(D)" because both i_4/n_12 are of signed type and don't wrap. In the end, function iv_elimination_compare_lt only handles the original form of may_be_zero. So below case is the closest one to illustrate the problem: #include "stdint.h" void f1 (char *p, int i, int n) { p += i; do { *p = '\0'; p += 1; i++; } while (i < n); } char arr[100] = "hello\n"; int main(void) { f1 (arr, 1, -1); return 0; } If we build the original form of may_b
Re: [C PATCH] Add -Wint-conversion option
On Mon, Jun 30, 2014 at 11:07:57PM +0200, Gerald Pfeifer wrote: > On Mon, 30 Jun 2014, Jakub Jelinek wrote: > > We don't have gcc-4.10/ directory, because the version of the next > > release is still to be decided (hopefully at Cauldron next month). > > I'm a bit worried we'll miss entries in the meantime. > > Can we use gcc-4.10/ for now and rename later if we go for > GCC V or whatever? :-) Well, looks like I can't do much right now, so I'll go through my C FE changes and new ubsan features after we have some actual changes.html, and post a patch then... Marek
Re: C++ PATCH for c++/61659 (undefined symbol with devirtualization)
Jason Merrill writes: > libstdc++-v3/ > * libsupc++/cxxabi.h (class __pbase_type_info): __pointer_catch > is pure, not inline. I'm getting this ABI change, is that OK? -FUNC:_ZNK10__cxxabiv117__pbase_type_info15__pointer_catchEPKS0_PPvj@@CXXABI_1.3 Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
[Patch ARM-AArch64/testsuite v2 00/21] Neon intrinsics executable tests
This patch series is an updated version of the series I sent here: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg00532.html Compared to v1: - all tests moved from gcc.target/arm to gcc.target/aarch64 - README updated to make it obvious that these tests are execution-only - added README.neon-intrinsics in gcc.target/arm to indicate that these tests are shared with gcc.target/aarch64 - removed scan-asseembler directives from vadd.c test - moved vshl.c in the 1st patch since the README mentions it as an example where corner cases are tested - added ChangeLog entries OK for trunk? Thanks, Christophe. Christophe Lyon (21): Neon intrinsics execution tests initial framework. Add unary operators: vabs and vneg. Add binary operators: vadd, vand, vbic, veor, vorn, vorr, vsub. Add comparison operators: vceq, vcge, vcgt, vcle and vclt. Add comparison operators with floating-point operands: vcage, vcagt, vcale and cvalt. Add unary saturating operators: vqabs and vqneg. Add binary saturating operators: vqadd, vqsub. Add vabal tests. Add vabd tests. Add vabdl tests. Add vaddhn tests. Add vaddl tests. Add vaddw tests. Add vbsl tests. Add vclz tests. Add vdup and vmov tests. Add vld1_dup tests. Add vld2/vld3/vld4 tests. Add vld2_lane, vld3_lane and vld4_lane Add vmul tests. Add vuzp and vzip tests.
[Patch ARM-AArch64/testsuite v2 02/21] Add unary operators: vabs and vneg.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3a0f99b..44c4990 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/unary_op.inc: New file. + * gcc.target/aarch64/neon-intrinsics/vabs.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vneg.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/arm/README.neon-intrinsics: New file. * gcc.target/aarch64/neon-intrinsics/README: Likewise. * gcc.target/aarch64/neon-intrinsics/arm-neon-ref.h: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/unary_op.inc b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/unary_op.inc new file mode 100644 index 000..33f9b5f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/unary_op.inc @@ -0,0 +1,72 @@ +/* Template file for unary operator validation. + + This file is meant to be included by the relevant test files, which + have to define the intrinsic family to test. If a given intrinsic + supports variants which are not supported by all the other unary + operators, these can be tested by providing a definition for + EXTRA_TESTS. */ + +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* Basic test: y=OP(x), then store the result. */ +#define TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) + +#define TEST_UNARY_OP(INSN, Q, T1, T2, W, N) \ + TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \ + + /* No need for 64 bits variants in the general case. */ + DECL_VARIABLE(vector, int, 8, 8); + DECL_VARIABLE(vector, int, 16, 4); + DECL_VARIABLE(vector, int, 32, 2); + DECL_VARIABLE(vector, int, 8, 16); + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + + DECL_VARIABLE(vector_res, int, 8, 8); + DECL_VARIABLE(vector_res, int, 16, 4); + DECL_VARIABLE(vector_res, int, 32, 2); + DECL_VARIABLE(vector_res, int, 8, 16); + DECL_VARIABLE(vector_res, int, 16, 8); + DECL_VARIABLE(vector_res, int, 32, 4); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + VLOAD(vector, buffer, , int, s, 8, 8); + VLOAD(vector, buffer, , int, s, 16, 4); + VLOAD(vector, buffer, , int, s, 32, 2); + VLOAD(vector, buffer, q, int, s, 8, 16); + VLOAD(vector, buffer, q, int, s, 16, 8); + VLOAD(vector, buffer, q, int, s, 32, 4); + + /* Apply a unary operator named INSN_NAME. */ + TEST_UNARY_OP(INSN_NAME, , int, s, 8, 8); + TEST_UNARY_OP(INSN_NAME, , int, s, 16, 4); + TEST_UNARY_OP(INSN_NAME, , int, s, 32, 2); + TEST_UNARY_OP(INSN_NAME, q, int, s, 8, 16); + TEST_UNARY_OP(INSN_NAME, q, int, s, 16, 8); + TEST_UNARY_OP(INSN_NAME, q, int, s, 32, 4); + + CHECK_RESULTS (TEST_MSG, ""); + +#ifdef EXTRA_TESTS + EXTRA_TESTS(); +#endif +} + +int main (void) +{ + FNNAME (INSN_NAME)(); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabs.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabs.c new file mode 100644 index 000..ca3901a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabs.c @@ -0,0 +1,74 @@ +#define INSN_NAME vabs +#define TEST_MSG "VABS/VABSQ" + +/* Extra tests for functions requiring floating-point types. */ +void exec_vabs_f32(void); +#define EXTRA_TESTS exec_vabs_f32 + +#include "unary_op.inc" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x10, 0xf, 0xe, 0xd, + 0xc, 0xb, 0xa, 0x9 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x10, 0xf, 0xe, 0xd }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x10, 0xf }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x10, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, + 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0x10, 0xf, 0xe, 0xd, +
[Patch ARM-AArch64/testsuite v2 03/21] Add binary operators: vadd, vand, vbic, veor, vorn, vorr, vsub.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 44c4990..73709c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,16 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/binary_op.inc: New file. + * gcc.target/aarch64/neon-intrinsics/vadd.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vand.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vbic.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/veor.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vorn.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vorr.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vsub.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/unary_op.inc: New file. * gcc.target/aarch64/neon-intrinsics/vabs.c: Likewise. * gcc.target/aarch64/neon-intrinsics/vneg.c: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/binary_op.inc b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/binary_op.inc new file mode 100644 index 000..3483e0e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/binary_op.inc @@ -0,0 +1,70 @@ +/* Template file for binary operator validation. + + This file is meant to be included by the relevant test files, which + have to define the intrinsic family to test. If a given intrinsic + supports variants which are not supported by all the other binary + operators, these can be tested by providing a definition for + EXTRA_TESTS. */ + +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* Basic test: y=OP(x1,x2), then store the result. */ +#define TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) + +#define TEST_BINARY_OP(INSN, Q, T1, T2, W, N) \ + TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \ + + DECL_VARIABLE_ALL_VARIANTS(vector); + DECL_VARIABLE_ALL_VARIANTS(vector2); + DECL_VARIABLE_ALL_VARIANTS(vector_res); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); + + /* Fill input vector2 with arbitrary values. */ + VDUP(vector2, , int, s, 8, 8, 2); + VDUP(vector2, , int, s, 16, 4, -4); + VDUP(vector2, , int, s, 32, 2, 3); + VDUP(vector2, , int, s, 64, 1, 100); + VDUP(vector2, , uint, u, 8, 8, 20); + VDUP(vector2, , uint, u, 16, 4, 30); + VDUP(vector2, , uint, u, 32, 2, 40); + VDUP(vector2, , uint, u, 64, 1, 2); + VDUP(vector2, q, int, s, 8, 16, -10); + VDUP(vector2, q, int, s, 16, 8, -20); + VDUP(vector2, q, int, s, 32, 4, -30); + VDUP(vector2, q, int, s, 64, 2, 24); + VDUP(vector2, q, uint, u, 8, 16, 12); + VDUP(vector2, q, uint, u, 16, 8, 3); + VDUP(vector2, q, uint, u, 32, 4, 55); + VDUP(vector2, q, uint, u, 64, 2, 3); + + /* Apply a binary operator named INSN_NAME. */ + TEST_MACRO_ALL_VARIANTS_1_5(TEST_BINARY_OP, INSN_NAME); + + CHECK_RESULTS (TEST_MSG, ""); + +#ifdef EXTRA_TESTS + EXTRA_TESTS(); +#endif +} + +int main (void) +{ + FNNAME (INSN_NAME) (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vadd.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vadd.c new file mode 100644 index 000..f08c620 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vadd.c @@ -0,0 +1,81 @@ +#define INSN_NAME vadd +#define TEST_MSG "VADD/VADDQ" + +/* Extra tests for functions requiring floating-point types. */ +void exec_vadd_f32(void); +#define EXTRA_TESTS exec_vadd_f32 + +#include "binary_op.inc" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0xf2, 0xf3, 0xf4, 0xf5, + 0xf6, 0xf7, 0xf8, 0xf9 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0xffec, 0xffed, 0xffee, 0xffef }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0xfff3, 0xfff4 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x54 }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x4, 0x5, 0x6, 0x7, + 0x8, 0x9, 0xa, 0xb }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0xe, 0xf, 0x10, 0x11 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x18, 0x19 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfff2 }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,
[Patch ARM-AArch64/testsuite v2 05/21] Add comparison operators with floating-point operands: vcage, vcagt, vcale and cvalt.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7af7fd0..3c25af1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/cmp_fp_op.inc: New file. + * gcc.target/aarch64/neon-intrinsics/vcage.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vcagt.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vcale.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vcalt.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/cmp_op.inc: New file. * gcc.target/aarch64/neon-intrinsics/vceq.c: Likewise. * gcc.target/aarch64/neon-intrinsics/vcge.c: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/cmp_fp_op.inc b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/cmp_fp_op.inc new file mode 100644 index 000..33451d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/cmp_fp_op.inc @@ -0,0 +1,75 @@ +/* Template file for the validation of comparison operator with + floating-point support. + + This file is meant to be included by the relevant test files, which + have to define the intrinsic family to test. If a given intrinsic + supports variants which are not supported by all the other + operators, these can be tested by providing a definition for + EXTRA_TESTS. */ + +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Additional expected results declaration, they are initialized in + each test file. */ +extern ARRAY(expected2, uint, 32, 2); +extern ARRAY(expected2, uint, 32, 4); + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* Basic test: y=vcomp(x1,x2), then store the result. */ +#define TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) \ + VECT_VAR(vector_res, T3, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_u##W(VECT_VAR(result, T3, W, N), VECT_VAR(vector_res, T3, W, N)) + +#define TEST_VCOMP(INSN, Q, T1, T2, T3, W, N) \ + TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) + + DECL_VARIABLE(vector, float, 32, 2); + DECL_VARIABLE(vector, float, 32, 4); + DECL_VARIABLE(vector2, float, 32, 2); + DECL_VARIABLE(vector2, float, 32, 4); + DECL_VARIABLE(vector_res, uint, 32, 2); + DECL_VARIABLE(vector_res, uint, 32, 4); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + VLOAD(vector, buffer, , float, f, 32, 2); + VLOAD(vector, buffer, q, float, f, 32, 4); + + /* Choose init value arbitrarily, will be used for vector + comparison. */ + VDUP(vector2, , float, f, 32, 2, -16.0f); + VDUP(vector2, q, float, f, 32, 4, -14.0f); + + /* Apply operator named INSN_NAME. */ + TEST_VCOMP(INSN_NAME, , float, f, uint, 32, 2); + CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, ""); + + TEST_VCOMP(INSN_NAME, q, float, f, uint, 32, 4); + CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, ""); + + /* Test again, with different input values. */ + VDUP(vector2, , float, f, 32, 2, -10.0f); + VDUP(vector2, q, float, f, 32, 4, 10.0f); + + TEST_VCOMP(INSN_NAME, , float, f, uint, 32, 2); + CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected2, ""); + + TEST_VCOMP(INSN_NAME, q, float, f, uint, 32, 4); + CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected2,""); +} + +int main (void) +{ + FNNAME (INSN_NAME) (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vcage.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vcage.c new file mode 100644 index 000..219d03f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vcage.c @@ -0,0 +1,52 @@ +#define INSN_NAME vcage +#define TEST_MSG "VCAGE/VCAGEQ" + +#include "cmp_fp_op.inc" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x333, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x333, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x, 0x0 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x
[Patch ARM-AArch64/testsuite v2 10/21] Add vabdl tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e88287b..5509d41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vabdl.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vabd.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabdl.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabdl.c new file mode 100644 index 000..28018ab --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabdl.c @@ -0,0 +1,109 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0x11, 0x10, 0xf, 0xe, + 0xd, 0xc, 0xb, 0xa }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0x3, 0x2, 0x1, 0x0 }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0x18, 0x17 }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0xef, 0xf0, 0xf1, 0xf2, +0xf3, 0xf4, 0xf5, 0xf6 }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0xffe3, 0xffe4, 0xffe5, 0xffe6 }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0xffe8, +0xffe9 }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + +#define TEST_MSG "VABDL" +void exec_vabdl (void) +{ + /* Basic test: v4=vabdl(v1,v2), then store the result. */ +#define TEST_VABDL(T1, T2, W, W2, N) \ + VECT_VAR(vector_res, T1, W2, N) =\ +vabdl_##T2##W(VECT_VAR(vector1, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) + +#define DECL_VABDL_VAR_LONG(VAR) \ + DECL_VARIABLE(VAR, int, 16, 8); \ + DECL_VARIABLE(VAR, int, 32, 4); \ + DECL_VARIABLE(VAR, int, 64, 2); \ + DECL_VARIABLE(VAR, uint, 16, 8); \ + DECL_VARIABLE(VAR, uint, 32, 4); \ + DECL_VARIABLE(VAR, uint, 64, 2) + +#define DECL_VABDL_VAR_SHORT(VAR) \ + DECL_VARIABLE(VAR, int, 8, 8); \ + DECL_VARIABLE(VAR, int, 16, 4); \ + DECL_VARIABLE(VAR, int, 32, 2); \ + DECL_VARIABLE(VAR, uint, 8, 8); \ + DECL_VARIABLE(VAR, uint, 16, 4); \ + DECL_VARIABLE(VAR, uint, 32, 2) + + DECL_VABDL_VAR_SHORT(vector1); + DECL_VABDL_VAR_SHORT(vector2); + DECL_VABDL_VAR_LONG(vector_res); + + clean_results (); + + /* Initialize input "vector1" from "buffer". */ + VLOAD(vector1, buffer, , int, s, 8, 8); + VLOAD(vector1, buffer, , int, s, 16, 4); + VLOAD(vector1, buffer, , int, s, 32, 2); + VLOAD(vector1, buffer, , uint, u, 8, 8); + VLOAD(vector1, buffer, , uint, u, 16, 4); + VLOAD(vector1, buffer, , uint, u, 32, 2); + + /* Choose init value arbitrarily.
[Patch ARM-AArch64/testsuite v2 01/21] Neon intrinsics execution tests initial framework.
* documentation (README) * dejanu driver (neon-intrinsics.exp) * support macros (arm-neon-ref.h, compute-ref-data.h) * Tests for 3 intrinsics: vaba, vld1, vshl diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c2ed273..3a0f99b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2014-06-30 Christophe Lyon + + * gcc.target/arm/README.neon-intrinsics: New file. + * gcc.target/aarch64/neon-intrinsics/README: Likewise. + * gcc.target/aarch64/neon-intrinsics/arm-neon-ref.h: Likewise. + * gcc.target/aarch64/neon-intrinsics/compute-ref-data.h: Likewise. + * gcc.target/aarch64/neon-intrinsics/neon-intrinsics.exp: Likewise. + * gcc.target/aarch64/neon-intrinsics/vaba.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vld1.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vshl.c: Likewise. + 2014-06-30 Igor Zamyatin PR middle-end/57541 diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/README b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/README new file mode 100644 index 000..232bb1d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/README @@ -0,0 +1,132 @@ +This directory contains executable tests for ARM/AArch64 Neon +intrinsics. + +It is meant to cover execution cases of all the Advanced SIMD +intrinsics, but does not scan the generated assembler code. + +The general framework is composed as follows: +- neon-intrinsics.exp: main dejagnu driver +- *.c: actual tests, generally one per intrinsinc family +- arm-neon-ref.h: contains macro definitions to save typing in actual + test files +- compute-ref-data.h: contains input vectors definitions +- *.inc: generic tests, shared by several families of intrinsics. For + instance, unary or binary operators + +A typical .c test file starts with the following contents (look at +vld1.c and vaba.c for sample cases): +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +Then, definitions of expected results, based on common input values, +as defined in compute-ref-data.h. +For example: +VECT_VAR_DECL(expected,int,16,4) [] = { 0x16, 0x17, 0x18, 0x19 }; +defines the expected results of an operator generating int16x4 values. + +The common input values defined in compute-ref-data.h have been chosen +to avoid corner-case values for most operators, yet exposing negative +values for signed operators. For this reason, their range is also +limited. For instance, the initialization of buffer_int16x4 will be +{ -16, -15, -14, -13 }. + +The initialization of floating-point values is done via hex notation, +to avoid potential rounding problems. + +To test special values and corner cases, specific initialization +values should be used in dedicated tests, to ensure proper coverage. +An example of this is vshl. + +When a variant of an intrinsic is not available, its expected result +should be defined to the value of CLEAN_PATTERN_8 as defined in +arm-neon-ref.h. For example: +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +if the given intrinsic has no variant producing an int64x1 result, +like the vcmp family (eg. vclt). + +This is because the helper function (check_results(), defined in +arm-neon-ref.h), iterates over all the possible variants, to save +typing in each individual test file. Alternatively, one can directly +call the CHECK/CHECK_FP macros to check only a few expected results +(see vabs.c for an example). + +Then, define the TEST_MSG string, which will be used when reporting errors. + +Next, define the function performing the actual tests, in general +relying on the helpers provided by arm-neon-ref.h, which means: + +* declare necessary vectors of suitable types: using + DECL_VARIABLE_ALL_VARIANTS when all variants are supported, or the + relevant of subset calls to DECL_VARIABLE. + +* call clean_results() to initialize the 'results' buffers. + +* initialize the input vectors, using VLOAD, VDUP or VSET_LANE (vld* + tests do not need this step, since their actual purpose is to + initialize vectors). + +* execute the intrinsic on relevant variants, for instance using + TEST_MACRO_ALL_VARIANTS_2_5. + +* call check_results() to check that the results match the expected + values. + +A template test file could be: += +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0xf6, 0xf7, 0xf8, 0xf9, + 0xfa, 0xfb, 0xfc, 0xfd }; +/* and as many others as necessary. */ + +#define TEST_MSG "VMYINTRINSIC" +void exec_myintrinsic (void) +{ + /* my test: v4=vmyintrinsic(v1,v2,v3), then store the result. */ +#define TEST_VMYINTR(Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ +vmyintr##Q##_##T2##W(VECT_VAR(vector1, T1, W, N),
[Patch ARM-AArch64/testsuite v2 11/21] Add vaddhn tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5509d41..e72500c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vaddhn.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vabdl.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddhn.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddhn.c new file mode 100644 index 000..74b4b4d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddhn.c @@ -0,0 +1,109 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +#if defined(__cplusplus) +#include +#else +#include +#endif + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x32, 0x32, 0x32, 0x32, + 0x32, 0x32, 0x32, 0x32 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x32, 0x32, 0x32, 0x32 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x18, 0x18 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x3, 0x3, 0x3, 0x3, + 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x37, 0x37, 0x37, 0x37 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0x, 0x, + 0x, 0x }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0x, 0x, +0x, 0x }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0x, +0x }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + +#ifndef INSN_NAME +#define INSN_NAME vaddhn +#define TEST_MSG "VADDHN" +#endif + +#define FNNAME1(NAME) void exec_ ## NAME (void) +#define FNNAME(NAME) FNNAME1(NAME) + +FNNAME (INSN_NAME) +{ + /* Basic test: vec64=vaddhn(vec128_a, vec128_b), then store the result. */ +#define TEST_VADDHN1(INSN, T1, T2, W, W2, N) \ + VECT_VAR(vector64, T1, W2, N) = INSN##_##T2##W(VECT_VAR(vector1, T1, W, N), \ +VECT_VAR(vector2, T1, W, N)); \ + vst1_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector64, T1, W2, N)) + +#define TEST_VADDHN(INSN, T1, T2, W, W2, N)\ + TEST_VADDHN1(INSN, T1, T2, W, W2, N) + + DECL_VARIABLE_64BITS_VARIANTS(vector64); + DECL_VARIABLE_128BITS_VARIANTS(vector1); + DECL_VARIABLE_128BITS_VARIANTS(vector2); + + clean_results (); + + /* Fill input vector1 and vector2 with arbitrary values */ + VDUP(vector1, q, int, s, 16, 8, 50*(UINT8_MAX+1)); + VDUP(vector1, q, int, s, 32, 4, 50*(UINT16_MAX+1)); + VDUP(vector1, q, int, s, 64, 2, 24*((uint64_t)UINT32_MAX+1)); + VDUP(vector1, q, uint, u, 16, 8, 3*(UINT8_MAX+1)); + VDUP(vector1, q, uint, u, 32, 4, 55*(UINT16_MAX+1)); + VDUP(vector1, q, uint, u, 64, 2, 3*((uint64_t)UINT32_MAX+1)); + + VDUP(vector2, q, int, s, 16, 8, (uint16_t)UINT8_MAX); + VDUP(vector2, q, int, s, 32, 4, (uint32_t)UINT16_MAX); + VDUP(vector2, q,
[Patch ARM-AArch64/testsuite v2 04/21] Add comparison operators: vceq, vcge, vcgt, vcle and vclt.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 73709c6..7af7fd0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/cmp_op.inc: New file. + * gcc.target/aarch64/neon-intrinsics/vceq.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vcge.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vcgt.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vcle.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vclt.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/binary_op.inc: New file. * gcc.target/aarch64/neon-intrinsics/vadd.c: Likewise. * gcc.target/aarch64/neon-intrinsics/vand.c: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/cmp_op.inc b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/cmp_op.inc new file mode 100644 index 000..a09c5f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/cmp_op.inc @@ -0,0 +1,224 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" +#include + +/* Additional expected results declaration, they are initialized in + each test file. */ +extern ARRAY(expected_uint, uint, 8, 8); +extern ARRAY(expected_uint, uint, 16, 4); +extern ARRAY(expected_uint, uint, 32, 2); +extern ARRAY(expected_q_uint, uint, 8, 16); +extern ARRAY(expected_q_uint, uint, 16, 8); +extern ARRAY(expected_q_uint, uint, 32, 4); +extern ARRAY(expected_float, uint, 32, 2); +extern ARRAY(expected_q_float, uint, 32, 4); +extern ARRAY(expected_uint2, uint, 32, 2); +extern ARRAY(expected_uint3, uint, 32, 2); +extern ARRAY(expected_uint4, uint, 32, 2); +extern ARRAY(expected_nan, uint, 32, 2); +extern ARRAY(expected_mnan, uint, 32, 2); +extern ARRAY(expected_nan2, uint, 32, 2); +extern ARRAY(expected_inf, uint, 32, 2); +extern ARRAY(expected_minf, uint, 32, 2); +extern ARRAY(expected_inf2, uint, 32, 2); +extern ARRAY(expected_mzero, uint, 32, 2); +extern ARRAY(expected_p8, uint, 8, 8); +extern ARRAY(expected_q_p8, uint, 8, 16); + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* Basic test: y=vcomp(x1,x2), then store the result. */ +#define TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) \ + VECT_VAR(vector_res, T3, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_u##W(VECT_VAR(result, T3, W, N), VECT_VAR(vector_res, T3, W, N)) + +#define TEST_VCOMP(INSN, Q, T1, T2, T3, W, N) \ + TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) + + /* No need for 64 bits elements. */ + DECL_VARIABLE(vector, int, 8, 8); + DECL_VARIABLE(vector, int, 16, 4); + DECL_VARIABLE(vector, int, 32, 2); + DECL_VARIABLE(vector, uint, 8, 8); + DECL_VARIABLE(vector, uint, 16, 4); + DECL_VARIABLE(vector, uint, 32, 2); + DECL_VARIABLE(vector, float, 32, 2); + DECL_VARIABLE(vector, int, 8, 16); + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + DECL_VARIABLE(vector, uint, 8, 16); + DECL_VARIABLE(vector, uint, 16, 8); + DECL_VARIABLE(vector, uint, 32, 4); + DECL_VARIABLE(vector, float, 32, 4); + + DECL_VARIABLE(vector2, int, 8, 8); + DECL_VARIABLE(vector2, int, 16, 4); + DECL_VARIABLE(vector2, int, 32, 2); + DECL_VARIABLE(vector2, uint, 8, 8); + DECL_VARIABLE(vector2, uint, 16, 4); + DECL_VARIABLE(vector2, uint, 32, 2); + DECL_VARIABLE(vector2, float, 32, 2); + DECL_VARIABLE(vector2, int, 8, 16); + DECL_VARIABLE(vector2, int, 16, 8); + DECL_VARIABLE(vector2, int, 32, 4); + DECL_VARIABLE(vector2, uint, 8, 16); + DECL_VARIABLE(vector2, uint, 16, 8); + DECL_VARIABLE(vector2, uint, 32, 4); + DECL_VARIABLE(vector2, float, 32, 4); + + DECL_VARIABLE(vector_res, uint, 8, 8); + DECL_VARIABLE(vector_res, uint, 16, 4); + DECL_VARIABLE(vector_res, uint, 32, 2); + DECL_VARIABLE(vector_res, uint, 8, 16); + DECL_VARIABLE(vector_res, uint, 16, 8); + DECL_VARIABLE(vector_res, uint, 32, 4); + + clean_results (); + + /* There is no 64 bits variant, don't use the generic initializer. */ + VLOAD(vector, buffer, , int, s, 8, 8); + VLOAD(vector, buffer, , int, s, 16, 4); + VLOAD(vector, buffer, , int, s, 32, 2); + VLOAD(vector, buffer, , uint, u, 8, 8); + VLOAD(vector, buffer, , uint, u, 16, 4); + VLOAD(vector, buffer, , uint, u, 32, 2); + VLOAD(vector, buffer, , float, f, 32, 2); + + VLOAD(vector, buffer, q, int, s, 8, 16); + VLOAD(vector, buffer, q, int, s, 16, 8); + VLOAD(vector, buffer, q, int, s, 32, 4); + VLOAD(vector, buffer, q, uint, u, 8, 16); + VLOAD(vector, buffer, q, uint, u, 16, 8); + VLOAD(vector, buffer, q, uint, u, 32, 4); + VLOAD(vector, buffer, q, float, f, 32, 4); + + /* Choose init value arbitrarily, will be used for vector + comparison.
[Patch ARM-AArch64/testsuite v2 08/21] Add vabal tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96cb431..b749a63 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vabal.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/binary_sat_op.inc: New file. * gcc.target/aarch64/neon-intrinsics/vqadd.c: Likewise. * gcc.target/aarch64/neon-intrinsics/vqsub.c: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabal.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabal.c new file mode 100644 index 000..cd31062 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabal.c @@ -0,0 +1,161 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff6, 0xfff7, 0xfff8, 0xfff9, + 0xfffa, 0xfffb, 0xfffc, 0xfffd }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0x16, 0x17, 0x18, 0x19 }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0x20, 0x21 }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0x53, 0x54, 0x55, 0x56, +0x57, 0x58, 0x59, 0x5a }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0x907, 0x908, 0x909, 0x90a }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0xffe7, +0xffe8 }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + +/* Expected results for cases with input values chosen to test + possible intermediate overflow. */ +VECT_VAR_DECL(expected2,int,16,8) [] = { 0xef, 0xf0, 0xf1, 0xf2, +0xf3, 0xf4, 0xf5, 0xf6 }; +VECT_VAR_DECL(expected2,int,32,4) [] = { 0xffef, 0xfff0, 0xfff1, 0xfff2 }; +VECT_VAR_DECL(expected2,int,64,2) [] = { 0xffef, 0xfff0 }; +VECT_VAR_DECL(expected2,uint,16,8) [] = { 0xee, 0xef, 0xf0, 0xf1, + 0xf2, 0xf3, 0xf4, 0xf5 }; +VECT_VAR_DECL(expected2,uint,32,4) [] = { 0xffe2, 0xffe3, 0xffe4, 0xffe5 }; +VECT_VAR_DECL(expected2,uint,64,2) [] = { 0xffe7, 0xffe8 }; + +#define TEST_MSG "VABAL" +void exec_vabal (void) +{ + /* Basic test: v4=vabal(v1,v2,v3), then store the result. */ +#define TEST_VABAL(T1, T2, W, W2, N) \ + VECT_VAR(vector_res, T1, W2, N) =\ +vabal_##T2##W(VECT_VAR(vector1, T1, W2, N), \ + VECT_VAR(vector2, T1, W, N), \ + VECT_VAR(vector3, T1, W, N)); \ + vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) + +#define DECL_VABAL_VAR_LONG(VAR) \ + DECL_VARIABLE(VAR, int, 16, 8); \ + DECL_VARIABLE(VAR, int, 32, 4); \ + DECL_VARIABLE(VAR, int, 64, 2); \ + DECL_VARIABLE(VAR, uint, 16, 8); \ + DECL_VARIABLE(VAR, uint, 32
[Patch ARM-AArch64/testsuite v2 12/21] Add vaddl tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e72500c..2888b74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vaddl.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vaddhn.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddl.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddl.c new file mode 100644 index 000..861abec --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddl.c @@ -0,0 +1,122 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x3, 0x3, 0x3, 0x3, + 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x37, 0x37, 0x37, 0x37 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0xffe3, 0xffe4, 0xffe5, 0xffe6, +0xffe7, 0xffe8, 0xffe9, 0xffea }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0xffe2, 0xffe3, + 0xffe4, 0xffe5 }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0xffe0, + 0xffe1 }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0x1e3, 0x1e4, 0x1e5, 0x1e6, +0x1e7, 0x1e8, 0x1e9, 0x1ea }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0x1ffe1, 0x1ffe2, +0x1ffe3, 0x1ffe4 }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0x1ffe0, 0x1ffe1 }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + +#ifndef INSN_NAME +#define INSN_NAME vaddl +#define TEST_MSG "VADDL" +#endif + +#define FNNAME1(NAME) void exec_ ## NAME (void) +#define FNNAME(NAME) FNNAME1(NAME) + +FNNAME (INSN_NAME) +{ + /* Basic test: y=vaddl(x1,x2), then store the result. */ +#define TEST_VADDL1(INSN, T1, T2, W, W2, N)\ + VECT_VAR(vector_res, T1, W2, N) =\ +INSN##_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N));\ + vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) + +#define TEST_VADDL(INSN, T1, T2, W, W2, N) \ + TEST_VADDL1(INSN, T1, T2, W, W2, N) + + DECL_VARIABLE(vector, int, 8, 8); + DECL_VARIABLE(vector, int, 16, 4); + DECL_VARIABLE(vector, int, 32, 2); + DECL_VARIABLE(vector, uint, 8, 8); + DECL_VARIABLE(vector, uint, 16, 4); + DECL_VARIABLE(vector, uint, 32, 2); + + DECL_VARIABLE(vector2, int, 8, 8); + DECL_VARIABLE(vector2, int, 16, 4); + DECL_VARIABLE(vector2, int, 32, 2); + DECL_VARIABLE(vector2, uint, 8, 8); + DECL_VARIABLE(vector2, uint, 16, 4); + DECL_VARIABLE(vector2, uint, 32, 2); + + DECL_VARIABLE(vector_res, int, 16, 8); + DECL_VARIABLE(vector_res, int, 32, 4); + DECL_VARIABLE(vector_res, int, 64, 2); + DECL_VARIABLE(vector_res, uint, 16, 8); + DECL_VARIABLE(vector_res, uint, 32, 4); + DECL_VARIABLE(vector_res, uint, 64, 2); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + VLO
[Patch ARM-AArch64/testsuite v2 09/21] Add vabd tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b749a63..e88287b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vabd.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vabal.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabd.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabd.c new file mode 100644 index 000..e95404f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vabd.c @@ -0,0 +1,153 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" +#include + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x11, 0x10, 0xf, 0xe, + 0xd, 0xc, 0xb, 0xa }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x3, 0x2, 0x1, 0x0 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x18, 0x17 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0xef, 0xf0, 0xf1, 0xf2, + 0xf3, 0xf4, 0xf5, 0xf6 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0xffe3, 0xffe4, 0xffe5, 0xffe6 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0xffe8, 0xffe9 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x41c2, 0x41ba }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x1a, 0x19, 0x18, 0x17, + 0x16, 0x15, 0x14, 0x13, + 0x12, 0x11, 0x10, 0xf, + 0xe, 0xd, 0xc, 0xb }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0x4, 0x3, 0x2, 0x1, + 0x0, 0x1, 0x2, 0x3 }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0x30, 0x2f, 0x2e, 0x2d }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0xe6, 0xe7, 0xe8, 0xe9, +0xea, 0xeb, 0xec, 0xed, +0xee, 0xef, 0xf0, 0xf1, +0xf2, 0xf3, 0xf4, 0xf5 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0xffe4, 0xffe5, 0xffe6, 0xffe7, +0xffe8, 0xffe9, 0xffea, 0xffeb }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0xffd0, 0xffd1, +0xffd2, 0xffd3 }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0x, +0x }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x42407ae1, 0x423c7ae1, + 0x42387ae1, 0x42347ae1 }; + +/* Additional expected results for float32 variants with specially + chosen input values. */ +VECT_VAR_DECL(expected_float32,hfloat,32,4) [] = { 0x0, 0x0, 0x0, 0x0 }; + +#define TEST_MSG "VABD/VABDQ" +void exec_vabd (void) +{ + /* Basic test: v4=vabd(v1,v2), then store the result. */ +#define TEST_VABD(Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ +vabd##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) + +#define DECL_VABD_VAR(VAR) \ + DECL_VARIABLE(VAR, int, 8, 8); \ + DECL_VARIABLE(VAR, int, 16, 4); \ + DECL_VARIABLE(VAR, int, 32, 2); \ + DECL_VARIABLE(VAR, uint, 8, 8); \ + DECL_VARIABLE(VAR, uint, 16, 4); \ + DECL_VARIABLE(VAR, uint, 32, 2); \ + DECL_VARIABLE(VAR, float, 32, 2);\ + DECL_VARIABLE(VAR, int, 8, 16); \ + DECL_VARIABLE(VAR, int, 16, 8); \ + DECL_VARIABLE(VAR, int, 32, 4); \ + DECL_VARIABLE(VAR, uint, 8, 16); \ + DECL_VARIABLE(VAR, uint, 16, 8); \ + DECL_VARIABLE(VAR, uint, 32, 4); \ + DECL_VARIABLE(VAR, float, 32, 4) + + DECL_VABD_VAR(vector1); + DECL_VABD_VAR(vector2); + DECL_VABD_VAR(vector_res); + + clean_results (); + +
[Patch ARM-AArch64/testsuite v2 13/21] Add vaddw tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2888b74..de7405d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vaddw.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vaddl.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddw.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddw.c new file mode 100644 index 000..5804cd7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vaddw.c @@ -0,0 +1,122 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x3, 0x3, 0x3, 0x3, + 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x37, 0x37, 0x37, 0x37 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0xffe3, 0xffe4, 0xffe5, 0xffe6, +0xffe7, 0xffe8, 0xffe9, 0xffea }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0xffe2, 0xffe3, + 0xffe4, 0xffe5 }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0xffe0, + 0xffe1 }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0xe3, 0xe4, 0xe5, 0xe6, +0xe7, 0xe8, 0xe9, 0xea }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0xffe1, 0xffe2, +0xffe3, 0xffe4 }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0xffe0, 0xffe1 }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + +#ifndef INSN_NAME +#define INSN_NAME vaddw +#define TEST_MSG "VADDW" +#endif + +#define FNNAME1(NAME) void exec_ ## NAME (void) +#define FNNAME(NAME) FNNAME1(NAME) + +FNNAME (INSN_NAME) +{ + /* Basic test: y=vaddw(x1,x2), then store the result. */ +#define TEST_VADDW1(INSN, T1, T2, W, W2, N)\ + VECT_VAR(vector_res, T1, W2, N) =\ +INSN##_##T2##W(VECT_VAR(vector, T1, W2, N), \ + VECT_VAR(vector2, T1, W, N));\ + vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) + +#define TEST_VADDW(INSN, T1, T2, W, W2, N) \ + TEST_VADDW1(INSN, T1, T2, W, W2, N) + + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + DECL_VARIABLE(vector, int, 64, 2); + DECL_VARIABLE(vector, uint, 16, 8); + DECL_VARIABLE(vector, uint, 32, 4); + DECL_VARIABLE(vector, uint, 64, 2); + + DECL_VARIABLE(vector2, int, 8, 8); + DECL_VARIABLE(vector2, int, 16, 4); + DECL_VARIABLE(vector2, int, 32, 2); + DECL_VARIABLE(vector2, uint, 8, 8); + DECL_VARIABLE(vector2, uint, 16, 4); + DECL_VARIABLE(vector2, uint, 32, 2); + + DECL_VARIABLE(vector_res, int, 16, 8); + DECL_VARIABLE(vector_res, int, 32, 4); + DECL_VARIABLE(vector_res, int, 64, 2); + DECL_VARIABLE(vector_res, uint, 16, 8); + DECL_VARIABLE(vector_res, uint, 32, 4); + DECL_VARIABLE(vector_res, uint, 64, 2); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + VLOAD(v
[Patch ARM-AArch64/testsuite v2 14/21] Add vbsl tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de7405d..cb539b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vbsl.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vaddw.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vbsl.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vbsl.c new file mode 100644 index 000..bb17f0a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vbsl.c @@ -0,0 +1,124 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0xf2, 0xf2, 0xf2, 0xf2, + 0xf6, 0xf6, 0xf6, 0xf6 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffd }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf3, 0xf3, 0xf3, 0xf3, + 0xf7, 0xf7, 0xf7, 0xf7 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf3, 0xf3, 0xf3, 0xf3, + 0xf7, 0xf7, 0xf7, 0xf7 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc184, 0xc174 }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0xf2, 0xf2, 0xf2, 0xf2, + 0xf6, 0xf6, 0xf6, 0xf6, + 0xf2, 0xf2, 0xf2, 0xf2, + 0xf6, 0xf6, 0xf6, 0xf6 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2, + 0xfff4, 0xfff4, 0xfff6, 0xfff6 }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0xfff0, 0xfff0, + 0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0xfffd, + 0xfffd }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0xf3, 0xf3, 0xf3, 0xf3, +0xf7, 0xf7, 0xf7, 0xf7, +0xf3, 0xf3, 0xf3, 0xf3, +0xf7, 0xf7, 0xf7, 0xf7 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2, +0xfff4, 0xfff4, 0xfff6, 0xfff6 }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0xfff0, 0xfff0, +0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfff1, +0xfff1 }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0xf3, 0xf3, 0xf3, 0xf3, +0xf7, 0xf7, 0xf7, 0xf7, +0xf3, 0xf3, 0xf3, 0xf3, +0xf7, 0xf7, 0xf7, 0xf7 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2, +0xfff4, 0xfff4, 0xfff6, 0xfff6 }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc181, 0xc171, + 0xc161, 0xc151 }; + +#define TEST_MSG "VBSL/VBSLQ" +void exec_vbsl (void) +{ + /* Basic test: y=vbsl(unsigned_vec,x1,x2), then store the result. */ +#define TEST_VBSL(T3, Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ +vbsl##Q##_##T2##W(VECT_VAR(vector_first, T3, W, N), \ + VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) + + DECL_VARIABLE_ALL_VARIANTS(vector); + DECL_VARIABLE_ALL_VARIANTS(vector2); + DECL_VARIABLE_ALL_VARIANTS(vector_res); + + DECL_VARIABLE_UNSIGNED_VARIANTS(vector_first); + + clean_results (); + + TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); + VLOAD(vector, buffer, , float, f, 32, 2); + VLOAD(vector, buffer, q, float, f, 32, 4); + + /* Choose init value arbitrarily, will be used for vector + comparison. As we want different values for each type variant, we + can't use generic initialization macros. */ + VDUP(vector2, , int, s, 8, 8, -10); + VDUP(vector2, , int, s, 16, 4, -14); + VDUP(vector2, , int, s, 32, 2, -30); + VDUP(vector2, , int, s, 64, 1, -33); + VDUP(vector2, , uint, u, 8, 8, 0xF3); + VDUP(vector2, , uint, u, 16, 4, 0xFFF2); + VDUP(vector2, , uint, u, 32, 2, 0xFFF0); + VDUP(vector2,
[Patch ARM-AArch64/testsuite v2 06/21] Add unary saturating operators: vqabs and vqneg.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c25af1..1c317a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/unary_sat_op.inc: New file. + * gcc.target/aarch64/neon-intrinsics/vqabs.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vqneg.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/cmp_fp_op.inc: New file. * gcc.target/aarch64/neon-intrinsics/vcage.c: Likewise. * gcc.target/aarch64/neon-intrinsics/vcagt.c: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/unary_sat_op.inc b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/unary_sat_op.inc new file mode 100644 index 000..3f6d984 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/unary_sat_op.inc @@ -0,0 +1,80 @@ +/* Template file for saturating unary operator validation. + + This file is meant to be included by the relevant test files, which + have to define the intrinsic family to test. If a given intrinsic + supports variants which are not supported by all the other + saturating unary operators, these can be tested by providing a + definition for EXTRA_TESTS. */ + +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* y=OP(x), then store the result. */ +#define TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + Set_Neon_Cumulative_Sat(0); \ + VECT_VAR(vector_res, T1, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ +vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ + VECT_VAR(vector_res, T1, W, N)); \ + CHECK_CUMULATIVE_SAT(TEST_MSG, T1, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + +#define TEST_UNARY_SAT_OP(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + + /* No need for 64 bits variants. */ + DECL_VARIABLE(vector, int, 8, 8); + DECL_VARIABLE(vector, int, 16, 4); + DECL_VARIABLE(vector, int, 32, 2); + DECL_VARIABLE(vector, int, 8, 16); + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + + DECL_VARIABLE(vector_res, int, 8, 8); + DECL_VARIABLE(vector_res, int, 16, 4); + DECL_VARIABLE(vector_res, int, 32, 2); + DECL_VARIABLE(vector_res, int, 8, 16); + DECL_VARIABLE(vector_res, int, 16, 8); + DECL_VARIABLE(vector_res, int, 32, 4); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + VLOAD(vector, buffer, , int, s, 8, 8); + VLOAD(vector, buffer, , int, s, 16, 4); + VLOAD(vector, buffer, , int, s, 32, 2); + VLOAD(vector, buffer, q, int, s, 8, 16); + VLOAD(vector, buffer, q, int, s, 16, 8); + VLOAD(vector, buffer, q, int, s, 32, 4); + + /* Apply a saturating unary operator named INSN_NAME. */ + TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 8, 8, expected_cumulative_sat, ""); + TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 16, 4, expected_cumulative_sat, ""); + TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 32, 2, expected_cumulative_sat, ""); + TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 8, 16, expected_cumulative_sat, ""); + TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 16, 8, expected_cumulative_sat, ""); + TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 32, 4, expected_cumulative_sat, ""); + + CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, ""); + CHECK(TEST_MSG, int, 16, 4, PRIx8, expected, ""); + CHECK(TEST_MSG, int, 32, 2, PRIx8, expected, ""); + CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, ""); + CHECK(TEST_MSG, int, 16, 8, PRIx8, expected, ""); + CHECK(TEST_MSG, int, 32, 4, PRIx8, expected, ""); + +#ifdef EXTRA_TESTS + EXTRA_TESTS(); +#endif +} + +int main (void) +{ + FNNAME (INSN_NAME) (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vqabs.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vqabs.c new file mode 100644 index 000..f2be790 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vqabs.c @@ -0,0 +1,127 @@ +#define INSN_NAME vqabs +#define TEST_MSG "VQABS/VQABSQ" + +/* Extra tests for functions requiring corner cases tests. */ +void vqabs_extra(void); +#define EXTRA_TESTS vqabs_extra + +#include "unary_sat_op.inc" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x10, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x10, 0xf, 0xe, 0xd }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x10, 0xf }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,uint,16,4) [] =
[Patch ARM-AArch64/testsuite v2 07/21] Add binary saturating operators: vqadd, vqsub.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c317a7..96cb431 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/binary_sat_op.inc: New file. + * gcc.target/aarch64/neon-intrinsics/vqadd.c: Likewise. + * gcc.target/aarch64/neon-intrinsics/vqsub.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/unary_sat_op.inc: New file. * gcc.target/aarch64/neon-intrinsics/vqabs.c: Likewise. * gcc.target/aarch64/neon-intrinsics/vqneg.c: Likewise. diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/binary_sat_op.inc b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/binary_sat_op.inc new file mode 100644 index 000..35d7701 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/binary_sat_op.inc @@ -0,0 +1,91 @@ +/* Template file for saturating binary operator validation. + + This file is meant to be included by the relevant test files, which + have to define the intrinsic family to test. If a given intrinsic + supports variants which are not supported by all the other + saturating binary operators, these can be tested by providing a + definition for EXTRA_TESTS. */ + +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* vector_res = OP(vector1,vector2), then store the result. */ + +#define TEST_BINARY_SAT_OP1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + Set_Neon_Cumulative_Sat(0); \ + VECT_VAR(vector_res, T1, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ +vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ + VECT_VAR(vector_res, T1, W, N)); \ + CHECK_CUMULATIVE_SAT(TEST_MSG, T1, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + +#define TEST_BINARY_SAT_OP(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_BINARY_SAT_OP1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + + DECL_VARIABLE_ALL_VARIANTS(vector1); + DECL_VARIABLE_ALL_VARIANTS(vector2); + DECL_VARIABLE_ALL_VARIANTS(vector_res); + + clean_results (); + + /* Initialize input "vector1" from "buffer". */ + TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector1, buffer); + + /* Choose arbitrary initialization values. */ + VDUP(vector2, , int, s, 8, 8, 0x11); + VDUP(vector2, , int, s, 16, 4, 0x22); + VDUP(vector2, , int, s, 32, 2, 0x33); + VDUP(vector2, , int, s, 64, 1, 0x44); + VDUP(vector2, , uint, u, 8, 8, 0x55); + VDUP(vector2, , uint, u, 16, 4, 0x66); + VDUP(vector2, , uint, u, 32, 2, 0x77); + VDUP(vector2, , uint, u, 64, 1, 0x88); + + VDUP(vector2, q, int, s, 8, 16, 0x11); + VDUP(vector2, q, int, s, 16, 8, 0x22); + VDUP(vector2, q, int, s, 32, 4, 0x33); + VDUP(vector2, q, int, s, 64, 2, 0x44); + VDUP(vector2, q, uint, u, 8, 16, 0x55); + VDUP(vector2, q, uint, u, 16, 8, 0x66); + VDUP(vector2, q, uint, u, 32, 4, 0x77); + VDUP(vector2, q, uint, u, 64, 2, 0x88); + + /* Apply a saturating binary operator named INSN_NAME. */ + TEST_BINARY_SAT_OP(INSN_NAME, , int, s, 8, 8, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , int, s, 16, 4, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , int, s, 32, 2, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , int, s, 64, 1, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , uint, u, 8, 8, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , uint, u, 16, 4, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , uint, u, 32, 2, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, , uint, u, 64, 1, expected_cumulative_sat, ""); + + TEST_BINARY_SAT_OP(INSN_NAME, q, int, s, 8, 16, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, int, s, 16, 8, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, int, s, 32, 4, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, int, s, 64, 2, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, uint, u, 8, 16, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, uint, u, 16, 8, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, uint, u, 32, 4, expected_cumulative_sat, ""); + TEST_BINARY_SAT_OP(INSN_NAME, q, uint, u, 64, 2, expected_cumulative_sat, ""); + + CHECK_RESULTS (TEST_MSG, ""); + +#ifdef EXTRA_TESTS + EXTRA_TESTS(); +#endif +} + +int main (void) +{ + FNNAME (INSN_NAME) (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vqadd.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vqadd.c new file mode 100644 index 000..c0
[Patch ARM-AArch64/testsuite v2 15/21] Add vclz tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb539b4..dbffbcb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vclz.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vbsl.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vclz.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vclz.c new file mode 100644 index 000..ad28d2d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vclz.c @@ -0,0 +1,194 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x11, 0x11 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x0, 0x0, 0x0, 0x0 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x5, 0x5 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, + 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, +0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0xd, 0xd, 0xd, 0xd, +0xd, 0xd, 0xd, 0xd }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0x1f, 0x1f, 0x1f, 0x1f }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0x, +0x }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33, +0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + + +/* Expected results with input=0. */ +VECT_VAR_DECL(expected_with_0,int,8,8) [] = { 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8 }; +VECT_VAR_DECL(expected_with_0,int,16,4) [] = { 0x10, 0x10, 0x10, 0x10 }; +VECT_VAR_DECL(expected_with_0,int,32,2) [] = { 0x20, 0x20 }; +VECT_VAR_DECL(expected_with_0,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected_with_0,uint,8,8) [] = { 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8 }; +VECT_VAR_DECL(expected_with_0,uint,16,4) [] = { 0x10, 0x10, 0x10, 0x10 }; +VECT_VAR_DECL(expected_with_0,uint,32,2) [] = { 0x20, 0x20 }; +VECT_VAR_DECL(expected_with_0,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected_with_0,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected_with_0,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected_with_0,hfloat,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected_with_0,int,8,16) [] = { 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8 }; +VECT_VAR_DECL(expected_with_0,int,16,8) [] = { 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10 }; +VECT_VAR_DECL(expected_with_0,int,32,4) [] = { 0x20, 0x20, 0x20, 0x20 }; +VECT_VAR_DECL(expected_with_0,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected_with_0,uint,8,16) [] = { 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8, + 0x8, 0x8, 0x8, 0x8 }; +VECT_VAR_DECL(expected_wi
[Patch ARM-AArch64/testsuite v2 17/21] Add vld1_dup tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f26e93f..5dd2ae0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vld1_dup.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vdup-vmov.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vld1_dup.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vld1_dup.c new file mode 100644 index 000..6aa16cf --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vld1_dup.c @@ -0,0 +1,189 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +/* Chunk 0. */ +VECT_VAR_DECL(expected0,int,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,int,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,32,2) [] = { 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,64,1) [] = { 0xfff0 }; +VECT_VAR_DECL(expected0,uint,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,uint,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,32,2) [] = { 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,64,1) [] = { 0xfff0 }; +VECT_VAR_DECL(expected0,poly,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,poly,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,hfloat,32,2) [] = { 0xc180, 0xc180 }; +VECT_VAR_DECL(expected0,int,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,int,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, +0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,32,4) [] = { 0xfff0, 0xfff0, +0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,64,2) [] = { 0xfff0, +0xfff0 }; +VECT_VAR_DECL(expected0,uint,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,uint,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,32,4) [] = { 0xfff0, 0xfff0, + 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,64,2) [] = { 0xfff0, + 0xfff0 }; +VECT_VAR_DECL(expected0,poly,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,poly,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,hfloat,32,4) [] = { 0xc180, 0xc180, + 0xc180, 0xc180 }; + +/* Chunk 1. */ +VECT_VAR_DECL(expected1,int,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, + 0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,int,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,int,32,2) [] = { 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,int,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected1,uint,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,uint,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,uint,32,2) [] = { 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,uint,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected1,poly,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,poly,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,hfloat,32,2) [] = { 0xc170, 0xc170 }; +VECT_VAR_DECL(expected1,int,8,16) [] = { 0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,int,16,8) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1, +
[Patch ARM-AArch64/testsuite v2 16/21] Add vdup and vmov tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dbffbcb..f26e93f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vdup-vmov.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vclz.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vdup-vmov.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vdup-vmov.c new file mode 100644 index 000..b5132f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vdup-vmov.c @@ -0,0 +1,253 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* We test vdup and vmov in the same place since they are aliases. */ + +/* Expected results. */ +/* Chunk 0. */ +VECT_VAR_DECL(expected0,int,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,int,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,32,2) [] = { 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,64,1) [] = { 0xfff0 }; +VECT_VAR_DECL(expected0,uint,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,uint,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,32,2) [] = { 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,64,1) [] = { 0xfff0 }; +VECT_VAR_DECL(expected0,poly,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,poly,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,hfloat,32,2) [] = { 0xc180, 0xc180 }; +VECT_VAR_DECL(expected0,int,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0, +0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,int,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, +0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,32,4) [] = { 0xfff0, 0xfff0, +0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,int,64,2) [] = { 0xfff0, +0xfff0 }; +VECT_VAR_DECL(expected0,uint,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,uint,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,32,4) [] = { 0xfff0, 0xfff0, + 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,uint,64,2) [] = { 0xfff0, + 0xfff0 }; +VECT_VAR_DECL(expected0,poly,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0 }; +VECT_VAR_DECL(expected0,poly,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,hfloat,32,4) [] = { 0xc180, 0xc180, + 0xc180, 0xc180 }; + +/* Chunk 1. */ +VECT_VAR_DECL(expected1,int,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, + 0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,int,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,int,32,2) [] = { 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,int,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected1,uint,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,uint,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,uint,32,2) [] = { 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,uint,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected1,poly,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_DECL(expected1,poly,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,hfloat,32,2) [] = { 0xc170, 0xc170 }; +VECT_VAR_DECL(expected1,int,8,16) [] = { 0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1, +0xf1, 0xf1, 0xf1, 0xf1 }; +VECT_VAR_D
[Patch ARM-AArch64/testsuite v2 20/21] Add vmul tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b923c53..775257e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vmul.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vldX_lane.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vmul.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vmul.c new file mode 100644 index 000..7527861 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vmul.c @@ -0,0 +1,156 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0xf0, 0x1, 0x12, 0x23, + 0x34, 0x45, 0x56, 0x67 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0xfde0, 0xfe02, 0xfe24, 0xfe46 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0xfcd0, 0xfd03 }; +VECT_VAR_DECL(expected,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0xc0, 0x4, 0x48, 0x8c, + 0xd0, 0x14, 0x58, 0x9c }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfab0, 0xfb05, 0xfb5a, 0xfbaf }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0xf9a0, 0xfa06 }; +VECT_VAR_DECL(expected,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected,poly,8,8) [] = { 0xc0, 0x84, 0x48, 0xc, + 0xd0, 0x94, 0x58, 0x1c }; +VECT_VAR_DECL(expected,poly,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc405, 0xc3f9c000 }; +VECT_VAR_DECL(expected,int,8,16) [] = { 0x90, 0x7, 0x7e, 0xf5, + 0x6c, 0xe3, 0x5a, 0xd1, + 0x48, 0xbf, 0x36, 0xad, + 0x24, 0x9b, 0x12, 0x89 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0xf780, 0xf808, 0xf890, 0xf918, + 0xf9a0, 0xfa28, 0xfab0, 0xfb38 }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0xf670, 0xf709, + 0xf7a2, 0xf83b }; +VECT_VAR_DECL(expected,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected,uint,8,16) [] = { 0x60, 0xa, 0xb4, 0x5e, +0x8, 0xb2, 0x5c, 0x6, +0xb0, 0x5a, 0x4, 0xae, +0x58, 0x2, 0xac, 0x56 }; +VECT_VAR_DECL(expected,uint,16,8) [] = { 0xf450, 0xf50b, 0xf5c6, 0xf681, +0xf73c, 0xf7f7, 0xf8b2, 0xf96d }; +VECT_VAR_DECL(expected,uint,32,4) [] = { 0xf340, 0xf40c, +0xf4d8, 0xf5a4 }; +VECT_VAR_DECL(expected,uint,64,2) [] = { 0x, +0x }; +VECT_VAR_DECL(expected,poly,8,16) [] = { 0x60, 0xca, 0x34, 0x9e, +0xc8, 0x62, 0x9c, 0x36, +0x30, 0x9a, 0x64, 0xce, +0x98, 0x32, 0xcc, 0x66 }; +VECT_VAR_DECL(expected,poly,16,8) [] = { 0x, 0x, 0x, 0x, +0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc4c7, 0xc4bac000, + 0xc4ae4ccd, 0xc4a1d999 }; + +#ifndef INSN_NAME +#define INSN_NAME vmul +#define TEST_MSG "VMUL" +#endif + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ +#define DECL_VMUL(T, W, N) \ + DECL_VARIABLE(vector1, T, W, N); \ + DECL_VARIABLE(vector2, T, W, N); \ + DECL_VARIABLE(vector_res, T, W, N) + + /* vector_res = OP(vector1, vector2), then store the result. */ +#define TEST_VMUL1(INSN, Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ +INSN##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ + VECT_VAR(vector_res, T1, W, N)) + +#define TEST_VMUL(INSN, Q, T1, T2, W, N) \ + TEST_VMUL1(INSN, Q, T1, T2, W, N) + + DECL_VMUL(int, 8, 8); + DECL_VMUL(int, 16, 4); + DECL_VMUL(int, 32, 2); + DECL_VMUL(uint, 8, 8); + DECL_VMUL(uint, 16, 4); + DECL_VMUL(uint, 32, 2); + DECL_VMUL(poly, 8, 8); + DECL_VMUL(float, 32, 2); + DECL_VMUL(int, 8, 16); + DECL_VMUL(int, 16, 8); + DECL_VMUL(int, 32, 4); + DECL_VMUL(uint, 8, 16); + DECL_VMUL(uint, 16, 8); + DECL_VMUL(uint, 32, 4); + DECL_VMUL(poly, 8, 16); + DECL_VMUL(float, 32, 4); + + clean_results
[Patch ARM-AArch64/testsuite v2 18/21] Add vld2/vld3/vld4 tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5dd2ae0..2a359e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vldX.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vld1_dup.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vldX.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vldX.c new file mode 100644 index 000..f0156c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vldX.c @@ -0,0 +1,812 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ + +/* vld2/chunk 0. */ +VECT_VAR_DECL(expected_vld2_0,int,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7 }; +VECT_VAR_DECL(expected_vld2_0,int,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_0,int,32,2) [] = { 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_0,int,64,1) [] = { 0xfff0 }; +VECT_VAR_DECL(expected_vld2_0,uint,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7 }; +VECT_VAR_DECL(expected_vld2_0,uint,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_0,uint,32,2) [] = { 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_0,uint,64,1) [] = { 0xfff0 }; +VECT_VAR_DECL(expected_vld2_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7 }; +VECT_VAR_DECL(expected_vld2_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_0,hfloat,32,2) [] = { 0xc180, 0xc170 }; +VECT_VAR_DECL(expected_vld2_0,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected_vld2_0,int,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, + 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_0,int,32,4) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_0,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected_vld2_0,uint,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, + 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_0,uint,32,4) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_0,uint,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected_vld2_0,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected_vld2_0,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, + 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_0,hfloat,32,4) [] = { 0xc180, 0xc170, + 0xc160, 0xc150 }; + +/* vld2/chunk 1. */ +VECT_VAR_DECL(expected_vld2_1,int,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected_vld2_1,int,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_1,int,32,2) [] = { 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_1,int,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected_vld2_1,uint,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected_vld2_1,uint,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_1,uint,32,2) [] = { 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_1,uint,64,1) [] = { 0xfff1 }; +VECT_VAR_DECL(expected_vld2_1,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected_vld2_1,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_1,hfloat,32,2) [] = { 0xc160, 0xc150 }; +VECT_VA
[Patch ARM-AArch64/testsuite v2 21/21] Add vuzp and vzip tests.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 775257e..14f80a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vuzp.c: New file. + * gcc.target/aarch64/neon-intrinsics/vzip.c: Likewise. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vmul.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vuzp.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vuzp.c new file mode 100644 index 000..53f875e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vuzp.c @@ -0,0 +1,245 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results splitted in several chunks. */ +/* Chunk 0. */ +VECT_VAR_DECL(expected0,int,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7 }; +VECT_VAR_DECL(expected0,int,16,4) [] = { 0xfff0, 0xfff1, +0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected0,int,32,2) [] = { 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected0,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected0,uint,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, +0xf4, 0xf5, 0xf6, 0xf7 }; +VECT_VAR_DECL(expected0,uint,16,4) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected0,uint,32,2) [] = { 0xfff0, + 0xfff1 }; +VECT_VAR_DECL(expected0,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, +0xf4, 0xf5, 0xf6, 0xf7 }; +VECT_VAR_DECL(expected0,poly,16,4) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected0,hfloat,32,2) [] = { 0xc180, 0xc170 }; +VECT_VAR_DECL(expected0,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, +0xf4, 0xf5, 0xf6, 0xf7, +0xf8, 0xf9, 0xfa, 0xfb, +0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected0,int,16,8) [] = { 0xfff0, 0xfff1, +0xfff2, 0xfff3, +0xfff4, 0xfff5, +0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected0,int,32,4) [] = { 0xfff0, 0xfff1, +0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected0,int,64,2) [] = { 0x, +0x }; +VECT_VAR_DECL(expected0,uint,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected0,uint,16,8) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3, + 0xfff4, 0xfff5, + 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected0,uint,32,4) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected0,uint,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected0,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, + 0xfc, 0xfd, 0xfe, 0xff }; +VECT_VAR_DECL(expected0,poly,16,8) [] = { 0xfff0, 0xfff1, + 0xfff2, 0xfff3, + 0xfff4, 0xfff5, + 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected0,hfloat,32,4) [] = { 0xc180, 0xc170, + 0xc160, 0xc150 }; + +/* Chunk 1. */ +VECT_VAR_DECL(expected1,int,8,8) [] = { 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11 }; +VECT_VAR_DECL(expected1,int,16,4) [] = { 0x22, 0x22, 0x22, 0x22 }; +VECT_VAR_DECL(expected1,int,32,2) [] = { 0x33, 0x33 }; +VECT_VAR_DECL(expected1,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected1,uint,8,8) [] = { 0x55, 0x55, 0x55, 0x55, +0x55, 0x55, 0x55, 0x55 }; +VECT_VAR_DECL(expected1,uint,16,4) [] = { 0x66, 0x66, 0x66, 0x66 }; +VECT_VAR_DECL(expected1,uint,32,2) [] = { 0x77, 0x77 }; +VECT_VAR_DECL(expected1,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected1,poly,8,8) [] = { 0x55, 0x55, 0x55, 0x55, +0x55, 0x55, 0x55, 0x55 }; +VECT_VAR_DECL(expected1,poly,16,4) [] = { 0x66,
[Patch ARM-AArch64/testsuite v2 19/21] Add vld2_lane, vld3_lane and vld4_lane
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a359e0..b923c53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vldX_lane.c: New file. + +2014-06-30 Christophe Lyon + * gcc.target/aarch64/neon-intrinsics/vldX.c: New file. 2014-06-30 Christophe Lyon diff --git a/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vldX_lane.c b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vldX_lane.c new file mode 100644 index 000..8887c3e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/neon-intrinsics/vldX_lane.c @@ -0,0 +1,679 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ + +/* vld2/chunk 0. */ +VECT_VAR_DECL(expected_vld2_0,int,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }; +VECT_VAR_DECL(expected_vld2_0,int,16,4) [] = { 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,int,32,2) [] = { 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_0,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }; +VECT_VAR_DECL(expected_vld2_0,uint,16,4) [] = { 0x, 0x, + 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected_vld2_0,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }; +VECT_VAR_DECL(expected_vld2_0,poly,16,4) [] = { 0x, 0x, + 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,hfloat,32,2) [] = { 0xc180, 0xc170 }; +VECT_VAR_DECL(expected_vld2_0,int,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected_vld2_0,int,16,8) [] = { 0x, 0x, 0x, 0x, + 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,int,32,4) [] = { 0x, 0x, + 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,int,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected_vld2_0,uint,16,8) [] = { 0x, 0x, 0x, 0x, + 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,32,4) [] = { 0xfff0, 0xfff1, + 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,uint,64,2) [] = { 0x, + 0x }; +VECT_VAR_DECL(expected_vld2_0,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33, + 0x33, 0x33, 0x33, 0x33 }; +VECT_VAR_DECL(expected_vld2_0,poly,16,8) [] = { 0x, 0x, 0x, 0x, + 0x, 0x, 0x, 0x }; +VECT_VAR_DECL(expected_vld2_0,hfloat,32,4) [] = { 0x, 0x, + 0x, 0x }; + +/* vld2/chunk 1. */ +VECT_VAR_DECL(expected_vld2_1,int,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xf0, 0xf1 }; +VECT_VAR_DECL(expected_vld2_1,int,16,4) [] = { 0xfff0, 0xfff1, 0x, 0x }; +VECT_VAR_DECL(expected_vld2_1,int,32,2) [] = { 0x, 0x }; +VECT_VAR_DECL(expected_vld2_1,int,64,1) [] = { 0x }; +VECT_VAR_DECL(expected_vld2_1,uint,8,8) [] = { 0xf0, 0xf1, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }; +VECT_VAR_DECL(expected_vld2_1,uint,16,4) [] = { 0x, 0x, 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_1,uint,32,2) [] = { 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_1,uint,64,1) [] = { 0x }; +VECT_VAR_DECL(expected_vld2_1,poly,8,8) [] = { 0xf0, 0xf1, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa }; +VECT_VAR_DECL(expected_vld2_1,poly,16,4) [] = { 0x, 0x
Re: [fixincludes] Fix signbit on Solaris
Hi Bruce, > On 06/26/14 02:18, Rainer Orth wrote: >> Ok for mainline? > > Could you please reformat the c_fix_arg's and test-text to be "here strings" > a la: > > c_fix_arg = <<- _EOS_ > #undef signbit > #define signbit(x) (sizeof(x) == sizeof(float) \ > \ ? __builtin_signbitf(x) \ > \ : sizeof(x) == sizeof(long double) \ > \? __builtin_signbitl(x) \ > \: __builtin_signbit(x))"; > _EOS_; > > I changed the "here string" thingy to eat that tab-backslash > and leave the rest of the tabs a few years ago. It's not yet in autogen 5.9: I've diffed the fixincl.x generated with my original patch and the amended one and those backslashes after the leading tab are still there. > That is considerably more readable than: > > c_fix_arg = "#undef\tsignbit\n" > "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n" > "\t\t\t ? __builtin_signbitf(x) \\\n" > "\t\t\t : sizeof(x) == sizeof(long double) \\\n" > "\t\t\t ? __builtin_signbitl(x) \\\n" > "\t\t\t : __builtin_signbit(x))"; > > and the other two are worse. Thank you! Fully agreed, that's why I tried that route first. I'm currently fighting to build autogen 5.18.3 and all its dependencies. Trouble is, if we do require a version newer than 5.5.4 as documented in install.texi, fixincludes make check will suddenly start to fail for those whose autogen version isn't recent enough. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH]Enable elimination of IV use with unsigned type candidate
On Tue, Jul 1, 2014 at 10:32 AM, Bin.Cheng wrote: > Sorry for this late reply, I spent some time in understanding the problem. > > On Tue, Jun 24, 2014 at 12:36 PM, Richard Biener > wrote: >> On Mon, Jun 23, 2014 at 11:49 AM, Bin Cheng wrote: > >>> expressions. It's possible to have iv_elimination_compare_lt to do some >>> undo transformation on may_be_zero, but I found it's difficult for cases >>> involving signed/unsigned conversion like case loop-41.c. Since I think >>> there is no obvious benefit to fold may_be_zero here (somehow because the >>> two operands are already in folded forms), this patch just calls build2_loc >>> instead. >> >> But it may fold to true/false, no? > You are right, it can be folded to false in many cases. Thus I > managed to check specific folded forms of may_be_zero, as in attached > patch. So far it works for tests I added, but there are some other > folded forms not handled. > >> > >>> >>> When GCC trying to eliminate use 0 with cand 0, the miscellaneous trees in >>> iv_elimination_compare_lt are like below with i_1 of signed type: >>> B: i_1 + 1 >>> A: 0 >>> niter->niter: (unsigned int)i_1 >>> >>> Apparently, (B-A-1) is "i_1", which doesn't equal to "(unsigned int)i_1". >>> Without this patch, it is considered equal to each other. >> >> just looking at this part. Do you have a testcase that exhibits a difference >> when just applying patch A? So I can have a look here? >> >> From the code in iv_elimination_compare_lt I can't figure why we'd >> end up with i_1 instead of (unsigned int)i_1 as we convert to a common >> type. >> >> I suppose the issue may be that at tree_to_aff_combination time >> we strip all nops with STRIP_NOPS but when operating on ->rest >> via convert/scale or add we do not strip them again. >> >> But then 'nit' should be i_1, not (unsigned int)i_1. So the analysis above >> really doesn't look correct. >> >> Just to make sure we don't paper over an issue in tree-affine.c. >> >> Thus - testcase? On x86 we don't run into this place in >> iv_elimination_compare_lt (on an unpatched tree). >> >> CCing Zdenek for the meat of patch B. > > I am more and more convinced that check of overflow in function > iv_elimination_compare_lt is not sufficient. Considering example > given by comments just before the function: > /* Tries to replace loop exit by one formulated in terms of a LT_EXPR >comparison with CAND. NITER describes the number of iterations of >the loops. If successful, the comparison in COMP_P is altered accordingly. > >We aim to handle the following situation: > >sometype *base, *p; >int a, b, i; > >i = a; >p = p_0 = base + a; > >do > { >bla (*p); >p++; >i++; > } >while (i < b); > >Here, the number of iterations of the loop is (a + 1 > b) ? 0 : b - a - 1. >We aim to optimize this to > >p = p_0 = base + a; >do > { >bla (*p); >p++; > } >while (p < p_0 - a + b); > >This preserves the correctness, since the pointer arithmetics does not >overflow. More precisely: > >1) if a + 1 <= b, then p_0 - a + b is the final value of p, hence there is > no > overflow in computing it or the values of p. >2) if a + 1 > b, then we need to verify that the expression p_0 - a does > not > overflow. To prove this, we use the fact that p_0 = base + a. */ > > The example seems wrong to me, because the statement only stands for > unsigned case like ivopts-lt.c: > > > #include "stdint.h" > > void > f1 (char *p, uintptr_t i, uintptr_t n) > { > p += i; > do > { > *p = '\0'; > p += 1; > i++; > } > while (i < n); > } > > If i/n are of signed type, the 2nd point for "a+1>b" scenario in the > comment isn't right, because of below facts: > a) niter of loop are calculated in unsigned type as in function > number_of_iterations_lt. So loop information for this case is like: > > Analyzing # of iterations of loop 1 > exit condition [i_4(D) + 1, + , 1](no_overflow) < n_12(D) > bounds on difference of bases: -4294967295 ... 4294967294 > result: > zero if i_4(D) >= n_12(D) > # of iterations ((unsigned int) n_12(D) - (unsigned int) i_4(D)) - > 1, bounded by 4294967294 > number of iterations ((unsigned int) n_12(D) - (unsigned int) > i_4(D)) - 1; zero if i_4(D) >= n_12(D) > > b) The (unsigned int)n_12(D) could overflow, the check in > iv_elimination_compare_lt doesn't take this fact into consideration. > > Tricky thing is GCC now doesn't eliminate "i < n" with point P for > signed version of case. The reason behind is again the may_be_zero > information. The original form of may_be_zero is like "i_4(D) + 1> > n_12(D)", which is folded into "i_4(D) >= n_12(D)" because both > i_4/n_12 are of signed type and don't wrap. In the end, function > iv_elimination_compare_lt only handles the original form of > may_be_zero. > So below case is the closest one to illustrate th
Re: [PATCH PR C++/58781, 59867, 60249 ] Various user-defined string literal issues involving character encodings, dropped bytes, semi-infinite loops
... I'm going to commit as obvious the below, to avoid the spurious fail that we are all seeing. Thanks, Paolo. 2014-07-01 Paolo Carlini * g++.dg/cpp1y/pr59867.C: Fix target selector. Index: g++.dg/cpp1y/pr59867.C === --- g++.dg/cpp1y/pr59867.C (revision 212191) +++ g++.dg/cpp1y/pr59867.C (working copy) @@ -1,7 +1,6 @@ // PR c++/59867 -// { dg-do compile { target c++14 } } +// { dg-do compile { target c++1y } } -#include using namespace std; // constant
Re: [fixincludes] Fix signbit on Solaris
Hi Bruce, >> On 06/26/14 02:18, Rainer Orth wrote: >>> Ok for mainline? >> >> Could you please reformat the c_fix_arg's and test-text to be "here strings" >> a la: >> >> c_fix_arg = <<- _EOS_ >> #undef signbit >> #define signbit(x) (sizeof(x) == sizeof(float) \ >> \ ? __builtin_signbitf(x) \ >> \ : sizeof(x) == sizeof(long double) \ >> \? __builtin_signbitl(x) \ >> \: __builtin_signbit(x))"; >> _EOS_; >> >> I changed the "here string" thingy to eat that tab-backslash >> and leave the rest of the tabs a few years ago. > > It's not yet in autogen 5.9: I've diffed the fixincl.x generated with my > original patch and the amended one and those backslashes after the > leading tab are still there. I've now managed to build autogen 5.18.3 on Solaris 11, but still there is some trouble: with the following fix /* * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing * warnings. */ fix = { hackname = solaris_math_11; select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ "; files = iso/math_c99.h; c_fix = format; c_fix_arg = <<- _EOFix_ #undef signbit #define signbit(x) (sizeof(x) == sizeof(float) \ \ ? __builtin_signbitf(x) \ \ : sizeof(x) == sizeof(long double) \ \? __builtin_signbitl(x) \ \: __builtin_signbit(x)) _EOFix_; c_fix_arg = <<- _EOArg_ ^#undef[]+signbit #if defined\(__sparc\) #define[]+signbit\(x\)[ ]+__extension__\( \\ [ ]+\{[ ]*__typeof\(x\)[]*__x_s[]*=[ ]*\(x\);[ ]*\\ [ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[ ]*\&__x_s[ ]*>>[ ]*31\);[]*\}\) #elif defined\(__i386\) \|\| defined\(__amd64\) #define[]+signbit\(x\)[ ]+__extension__\( \\ [ ]+\{ __typeof\(x\) __x_s = \(x\); \\ [ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\ [ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\ [ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\ [ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\ [ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\) #endif _EOArg_; test_text = <<- _EOText_ /* @(#)math_c99.h 1.1413/03/27 */ #undef signbit #if defined(__sparc) #define signbit(x) __extension__( \\ \ { __typeof(x) __x_s = (x); \\ \ (int) (*(unsigned *) &__x_s >> 31); }) #elif defined(__i386) || defined(__amd64) #define signbit(x) __extension__( \\ \ { __typeof(x) __x_s = (x); \\ \ (sizeof (__x_s) == sizeof (float) ? \\ \ (int) (*(unsigned *) &__x_s >> 31) : \\ \ sizeof (__x_s) == sizeof (double) ? \\ \ (int) (((unsigned *) &__x_s)[1] >> 31) : \\ \ (int) (((unsigned short *) &__x_s)[4] >> 15)); }) #endif _EOText_; }; the test passes (not ran a bootstrap yet). But I had to make two unexpected changes: * In the second c_fix_arg, all \t in charsets had to be replaced by literal TABs, otherwise they would occur as \\t in fixincl.x. * In test_text, I had to backslash-escape the trailing \, otherwise they were eaten up. Whether or not I do this makes no difference for the generated fixincl.x, but only with the escaping does make check pass. >> That is considerably more readable than: >> >> c_fix_arg = "#undef\tsignbit\n" >> "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n" >> "\t\t\t ? __builtin_signbitf(x) \\\n" >> "\t\t\t : sizeof(x) == sizeof(long double) \\\n" >> "\t\t\t ? __builtin_signbitl(x) \\\n" >> "\t\t\t : __builtin_signbit(x))"; >> >> and the other two are worse. Thank you! > > Fully agreed, that's why I tried that route first. > > I'm currently fighting to build autogen 5.18.3 and all its dependencies. > Trouble is, if we do require a version newer than 5.5.4 as documented in > install.texi, fixincludes make check will suddenly start to fail for > those whose autogen version isn't recent enough. This is certainly something that needs to be decided: if we go this route, we should bump the autogen version requirement in install.texi (to whatever is necessary to support the TAB\ magic). Thanks. Rainer -- - Rainer Orth, Center for Biotechnology
[wwwdocs,Java] Merge java/.htaccess into top level .htaccess and convert to https
2014-07-01 Gerald Pfeifer * .htaccess: Merge java/.htaccess into top level .htaccess and convert to https. Committed. Index: java/.htaccess === RCS file: java/.htaccess diff -N java/.htaccess --- java/.htaccess 4 May 2001 16:24:26 - 1.6 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,4 +0,0 @@ -Redirect permanent /java/FAQ.html http://gcc.gnu.org/java/faq.html -Redirect permanent /java/gcj.html http://gcc.gnu.org/java/index.html -Redirect permanent /java/libgcj.html http://gcc.gnu.org/java/index.html -Redirect permanent /java/about.html http://gcc.gnu.org/about.html Index: .htaccess === RCS file: /cvs/gcc/wwwdocs/htdocs/.htaccess,v retrieving revision 1.32 diff -u -r1.32 .htaccess --- .htaccess 11 Jun 2014 17:45:32 - 1.32 +++ .htaccess 1 Jul 2014 11:15:26 - @@ -42,6 +42,11 @@ Redirect permanent /onlinedocs/g77_bugs.html https://gcc.gnu.org/onlinedocs/g77/Trouble.html Redirect permanent /onlinedocs/g77/ https://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/ +Redirect permanent /java/FAQ.html https://gcc.gnu.org/java/faq.html +Redirect permanent /java/gcj.html https://gcc.gnu.org/java/ +Redirect permanent /java/libgcj.html https://gcc.gnu.org/java/ +Redirect permanent /java/about.htmlhttps://gcc.gnu.org/about.html + Redirect permanent /bugs.html https://gcc.gnu.org/bugs/ Redirect permanent /c9xstatus.html https://gcc.gnu.org/c99status.html Redirect permanent /cvswrite.html https://gcc.gnu.org/svnwrite.html
Re: [AArch64] Implement some vca*_f[32,64] intrinsics
On 23 June 2014 15:30, Kyrill Tkachov wrote: > Hi all, > > This patch implements some absolute compare intrinsics in arm_neon.h. > > Execution tests are added. > Tested aarch64-none-elf, aarch64_be-none-elf, bootstrapped on aarch64 linux +/* { dg-do run } */ +/* { dg-options "-save-temps -O3" } */ + +#include "arm_neon.h" +#include + Drop the dependence on stdio.h please. +fprintf (stderr, "Expected: %ld, got %ld\n", expected, actual); No need to print the expected value, abort( i alone is fine. Dropping the printf will make the #include above go away. Ok with those changes. /Marcus
Re: [patch] c++/58051 Implement Core 1579
On 2014.06.26 at 14:06 +0100, Jonathan Wakely wrote: > DR1579 relaxes [class.copy]/32 so that expressions in return > statements can be looked up as rvalues even when they aren't the same > type as the function return type. > > Implementing that seems as simple as removing the restriction on the > types. Tested x86_64-linux, no regressions. This patch cause yet another LLVM build error: FAILED: /var/tmp/gcc_test/usr/local/bin/g++ -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DclangFrontend_EXPORTS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -O2 -DNDEBUG -pipe -fPIC -Itools/clang/lib/Frontend -I/var/tmp/llvm-project/llvm/tools/clang/lib/Frontend -I/var/tmp/llvm-project/llvm/tools/clang/include -Itools/clang/include -Iinclude -I/var/tmp/llvm-project/llvm/include-fno-exceptions -fno-rtti -MMD -MT tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -MF "tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o.d" -o tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -c /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp In file included from /var/tmp/llvm-project/llvm/tools/clang/include/clang/Basic/DiagnosticOptions.h:14:0, from /var/tmp/llvm-project/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h:13, from /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:10: /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘llvm::IntrusiveRefCntPtr::IntrusiveRefCntPtr(llvm::IntrusiveRefCntPtr&&) [with X = clang::vfs::OverlayFileSystem; T = clang::vfs::FileSystem]’: /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:2047:10: required from here /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:137:8: error: ‘clang::vfs::OverlayFileSystem* llvm::IntrusiveRefCntPtr::Obj’ is private T* Obj; ^ /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:158:13: error: within this context S.Obj = 0; ^ Reduced: markus@x4 llvm_build % cat CompilerInvocation.ii template class A { T Obj; public: T element_type; A (T *); template A (A &&p1) { p1.Obj; } template A (A &); }; class B { public: B (A); }; A fn1 () { A a (new B (0)); return a; } markus@x4 llvm_build % /var/tmp/gcc_test/usr/local/bin/g++ -c -std=c++11 CompilerInvocation.ii CompilerInvocation.ii: In instantiation of ‘A::A(A&&) [with X = B; T = int]’: CompilerInvocation.ii:20:10: required from here CompilerInvocation.ii:3:5: error: ‘B A::Obj’ is private T Obj; ^ CompilerInvocation.ii:8:38: error: within this context template A (A &&p1) { p1.Obj; } ^ -- Markus template class A { T Obj; public: T element_type; A (T *); template A (A &&p1) { p1.Obj; } template A (A &); }; class B { public: B (A); }; A fn1 () { A a (new B (0)); return a; }
[GOOGLE] LIPO resolved node handling for inline clone references
This patch addresses an issue with looking up the resolved node rebuilding cgraph references during clone materialization. It is possible that in ipa-cp cases the resolved node was eliminated during inlining and indirect call promotion, but the clone still exists as a function call argument in an inline virtual clone. The clones would be removed later when we actually do the inline transformation, but in the meantime during clone materialization the cgraph references are rebuilt, and the temporary reference on the call still exists in the IR. Handle this by skipping such references in inline clones. Passes regression tests. Ok for google/4_9? Teresa 2014-07-01 Teresa Johnson Google ref b/15411384. * cgraphbuild.c (mark_address): Skip resolved node lookup in inline copies. Index: cgraphbuild.c === --- cgraphbuild.c (revision 211957) +++ cgraphbuild.c (working copy) @@ -389,8 +389,28 @@ mark_address (gimple stmt, tree addr, tree, void * addr = get_base_address (addr); if (TREE_CODE (addr) == FUNCTION_DECL) { + /* Before possibly cloning the node in cgraph_get_create_node, + save the current cgraph node for addr. */ + struct cgraph_node *first_clone = cgraph_get_node (addr); struct cgraph_node *node = cgraph_get_create_node (addr); - if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done) + /* In LIPO mode we use the resolved node. However, there is + a possibility that it may not exist at this point. This + can happen in cases of ipa-cp, where this is a reference + that will eventually go away during inline_transform when we + invoke cgraph_redirect_edge_call_stmt_to_callee to rewrite + the call_stmt and skip some arguments. It is possible + that earlier during inline_call the references to the original + non-cloned resolved node were all eliminated, and it was removed. + However, virtual clones may stick around until inline_transform, + due to references in other virtual clones, at which point they + will all be removed. In between inline_call and inline_transform, + however, we will materialize clones which would rebuild references + and end up here upon still seeing the reference on the call. + Handle this by skipping the resolved node lookup when the first + clone was marked global.inlined_to (i.e. it is a virtual clone, + the original is gone). */ + if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done + && first_clone && !first_clone->global.inlined_to) node = cgraph_lipo_get_resolved_node (addr); cgraph_mark_address_taken_node (node); -- Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
[C++ Patch] Replace error + error with error + inform
Hi, noticed these error messages. Tested x86_64-linux. Thanks, Paolo. /// /cp 2014-07-01 Paolo Carlini * pt.c (convert_template_argument): Use inform instead of error in three places. /testsuite 2014-07-01 Paolo Carlini * g++.dg/cpp0x/variadic-ex10.C: Adjust for inform instead of error. * g++.dg/cpp0x/variadic-ex14.C: Likewise. * g++.dg/parse/error11.C: Likewise. * g++.old-deja/g++.brendan/template17.C: Likewise. Index: cp/pt.c === --- cp/pt.c (revision 212194) +++ cp/pt.c (working copy) @@ -6468,13 +6468,16 @@ convert_template_argument (tree parm, "parameter list for %qD", i + 1, in_decl); if (is_type) - error (" expected a constant of type %qT, got %qT", - TREE_TYPE (parm), - (DECL_P (arg) ? DECL_NAME (arg) : orig_arg)); + inform (input_location, + " expected a constant of type %qT, got %qT", + TREE_TYPE (parm), + (DECL_P (arg) ? DECL_NAME (arg) : orig_arg)); else if (requires_tmpl_type) - error (" expected a class template, got %qE", orig_arg); + inform (input_location, + " expected a class template, got %qE", orig_arg); else - error (" expected a type, got %qE", orig_arg); + inform (input_location, + " expected a type, got %qE", orig_arg); } } return error_mark_node; @@ -6487,9 +6490,11 @@ convert_template_argument (tree parm, "parameter list for %qD", i + 1, in_decl); if (is_tmpl_type) - error (" expected a type, got %qT", DECL_NAME (arg)); + inform (input_location, + " expected a type, got %qT", DECL_NAME (arg)); else - error (" expected a class template, got %qT", orig_arg); + inform (input_location, + " expected a class template, got %qT", orig_arg); } return error_mark_node; } @@ -6537,8 +6542,9 @@ convert_template_argument (tree parm, error ("type/value mismatch at argument %d in " "template parameter list for %qD", i + 1, in_decl); - error (" expected a template of type %qD, got %qT", -parm, orig_arg); + inform (input_location, + " expected a template of type %qD, got %qT", + parm, orig_arg); } val = error_mark_node; Index: testsuite/g++.dg/cpp0x/variadic-ex10.C === --- testsuite/g++.dg/cpp0x/variadic-ex10.C (revision 212194) +++ testsuite/g++.dg/cpp0x/variadic-ex10.C (working copy) @@ -5,5 +5,5 @@ Tuple<> t0; // Types contains no arguments Tuple t1; // Types contains one argument: int Tuple t2; // Types contains two arguments: int and float Tuple<0> error; // { dg-error "mismatch" "mismatch" } -// { dg-error "expected a type" "expected a type" { target *-*-* } 7 } +// { dg-message "expected a type" "expected a type" { target *-*-* } 7 } // { dg-error "in declaration" "in declaration" { target *-*-* } 7 } Index: testsuite/g++.dg/cpp0x/variadic-ex14.C === --- testsuite/g++.dg/cpp0x/variadic-ex14.C (revision 212194) +++ testsuite/g++.dg/cpp0x/variadic-ex14.C (working copy) @@ -9,10 +9,10 @@ template class Q> class Y { /* X xA; // okay X xB; // { dg-error "mismatch" "mismatch" } -// { dg-error "expected a template" "expected" { target *-*-* } 11 } +// { dg-message "expected a template" "expected" { target *-*-* } 11 } // { dg-error "invalid type" "invalid" { target *-*-* } 11 } X xC; // { dg-error "mismatch" "mismatch" } -// { dg-error "expected a template" "expected" { target *-*-* } 14 } +// { dg-message "expected a template" "expected" { target *-*-* } 14 } // { dg-error "invalid type" "invalid" { target *-*-* } 14 } Y yA; Y yB; Index: testsuite/g++.dg/parse/error11.C === --- testsuite/g++.dg/parse/error11.C(revision 212194) +++ testsuite/g++.dg/parse/error11.C(working copy) @@ -33,7 +33,7 @@ template struct Foo2 {}; template struct Foo2<::B>; // { dg-error "21:'<::' cannot begin" "begin" { target { ! c++11 } } } // { dg-message "21:'<:' is an alternate" "alt" { target { ! c++11 } } 33 } // { dg-message "25:type/value mismatch" "mismatch" { target *-*-* } 33 } -// { dg-error "25:expected a constant" "const" { target *-*-* } 33 } +// { dg-message "25:expected a constant" "const" {
Re: [patch] c++/58051 Implement Core 1579
On Tue, 1 Jul 2014, Markus Trippelsdorf wrote: This patch cause yet another LLVM build error: [...] Reduced: markus@x4 llvm_build % cat CompilerInvocation.ii template class A { T Obj; public: T element_type; A (T *); template A (A &&p1) { p1.Obj; } template A (A &); }; class B { public: B (A); }; A fn1 () { A a (new B (0)); return a; } markus@x4 llvm_build % /var/tmp/gcc_test/usr/local/bin/g++ -c -std=c++11 CompilerInvocation.ii CompilerInvocation.ii: In instantiation of ‘A::A(A&&) [with X = B; T = int]’: CompilerInvocation.ii:20:10: required from here CompilerInvocation.ii:3:5: error: ‘B A::Obj’ is private T Obj; ^ CompilerInvocation.ii:8:38: error: within this context template A (A &&p1) { p1.Obj; } ^ This looks invalid. As the core issue says, the return statement looks up a as an rvalue, so it uses that constructor for A, and that uses a private member of a different specialization of A, which is illegal. -- Marc Glisse
Re: [patch] c++/58051 Implement Core 1579
On 01/07/14 16:10 +0200, Marc Glisse wrote: On Tue, 1 Jul 2014, Markus Trippelsdorf wrote: This patch cause yet another LLVM build error: [...] Reduced: markus@x4 llvm_build % cat CompilerInvocation.ii template class A { T Obj; public: T element_type; A (T *); template A (A &&p1) { p1.Obj; } template A (A &); }; class B { public: B (A); }; A fn1 () { A a (new B (0)); return a; } markus@x4 llvm_build % /var/tmp/gcc_test/usr/local/bin/g++ -c -std=c++11 CompilerInvocation.ii CompilerInvocation.ii: In instantiation of ‘A::A(A&&) [with X = B; T = int]’: CompilerInvocation.ii:20:10: required from here CompilerInvocation.ii:3:5: error: ‘B A::Obj’ is private T Obj; ^ CompilerInvocation.ii:8:38: error: within this context template A (A &&p1) { p1.Obj; } ^ This looks invalid. As the core issue says, the return statement looks up a as an rvalue, so it uses that constructor for A, and that uses a private member of a different specialization of A, which is illegal. Right, it looks as though that constructor has never been compiled or tested before, so GCC is not only making the code faster but also finding a bug :-) The most obvious fix is to add: template friend class IntrusiveRefCntPtr; so that conversion from rvalues of different types is supported.
Re: [patch] c++/58051 Implement Core 1579
On 01/07/14 15:06 +0200, Markus Trippelsdorf wrote: On 2014.06.26 at 14:06 +0100, Jonathan Wakely wrote: DR1579 relaxes [class.copy]/32 so that expressions in return statements can be looked up as rvalues even when they aren't the same type as the function return type. Implementing that seems as simple as removing the restriction on the types. Tested x86_64-linux, no regressions. This patch cause yet another LLVM build error: FAILED: /var/tmp/gcc_test/usr/local/bin/g++ -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DclangFrontend_EXPORTS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -O2 -DNDEBUG -pipe -fPIC -Itools/clang/lib/Frontend -I/var/tmp/llvm-project/llvm/tools/clang/lib/Frontend -I/var/tmp/llvm-project/llvm/tools/clang/include -Itools/clang/include -Iinclude -I/var/tmp/llvm-project/llvm/include-fno-exceptions -fno-rtti -MMD -MT tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -MF "tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o.d" -o tools/clang/lib/Frontend/CMakeFiles/clangFrontend.dir/CompilerInvocation.cpp.o -c /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp In file included from /var/tmp/llvm-project/llvm/tools/clang/include/clang/Basic/DiagnosticOptions.h:14:0, from /var/tmp/llvm-project/llvm/tools/clang/include/clang/Frontend/CompilerInvocation.h:13, from /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:10: /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘llvm::IntrusiveRefCntPtr::IntrusiveRefCntPtr(llvm::IntrusiveRefCntPtr&&) [with X = clang::vfs::OverlayFileSystem; T = clang::vfs::FileSystem]’: /var/tmp/llvm-project/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp:2047:10: required from here /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:137:8: error: ‘clang::vfs::OverlayFileSystem* llvm::IntrusiveRefCntPtr::Obj’ is private T* Obj; ^ /var/tmp/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:158:13: error: within this context S.Obj = 0; ^ Reduced: markus@x4 llvm_build % cat CompilerInvocation.ii template class A { T Obj; public: T element_type; A (T *); template A (A &&p1) { p1.Obj; } template A (A &); }; class B { public: B (A); }; A fn1 () { A a (new B (0)); return a; } markus@x4 llvm_build % /var/tmp/gcc_test/usr/local/bin/g++ -c -std=c++11 CompilerInvocation.ii CompilerInvocation.ii: In instantiation of ‘A::A(A&&) [with X = B; T = int]’: CompilerInvocation.ii:20:10: required from here CompilerInvocation.ii:3:5: error: ‘B A::Obj’ is private T Obj; ^ CompilerInvocation.ii:8:38: error: within this context template A (A &&p1) { p1.Obj; } The error looks correct, A cannot access private members of A. My patch only affects return statements and you get exactly the same error if you change the code so there's no return statement: void fn2 () { A a (new B (0)); A aa( static_cast&&>(a) ); }
Re: [patch] c++/58051 Implement Core 1579
On Tue, 1 Jul 2014, Jonathan Wakely wrote: Right, it looks as though that constructor has never been compiled or tested before, so GCC is not only making the code faster but also finding a bug :-) The most obvious fix is to add: template friend class IntrusiveRefCntPtr; so that conversion from rvalues of different types is supported. No in the friend declaration though. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12429 -- Marc Glisse
Re: [GOOGLE] LIPO resolved node handling for inline clone references
Ok, with minor fix to the comments: 1) Before possibly cloning --> Before possibly creating a new 2) It is not clear from the comments that the remaining references are from call statements in ipa cp clones that have not been fixed up. Possibly add a 3 line example to show the call statements calling the original function --> after fixup it will be calling the callee's clone? thanks, David On Tue, Jul 1, 2014 at 7:06 AM, Teresa Johnson wrote: > This patch addresses an issue with looking up the resolved node > rebuilding cgraph references during clone materialization. It is > possible that in ipa-cp cases the resolved node was eliminated during > inlining and indirect call promotion, but the clone still exists as a > function call argument in an inline virtual clone. The clones would be > removed later when we actually do the inline transformation, but in > the meantime during clone materialization the cgraph references are > rebuilt, and the temporary reference on the call still exists in the > IR. Handle this by skipping such references in inline clones. > > Passes regression tests. Ok for google/4_9? > > Teresa > > 2014-07-01 Teresa Johnson > > Google ref b/15411384. > * cgraphbuild.c (mark_address): Skip resolved node lookup > in inline copies. > > Index: cgraphbuild.c > === > --- cgraphbuild.c (revision 211957) > +++ cgraphbuild.c (working copy) > @@ -389,8 +389,28 @@ mark_address (gimple stmt, tree addr, tree, void * >addr = get_base_address (addr); >if (TREE_CODE (addr) == FUNCTION_DECL) > { > + /* Before possibly cloning the node in cgraph_get_create_node, > + save the current cgraph node for addr. */ > + struct cgraph_node *first_clone = cgraph_get_node (addr); >struct cgraph_node *node = cgraph_get_create_node (addr); > - if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done) > + /* In LIPO mode we use the resolved node. However, there is > + a possibility that it may not exist at this point. This > + can happen in cases of ipa-cp, where this is a reference > + that will eventually go away during inline_transform when we > + invoke cgraph_redirect_edge_call_stmt_to_callee to rewrite > + the call_stmt and skip some arguments. It is possible > + that earlier during inline_call the references to the original > + non-cloned resolved node were all eliminated, and it was removed. > + However, virtual clones may stick around until inline_transform, > + due to references in other virtual clones, at which point they > + will all be removed. In between inline_call and inline_transform, > + however, we will materialize clones which would rebuild references > + and end up here upon still seeing the reference on the call. > + Handle this by skipping the resolved node lookup when the first > + clone was marked global.inlined_to (i.e. it is a virtual clone, > + the original is gone). */ > + if (L_IPO_COMP_MODE && cgraph_pre_profiling_inlining_done > + && first_clone && !first_clone->global.inlined_to) > node = cgraph_lipo_get_resolved_node (addr); > >cgraph_mark_address_taken_node (node); > > > -- > Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
[PATCH, AArch64, Testsuite] Specify -fno-use-caller-save for func-ret* tests
Hi, This patch resolves a conflict between the aapcs64 test framework for func-ret tests and the optimization option -fuse-caller-save, which was enabled by default at -O1 or above recently. Basically, the test framework has an inline-assembly based mechanism in place which invokes the test facility function right on the return of a tested function. The compiler with -fuse-caller-save is unable to identify the unconventional call graph and carries out the optimization regardless. Adding explicit LR clobbering field to the inline assembly doesn't solve the issue as the compiler would simply generate extra save/store of LR in the prologue/epilogue. OK for the trunk? Thanks, Yufeng gcc/testsuite/ * gcc.target/aarch64/aapcs64/aapcs64.exp: (additional_flags_for_func_ret): New variable based on $additional_flags plus -fno-use-caller-save. (func-ret-*.c): Use the new variable.diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp index 195f977..fdfbff1 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp @@ -48,11 +48,15 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/va_arg-*.c]] { } # Test function return value. +# Disable -fuse-caller-save to prevent the compiler from generating +# conflicting code. +set additional_flags_for_func_ret $additional_flags +append additional_flags_for_func_ret " -fno-use-caller-save" foreach src [lsort [glob -nocomplain $srcdir/$subdir/func-ret-*.c]] { if {[runtest_file_p $runtests $src]} { c-torture-execute [list $src \ $srcdir/$subdir/abitest.S] \ - $additional_flags + $additional_flags_for_func_ret } }
[wwwdocs] Convert our cgi-bin invocations to https
These services run on gcc.gnu.org only, but also need to be accessed from our www.gnu.org/software/gcc mirror, hence the requirement to have an absolute link. Applied. Gerald Index: lists.html === RCS file: /cvs/gcc/wwwdocs/htdocs/lists.html,v retrieving revision 1.110 diff -u -r1.110 lists.html --- lists.html 28 Jun 2014 10:34:16 - 1.110 +++ lists.html 1 Jul 2014 16:02:01 - @@ -195,7 +195,7 @@ --> -http://gcc.gnu.org/cgi-bin/ml-request";> +https://gcc.gnu.org/cgi-bin/ml-request";> Mailing list: gcc-announce Index: search.html === RCS file: /cvs/gcc/wwwdocs/htdocs/search.html,v retrieving revision 1.190 diff -u -r1.190 search.html --- search.html 1 Mar 2013 10:36:04 - 1.190 +++ search.html 1 Jul 2014 16:02:03 - @@ -7,7 +7,7 @@ GCC detailed search -http://gcc.gnu.org/cgi-bin/htsearch";> +https://gcc.gnu.org/cgi-bin/htsearch";> Match: Boolean expression Index: searchbox.ihtml === RCS file: /cvs/gcc/wwwdocs/htdocs/searchbox.ihtml,v retrieving revision 1.15 diff -u -r1.15 searchbox.ihtml --- searchbox.ihtml 21 Sep 2006 14:17:36 - 1.15 +++ searchbox.ihtml 1 Jul 2014 16:02:03 - @@ -1,6 +1,6 @@ -http://gcc.gnu.org/cgi-bin/search.cgi";> +https://gcc.gnu.org/cgi-bin/search.cgi";> Index: about.html === RCS file: /cvs/gcc/wwwdocs/htdocs/about.html,v retrieving revision 1.23 diff -u -r1.23 about.html --- about.html 28 Jun 2014 07:45:04 - 1.23 +++ about.html 1 Jul 2014 16:02:03 - @@ -18,7 +18,7 @@ . The web pages are under CVS control and you -can http://gcc.gnu.org/cgi-bin/cvsweb.cgi/wwwdocs/";>browse +can https://gcc.gnu.org/cgi-bin/cvsweb.cgi/wwwdocs/";>browse the repository online. The pages on gcc.gnu.org are updated "live" directly after a change has been made; www.gnu.org is updated once a day at 4:00 -0700
Re: [Patch, PR 61061] Add state limit for regex NFA
On Sat, Jun 28, 2014 at 2:48 AM, Jonathan Wakely wrote: > OK for trunk, thanks. Committed. Thanks! -- Regards, Tim Shen
Re: [patch] gcc fstack-protector-explicit
On 03/19/14 08:06, Marcos Díaz wrote: Well, finally I have the assignment, could you please review this patch? Thanks. My first thought was that if we've marked the function with an explicit static protector attribute, then it ought to be protected regardless of any flags. Is there some reason to require the -fstack-protect-explicit? The patch itself is relatively simple and I don't see anything that looks terribly wrong at first glance. I think we just need to make sure we're on the same page WRT needing the -fstack-protect-explicit flag. jeff
Re: [PATCH, AArch64, Testsuite] Specify -fno-use-caller-save for func-ret* tests
On 07/01/14 09:51, Yufeng Zhang wrote: Hi, This patch resolves a conflict between the aapcs64 test framework for func-ret tests and the optimization option -fuse-caller-save, which was enabled by default at -O1 or above recently. Basically, the test framework has an inline-assembly based mechanism in place which invokes the test facility function right on the return of a tested function. The compiler with -fuse-caller-save is unable to identify the unconventional call graph and carries out the optimization regardless. Adding explicit LR clobbering field to the inline assembly doesn't solve the issue as the compiler would simply generate extra save/store of LR in the prologue/epilogue. OK for the trunk? Thanks, Yufeng gcc/testsuite/ * gcc.target/aarch64/aapcs64/aapcs64.exp: (additional_flags_for_func_ret): New variable based on $additional_flags plus -fno-use-caller-save. (func-ret-*.c): Use the new variable. OK. Jeff
Re: [fixincludes] Fix signbit on Solaris
Hi Rainer, On Tue, Jul 1, 2014 at 4:22 AM, Rainer Orth wrote: >> It's not yet in autogen 5.9: I've diffed the fixincl.x generated with my >> original patch and the amended one and those backslashes after the >> leading tab are still there. 5.9 is 7 years old now. However, I just looked up the change. I did it 2 years ago. It would mean bumping the requirement to 5.17.4, from a mere 1 year ago. > I've now managed to build autogen 5.18.3 on Solaris 11, but still there Please send your "managed to build" stories. If they are not Guile related, I can try to clean 'em up. Building Guile is not for the feint of heart. > is some trouble: with the following fix > > /* > * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing > * warnings. > */ > fix = { [...] > }; > > the test passes (not ran a bootstrap yet). But I had to make two > unexpected changes: > > * In the second c_fix_arg, all \t in charsets had to be replaced by > literal TABs, otherwise they would occur as \\t in fixincl.x. I made the "here string" largely similar to the shell "here doc", excepting there is no such thing as shell expansions (${var} stuff) and I (now) erase that backslash-before-whitespace thingy. > * In test_text, I had to backslash-escape the trailing \, otherwise they > were eaten up. Whether or not I do this makes no difference for the > generated fixincl.x, but only with the escaping does make check pass. Right. It likely gets massaged by a shell script somewhere. I'd need to look up how "test-text" gets used in the template. >> I'm currently fighting to build autogen 5.18.3 and all its dependencies. >> Trouble is, if we do require a version newer than 5.5.4 as documented in >> install.texi, fixincludes make check will suddenly start to fail for >> those whose autogen version isn't recent enough. Every decade or so it ought to be possible to update by a few years. > This is certainly something that needs to be decided: if we go this > route, we should bump the autogen version requirement in install.texi > (to whatever is necessary to support the TAB\ magic). I think Debian stable has moved up to 5.18.2, if I am remembering correctly. It's a year old (last fall). I think that is old enough to have been spread around by now. Thanks for looking into it. Regards, Bruce
[PATCH] Generate canonical infinity for the Motorola extended real format
This patch fixes encode_ieee_extended_motorola to generate the canonical infinity matching the bit pattern generated by the fpu (in the Motorola variant of the extended real format the integer bit is ignored on input and cleared on output, unlike the Intel variant). This fixes the ieee/copysign[12].c tests on m68k. Andreas. * real.c (encode_ieee_extended_motorola): Clear integer bit in the infinity format. --- gcc/real.c | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/real.c b/gcc/real.c index 231fc96..1c2f709 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -3481,6 +3481,11 @@ encode_ieee_extended_motorola (const struct real_format *fmt, long *buf, long intermed[3]; encode_ieee_extended (fmt, intermed, r); + if (r->cl == rvc_inf) +/* For infinity clear the explicit integer bit again, so that the + format matches the canonical infinity generated by the FPU. */ +intermed[1] = 0; + /* Motorola chips are assumed always to be big-endian. Also, the padding in a Motorola extended real goes between the exponent and the mantissa. At this point the mantissa is entirely within -- 2.0.1 -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Re: Ok to backport r210653 (fix for PR58930) to gcc-4_9-branch?
On Fri, Jun 27, 2014 at 12:51 PM, Jason Merrill wrote: > On 06/27/2014 11:04 AM, Paul Pluzhnikov wrote: >> >> Ok to backport r210653 (fix for PR58930) to gcc-4_9-branch? > > > OK, yes. Thanks. Committed attached patch as r212207. Tested on Linux/x86_64, no regressions. -- Paul Pluzhnikov Index: gcc/testsuite/g++.dg/cpp0x/nsdmi-template11.C === --- gcc/testsuite/g++.dg/cpp0x/nsdmi-template11.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/nsdmi-template11.C (revision 212207) @@ -0,0 +1,30 @@ +// PR c++/58930 +// { dg-do compile { target c++11 } } + +struct SampleModule +{ + explicit SampleModule (int); +}; + +template < typename > +struct BaseHandler +{ + SampleModule module_ { 0 }; +}; + +BaseHandler a; +// PR c++/58930 +// { dg-do compile { target c++11 } } + +struct SampleModule +{ + explicit SampleModule (int); +}; + +template < typename > +struct BaseHandler +{ + SampleModule module_ { 0 }; +}; + +BaseHandler a; Index: gcc/testsuite/g++.dg/cpp0x/nsdmi-template13.C === --- gcc/testsuite/g++.dg/cpp0x/nsdmi-template13.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/nsdmi-template13.C (revision 212207) @@ -0,0 +1,22 @@ +// PR c++/58704 +// { dg-do compile { target c++11 } } + +struct A {}; + +template struct B +{ + A a[1] = { }; +}; + +B b; +// PR c++/58704 +// { dg-do compile { target c++11 } } + +struct A {}; + +template struct B +{ + A a[1] = { }; +}; + +B b; Index: gcc/testsuite/g++.dg/cpp0x/nsdmi-template12.C === --- gcc/testsuite/g++.dg/cpp0x/nsdmi-template12.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/nsdmi-template12.C (revision 212207) @@ -0,0 +1,34 @@ +// PR c++/58753 +// { dg-do compile { target c++11 } } + +#include + +template +struct X {X(std::initializer_list) {}}; + +template +class T { + X x{1}; +}; + +int main() +{ + T t; +} +// PR c++/58753 +// { dg-do compile { target c++11 } } + +#include + +template +struct X {X(std::initializer_list) {}}; + +template +class T { + X x{1}; +}; + +int main() +{ + T t; +} Index: gcc/cp/init.c === --- gcc/cp/init.c (revision 212206) +++ gcc/cp/init.c (revision 212207) @@ -522,6 +522,49 @@ } } +/* Return the non-static data initializer for FIELD_DECL MEMBER. */ + +tree +get_nsdmi (tree member, bool in_ctor) +{ + tree init; + tree save_ccp = current_class_ptr; + tree save_ccr = current_class_ref; + if (!in_ctor) +inject_this_parameter (DECL_CONTEXT (member), TYPE_UNQUALIFIED); + if (DECL_LANG_SPECIFIC (member) && DECL_TEMPLATE_INFO (member)) +{ + /* Do deferred instantiation of the NSDMI. */ + init = (tsubst_copy_and_build + (DECL_INITIAL (DECL_TI_TEMPLATE (member)), + DECL_TI_ARGS (member), + tf_warning_or_error, member, /*function_p=*/false, + /*integral_constant_expression_p=*/false)); + + init = digest_nsdmi_init (member, init); +} + else +{ + init = DECL_INITIAL (member); + if (init && TREE_CODE (init) == DEFAULT_ARG) + { + error ("constructor required before non-static data member " +"for %qD has been parsed", member); + DECL_INITIAL (member) = error_mark_node; + init = NULL_TREE; + } + /* Strip redundant TARGET_EXPR so we don't need to remap it, and +so the aggregate init code below will see a CONSTRUCTOR. */ + if (init && TREE_CODE (init) == TARGET_EXPR + && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (init + init = TARGET_EXPR_INITIAL (init); + init = break_out_target_exprs (init); +} + current_class_ptr = save_ccp; + current_class_ref = save_ccr; + return init; +} + /* Initialize MEMBER, a FIELD_DECL, with INIT, a TREE_LIST of arguments. If TREE_LIST is void_type_node, an empty initializer list was given; if NULL_TREE no initializer was given. */ @@ -535,31 +578,7 @@ /* Use the non-static data member initializer if there was no mem-initializer for this field. */ if (init == NULL_TREE) -{ - if (DECL_LANG_SPECIFIC (member) && DECL_TEMPLATE_INFO (member)) - /* Do deferred instantiation of the NSDMI. */ - init = (tsubst_copy_and_build - (DECL_INITIAL (DECL_TI_TEMPLATE (member)), -DECL_TI_ARGS (member), -tf_warning_or_error, member, /*function_p=*/false, -/*integral_constant_expression_p=*/false)); - else - { - init = DECL_INITIAL (member); - if (init && TREE_CODE (init) == DEFAULT_ARG) - { - error ("constructor required before non-static data member " -"for %qD has been parsed", member); - init = NULL_TREE; - } - /* Str
Re: Ok to backport r210653 (fix for PR58930) to gcc-4_9-branch?
Hi, On 07/01/2014 08:49 PM, Paul Pluzhnikov wrote: Index: gcc/testsuite/g++.dg/cpp0x/nsdmi-template11.C === --- gcc/testsuite/g++.dg/cpp0x/nsdmi-template11.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/nsdmi-template11.C (revision 212207) @@ -0,0 +1,30 @@ +// PR c++/58930 +// { dg-do compile { target c++11 } } + +struct SampleModule +{ + explicit SampleModule (int); +}; + +template < typename > +struct BaseHandler +{ + SampleModule module_ { 0 }; +}; + +BaseHandler a; +// PR c++/58930 +// { dg-do compile { target c++11 } } + +struct SampleModule +{ + explicit SampleModule (int); +}; + +template < typename > +struct BaseHandler +{ + SampleModule module_ { 0 }; +}; + +BaseHandler a; If this is what you actually committed, something went wrong with the testcases... Paolo.
Re: Ok to backport r210653 (fix for PR58930) to gcc-4_9-branch?
On Tue, Jul 1, 2014 at 12:06 PM, Paolo Carlini wrote: > If this is what you actually committed Yes. > something went wrong with the testcases... Thanks. The patch applied twice, causing doubling of the test :-( Now I have to see how that didn't cause new failures ... In the mean time, r212208 deleted the doubling. Thanks, -- Paul Pluzhnikov
Re: [PATCH, loop2_invariant, 2/2] Change heuristics for identical invariants
On 07/01/14 01:16, Zhenqiang Chen wrote: ChangeLog: 2014-07-01 Zhenqiang Chen * loop-invariant.c (struct invariant): Add a new member: eqno; (find_identical_invariants): Update eqno; (create_new_invariant): Init eqno; (get_inv_cost): Compute comp_cost wiht eqno; s/wiht/with/ Do you have a testcase for this? If at all possible I'd like to see some kind of test to verify that this tracking results in better invariant selection. With some kind of test and the ChangeLog typo fixed, this is OK. jeff
Re: [DOC Patch] Explicit Register Variables
On 06/30/14 23:51, David Wohlferd wrote: My proposed patch says "When selecting a register, choose one that is normally saved and restored by function calls on your machine. This ensures library routines which are unaware of this reservation will restore it before returning." This platform-neutral statement seems to cover what needs to be said here. Let's go with your platform-neutral statement. *If* someone comes back with real world feedback on this stuff, we can always update. Jeff
Re: [GOOGLE] Report the difference between profiled and guessed or annotated branch probabilities.
Per offline discussion, * do not export function start line number. Instead, hash branch offset and discriminator into the "function_hash" (renamed to just "hash" to clarify) * protect all operations about the new EDGE_PREDICTED_BY_EXPECT flag with flag_check_branch_annotation. On Mon, Jun 30, 2014 at 5:42 PM, Yi Yang wrote: > Fixed a style error (missing a space before a left parenthesis) > > > On Mon, Jun 30, 2014 at 5:41 PM, Yi Yang wrote: >> Done. >> >> On Mon, Jun 30, 2014 at 5:20 PM, Dehao Chen wrote: >>> For get_locus_information, can you cal get_inline_stack and directly use its >>> output to get the function name instead? >>> >>> Dehao >>> >>> >>> On Mon, Jun 30, 2014 at 4:47 PM, Yi Yang wrote: Removed fill_invalid_locus_information. Change the function call to a return statement. On Mon, Jun 30, 2014 at 4:42 PM, Dehao Chen wrote: > There is no need for fill_invalid_locus_information, just initialize > every field to 0, and if it's unknown location, no need to output this > line. > > Dehao > > On Mon, Jun 30, 2014 at 4:26 PM, Yi Yang wrote: >> Instead of storing percentages of the branch probabilities, store them >> times REG_BR_PROB_BASE. >> >> On Mon, Jun 30, 2014 at 3:26 PM, Yi Yang wrote: >>> Fixed. (outputting only the integer percentage) >>> >>> On Mon, Jun 30, 2014 at 2:20 PM, Yi Yang wrote: This is intermediate result, which is meant to be consumed by further post-processing. For this reason I'd prefer to put a number without that percentage sign. I'd just output (int)(probability*1+0.5). Does this look good for you? Or maybe change that to 100 since six digits are more than enough. I don't see a reason to intentionally drop precision though. Note that for the actual probability, the best way to store it is to store the edge count, since the probability is just edge_count/bb_count. But this causes disparity in the formats of the two probabilities. On Mon, Jun 30, 2014 at 2:12 PM, Dehao Chen wrote: > Let's use %d to replace %f (manual conversion, let's do xx%). > > Dehao > > On Mon, Jun 30, 2014 at 2:06 PM, Yi Yang > wrote: >> Fixed. >> >> Also, I spotted some warnings caused by me using "%lf"s in >> snprintf(). >> I changed these to "%f" and tested. >> >> >> On Mon, Jun 30, 2014 at 1:49 PM, Dehao Chen >> wrote: >>> You don't need extra space to store file name in >>> locus_information_t. >>> Use pointer instead. >>> >>> Dehao >>> >>> >>> On Mon, Jun 30, 2014 at 1:36 PM, Yi Yang >>> wrote: I refactored the code and added comments. A bug (prematurely breaking from a loop) was fixed during the refactoring. (My last mail was wrongly set to HTML instead of plain text. I apologize for that.) 2014-06-30 Yi Yang * auto-profile.c (get_locus_information) (fill_invalid_locus_information, record_branch_prediction_results) (afdo_calculate_branch_prob, afdo_annotate_cfg): Main comparison and reporting logic. * cfg-flags.def (PREDICTED_BY_EXPECT): Add an extra flag representing an edge's probability is predicted by annotations. * predict.c (combine_predictions_for_bb): Set up the extra flag on an edge when appropriate. * common.opt (fcheck-branch-annotation) (fcheck-branch-annotation-threshold=): Add an extra GCC option to turn on report On Fri, Jun 27, 2014 at 3:20 PM, Xinliang David Li wrote: > Hi Yi, > > 1) please add comments before new functions as documentation -- > follow > the coding style guideline > 2) missing documenation on the new flags (pointed out by > Gerald) > 3) Please refactor the check code in afdo_calculate_branch_prob > into a > helper function > > 4) the change log is not needed for google branches, but if > provided, > the format should follow the style guide (e.g, function name in > () ). > > David > > > On Fri, Jun 27, 2014 at 11:07 AM, Yi Yang > wrote:
Re: [GOOGLE] Report the difference between profiled and guessed or annotated branch probabilities.
OK for google-4_8 after testing. Thanks, Dehao On Tue, Jul 1, 2014 at 1:04 PM, Yi Yang wrote: > Per offline discussion, > * do not export function start line number. Instead, hash branch > offset and discriminator into the "function_hash" (renamed to just > "hash" to clarify) > * protect all operations about the new EDGE_PREDICTED_BY_EXPECT flag > with flag_check_branch_annotation. > > On Mon, Jun 30, 2014 at 5:42 PM, Yi Yang wrote: >> Fixed a style error (missing a space before a left parenthesis) >> >> >> On Mon, Jun 30, 2014 at 5:41 PM, Yi Yang wrote: >>> Done. >>> >>> On Mon, Jun 30, 2014 at 5:20 PM, Dehao Chen wrote: For get_locus_information, can you cal get_inline_stack and directly use its output to get the function name instead? Dehao On Mon, Jun 30, 2014 at 4:47 PM, Yi Yang wrote: > > Removed fill_invalid_locus_information. Change the function call to a > return statement. > > On Mon, Jun 30, 2014 at 4:42 PM, Dehao Chen wrote: > > There is no need for fill_invalid_locus_information, just initialize > > every field to 0, and if it's unknown location, no need to output this > > line. > > > > Dehao > > > > On Mon, Jun 30, 2014 at 4:26 PM, Yi Yang wrote: > >> Instead of storing percentages of the branch probabilities, store them > >> times REG_BR_PROB_BASE. > >> > >> On Mon, Jun 30, 2014 at 3:26 PM, Yi Yang wrote: > >>> Fixed. (outputting only the integer percentage) > >>> > >>> On Mon, Jun 30, 2014 at 2:20 PM, Yi Yang wrote: > This is intermediate result, which is meant to be consumed by further > post-processing. For this reason I'd prefer to put a number without > that percentage sign. > > I'd just output (int)(probability*1+0.5). Does this look good > for you? Or maybe change that to 100 since six digits are more > than enough. I don't see a reason to intentionally drop precision > though. > > Note that for the actual probability, the best way to store it is to > store the edge count, since the probability is just > edge_count/bb_count. But this causes disparity in the formats of the > two probabilities. > > On Mon, Jun 30, 2014 at 2:12 PM, Dehao Chen wrote: > > Let's use %d to replace %f (manual conversion, let's do xx%). > > > > Dehao > > > > On Mon, Jun 30, 2014 at 2:06 PM, Yi Yang > > wrote: > >> Fixed. > >> > >> Also, I spotted some warnings caused by me using "%lf"s in > >> snprintf(). > >> I changed these to "%f" and tested. > >> > >> > >> On Mon, Jun 30, 2014 at 1:49 PM, Dehao Chen > >> wrote: > >>> You don't need extra space to store file name in > >>> locus_information_t. > >>> Use pointer instead. > >>> > >>> Dehao > >>> > >>> > >>> On Mon, Jun 30, 2014 at 1:36 PM, Yi Yang > >>> wrote: > > I refactored the code and added comments. A bug (prematurely > breaking > from a loop) was fixed during the refactoring. > > (My last mail was wrongly set to HTML instead of plain text. I > apologize for that.) > > 2014-06-30 Yi Yang > > * auto-profile.c (get_locus_information) > (fill_invalid_locus_information, > record_branch_prediction_results) > (afdo_calculate_branch_prob, afdo_annotate_cfg): Main > comparison and > reporting logic. > * cfg-flags.def (PREDICTED_BY_EXPECT): Add an extra flag > representing > an edge's probability is predicted by annotations. > * predict.c (combine_predictions_for_bb): Set up the extra > flag on an > edge when appropriate. > * common.opt (fcheck-branch-annotation) > (fcheck-branch-annotation-threshold=): Add an extra GCC > option to turn > on report > > On Fri, Jun 27, 2014 at 3:20 PM, Xinliang David Li > wrote: > > Hi Yi, > > > > 1) please add comments before new functions as documentation -- > > follow > > the coding style guideline > > 2) missing documenation on the new flags (pointed out by > > Gerald) > > 3) Please refactor the check code in afdo_calculate_branch_prob > > into a > > helper function > > > > 4) the change log is not needed for google branches, but if > > provided, > > the format should f
Re: [GOOGLE] Report the difference between profiled and guessed or annotated branch probabilities.
and for google/gcc4_9 too. David On Tue, Jul 1, 2014 at 1:16 PM, Dehao Chen wrote: > OK for google-4_8 after testing. > > Thanks, > Dehao > > On Tue, Jul 1, 2014 at 1:04 PM, Yi Yang wrote: >> Per offline discussion, >> * do not export function start line number. Instead, hash branch >> offset and discriminator into the "function_hash" (renamed to just >> "hash" to clarify) >> * protect all operations about the new EDGE_PREDICTED_BY_EXPECT flag >> with flag_check_branch_annotation. >> >> On Mon, Jun 30, 2014 at 5:42 PM, Yi Yang wrote: >>> Fixed a style error (missing a space before a left parenthesis) >>> >>> >>> On Mon, Jun 30, 2014 at 5:41 PM, Yi Yang wrote: Done. On Mon, Jun 30, 2014 at 5:20 PM, Dehao Chen wrote: > For get_locus_information, can you cal get_inline_stack and directly use > its > output to get the function name instead? > > Dehao > > > On Mon, Jun 30, 2014 at 4:47 PM, Yi Yang wrote: >> >> Removed fill_invalid_locus_information. Change the function call to a >> return statement. >> >> On Mon, Jun 30, 2014 at 4:42 PM, Dehao Chen wrote: >> > There is no need for fill_invalid_locus_information, just initialize >> > every field to 0, and if it's unknown location, no need to output this >> > line. >> > >> > Dehao >> > >> > On Mon, Jun 30, 2014 at 4:26 PM, Yi Yang wrote: >> >> Instead of storing percentages of the branch probabilities, store them >> >> times REG_BR_PROB_BASE. >> >> >> >> On Mon, Jun 30, 2014 at 3:26 PM, Yi Yang wrote: >> >>> Fixed. (outputting only the integer percentage) >> >>> >> >>> On Mon, Jun 30, 2014 at 2:20 PM, Yi Yang wrote: >> This is intermediate result, which is meant to be consumed by >> further >> post-processing. For this reason I'd prefer to put a number without >> that percentage sign. >> >> I'd just output (int)(probability*1+0.5). Does this look >> good >> for you? Or maybe change that to 100 since six digits are more >> than enough. I don't see a reason to intentionally drop precision >> though. >> >> Note that for the actual probability, the best way to store it is to >> store the edge count, since the probability is just >> edge_count/bb_count. But this causes disparity in the formats of the >> two probabilities. >> >> On Mon, Jun 30, 2014 at 2:12 PM, Dehao Chen >> wrote: >> > Let's use %d to replace %f (manual conversion, let's do xx%). >> > >> > Dehao >> > >> > On Mon, Jun 30, 2014 at 2:06 PM, Yi Yang >> > wrote: >> >> Fixed. >> >> >> >> Also, I spotted some warnings caused by me using "%lf"s in >> >> snprintf(). >> >> I changed these to "%f" and tested. >> >> >> >> >> >> On Mon, Jun 30, 2014 at 1:49 PM, Dehao Chen >> >> wrote: >> >>> You don't need extra space to store file name in >> >>> locus_information_t. >> >>> Use pointer instead. >> >>> >> >>> Dehao >> >>> >> >>> >> >>> On Mon, Jun 30, 2014 at 1:36 PM, Yi Yang >> >>> wrote: >> >> I refactored the code and added comments. A bug (prematurely >> breaking >> from a loop) was fixed during the refactoring. >> >> (My last mail was wrongly set to HTML instead of plain text. I >> apologize for that.) >> >> 2014-06-30 Yi Yang >> >> * auto-profile.c (get_locus_information) >> (fill_invalid_locus_information, >> record_branch_prediction_results) >> (afdo_calculate_branch_prob, afdo_annotate_cfg): Main >> comparison and >> reporting logic. >> * cfg-flags.def (PREDICTED_BY_EXPECT): Add an extra flag >> representing >> an edge's probability is predicted by annotations. >> * predict.c (combine_predictions_for_bb): Set up the extra >> flag on an >> edge when appropriate. >> * common.opt (fcheck-branch-annotation) >> (fcheck-branch-annotation-threshold=): Add an extra GCC >> option to turn >> on report >> >> On Fri, Jun 27, 2014 at 3:20 PM, Xinliang David Li >> wrote: >> > Hi Yi, >> > >> > 1) please add comments before new functions as documentation >> > -- >> > follow >> > the coding style guideline >> > 2) missing documenation on the new flags (pointed out by >> > Gerald) >> > 3) Ple
Re: [DOC Patch] Explicit Register Variables
On 06/30/14 17:10, David Wohlferd wrote: - Describing Local Register Variables as "sometimes convenient for use with the extended asm feature" misses the point that this is in fact the ONLY supported use for Local Register Variables. What makes you believe that this feature is only useful for extended asms? My recollection is that for the last 20+ years this feature has served effectively as a pre-allocation of certain function scoped objects into predetermined registers. That's great feedback. The existing docs don't even mention that use. If you have a link (or if you can put together a few sentences) describing how you could use it for this, I'll add it and re-work the text. And if you can think of any other common uses, I'd be glad to add them too. I think that's fundamentally what the feature was meant to be used for; the fact that it wasn't ever well documented is unfortunate. Then again, there were many aspects of GCC's early documentation that were poor and misguided. I'm not really sure what I'd add -- the docs already largely describe the net effect. Maybe just "This extension, in effect, pre-assigns a target register to a particular variable. This option does not guarantee that GCC generates code that has ..." Not sure I really agree with this either. There's nothing inherently wrong with someone trying to use a local register variable to try and optimize code for example. Umm. Well. Hmm. You haven't said this was a good idea or even that it would work, so I guess the statement that there's nothing "inherently wrong" with it is true. Right. I personally wouldn't take that approach, but I'm far more concerned about portable code and trust the register allocators to make generally good decisions. Could someone possibly do a better job than the register allocator by using local register variables? Most likely, yes. And for some subset of developers that may be worth the maintenance pain. However, by explicitly stating it is not supported, we would be making it clear that when the next release uses registers in a slightly different way that wipes out all their "improvements," we can say "we told you that wasn't a supported use of this feature." However, I'm prepared to remove or rework this statement if you feel strongly. Well, the whole point behind the feature is to allow someone to do precisely what you're saying isn't supported. So, yea, I feel pretty strongly that such language is not appropriate. I *almost* sent this as an RFD to the gcc list. But it being such an obscure area, I wasn't really expecting much response (see https://gcc.gnu.org/ml/gcc-help/2014-04/msg00124.html for example). The items listed in my "problem description" were only highlights. As you have no doubt noticed, nearly all the text on these 2 pages got modified. If you have feedback on any of the rest of the text, I'd love to hear it. You sent it as we were approaching the 4.9 release; speaking strictly for myself, my focus is very much on fixing code generation, ICE and related regressions at that point. Everything else gets pushed down the queue. As far as further improvements to those docs; I'm happy to work with you on improving it -- but I've got a lot on my plate and really can't justify reviewing docs for some of the less important extensions like this, except in a reviewing role. jeff
Re: [DOC Patch] Explicit Register Variables
On Mon, 30 Jun 2014, David Wohlferd wrote: > I don't have permissions to commit this patch, but I do have a release on file > with the FSF. > > Problem description: > The text for using Explicit Register Variables is confusing, redundant, and > fails to make certain essential information clear. [...] Bah, Jeff already made all the good comments... :] Happy to see this area improved though! > - Unambiguous statements such as "The following uses are explicitly /not/ > supported" when describing things such as calling Basic asm discourage people > from attempting to misuse the feature. I'm somewhat wary that having an explicitly-not-supported list, would imply that some (or every) other crazy user invention is supported. > +Other implementation details: Not really _implementation_ details though, at least not all of them. Maybe "Notable details" or something. Thanks! brgds, H-P
Re: [patch] gcc fstack-protector-explicit
On Tue, Jul 1, 2014 at 2:25 PM, Jeff Law wrote: > On 03/19/14 08:06, Marcos Díaz wrote: >> >> Well, finally I have the assignment, could you please review this patch? > > Thanks. > > My first thought was that if we've marked the function with an explicit > static protector attribute, then it ought to be protected regardless of any > flags. Is there some reason to require the -fstack-protect-explicit? They can work separately, since the logic is: if NOT stack-protect-explicit a function can be protected by the current logic OR it has the attribute (a function may be not automatically protected with the current logic) ELSE // stack-protect-explicit only functions marked with the attribute will be protected. IOW, when no stack-protect-explicit, the functions may not be protected due to current logic, so the attribute acts as an override to request protection. > > The patch itself is relatively simple and I don't see anything that looks > terribly wrong at first glance. I think we just need to make sure we're on > the same page WRT needing the -fstack-protect-explicit flag. > > jeff > > -- Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 Córdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson
[patch] Fix ICEs with -gsplit-dwarf
This patch fixes a couple of ICEs when using -gsplit-dwarf. When compiling a small-enough compilation unit that has no address table entries, but complex enough that -freorder-blocks-and-partition produces location lists, dwarf2out_finish does not call index_location_lists, but optimize_location_lists will later assume that the addr_index_table has been indexed. Google ref: b/15417905 When resolve_addr_in_expr replaces a CONST_STRING rtx, it directly updates the pointer to the old expression with the new one. In the case of a DW_OP_GNU_addr_index or DW_OP_GNU_const_index, that pointer may be in an address table entry, which is keyed by the rtx. Instead of directly replacing the pointer, we need to remove the old address table entry (i.e., decrement its reference count), and add a new one. Google ref: b/15957101 Bootstrapped with no new regressions, and committed as r212211. -cary 2014-07-01 Cary Coutant gcc/ * dwarf2out.c (remove_addr_table_entry): Remove unnecessary hash table lookup. (resolve_addr_in_expr): When replacing the rtx in a location list entry, get a new address table entry. (dwarf2out_finish): Call index_location_lists even if there are no addr_index_table entries yet. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8caf940..94e98a1 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -4222,13 +4222,10 @@ add_addr_table_entry (void *addr, enum ate_kind kind) static void remove_addr_table_entry (addr_table_entry *entry) { - addr_table_entry *node; - gcc_assert (dwarf_split_debug_info && addr_index_table); - node = (addr_table_entry *) htab_find (addr_index_table, entry); /* After an index is assigned, the table is frozen. */ - gcc_assert (node->refcount > 0 && node->index == NO_INDEX_ASSIGNED); - node->refcount--; + gcc_assert (entry->refcount > 0 && entry->index == NO_INDEX_ASSIGNED); + entry->refcount--; } /* Given a location list, remove all addresses it refers to from the @@ -23102,11 +23099,16 @@ resolve_addr_in_expr (dw_loc_descr_ref loc) break; case DW_OP_GNU_addr_index: case DW_OP_GNU_const_index: - if ((loc->dw_loc_opc == DW_OP_GNU_addr_index -|| (loc->dw_loc_opc == DW_OP_GNU_const_index && loc->dtprel)) - && resolve_one_addr (&loc->dw_loc_oprnd1.val_entry->addr.rtl, -NULL)) - return false; + if (loc->dw_loc_opc == DW_OP_GNU_addr_index +|| (loc->dw_loc_opc == DW_OP_GNU_const_index && loc->dtprel)) + { +rtx rtl = loc->dw_loc_oprnd1.val_entry->addr.rtl; +if (resolve_one_addr (&rtl, NULL)) + return false; +remove_addr_table_entry (loc->dw_loc_oprnd1.val_entry); +loc->dw_loc_oprnd1.val_entry = +add_addr_table_entry (rtl, ate_kind_rtx); + } break; case DW_OP_const4u: case DW_OP_const8u: @@ -24198,18 +24200,23 @@ dwarf2out_finish (const char *filename) dwarf_strict ? DW_AT_macro_info : DW_AT_GNU_macros, macinfo_section_label); - if (dwarf_split_debug_info && addr_index_table != NULL) + if (dwarf_split_debug_info) { /* optimize_location_lists calculates the size of the lists, so index them first, and assign indices to the entries. Although optimize_location_lists will remove entries from the table, it only does so for duplicates, and therefore only reduces ref_counts to 1. */ - unsigned int index = 0; index_location_lists (comp_unit_die ()); - htab_traverse_noresize (addr_index_table, - index_addr_table_entry, &index); + + if (addr_index_table != NULL) +{ + unsigned int index = 0; + htab_traverse_noresize (addr_index_table, + index_addr_table_entry, &index); +} } + if (have_location_lists) optimize_location_lists (comp_unit_die ());
Re: [patch] Fix ICEs with -gsplit-dwarf
Any objections to backporting these fixes to the 4.9 branch? -cary On Tue, Jul 1, 2014 at 2:37 PM, Cary Coutant wrote: > This patch fixes a couple of ICEs when using -gsplit-dwarf. > > When compiling a small-enough compilation unit that has no address table > entries, but complex enough that -freorder-blocks-and-partition produces > location lists, dwarf2out_finish does not call index_location_lists, but > optimize_location_lists will later assume that the addr_index_table has > been indexed. > Google ref: b/15417905 > > When resolve_addr_in_expr replaces a CONST_STRING rtx, it directly > updates the pointer to the old expression with the new one. In the > case of a DW_OP_GNU_addr_index or DW_OP_GNU_const_index, that pointer > may be in an address table entry, which is keyed by the rtx. Instead > of directly replacing the pointer, we need to remove the old address > table entry (i.e., decrement its reference count), and add a new one. > Google ref: b/15957101 > > Bootstrapped with no new regressions, and committed as r212211. > > -cary > > > 2014-07-01 Cary Coutant > > gcc/ > * dwarf2out.c (remove_addr_table_entry): Remove unnecessary hash table > lookup. > (resolve_addr_in_expr): When replacing the rtx in a location list > entry, get a new address table entry. > (dwarf2out_finish): Call index_location_lists even if there are no > addr_index_table entries yet. > > > diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c > index 8caf940..94e98a1 100644 > --- a/gcc/dwarf2out.c > +++ b/gcc/dwarf2out.c > @@ -4222,13 +4222,10 @@ add_addr_table_entry (void *addr, enum ate_kind kind) > static void > remove_addr_table_entry (addr_table_entry *entry) > { > - addr_table_entry *node; > - >gcc_assert (dwarf_split_debug_info && addr_index_table); > - node = (addr_table_entry *) htab_find (addr_index_table, entry); >/* After an index is assigned, the table is frozen. */ > - gcc_assert (node->refcount > 0 && node->index == NO_INDEX_ASSIGNED); > - node->refcount--; > + gcc_assert (entry->refcount > 0 && entry->index == NO_INDEX_ASSIGNED); > + entry->refcount--; > } > > /* Given a location list, remove all addresses it refers to from the > @@ -23102,11 +23099,16 @@ resolve_addr_in_expr (dw_loc_descr_ref loc) > break; >case DW_OP_GNU_addr_index: >case DW_OP_GNU_const_index: > - if ((loc->dw_loc_opc == DW_OP_GNU_addr_index > -|| (loc->dw_loc_opc == DW_OP_GNU_const_index && loc->dtprel)) > - && resolve_one_addr (&loc->dw_loc_oprnd1.val_entry->addr.rtl, > -NULL)) > - return false; > + if (loc->dw_loc_opc == DW_OP_GNU_addr_index > +|| (loc->dw_loc_opc == DW_OP_GNU_const_index && loc->dtprel)) > + { > +rtx rtl = loc->dw_loc_oprnd1.val_entry->addr.rtl; > +if (resolve_one_addr (&rtl, NULL)) > + return false; > +remove_addr_table_entry (loc->dw_loc_oprnd1.val_entry); > +loc->dw_loc_oprnd1.val_entry = > +add_addr_table_entry (rtl, ate_kind_rtx); > + } > break; >case DW_OP_const4u: >case DW_OP_const8u: > @@ -24198,18 +24200,23 @@ dwarf2out_finish (const char *filename) >dwarf_strict ? DW_AT_macro_info : DW_AT_GNU_macros, >macinfo_section_label); > > - if (dwarf_split_debug_info && addr_index_table != NULL) > + if (dwarf_split_debug_info) > { >/* optimize_location_lists calculates the size of the lists, > so index them first, and assign indices to the entries. > Although optimize_location_lists will remove entries from > the table, it only does so for duplicates, and therefore > only reduces ref_counts to 1. */ > - unsigned int index = 0; >index_location_lists (comp_unit_die ()); > - htab_traverse_noresize (addr_index_table, > - index_addr_table_entry, &index); > + > + if (addr_index_table != NULL) > +{ > + unsigned int index = 0; > + htab_traverse_noresize (addr_index_table, > + index_addr_table_entry, &index); > +} > } > + >if (have_location_lists) > optimize_location_lists (comp_unit_die ()); >
[C++ Patch] PR 51448, 53618, 58059
Hi, some time ago I started analyzing the bugs in Bugzilla involving crashes for too deep recursive template instantiation and figured out that this subset is probably the simplest to tackle (https://gcc.gnu.org/ml/gcc-patches/2013-08/msg01348.html). All these crashes involve instantiate_class_template_1 *before* the existing push_tinst_level check, via most_specialized_class, and I think it makes sense to protect it in a way very similar to that used in maybe_instantiate_noexcept. Lately I also tried simply moving the existing check before most_specialized_class and it mostly worked for C++, but regressions showed up in the libstdc++-v3 testsuite (mostly in 20_util). As regards the testcases, template/recurse.C is tweaked because the diagnostic about template instantiation depth exceed is exactly the same but isn't duplicated anymore. Anyway, tested x86_64-linux. Thanks, Paolo. / /cp 2014-07-01 Paolo Carlini PR c++/51488 PR c++/53618 PR c++/58059 * pt.c (instantiate_class_template_1): Call push_tinst_level / pop_tinst_level around most_specialized_class. /testsuite 2014-07-01 Paolo Carlini PR c++/51488 PR c++/53618 PR c++/58059 * g++.dg/cpp0x/template-recurse1.C: New. * g++.dg/template/recurse4.C: Likewise. * g++.dg/template/recurse.C: Adjust. Index: cp/pt.c === --- cp/pt.c (revision 212204) +++ cp/pt.c (working copy) @@ -8905,8 +8911,15 @@ instantiate_class_template_1 (tree type) gcc_assert (TREE_CODE (templ) == TEMPLATE_DECL); /* Determine what specialization of the original template to - instantiate. */ - t = most_specialized_class (type, tf_warning_or_error); + instantiate. Note: protect vs too deep instantiation. */ + if (push_tinst_level (type)) +{ + t = most_specialized_class (type, tf_warning_or_error); + pop_tinst_level (); +} + else +t = error_mark_node; + if (t == error_mark_node) { TYPE_BEING_DEFINED (type) = 1; Index: testsuite/g++.dg/cpp0x/template-recurse1.C === --- testsuite/g++.dg/cpp0x/template-recurse1.C (revision 0) +++ testsuite/g++.dg/cpp0x/template-recurse1.C (working copy) @@ -0,0 +1,25 @@ +// PR c++/58059 +// { dg-do compile { target c++11 } } + +template struct enable_if { typedef T type; }; +template struct enable_if { }; + +// This code is nonsense; it was produced by minimizing the problem repeatedly. +constexpr bool test_func(int value) { + return true; +} +template +struct test_class { + static constexpr int value = 0; +}; +template +struct test_class< +TParm, +// This line ultimately causes the crash. +typename enable_if::value)>::type // { dg-error "depth exceeds" } +> { + static constexpr int value = 1; +}; + +// This instantiation is required in order to crash. +template class test_class<2,void>; Index: testsuite/g++.dg/template/recurse.C === --- testsuite/g++.dg/template/recurse.C (revision 212204) +++ testsuite/g++.dg/template/recurse.C (working copy) @@ -5,9 +5,7 @@ template struct F { int operator()() { - F f;// { dg-error "incomplete type" "incomplete" } - // { dg-bogus "exceeds maximum.*exceeds maximum" "exceeds" { xfail *-*-* } 8 } -// { dg-error "exceeds maximum" "exceeds" { xfail *-*-* } 8 } + F f;// { dg-error "depth exceeds|incomplete" } return f()*I; // { dg-message "recursively" "recurse" } } }; Index: testsuite/g++.dg/template/recurse4.C === --- testsuite/g++.dg/template/recurse4.C(revision 0) +++ testsuite/g++.dg/template/recurse4.C(working copy) @@ -0,0 +1,5 @@ +// PR c++/51488 + +template struct s; +template struct s::a> {}; +s ca; // { dg-error "depth exceeds|incomplete" }
Re: [patch] Fix ICEs with -gsplit-dwarf
On 07/01/2014 02:41 PM, Cary Coutant wrote: Any objections to backporting these fixes to the 4.9 branch? Nope. Jason
Re: [C++ Patch] Replace error + error with error + inform
OK. Jason
Re: C++ PATCH for c++/61659 (undefined symbol with devirtualization)
On 07/01/2014 02:45 AM, Andreas Schwab wrote: I'm getting this ABI change, is that OK? -FUNC:_ZNK10__cxxabiv117__pbase_type_info15__pointer_catchEPKS0_PPvj@@CXXABI_1.3 Hmm, probably not, thanks. Jason
Re: [PATCH] add __attribute__ ((designated_init))
> "Joseph" == Joseph S Myers writes: [...] Joseph> Is there a reason someone using the attribute might not want the Joseph> warning? That is, why isn't -Wdesignated-init enabled by Joseph> default, given that it's only relevant to people using an Joseph> attribute whose sole function relates to the warning? I've finally updated this patch. I think I've addressed all the review comments. For reference the original thread is here: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01284.html This adds __attribute__((designated_init)) and -Wdesignated-init, a feature from sparse. This is also PR c/59855. Tom 2014-07-01 Tom Tromey PR c/59855 * doc/invoke.texi (Warning Options): Document -Wdesignated-init. * doc/extend.texi (Type Attributes): Document designated_init attribute. 2014-07-01 Tom Tromey PR c/59855 * c.opt (Wdesignated-init): New option. * c-common.c (c_common_attribute_table): Add "designated_init". (handle_designated_init): New function. 2014-07-01 Tom Tromey * c-typeck.c (struct constructor_stack) : New field. (really_start_incremental_init, push_init_level): Initialize designator_depth. (pop_init_level): Set global designator_depth. (process_init_element): Check for designated_init attribute. 2014-07-01 Tom Tromey PR c/59855 * gcc.dg/Wdesignated-init.c: New file. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index ee89fca..79d0f2f 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -380,6 +380,7 @@ static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *); static tree handle_omp_declare_target_attribute (tree *, tree, tree, int, bool *); +static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *); static void check_function_nonnull (tree, int, tree *); static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT); @@ -773,6 +774,8 @@ const struct attribute_spec c_common_attribute_table[] = handle_alloc_align_attribute, false }, { "assume_aligned",1, 2, false, true, true, handle_assume_aligned_attribute, false }, + { "designated_init",0, 0, false, true, false, + handle_designated_init_attribute, false }, { NULL, 0, 0, false, false, false, NULL, false } }; @@ -9275,6 +9278,21 @@ handle_returns_nonnull_attribute (tree *node, tree, tree, int, return NULL_TREE; } +/* Handle a "designated_init" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_designated_init_attribute (tree *node, tree name, tree, int, + bool *no_add_attrs) +{ + if (TREE_CODE (*node) != RECORD_TYPE) +{ + error ("%qE attribute is only valid on % type", name); + *no_add_attrs = true; +} + return NULL_TREE; +} + /* Check for valid arguments being passed to a function with FNTYPE. There are NARGS arguments in the array ARGARRAY. */ diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index c89040a..6517790 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -359,6 +359,10 @@ Wdeprecated C C++ ObjC ObjC++ Var(warn_deprecated) Init(1) Warning Warn if a deprecated compiler feature, class, method, or field is used +Wdesignated-init +C ObjC Var(warn_designated_init) Init(1) Warning +Warn about positional initialization of structs requiring designated initializers + Wdiscarded-qualifiers C ObjC Var(warn_discarded_qualifiers) Init(1) Warning Warn if type qualifiers on pointers are discarded diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 35bfd14..c0f3912 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -6946,6 +6946,7 @@ struct constructor_stack char outer; char incremental; char designated; + int designator_depth; }; static struct constructor_stack *constructor_stack; @@ -7117,6 +7118,7 @@ really_start_incremental_init (tree type) p->outer = 0; p->incremental = constructor_incremental; p->designated = constructor_designated; + p->designator_depth = designator_depth; p->next = 0; constructor_stack = p; @@ -7266,6 +7268,7 @@ push_init_level (location_t loc, int implicit, p->outer = 0; p->incremental = constructor_incremental; p->designated = constructor_designated; + p->designator_depth = designator_depth; p->next = constructor_stack; p->range_stack = 0; constructor_stack = p; @@ -7573,6 +7576,7 @@ pop_init_level (location_t loc, int implicit, constructor_erroneous = p->erroneous; constructor_incremental = p->incremental; constructor_designated = p->designated; + designator_depth = p->designator_depth; constructor_pending_elts = p->pending_elts; constructor_depth = p-
Re: [C++] make TYPE_DECLs public for builtin type and templates
On 06/30/2014 03:27 PM, Jan Hubicka wrote: This catches two cases in C++ FE and several other cases elsewhere. Does something like this make sense? I think bulitin_types are generally public, but I am not quite sure about templates. Template parms have no linkage, but they certainly don't prevent a template from being public. So I guess setting TREE_PUBLIC makes sense. I also wonder if I should copy PUBLIC flag from component type in complex numbers - can we produce complex number from anonymous type? Only from built-in types I think, but it wouldn't hurt to copy TREE_PUBLIC from component_type. Finally type_in_anonymous_namespace_p needs to be extended into two cases where the type is considered nonanonymous by lack of DECL_NAME. I would think the right fix is to avoid calling it for non-class types? Jason
libgo patch committed: Build targets for benchmarks
This patch from Peter Collingbourne makes it easier to run the libgo benchmarks using "make bench" in the libgo build directory. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 7650eafca8af libgo/Makefile.am --- a/libgo/Makefile.am Tue Jun 24 16:49:15 2014 -0700 +++ b/libgo/Makefile.am Tue Jul 01 16:18:18 2014 -0700 @@ -1996,6 +1996,7 @@ $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files GOTESTFLAGS = +GOBENCH = # Check a package. CHECK = \ @@ -2015,6 +2016,8 @@ rm -f $@-testsum $@-testlog; \ if test "$(USE_DEJAGNU)" = "yes"; then \ $(SHELL) $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ + elif test "$(GOBENCH)" != ""; then \ + $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" --bench="$(GOBENCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ else \ if $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) >>$@-testlog 2>&1; then \ echo "PASS: $(@D)" >> $@-testlog; \ @@ -3845,6 +3848,9 @@ check-multi: $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE) +bench: + -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=. + MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep mostlyclean-local: diff -r 7650eafca8af libgo/testsuite/gotest --- a/libgo/testsuite/gotest Tue Jun 24 16:49:15 2014 -0700 +++ b/libgo/testsuite/gotest Tue Jul 01 16:18:18 2014 -0700 @@ -36,6 +36,7 @@ GOARCH="" timeout=240 testname="" +bench="" trace=false while $loop; do case "x$1" in @@ -124,6 +125,15 @@ testname=`echo $1 | sed -e 's/^--testname=//'` shift ;; + x--bench) + bench=$2 + shift + shift + ;; + x--bench=*) + bench=`echo $1 | sed -e 's/^--bench=//'` + shift + ;; x--trace) trace=true shift @@ -473,20 +483,28 @@ fi ${GL} *.o ${GOLIBS} - if test "$trace" = "true"; then - echo ./a.out -test.short -test.timeout=${timeout}s "$@" - fi - ./a.out -test.short -test.timeout=${timeout}s "$@" & - pid=$! - (sleep `expr $timeout + 10` - echo > gotest-timeout - echo "timed out in gotest" 1>&2 - kill -9 $pid) & - alarmpid=$! - wait $pid - status=$? - if ! test -f gotest-timeout; then - kill $alarmpid + if test "$bench" = ""; then + if test "$trace" = "true"; then + echo ./a.out -test.short -test.timeout=${timeout}s "$@" + fi + ./a.out -test.short -test.timeout=${timeout}s "$@" & + pid=$! + (sleep `expr $timeout + 10` + echo > gotest-timeout + echo "timed out in gotest" 1>&2 + kill -9 $pid) & + alarmpid=$! + wait $pid + status=$? + if ! test -f gotest-timeout; then + kill $alarmpid + fi + else + if test "$trace" = "true"; then + echo ./a.out -test.run=^\$ -test.bench="${bench}" "$@" + fi + ./a.out -test.run=^\$ -test.bench="${bench}" "$@" + status=$? fi exit $status ;;
Re: [PATCH 3/5] IPA ICF pass
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c > new file mode 100644 > index 000..8a13dca > --- /dev/null > +++ b/gcc/ipa-icf.c > +/* Itializes internal structures according to given number of initialize > + if (is_a_helper::test (node)) shouldn't you just use is_a (node) ? > +sem_item_optimizer::filter_removed_items (void) > +{ > + vec filtered; > + filtered.create (m_items.length()); use auto_vec here? > + m_items.release (); > + > + for (unsigned int i = 0; i < filtered.length(); i++) > +m_items.safe_push (filtered[i]); hrm, maybe adding vec::swap makes sense. > + if (c->members.length() > 1) > + { > + vec new_vector; > + new_vector.create (c->members.length ()); same comment about auto_vec and swap. > +bool > +sem_item_optimizer::release_split_map (__attribute__((__unused__)) > congruence_class * > +const &cls, > +__attribute__((__unused__)) bitmap const > &b, that one is definitly used > +__attribute__((__unused__)) > traverse_split_pair *pair) Why can't you just leave the arguments unnamed to fix the warning? > +sem_item_optimizer::do_congruence_step_for_index (congruence_class *cls, > +unsigned int index) > +{ > + hash_map *split_map = > + new hash_map (); why aren't you putting the hash_map on the stack? in any case it looks like you fail to delete it when your done with it. > diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h > new file mode 100644 > index 000..d328dd6 > --- /dev/null > +++ b/gcc/ipa-icf.h > @@ -0,0 +1,743 @@ > +/* Prints string STRING to a FILE with a given number of SPACE_COUNT. */ > +#define FPUTS_SPACES(file, space_count, string) \ > + do \ > + { \ > +fprintf (file, "%*s" string, space_count, " "); \ seems like you could do this with a static inline function. > +/* Prints a MESSAGE to dump_file if exists. */ > +#define SE_DUMP_MESSAGE(message) \ > + do \ > + { \ > +if (dump_file && (dump_flags & TDF_DETAILS)) \ > + fprintf (dump_file, " debug message: %s (%s:%u)\n", message, > __func__, __LINE__); \ a inline function that used the builtins like the memory statis stuff might be slightly less ugly imho > +/* Logs a MESSAGE to dump_file if exists and returns false. */ > +#define SE_EXIT_FALSE_WITH_MSG(message) \ > + do \ > + { \ > +if (dump_file && (dump_flags & TDF_DETAILS)) \ > + fprintf (dump_file, " false returned: '%s' (%s:%u)\n", message, > __func__, __LINE__); \ > +return false; \ > + } \ > + while (false); ugh macros that effect control flow, instead maybe define a inline function that does the logging and then returns the value you want your function to return so you can write if (whatever) return SE_LOG (NULL, "something or other"); ? > +/* Forward declaration for sem_func class. */ > +class sem_item; comment is wrong, and imho useless. > + /* Initializes internal structures according to given number of > + source and target SSA names. The number of source names is SSA_SOURCE, > + respectively SSA_TARGET. */ > + func_checker (unsigned ssa_source, unsigned sss_target); ssa_target? > + /* Source to target edge map. */ > + hash_map *m_edge_map; is there a reason to not embedd these in the object? you seem to create them in the ctor and delete them in the dtor, so I expect they have teh same lifetime. > +/* Basic block struct for sematic equality pass. */ semantic? > +typedef struct sem_bb you don't need the typedef in C++ > + /* Item type. */ > + enum sem_item_type type; loose the enum keyword since you don't need it? > +class sem_function: public sem_item > +{ > + /* COMPARED_FUNC is a function that we compare to. */ > + sem_function *m_compared_func; this feels like a weird place for this, would func_checker maybe make more sense as a place to put it? > +class sem_variable: public sem_item > +{ > + /* Initializes references to other semantic functions/variables. */ > + inline virtual void init_refs () iirc defining with in a class definition implies inline. > +typedef struct congruence_class_group > +{ > + hashval_t hash; > + sem_item_type type; > + vec classes; > +} congruence_class_group_t; lose the typedef? > + /* Returns true if a congruence class CLS is presented in worklist. */ s/presented/present/ ? Trev
Re: [C++] make TYPE_DECLs public for builtin type and templates
> On 06/30/2014 03:27 PM, Jan Hubicka wrote: > >This catches two cases in C++ FE and several other cases elsewhere. > >Does something like this make sense? I think bulitin_types are > >generally public, but I am not quite sure about templates. > > Template parms have no linkage, but they certainly don't prevent a > template from being public. So I guess setting TREE_PUBLIC makes > sense. > > >I also wonder if I should copy > >PUBLIC flag from component type in complex numbers - can we produce complex > >number from anonymous type? > > Only from built-in types I think, but it wouldn't hurt to copy > TREE_PUBLIC from component_type. OK, I updated my copy of the patch. > > >Finally type_in_anonymous_namespace_p needs to be extended into two cases > >where > >the type is considered nonanonymous by lack of DECL_NAME. > > I would think the right fix is to avoid calling it for non-class types? I am trying to make LTO tree streaming to not unify types that are known to be local to a compilation unit. This allows better TBAA to be preserved, since two anonymous namespace types from two different unit are not the same. I want to avoid the overhead of SCC hashing and canonical type computation for these and here I want the concept of anonymous namespace types to be closed upwards. That is if I have type that is not considered anonymous it should not be built from non-anonymous types. So here I need to test anonymity of non-class types... Thanks for looking into this! Honza
ipa-devirt tweeks
Hi, this is a preparation patch for the ODR type work. It removes odr comparsion code from tree.c that never worked (because it misses names of template parameters) and is for quite a while replaced by compared assembler names of virtual tables of polymorphic types. I plan to extend this trick and stream mangled names of all non-anonymous types in C++. The ODR hash is now hashing types by their names not only main variants, it allows inserting incomplete types and later replacing them by complete variants and it records cases where ODR violations was found. I also added checks needed to make odr hash work on all types, not only classes, so we need to watch out before accessing TYPE_BINFO. There are no functional changes with current code, Bootstrapped/regtested x86_64-linux and tested with patches enabling the new code paths on Firefox/LTO bootstrap, comitted. * tree.c (decls_same_for_odr, decls_same_for_odr, types_same_for_odr): Remove. (type_in_anonymous_namespace_p): Constify argument. * tree.h (types_same_for_odr, type_in_anonymous_namespace_p): Constify. * ipa-devirt.c (odr_type_d): Add ODR_VIOLATED field. (main_odr_variant): New function. (hash_type_name): Make static; update assert; do not ICE on non-records. (types_same_for_odr): Bring here from tree.c; simplify and remove old structural comparing code that doesn't work for templates. (odr_hasher::equal): Update assert. (add_type_duplicate): Return true when bases should be computed; replace incomplete loader by complete; do not output duplicated warnings; do not ICE on non-records; set odr_violated flag. (get_odr_type): Be ready to replace incomplete type by complete one; work on ODR variants instead of main variants; reorder item in array so bases have still smaller indexes. (dump_type_inheritance_graph): Be ready for holdes in odr_types array. (possible_polymorphic_call_targets): Do not ICE when BINFO is NULL. Index: tree.c === --- tree.c (revision 212211) +++ tree.c (working copy) @@ -232,7 +232,6 @@ static void print_value_expr_statistics static int type_hash_marked_p (const void *); static unsigned int type_hash_list (const_tree, hashval_t); static unsigned int attribute_hash_list (const_tree, hashval_t); -static bool decls_same_for_odr (tree decl1, tree decl2); tree global_trees[TI_MAX]; tree integer_types[itk_none]; @@ -11821,151 +11820,6 @@ lhd_gcc_personality (void) return gcc_eh_personality_decl; } -/* For languages with One Definition Rule, work out if - trees are actually the same even if the tree representation - differs. This handles only decls appearing in TYPE_NAME - and TYPE_CONTEXT. That is NAMESPACE_DECL, TYPE_DECL, - RECORD_TYPE and IDENTIFIER_NODE. */ - -static bool -same_for_odr (tree t1, tree t2) -{ - if (t1 == t2) -return true; - if (!t1 || !t2) -return false; - /* C and C++ FEs differ by using IDENTIFIER_NODE and TYPE_DECL. */ - if (TREE_CODE (t1) == IDENTIFIER_NODE - && TREE_CODE (t2) == TYPE_DECL - && DECL_FILE_SCOPE_P (t1)) -{ - t2 = DECL_NAME (t2); - gcc_assert (TREE_CODE (t2) == IDENTIFIER_NODE); -} - if (TREE_CODE (t2) == IDENTIFIER_NODE - && TREE_CODE (t1) == TYPE_DECL - && DECL_FILE_SCOPE_P (t2)) -{ - t1 = DECL_NAME (t1); - gcc_assert (TREE_CODE (t1) == IDENTIFIER_NODE); -} - if (TREE_CODE (t1) != TREE_CODE (t2)) -return false; - if (TYPE_P (t1)) -return types_same_for_odr (t1, t2); - if (DECL_P (t1)) -return decls_same_for_odr (t1, t2); - return false; -} - -/* For languages with One Definition Rule, work out if - decls are actually the same even if the tree representation - differs. This handles only decls appearing in TYPE_NAME - and TYPE_CONTEXT. That is NAMESPACE_DECL, TYPE_DECL, - RECORD_TYPE and IDENTIFIER_NODE. */ - -static bool -decls_same_for_odr (tree decl1, tree decl2) -{ - if (decl1 && TREE_CODE (decl1) == TYPE_DECL - && DECL_ORIGINAL_TYPE (decl1)) -decl1 = DECL_ORIGINAL_TYPE (decl1); - if (decl2 && TREE_CODE (decl2) == TYPE_DECL - && DECL_ORIGINAL_TYPE (decl2)) -decl2 = DECL_ORIGINAL_TYPE (decl2); - if (decl1 == decl2) -return true; - if (!decl1 || !decl2) -return false; - gcc_checking_assert (DECL_P (decl1) && DECL_P (decl2)); - if (TREE_CODE (decl1) != TREE_CODE (decl2)) -return false; - if (TREE_CODE (decl1) == TRANSLATION_UNIT_DECL) -return true; - if (TREE_CODE (decl1) != NAMESPACE_DECL - && TREE_CODE (decl1) != TYPE_DECL) -return false; - if (!DECL_NAME (decl1)) -return false; - gcc_checking_assert (TREE_CODE (DECL_NAME (decl1)) == IDENTIFIER_NODE); - gcc_checking_assert (!DECL_NAME (decl2) - || TREE_CODE (DECL_NAME (decl2)) == IDENTIFIER_NODE);
*ping* - [Patch, Fortran] Coarray fixes for select type/associate and type of derived components
On June 29, 2014, Tobias Burnus wrote: This patch fixes some issues with polymorphic coarrays. I still have to fix at least one issue. Fixed by the patch: a) The temporary pointer generated with SELECT TYPE has to be a coarray. That's fixed with the resolve.c patch. The comment is also bogus: The comment is correct – and gfortran correctly detects coindexed variables as selector. However, in the code in question, the selector is not coindexed but the variable in the coindexed section is. b) It doesn't make sense to try to initialize the temporary pointer of SELECT TYPE (or ASSOCIATE), thus we have to exclude it also in trans-decl.c c) As the temporary variable is internally a pointer, the assert in trans-array.c also has to accept a pointer – even though coarrays with token in the descriptor can only be allocatable. But for code like "a(1)[1])", "a(1)" is not longer a pointer – and one ends up having an akind of unknown. Instead of adding all kind of values, I simply removed the assert. d) In trans-intrinsic.c, one has a similar issue. We now avoid an ICE by checking whether the variable is set before accessing it. e) For caf(:)[i]%a, we had the dtype of the descriptor of "caf" instead of "...%a". That's now fixed. Build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias PS: Still to be done for coarrays: Nonallocatable polymorphic coarray dummies. For those, the offset and the token is passed as additional argument – but that's not yet correctly handled with ASSOCIATE/SELECT TYPE. Also to be done are more type-conversion checks (beyond those which are implicitly checked by this patch) – and the handling of vector subscripts.
RE: [PATCH] Fix PR61375: cancel bswap optimization when value doesn't fit in a HOST_WIDE_INT
Ping? > -Original Message- > From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- > ow...@gcc.gnu.org] On Behalf Of Thomas Preud'homme > Sent: Thursday, June 26, 2014 9:11 AM > To: 'Jakub Jelinek' > Cc: Richard Biener; GCC Patches > Subject: RE: [PATCH] Fix PR61375: cancel bswap optimization when value > doesn't fit in a HOST_WIDE_INT > > Ok, what about the following patch and associated ChangeLog entries? > > 2014-06-24 Thomas Preud'homme > > PR tree-optimization/61375 > * tree-ssa-math-opts.c (find_bswap_or_nop_1): Cancel optimization > if > symbolic number cannot be represented in an unsigned > HOST_WIDE_INT. > (execute_optimize_bswap): Cancel optimization if CHAR_BIT != 8. > > 2014-06-24 Thomas Preud'homme > > PR tree-optimization/61375 > * gcc.c-torture/execute/pr61375-1.c: New test. > > > diff --git a/gcc/testsuite/gcc.c-torture/execute/pr61375.c > b/gcc/testsuite/gcc.c-torture/execute/pr61375.c > new file mode 100644 > index 000..6fb4693 > --- /dev/null > +++ b/gcc/testsuite/gcc.c-torture/execute/pr61375.c > @@ -0,0 +1,35 @@ > +#ifdef __UINT64_TYPE__ > +typedef __UINT64_TYPE__ uint64_t; > +#else > +typedef unsigned long long uint64_t; > +#endif > + > +#ifndef __SIZEOF_INT128__ > +#define __int128 long long > +#endif > + > +/* Some version of bswap optimization would ICE when analyzing a mask > constant > + too big for an HOST_WIDE_INT (PR61375). */ > + > +__attribute__ ((noinline, noclone)) uint64_t > +uint128_central_bitsi_ior (unsigned __int128 in1, uint64_t in2) > +{ > + __int128 mask = (__int128)0x << 56; > + return ((in1 & mask) >> 56) | in2; > +} > + > +int > +main (int argc) > +{ > + __int128 in = 1; > +#ifdef __SIZEOF_INT128__ > + in <<= 64; > +#endif > + if (sizeof (uint64_t) * __CHAR_BIT__ != 64) > +return 0; > + if (sizeof (unsigned __int128) * __CHAR_BIT__ != 128) > +return 0; > + if (uint128_central_bitsi_ior (in, 2) != 0x102) > +__builtin_abort (); > + return 0; > +} > diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c > index 9ff857c..045bf48 100644 > --- a/gcc/tree-ssa-math-opts.c > +++ b/gcc/tree-ssa-math-opts.c > @@ -1740,6 +1740,8 @@ find_bswap_1 (gimple stmt, struct > symbolic_number *n, int limit) > n->size = TYPE_PRECISION (TREE_TYPE (rhs1)); > if (n->size % BITS_PER_UNIT != 0) > return NULL_TREE; > + if (n->size > HOST_BITS_PER_WIDEST_INT) > + return NULL_TREE; > n->size /= BITS_PER_UNIT; > n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 : > (unsigned HOST_WIDEST_INT)0x08070605 << 32 | > 0x04030201); > @@ -1781,6 +1783,8 @@ find_bswap_1 (gimple stmt, struct > symbolic_number *n, int limit) > type_size = TYPE_PRECISION (gimple_expr_type (stmt)); > if (type_size % BITS_PER_UNIT != 0) > return NULL_TREE; > + if (type_size > (int) HOST_BITS_PER_WIDEST_INT) > + return NULL_TREE; > > if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT))) > { > @@ -1911,7 +1915,7 @@ execute_optimize_bswap (void) >bool changed = false; >tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, > bswap64_type = NULL_TREE; > > - if (BITS_PER_UNIT != 8) > + if (BITS_PER_UNIT != 8 || CHAR_BIT != 8) > return 0; > >if (sizeof (HOST_WIDEST_INT) < 8) > > Is this ok for 4.8 and 4.9 branches? > > Best regards, > > Thomas > >
[Patch, Fortran, committed] Fix race condition in coarray test case
I have committed the attached test case as Rev. 212220. The problem popped up with the MPI version of the library. The race came apparent with Open MPI 1.8 (but not 1.7) which shows how the one-sided communication in Open MPI improved with 1.8 … Tobias Index: gcc/testsuite/ChangeLog === --- gcc/testsuite/ChangeLog (Revision 212219) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,9 @@ +2014-07-02 Tobias Burnus + + * gfortran.dg/coarray/get_array.f90: Add missing SYNC ALL. + * gfortran.dg/coarray/send_array.f90: Ditto. + * gfortran.dg/coarray/sendget_array.f90: Ditto. + 2014-07-01 James Greenhalgh Yufeng Zhang Index: gcc/testsuite/gfortran.dg/coarray/get_array.f90 === --- gcc/testsuite/gfortran.dg/coarray/get_array.f90 (Revision 212219) +++ gcc/testsuite/gfortran.dg/coarray/get_array.f90 (Arbeitskopie) @@ -52,6 +52,7 @@ contains if (any (a /= c)) then call abort() end if +sync all ! Scalar assignment caf = -42 @@ -76,6 +77,7 @@ contains if (any (a /= c)) then call abort() end if +sync all ! Array sections with different ranges and pos/neg strides do i_sgn1 = -1, 1, 2 @@ -101,6 +103,7 @@ contains if (any (c /= a)) then call abort() end if +sync all end do end do end do @@ -135,6 +138,7 @@ contains if (any (a /= c)) then call abort() end if +sync all ! Scalar assignment caf = -42 @@ -159,6 +163,7 @@ contains if (any (a /= c)) then call abort() end if +sync all ! Array sections with different ranges and pos/neg strides do i_sgn1 = -1, 1, 2 @@ -184,6 +189,7 @@ contains if (any (c /= a)) then call abort() end if +sync all end do end do end do @@ -218,6 +224,7 @@ contains if (any (a /= c)) then call abort() end if +sync all ! Scalar assignment caf = -42 @@ -242,6 +249,7 @@ contains if (any (a /= c)) then call abort() end if +sync all ! Array sections with different ranges and pos/neg strides do i_sgn1 = -1, 1, 2 @@ -267,6 +275,7 @@ contains if (any (c /= a)) then call abort() end if +sync all end do end do end do Index: gcc/testsuite/gfortran.dg/coarray/send_array.f90 === --- gcc/testsuite/gfortran.dg/coarray/send_array.f90 (Revision 212219) +++ gcc/testsuite/gfortran.dg/coarray/send_array.f90 (Arbeitskopie) @@ -44,6 +44,7 @@ contains if (any (a /= caf)) & call abort() end if +sync all ! Whole array: ARRAY = ARRAY caf = -42 @@ -58,6 +59,7 @@ contains if (any (a /= caf)) & call abort() end if +sync all ! Scalar assignment caf = -42 @@ -90,6 +92,7 @@ contains if (any (a /= caf)) & call abort() end if +sync all ! Array sections with different ranges and pos/neg strides do i_sgn1 = -1, 1, 2 @@ -136,6 +139,7 @@ contains call abort() endif end if +sync all end do end do end do @@ -183,6 +187,7 @@ contains if (any (a /= caf)) & call abort() end if +sync all ! Scalar assignment caf = -42 @@ -215,6 +220,7 @@ contains if (any (a /= caf)) & call abort() end if +sync all ! Array sections with different ranges and pos/neg strides do i_sgn1 = -1, 1, 2 @@ -261,6 +267,7 @@ contains call abort() endif end if +sync all end do end do end do @@ -308,6 +315,7 @@ contains if (any (a /= caf)) & call abort() end if +sync all ! Scalar assignment caf = -42 @@ -386,6 +394,7 @@ contains call abort() endif end if +sync all end do end do end do Index: gcc/testsuite/gfortran.dg/coarray/sendget_array.f90 === --- gcc/testsuite/gfortran.dg/coarray/sendget_array.f90 (Revision 212219) +++ gcc/testsuite/gfortran.dg/coarray/sendget_array.f90 (Arbeitskopie) @@ -52,6 +52,7 @@ contains if (any (a /= caf2)) then call abort(
Re: [PATCH ARM]Handle REG addressing mode in output_move_neon explicitly
On Mon, May 5, 2014 at 8:21 AM, bin.cheng wrote: > > >> -Original Message- >> From: Richard Earnshaw >> Sent: Thursday, May 01, 2014 10:03 PM >> To: Bin Cheng >> Cc: gcc-patches@gcc.gnu.org >> Subject: Re: [PATCH ARM]Handle REG addressing mode in >> output_move_neon explicitly >> >> On 29/04/14 04:02, bin.cheng wrote: >> > Hi, >> > Function output_move_neon now generates vld1.64 for memory ref like >> > "dx <- [r1:SI]", this is bogus because it requires at least 64-bit >> > alignment for 32-bit aligned memory ref. It works now because GCC >> > doesn't generate such insns in the first place, but things are going >> > to change if memset/memcpy calls are inlined by using neon instructions. >> > >> >> V[LD/ST]1.64 only need to be 64-bit aligned if strict alignment is > enabled. We >> normally assume that not to be the case. The exception to this is when an > theoretically, this doesn't make the problem go away, right? > >> explicit alignment check is used in the address expression (the :64 > suffix), >> which causes the address to be checked for strict alignment at all times. >> >> Do you have a testcase? > I can't provide a test case without the memset inlining patch. > Are the tests in the memset inlining patch now sufficient to expose the problem or do we need another test ? Ramana > Thanks, > bin > > > >