Re: [Patch] Teach genrecog/genoutput that scratch registers require write constraint modifiers
Tested on ia64-suse-linux and checked in as obvious. Andreas. * config/ia64/ia64.md: Remove constraints from define_split patterns. diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md index 986ef02..572870f 100644 --- a/gcc/config/ia64/ia64.md +++ b/gcc/config/ia64/ia64.md @@ -2565,7 +2565,7 @@ [(set (match_operand:TI 0 register_operand ) (minus:TI (match_operand:TI 1 register_operand ) (match_operand:TI 2 register_operand ))) - (clobber (match_scratch:BI 3 =c))] + (clobber (match_scratch:BI 3 ))] reload_completed [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2))) (set (match_dup 3) (ltu:BI (match_dup 1) (match_dup 0))) @@ -2587,7 +2587,7 @@ [(set (match_operand:TI 0 register_operand ) (minus:TI (match_operand:TI 1 immediate_operand ) (match_operand:TI 2 register_operand ))) - (clobber (match_scratch:BI 3 =c))] + (clobber (match_scratch:BI 3 ))] reload_completed satisfies_constraint_K (operands[1]) [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2))) (set (match_dup 3) (gtu:BI (match_dup 0) (match_dup 1))) @@ -4152,7 +4152,7 @@ [(set (match_operand:DI 0 register_operand ) (if_then_else:DI (match_operator 4 predicate_operator - [(match_operand:BI 1 register_operand c,c) + [(match_operand:BI 1 register_operand ) (const_int 0)]) (neg:DI (match_operand:DI 2 gr_reg_or_22bit_operand )) (match_operand:DI 3 gr_reg_or_22bit_operand )))] @@ -4167,7 +4167,7 @@ [(set (match_operand:DI 0 register_operand ) (if_then_else:DI (match_operator 4 predicate_operator - [(match_operand:BI 1 register_operand c,c) + [(match_operand:BI 1 register_operand ) (const_int 0)]) (neg:DI (match_operand:DI 2 gr_reg_or_22bit_operand )) (match_operand:DI 3 gr_reg_or_22bit_operand )))] @@ -4220,7 +4220,7 @@ [(set (match_operand:SI 0 register_operand ) (if_then_else:SI (match_operator 4 predicate_operator - [(match_operand:BI 1 register_operand c,c) + [(match_operand:BI 1 register_operand ) (const_int 0)]) (neg:SI (match_operand:SI 2 gr_reg_or_22bit_operand )) (match_operand:SI 3 gr_reg_or_22bit_operand )))] @@ -4235,7 +4235,7 @@ [(set (match_operand:SI 0 register_operand ) (if_then_else:SI (match_operator 4 predicate_operator - [(match_operand:BI 1 register_operand c,c) + [(match_operand:BI 1 register_operand ) (const_int 0)]) (neg:SI (match_operand:SI 2 gr_reg_or_22bit_operand )) (match_operand:SI 3 gr_reg_or_22bit_operand )))] -- 2.1.0 -- 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.
[PATCH] Fix whitespace in comments.
A somewhat trivial patch to cleanup whitespace issues in comments: sed s/\. \*\//\. \*\//g Tested with a recompile only. Ok for trunk ? gcc/fortran/ChangeLog: 2014-09-20 Joost VandeVondele vond...@gcc.gnu.org * trans-expr.c (gfc_reset_vptr): Fix comment whitespace. (gfc_conv_class_to_class): Likewise. (gfc_conv_procedure_call): Likewise. (arrayfunc_assign_needs_temporary): Likewise. (realloc_lhs_loop_for_fcn_call): Likewise. (gfc_trans_assignment_1): Likewise. * trans-array.c (gfc_conv_array_ref): Likewise. (gfc_array_allocate): Likewise. (gfc_alloc_allocatable_for_assignment): Likewise. * symbol.c (generate_isocbinding_symbol): Likewise. * class.c (finalization_scalarizer): Likewise. (finalizer_insert_packed_call): Likewise. (generate_finalization_wrapper): Likewise. (find_intrinsic_vtab): Likewise. * decl.c (gfc_match_import): Likewise. (match_procedure_decl): Likewise. (gfc_match_subroutine): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_volatile): Likewise. * trans-common.c (create_common): Likewise. * error.c (gfc_diagnostic_starter): Likewise. * trans-stmt.c (gfc_trans_sync): Likewise. (gfc_trans_critical): Likewise. (gfc_trans_simple_do): Likewise. (gfc_trans_do): Likewise. (gfc_trans_where_assign): Likewise. * expr.c (gfc_is_simply_contiguous): Likewise. * module.c (unquote_string): Likewise. * trans.c (gfc_add_finalizer_call): Likewise. * trans-types.c (gfc_init_kinds): Likewise. * scanner.c (preprocessor_line): Likewise. * gfortranspec.c (lang_specific_driver): Likewise. * frontend-passes.c (create_var): Likewise. (cfe_expr_0): Likewise. * resolve.c (check_host_association): Likewise. (gfc_resolve_code): Likewise. (resolve_fl_derived0): Likewise. (resolve_symbol): Likewise. * f95-lang.c (poplevel): Likewise. * trans-decl.c (create_main_function): Likewise. * trans-io.c (transfer_expr): Likewise. * arith.c (gfc_arith_divide): Likewise. * parse.c (resolve_all_program_units): Likewise. * check.c (gfc_check_rank): Likewise. (gfc_check_sizeof): Likewise. (is_c_interoperable): Likewise. * dependency.c (gfc_dep_difference): Likewise. * primary.c (gfc_match_rvalue): Likewise. * trans-intrinsic.c (conv_intrinsic_system_clock): Likewise. (conv_isocbinding_subroutine): Likewise. * options.c (gfc_post_options): Likewise. (gfc_handle_fpe_option): Likewise. (gfc_get_option_string): Likewise. * simplify.c (simplify_transformation_to_scalar): Likewise. (gfc_simplify_spread): Likewise. Index: gcc/fortran/trans-expr.c === --- gcc/fortran/trans-expr.c (revision 215323) +++ gcc/fortran/trans-expr.c (working copy) @@ -231,7 +231,7 @@ gfc_reset_vptr (stmtblock_t *block, gfc_ gfc_ref *ref; /* If we have a class array, we need go back to the class - container. */ + container. */ if (lhs-ref lhs-ref-next !lhs-ref-next-next lhs-ref-next-type == REF_ARRAY lhs-ref-next-u.ar.type == AR_FULL @@ -729,7 +729,7 @@ gfc_conv_class_to_class (gfc_se *parmse, ctree = gfc_class_vptr_get (var); /* The vptr is the second field of the actual argument. - First we have to find the corresponding class reference. */ + First we have to find the corresponding class reference. */ tmp = NULL_TREE; if (class_ref == NULL @@ -4953,7 +4953,7 @@ gfc_conv_procedure_call (gfc_se * se, gf CLASS_DATA (fsym)-attr.codimension !CLASS_DATA (fsym)-attr.allocatable))) { - /* Token and offset. */ + /* Token and offset. */ vec_safe_push (stringargs, null_pointer_node); vec_safe_push (stringargs, build_int_cst (gfc_array_index_type, 0)); gcc_assert (fsym-attr.optional); @@ -7391,7 +7391,7 @@ arrayfunc_assign_needs_temporary (gfc_ex { /* A temporary is not needed if the function is not contained and the variable is local or host associated and not a pointer or - a target. */ + a target. */ if (!expr2-value.function.esym-attr.contained) return false; @@ -7420,7 +7420,7 @@ realloc_lhs_loop_for_fcn_call (gfc_se *s gfc_loopinfo *loop) { /* Signal that the function call should not be made by - gfc_conv_loop_setup. */ + gfc_conv_loop_setup. */ se-ss-is_alloc_lhs = 1; gfc_init_loopinfo (loop); gfc_add_ss_to_loop (loop, *ss); @@ -8252,7 +8252,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1 the function call must happen before the (re)allocation of the lhs - otherwise the character length of the result is not known. NOTE: This relies on having the exact dependence of the length type -
Re: [PATCH] Fix whitespace in comments.
Hi Joost, A somewhat trivial patch to cleanup whitespace issues in comments: sed s/\. \*\//\. \*\//g Tested with a recompile only. Ok for trunk ? OK. (Obvious, really). Thomas
Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner
[replying to an ancient post here..] Uros Bizjak ubiz...@gmail.com writes: Hello! Attached patch fixes libgo reflect test failure with libffi closures. The gccgo compiler started to use FFI closures recently; the compiler passes ffi_type_void for structures with zero members. Why not just pass an FFI_TYPE_STRUCT with zero members? ffi_call form src/alpha/ffi.c allows FFI_TYPE_VOID arguments in non-debug mode through the default: case, but ffi_closure_osf_inner aborts with this type of argument. The patch changes the default case in ffi_closure_osf_inner from abort to FFI_ASSERT, an this way synchronizes argument handling in both cases. 2014-07-21 Uros Bizjak ubiz...@gmail.com * src/alpha/ffi.c: Do not include stdlib.h. (ffi_closure_osf_inner) default: Use FFI_ASSERT instead of abort. Patch was tested with libffi testsuite on alphaev6-linux-gnu. Additionally, the patch fixed reflect test from the libgo testsuite and go.test/test/recover.go test from the gcc testsuite. Why not add an FFI_TYPE_VOID case so it doesn't ever abort if that's expected behaviour? The default case is there to catch unexpected values. AG Uros. Index: src/alpha/ffi.c === --- src/alpha/ffi.c (revision 212882) +++ src/alpha/ffi.c (working copy) @@ -27,7 +27,6 @@ #include ffi.h #include ffi_common.h -#include stdlib.h /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; all further uses in this file will refer to the 128-bit type. */ @@ -273,7 +272,7 @@ ffi_closure_osf_inner(ffi_closure *closure, void * break; default: - abort (); + FFI_ASSERT (0); } argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
Re: [PATCH] RTEMS: Update contrib/config-list.mk
On Fri, 2014-09-19 22:26:59 +0200, Jan-Benedict Glaw jbg...@lug-owl.de wrote: On Thu, 2014-09-18 16:55:35 -0500, Joel Sherrill joel.sherr...@oarcorp.com wrote: I only see one RTEMS target that has been built in the top page. Are more than the powerpc-rtems being built? How can I check? The builders work down their list, and when done will start a new round (with a list that would now contain the three new targets.) Though they're still working down their old list; I've just added the targets there as well, they should show up soonish on one of the *-configlist_mk* builders. Here we are: arm-rtems was successfully built http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=355716 powerpc-rtems was successfully built http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=355861 nios2-rtems failed to build http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=355729 Please note that nios2 failed in the same way a number of other targets fail, too: cr16-elf http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=351532 fr30-elf http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=348510 lm32-elf http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=352224 microblaze-elf http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=347412 moxie-elf http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=355056 rl78-elf http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=355368 The build error always looks like this (I should have opened a PR for that already, but didn't): [...] g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../../gcc/gcc -I../../../gcc/gcc/. -I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include -I/opt/cfarm/mpc/include -I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../gcc/gcc/../libbacktrace-o reload1.o -MT reload1.o -MMD -MP -MF ./.deps/reload1.TPo ../../../gcc/gcc/reload1.c ../../../gcc/gcc/reload1.c: In function ‘void elimination_costs_in_insn(rtx_insn*)’: ../../../gcc/gcc/reload1.c:3762:41: error: ‘orig_dup[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized] *recog_data.dup_loc[i] = orig_dup[i]; ^ cc1plus: all warnings being treated as errors make[2]: *** [reload1.o] Error 1 (All config-list.mk builds are done with a compiler of the very same revision number.) MfG, JBG -- Jan-Benedict Glaw jbg...@lug-owl.de +49-172-7608481 Signature of: http://perl.plover.com/Questions.html the second : signature.asc Description: Digital signature
[Patch, Fortran] Add CO_BROADCAST
This patch adds a CO_BROADCAST and prepares a bit for CO_REDUCE. Both functions permit arguments with allocatable components (nonpolymophic or polymorphic), CO_BROADCAST also permits polymorphic arguments. This patch doesn't support allocatable/polymorphic arguments but otherwise CO_BROADCAST should work. For CO_REDUCE only some parsing/argument checking is done but no actual implementation. The allocatables make life harder for general coarray communication, broadcast and reduction and have to be implemented at some point in a clever way. I am thinking of some call-back-able function - which could also be used for OpenMP 4.x/5.0 to handle copying to threadprivate variables and for copyin/out to accelerators; the current spec handles allocatable components by creating the copying code in the middle end, but that won't work for polymorphic allocatables. For CO_REDUCE, it becomes even harder as currently any pure function works (elemental or not, passing arguments with array descriptor, as pointer or as value, having a hidden string length argument or [with C binding] not etc. Requiring packed array arguments or not, whether gfortran returns the result as value or as argument - and possibly more). There is some J3 discussion if one could narrow down the possibilities a bit. In any case, implementing co_reduce requires some thinking. The attached patch was build and regtested on x86-64-gnu-linux. OK for the trunk? Tobias 2014-09-20 Tobias Burnus bur...@net-b.de gcc/fortran * check.c (check_co_collective): Renamed from check_co_minmaxsum, handle co_reduce. (gfc_check_co_minmax, gfc_check_co_sum): Update call. (gfc_check_co_broadcast, gfc_check_co_reduce): New. * gfortran.h (gfc_isym_id): Add GFC_ISYM_CO_BROADCAST and GFC_ISYM_CO_REDUCE. * intrinsic.c (add_subroutines): Add co_reduce and co_broadcast. * intrinsic.h (gfc_check_co_broadcast, gfc_check_co_reduce): Add proto types. * intrinsic.texi (CO_BROADCAST): Add. * trans.h (gfor_fndecl_co_broadcast): New. * trans-decl.c (gfor_fndecl_co_broadcast): Ditto. (gfc_build_builtin_function_decls): Add decl for it, * trans-intrinsic.c (conv_co_collective): Renamed from conv_co_minmaxsum. Handle co_reduce. (gfc_conv_intrinsic_subroutine): Handle co_reduce. gcc/testsuite/ * gfortran.dg/coarray/collectives_3.f90: New. * gfortran.dg/coarray_collectives_9.f90: New. * gfortran.dg/coarray_collectives_10.f90: New. * gfortran.dg/coarray_collectives_11.f90: New. * gfortran.dg/coarray_collectives_12.f90: New. libgfortran/ * caf/libcaf.h | 10 +- * caf/single.c | 14 ++- diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 531fe86..0a08c73 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -1414,8 +1414,8 @@ gfc_check_cmplx (gfc_expr *x, gfc_expr *y, gfc_expr *kind) static bool -check_co_minmaxsum (gfc_expr *a, gfc_expr *result_image, gfc_expr *stat, - gfc_expr *errmsg) +check_co_collective (gfc_expr *a, gfc_expr *image_idx, gfc_expr *stat, + gfc_expr *errmsg, bool co_reduce) { if (!variable_check (a, 0, false)) return false; @@ -1424,6 +1424,7 @@ check_co_minmaxsum (gfc_expr *a, gfc_expr *result_image, gfc_expr *stat, INTENT(INOUT))) return false; + /* Fortran 2008, 12.5.2.4, paragraph 18. */ if (gfc_has_vector_subscript (a)) { gfc_error (Argument 'A' with INTENT(INOUT) at %L of the intrinsic @@ -1432,21 +1433,21 @@ check_co_minmaxsum (gfc_expr *a, gfc_expr *result_image, gfc_expr *stat, return false; } - if (result_image != NULL) + if (image_idx != NULL) { - if (!type_check (result_image, 1, BT_INTEGER)) + if (!type_check (image_idx, co_reduce ? 2 : 1, BT_INTEGER)) return false; - if (!scalar_check (result_image, 1)) + if (!scalar_check (image_idx, co_reduce ? 2 : 1)) return false; } if (stat != NULL) { - if (!type_check (stat, 2, BT_INTEGER)) + if (!type_check (stat, co_reduce ? 3 : 2, BT_INTEGER)) return false; - if (!scalar_check (stat, 2)) + if (!scalar_check (stat, co_reduce ? 3 : 2)) return false; - if (!variable_check (stat, 2, false)) + if (!variable_check (stat, co_reduce ? 3 : 2, false)) return false; if (stat-ts.kind != 4) { @@ -1458,11 +1459,11 @@ check_co_minmaxsum (gfc_expr *a, gfc_expr *result_image, gfc_expr *stat, if (errmsg != NULL) { - if (!type_check (errmsg, 3, BT_CHARACTER)) + if (!type_check (errmsg, co_reduce ? 4 : 3, BT_CHARACTER)) return false; - if (!scalar_check (errmsg, 3)) + if (!scalar_check (errmsg, co_reduce ? 4 : 3)) return false; - if (!variable_check (errmsg, 3, false)) + if (!variable_check (errmsg, co_reduce ? 4 : 3, false)) return false; if (errmsg-ts.kind != 1) { @@ -1484,6 +1485,61 @@ check_co_minmaxsum (gfc_expr *a, gfc_expr *result_image, gfc_expr *stat, bool +gfc_check_co_broadcast
Re: [PATCH, Fortran] Wrong invocation of caf_atomic_op
Hi Alessandro et al., I have now committed (Rev. 215421) the attached patch, which includes a test case for it. Thanks for the report and the patch Alessandro! Tobias On 15.09.2014 23:29, Tobias Burnus wrote: On 15.09.2014 22:23, Alessandro Fanfarillo wrote: In attachment a test case which fails with the current gcc-trunk version but works when the patch is applied. coarray_35.f90 is my attempt to write a gcc test case. The problem is related with atomic_add. Well, if it is a dg-do compile test, it won't exercise the issue: Even without the patch, it was compiling. It should either be a run test (dg-do run) – and then under gfortran.dg/coarray/ - which will automatically link libcaf_single to it. (And do another run with -fcoarray=single). – Or you have to additionally use -fdump-tree-original and scan for the strings, using dg-final { scan-tree-dump-times ... or scan-tree-dump-not. See other test cases there. I think ATOMIC_ADD should also fail without the patch, i.e. the run test really would test whether it works. Thus, that might be the simpler option. Or you do both – but the dump one shouldn't be under gfortran.dg/coarray/ as that is also run with -fcoarray=single, but under gfortran.dg/ directly. Tobias 2014-09-20 Alessandro Fanfarillo fanfarillo@gmail.com Tobias Burnus bur...@net-b.de gcc/fortran * trans-intrinsic.c (conv_intrinsic_atomic_op): Fix issue with generating temporary for value argument. gcc/testsuite/ * gfortran.dg/coarray_atomic_5.f90: New diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 0a83ad0..0a3315d 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -8396,7 +8405,7 @@ conv_intrinsic_atomic_op (gfc_code *code) else image_index = integer_zero_node; - if (TREE_TYPE (TREE_TYPE (atom)) != TREE_TYPE (TREE_TYPE (value))) + if (!POINTER_TYPE_P (TREE_TYPE (value))) { tmp = gfc_create_var (TREE_TYPE (TREE_TYPE (atom)), value); gfc_add_modify (block, tmp, fold_convert (TREE_TYPE (tmp), value)); diff --git a/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 b/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 new file mode 100644 index 000..11d52ba --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_atomic_5.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! { dg-options -fdump-tree-original -fcoarray=lib } +! +! Argument passing was wrong +! + +program atomic + use iso_fortran_env + implicit none + + integer :: me + integer(atomic_int_kind) :: atom[*] + me = this_image() + call atomic_define(atom[1],0) + sync all + call ATOMIC_ADD (atom[1], me) + if(me == 1) call atomic_ref(me,atom[1]) + sync all + write(*,*) me +end program + +! { dg-final { scan-tree-dump-times value.. = 0; 1 original } } +! { dg-final { scan-tree-dump-times _gfortran_caf_atomic_define \\(caf_token.0, 0, 1, value.., 0B, 1, 4\\); 1 original } } +! { dg-final { scan-tree-dump-times _gfortran_caf_atomic_op \\(1, caf_token.0, 0, 1, me, 0B, 0B, 1, 4\\); 1 original } } +! { dg-final { scan-tree-dump-times _gfortran_caf_atomic_ref \\(caf_token.0, 0, 1, me, 0B, 1, 4\\); 1 original } } +! { dg-final { cleanup-tree-dump original } }
Re: [PATCH] Fix whitespace in comments.
Hi Joost and Thomas, On 20.09.2014 12:02, Thomas Koenig wrote: A somewhat trivial patch to cleanup whitespace issues in comments: sed s/\. \*\//\. \*\//g Tested with a recompile only. Ok for trunk ? OK. (Obvious, really). I want to point a downside of massive code changes: It makes it more difficult to find out with git/svn blame when or why a line of code was changed. That's not so much a problem of comment changes like this one – and I am fine with that change. :-) However, I wanted to point out that seemingly trivial and obviously correct patches can have a downside. (One can still do such changes, but at least one should have weighted them against the downside.) Tobias
Re: Speedup int_bit_from_pos
On 09/19/14 22:04, Jan Hubicka wrote: Hi, int_bit_position is used by ipa-devirt's type walking code. It is currently a bottleneck since I introduced speculation into contextes (I plan to solve this by changing the way i cache results). But this patch seems to make sense anyway: we do not need to go through folding: tree bit_from_pos (tree offset, tree bitpos) { if (TREE_CODE (offset) == PLUS_EXPR) offset = size_binop (PLUS_EXPR, fold_convert (bitsizetype, TREE_OPERAND (offset, 0)), fold_convert (bitsizetype, TREE_OPERAND (offset, 1))); else offset = fold_convert (bitsizetype, offset); return size_binop (PLUS_EXPR, bitpos, size_binop (MULT_EXPR, offset, bitsize_unit_node)); } Because all the code cares only about constant offsets, we do not need to go through fold_convert, because all the codes go via int_bit_position that already expects result to be host wide int, it seems to make sense to implement quick path for that. Bootstrap/regtest x86_64 in progress, OK? Honza * stor-layout.c (int_bit_from_pos): New function. * stor-layout.h (int_bit_from_pos): Declare. * tree.c (int_bit_from_pos): Use it. Just as a note to anyone else that peeks at this code, tree_to_shwi will verify the nodes are constant during a checking build. I'd consider a different name for the function that somehow indicates the inputs are constants. jeff Please consider an assert or other checking code to ensure that OFFSET and BITPOS are constants. Oh, I see that tree_to_shwi will get that checking when it Jeff
RE: [PATCH] Fix whitespace in comments.
Hi Tobias, However, I wanted to point out that seemingly trivial and obviously correct patches can have a downside. (One can still do such changes, but at least one should have weighted them against the downside.) I agree, that's why I asked explicitly. Joost
Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'
On 09/16/2014 08:33 PM, Michael Eager wrote: On 09/15/14 15:53, Chen Gang wrote: On 09/15/2014 11:30 PM, Michael Eager wrote: Configuring DejaGNU for cross-target testing requires creating a configuration file describing the target board. OK, thank you very much. And could you share your configuration file, which I can reference to? See attached. Thank you very much for your attachments, it is very useful to me! I tried testsuite for microblaze cross target on x86_64 host, it says OK (echo $? == 0), but I am not quite sure about it (I still doubt that my configuration is incorrect), please help check, thanks. dejagnu configuration: cp xmd.exp /usr/local/share/dejagnu/config/ cp microblaze-xilinx-gdb.exp /usr/local/share/dejagn/baseboards/ vi microblaze-xilinx-gdb.exp s/mc_gcc/microblaze\-gchen\-linux\-gcc/g gcc operation: ../gcc/configure --target=microblaze-gchen-linux --disable-nls --enable-languages=c --disable-threads --disable-shared \ --without-headers --disable-libssp --disable-libquadmath --disable-libgomp --disable-libatomic make make -k check-gcc RUNTESTFLAGS=--target_board=microblaze-xilinx-gdb/-mno-xl-soft-mul/-mxl-barrel-shift/-mcpu=v6.00.a gcc result: === gcc Summary === # of expected passes 48408 # of unexpected failures 17253 # of unexpected successes 1 # of expected failures97 # of unresolved testcases 16570 # of unsupported tests1854 /upstream/build-gcc/gcc/xgcc version 5.0.0 20140920 (experimental) (GCC) make[2]: Leaving directory `/upstream/build-gcc/gcc' make[1]: Leaving directory `/upstream/build-gcc/gcc' [root@localhost build-gcc]# echo $? 0 Thanks. -- Chen Gang Open share and attitude like air water and life which God blessed
Re: Speedup int_bit_from_pos
On 09/19/14 22:04, Jan Hubicka wrote: Hi, int_bit_position is used by ipa-devirt's type walking code. It is currently a bottleneck since I introduced speculation into contextes (I plan to solve this by changing the way i cache results). But this patch seems to make sense anyway: we do not need to go through folding: tree bit_from_pos (tree offset, tree bitpos) { if (TREE_CODE (offset) == PLUS_EXPR) offset = size_binop (PLUS_EXPR, fold_convert (bitsizetype, TREE_OPERAND (offset, 0)), fold_convert (bitsizetype, TREE_OPERAND (offset, 1))); else offset = fold_convert (bitsizetype, offset); return size_binop (PLUS_EXPR, bitpos, size_binop (MULT_EXPR, offset, bitsize_unit_node)); } Because all the code cares only about constant offsets, we do not need to go through fold_convert, because all the codes go via int_bit_position that already expects result to be host wide int, it seems to make sense to implement quick path for that. Bootstrap/regtest x86_64 in progress, OK? Honza * stor-layout.c (int_bit_from_pos): New function. * stor-layout.h (int_bit_from_pos): Declare. * tree.c (int_bit_from_pos): Use it. Just as a note to anyone else that peeks at this code, tree_to_shwi will verify the nodes are constant during a checking build. I'd consider a different name for the function that somehow indicates the inputs are constants. jeff Please consider an assert or other checking code to ensure that OFFSET and BITPOS are constants. Oh, I see that tree_to_shwi will get that checking when it Jeff Yep, tree_to_shwi will check it. The old code did generic expression folding and called tree_to_shwi on result, so the only difference is that old code will accept unfolded expressions that miraculously folds into constant. I think it is bug to have those in IL especially on places we do not expect variable offsets. Based on that observation, I think we can also drop handling of PLUS_EXPR in this case as follows. Concerning the function, it has documented in toplevel comment that parameter must be constant or it crashes, so I think it is fine. Conerning name, I am open for renaming, but we have those int_* variants in quite few copies, so I can do that incrementally (see int_byte_position and related functions in stor layout). I am testing the following simplified (and inline) variant. Perhaps we could do similar stuff for other int_* accessors even if they do not sit on hot paths in my test, just for the sake of code size. Honza Index: tree.c === --- tree.c (revision 215421) +++ tree.c (working copy) @@ -2831,16 +2831,6 @@ bit_position (const_tree field) return bit_from_pos (DECL_FIELD_OFFSET (field), DECL_FIELD_BIT_OFFSET (field)); } - -/* Likewise, but return as an integer. It must be representable in - that way (since it could be a signed value, we don't have the - option of returning -1 like int_size_in_byte can. */ - -HOST_WIDE_INT -int_bit_position (const_tree field) -{ - return tree_to_shwi (bit_position (field)); -} /* Return the byte position of FIELD, in bytes from the start of the record. This is a tree of type sizetype. */ Index: tree.h === --- tree.h (revision 215421) +++ tree.h (working copy) @@ -3877,10 +3877,20 @@ extern tree size_in_bytes (const_tree); extern HOST_WIDE_INT int_size_in_bytes (const_tree); extern HOST_WIDE_INT max_int_size_in_bytes (const_tree); extern tree bit_position (const_tree); -extern HOST_WIDE_INT int_bit_position (const_tree); extern tree byte_position (const_tree); extern HOST_WIDE_INT int_byte_position (const_tree); +/* Like bit_position, but return as an integer. It must be representable in + that way (since it could be a signed value, we don't have the + option of returning -1 like int_size_in_byte can. */ + +static inline HOST_WIDE_INT int_bit_position (const_tree field) +{ + return tree_to_shwi (DECL_FIELD_OFFSET (field)) * BITS_PER_UNIT ++ tree_to_shwi (DECL_FIELD_BIT_OFFSET (field)); +} + + #define sizetype sizetype_tab[(int) stk_sizetype] #define bitsizetype sizetype_tab[(int) stk_bitsizetype] #define ssizetype sizetype_tab[(int) stk_ssizetype]
Re: [patch i386]: Sibcall tail-call improvement and partial fix PR/60104
Hi Kai, The patch you sent (copied below) does not fix the darwin regression. It still fails with the same ICE on attached valid code (in 64-bit mode; it compiles with -m32). FX a.C Description: Binary data Index: config/i386/predicates.md === --- config/i386/predicates.md (Revision 215364) +++ config/i386/predicates.md (Arbeitskopie) @@ -73,8 +73,15 @@ ;; Return true if OP is a memory operands that can be used in sibcalls. (define_predicate sibcall_memory_operand - (and (match_operand 0 memory_operand) - (match_test CONSTANT_P (XEXP (op, 0) + (match_operand 0 memory_operand) +{ + if (TARGET_MACHO TARGET_64BIT + GET_CODE (op) == CONST + GET_CODE (XEXP (op, 0)) == UNSPEC + XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL) +return false; + return CONSTANT_P (XEXP (op, 0)); +}) ;; Match an SI or HImode register for a zero_extract. (define_special_predicate ext_register_operand
Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'
On 09/20/14 08:52, Chen Gang wrote: Thank you very much for your attachments, it is very useful to me! I tried testsuite for microblaze cross target on x86_64 host, it says OK (echo $? == 0), but I am not quite sure about it (I still doubt that my configuration is incorrect), please help check, thanks. Welcome to the joys of DejaGNU. Configuration can be confusing. As you can see, the return code is not useful. dejagnu configuration: cp xmd.exp /usr/local/share/dejagnu/config/ cp microblaze-xilinx-gdb.exp /usr/local/share/dejagn/baseboards/ vi microblaze-xilinx-gdb.exp s/mc_gcc/microblaze\-gchen\-linux\-gcc/g gcc operation: ../gcc/configure --target=microblaze-gchen-linux --disable-nls --enable-languages=c --disable-threads --disable-shared \ --without-headers --disable-libssp --disable-libquadmath --disable-libgomp --disable-libatomic make make -k check-gcc RUNTESTFLAGS=--target_board=microblaze-xilinx-gdb/-mno-xl-soft-mul/-mxl-barrel-shift/-mcpu=v6.00.a Check whether these compiler options are being passed to mb-gcc. There is a line in my microblaze-xilinx-gdb.exp which sets CFLAGS: set_board_info cflags -mcpu=v4.00.b -mno-xl-soft-mul -mxl-barrel-shift This is likely overriding any options passed to runtest. Make sure that the options match the features of your target board. You might not need any options for your initial tests. Make sure that the correct flags are being passed to the linker. Add -v or -v -v to RUNTESTFLAGS so that the gcc.log file gives useful info. You might want to limit the number of tests run until you get problems worked out: make check-gcc RUNTESTFLAGS=execute.exp -v -v --target_board=microblaze-xilinx-gdb This will run only the gcc.c-torture/execute/execute.exp tests. gcc result: === gcc Summary === # of expected passes 48408 # of unexpected failures 17253 # of unexpected successes 1 # of expected failures97 # of unresolved testcases 16570 # of unsupported tests1854 /upstream/build-gcc/gcc/xgcc version 5.0.0 20140920 (experimental) (GCC) Look at gcc.sum and gcc.log to find out what is causing the large number of unexpected failures. A large number of unresolved test cases often means that the compiler returned an error. -- Michael Eagerea...@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
Re: [patch i386]: Sibcall tail-call improvement and partial fix PR/60104
The patch you sent (copied below) does not fix the darwin regression. It still fails with the same ICE on attached valid code (in 64-bit mode; it compiles with -m32). The proposed patch by Iain’s patch (https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01141.html and attached), which Mike seconds, fixes the issue. See the testresults I posted here: https://gcc.gnu.org/ml/gcc-testresults/2014-09/msg01449.html (without the patch, there are 900+ testsuite failures) Could one of the maintainers (i386 or global) review it, please? FX Index: gcc/config/i386/i386.c === --- gcc/config/i386/i386.c (revision 215419) +++ gcc/config/i386/i386.c (working copy) @@ -38968,9 +38968,11 @@ x86_output_mi_thunk (FILE *file, tree, H { if (sibcall_insn_operand (fnaddr, word_mode)) { - tmp = gen_rtx_CALL (VOIDmode, fnaddr, const0_rtx); - tmp = emit_call_insn (tmp); - SIBLING_CALL_P (tmp) = 1; + fnaddr = XEXP (DECL_RTL (function), 0); + tmp = gen_rtx_MEM (QImode, fnaddr); + tmp = gen_rtx_CALL (VOIDmode, tmp, const0_rtx); + tmp = emit_call_insn (tmp); + SIBLING_CALL_P (tmp) = 1; } else emit_jump_insn (gen_indirect_jump (fnaddr));
Introduce constructors for polymorphic_call_info
Hi, this patch makes ipa_polymorphic_call_context construction to be useful for forward propagation passes (such as ipa-devirt). My original implementation takes polymorphic call statment as a parameter and walks backward the SSA graph. Now one can construct the polymorphic call info for any constant or SSA name and do forward propagation to the call statement himself. Martin, this is how I expect this to be used by ipa-prop. 1) You will want to have polymorphic call contextes for polymorphic call (saved to edges), function parameters (in jump functoins) on each call site and to function parameters themselves (or handle that specially - the point here is that method functions will have context specifying type of THIS pointer) You can use the new constructors to build these. I.e.: ipa_polymorphic_call_context context (decl, param, call_stmt, instance); on parameters of function calls to get polymorphic call info for values passed by pointer to PARAM. You can also build contetes for invariants (var) and function parameters (parm_decl). 2) The optional instance parameter to constructor may be used to let ipa-prop to track from where the instance is comming and build jump functions (i.e. if INSTANCE of a context is PARM_DECL). You will need to store this info yourself for polymorphic calls and jump functions. I guess it all boils down to PARAM_INDEX, but you do not want to share this with PARAM_INDEX used for normal data jump functions as in some cases the context may be fully specified (i.e. PARAM_INDEX -1) even though the PARAM_INDEX of data function is non-NULL I really think that unlike what we do now, we basically want to have two sets of data - i.e. data jump functions (what we have now minus KNOWN_TYPE) and type jump functions (contextes + param_index). While propagating we can use one to feed the other, but these are generally two dataflow problems. 3) In addition to be able to build contextes for parameters, we will need methods for forward propagation. I expect we will need AND/OR/OFFSET_BY methods for contextes to implement the forward dataflow on them as opposed to binfos we do now. offset_by is trivial to do - just add given offset to context-offset and context-speculative_offset (if speculation is present). And/or will be bit more fun - we need to check if one context is more restricted than the other that can be done via containst_type_p, but we can start with dummy operations. 4) LTO will also need stream_out/stream_in methods for polymorphic contextes. Bootstrapped/regtested x86_64-linux, comitted. * ipa-utils.h (ipa_polymorphic_call_context): Turn into class; add ctors. (possible_polymorphic_call_targets, dump_possible_polymorphic_call_targets, possible_polymorphic_call_target_p, possible_polymorphic_call_target_p): Simplify. (get_dynamic_type): Remove. * ipa-devirt.c (ipa_dummy_polymorphic_call_context): Remove. (clear_speculation): Bring to ipa-deivrt.h (get_class_context): Rename to ... (ipa_polymorphic_call_context::restrict_to_inner_class): ... this one. (contains_type_p): Update. (get_dynamic_type): Rename to ... ipa_polymorphic_call_context::get_dynamic_type(): ... this one. (possible_polymorphic_call_targets): UPdate. * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Update. * ipa-prop.c (ipa_analyze_call_uses): Update. Index: cgraph.c === --- cgraph.c(revision 215391) +++ cgraph.c(working copy) @@ -884,21 +884,15 @@ (target = gimple_call_fn (call_stmt)) virtual_method_call_p (target)) { - tree otr_type; - HOST_WIDE_INT otr_token; - ipa_polymorphic_call_context context; + ipa_polymorphic_call_context context (decl, target, call_stmt); - get_polymorphic_call_info (decl, -target, -otr_type, otr_token, -context, call_stmt); - /* Only record types can have virtual calls. */ - gcc_assert (TREE_CODE (otr_type) == RECORD_TYPE); edge-indirect_info-polymorphic = true; edge-indirect_info-param_index = -1; - edge-indirect_info-otr_token = otr_token; - edge-indirect_info-otr_type = otr_type; + edge-indirect_info-otr_token += tree_to_uhwi (OBJ_TYPE_REF_TOKEN (target)); + edge-indirect_info-otr_type = obj_type_ref_class (target); + gcc_assert (TREE_CODE (edge-indirect_info-otr_type) == RECORD_TYPE); edge-indirect_info-outer_type = context.outer_type; edge-indirect_info-speculative_outer_type = context.speculative_outer_type; Index: gimple-fold.c === --- gimple-fold.c (revision 215391) +++ gimple-fold.c
[PATCH] remove duplicated lines in gcc/fortran/resolve.c
AFAICT the lines 11200-11222 in gcc/fortran/resolve.c are a copy of the lines 11176-11198. The following patch removes the duplicated lines. OK for the trunk? Dominique --- ../_clean/gcc/fortran/resolve.c 2014-09-20 13:56:57.0 +0200 +++ gcc/fortran/resolve.c 2014-09-20 14:01:42.0 +0200 @@ -11184,30 +11184,6 @@ resolve_fl_procedure (gfc_symbol *sym, i !arg-sym-ts.u.derived-attr.use_assoc !gfc_check_symbol_access (arg-sym-ts.u.derived) !gfc_notify_std (GFC_STD_F2003, Procedure '%s' in - PUBLIC interface '%s' at %L - takes dummy arguments of '%s' which - is PRIVATE, iface-sym-name, - sym-name, iface-sym-declared_at, - gfc_typename(arg-sym-ts))) - { - /* Stop this message from recurring. */ - arg-sym-ts.u.derived-attr.access = ACCESS_PUBLIC; - return false; - } -} - } - - /* PUBLIC interfaces may expose PRIVATE procedures that take types -PRIVATE to the containing module. */ - for (iface = sym-generic; iface; iface = iface-next) - { - for (arg = gfc_sym_get_dummy_args (iface-sym); arg; arg = arg-next) - { - if (arg-sym - arg-sym-ts.type == BT_DERIVED - !arg-sym-ts.u.derived-attr.use_assoc - !gfc_check_symbol_access (arg-sym-ts.u.derived) - !gfc_notify_std (GFC_STD_F2003, Procedure '%s' in PUBLIC interface '%s' at %L takes dummy arguments of '%s' which is PRIVATE, iface-sym-name,
Re: [PATCH] microblaze: microblaze.md: Use 'SI' instead of 'VOID' for operand 1 of 'call_value_intern'
Thank you very much for your quickly response, I shall continue try. Thanks. On 09/21/2014 12:31 AM, Michael Eager wrote: On 09/20/14 08:52, Chen Gang wrote: Thank you very much for your attachments, it is very useful to me! I tried testsuite for microblaze cross target on x86_64 host, it says OK (echo $? == 0), but I am not quite sure about it (I still doubt that my configuration is incorrect), please help check, thanks. Welcome to the joys of DejaGNU. Configuration can be confusing. As you can see, the return code is not useful. dejagnu configuration: cp xmd.exp /usr/local/share/dejagnu/config/ cp microblaze-xilinx-gdb.exp /usr/local/share/dejagn/baseboards/ vi microblaze-xilinx-gdb.exp s/mc_gcc/microblaze\-gchen\-linux\-gcc/g gcc operation: ../gcc/configure --target=microblaze-gchen-linux --disable-nls --enable-languages=c --disable-threads --disable-shared \ --without-headers --disable-libssp --disable-libquadmath --disable-libgomp --disable-libatomic make make -k check-gcc RUNTESTFLAGS=--target_board=microblaze-xilinx-gdb/-mno-xl-soft-mul/-mxl-barrel-shift/-mcpu=v6.00.a Check whether these compiler options are being passed to mb-gcc. There is a line in my microblaze-xilinx-gdb.exp which sets CFLAGS: set_board_info cflags -mcpu=v4.00.b -mno-xl-soft-mul -mxl-barrel-shift This is likely overriding any options passed to runtest. Make sure that the options match the features of your target board. You might not need any options for your initial tests. Make sure that the correct flags are being passed to the linker. Add -v or -v -v to RUNTESTFLAGS so that the gcc.log file gives useful info. You might want to limit the number of tests run until you get problems worked out: make check-gcc RUNTESTFLAGS=execute.exp -v -v --target_board=microblaze-xilinx-gdb This will run only the gcc.c-torture/execute/execute.exp tests. gcc result: === gcc Summary === # of expected passes 48408 # of unexpected failures 17253 # of unexpected successes 1 # of expected failures97 # of unresolved testcases 16570 # of unsupported tests1854 /upstream/build-gcc/gcc/xgcc version 5.0.0 20140920 (experimental) (GCC) Look at gcc.sum and gcc.log to find out what is causing the large number of unexpected failures. A large number of unresolved test cases often means that the compiler returned an error. -- Chen Gang Open share and attitude like air water and life which God blessed
Re: [patch i386]: Sibcall tail-call improvement and partial fix PR/60104
Hi FX, I missed that op points still on the memory here. So corrected patch is inlined below. Kai Index: predicates.md === --- predicates.md (Revision 215364) +++ predicates.md (Arbeitskopie) @@ -73,9 +73,18 @@ ;; Return true if OP is a memory operands that can be used in sibcalls. (define_predicate sibcall_memory_operand - (and (match_operand 0 memory_operand) - (match_test CONSTANT_P (XEXP (op, 0) + (match_operand 0 memory_operand) +{ + op = XEXP (op, 0); + if (TARGET_MACHO TARGET_64BIT + GET_CODE (op) == CONST + GET_CODE (XEXP (op, 0)) == UNSPEC + XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL) +return false; + return CONSTANT_P (op); +}) + ;; Match an SI or HImode register for a zero_extract. (define_special_predicate ext_register_operand (match_operand 0 register_operand)
[PATCH 1/9] rs6000: Change how we model the carry bit
This series handles most of the small changes for handling the carry bit; it does not touch the add and scc patterns yet, and no pattern sets or uses the carry yet either (only clobbers). Tested as usual, no regressions. Are these okay to apply? Segher - - - Make the carry bit non-allocatable (i.e., of class NO_REGS). It will only ever be assigned to explicitly by machine patterns. Let it have mode SI or DI (if compiling for 64-bit), even though it only ever contains 0 or 1, so that the patterns will be simpler, and combine will have an easier time and more opportunities. Do not allow CA as input_operand; we have no patterns for moving CA around (such patterns would be quite expensive). Allow taking a subreg of CA; this happens e.g. for sraw in 64-bit mode. 2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/predicates.md (ca_operand): Allow subregs. (input_operand): Do not allow ca_operand. * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): For the carry bit, allow SImode and Pmode. (rs6000_init_hard_regno_mode_ok): Make the carry bit class NO_REGS. --- gcc/config/rs6000/predicates.md | 16 ++-- gcc/config/rs6000/rs6000.c | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index ef7bc69..21a14e6 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -116,8 +116,16 @@ (define_predicate vlogical_operand ;; Return 1 if op is the carry register. (define_predicate ca_operand - (and (match_code reg) - (match_test CA_REGNO_P (REGNO (op) + (match_operand 0 register_operand) +{ + if (GET_CODE (op) == SUBREG) +op = SUBREG_REG (op); + + if (!REG_P (op)) +return 0; + + return CA_REGNO_P (REGNO (op)); +}) ;; Return 1 if op is a signed 5-bit constant integer. (define_predicate s5bit_cint_operand @@ -1121,6 +1129,10 @@ (define_predicate input_operand || GET_MODE_SIZE (mode) UNITS_PER_WORD) return register_operand (op, mode); + /* We don't allow moving the carry bit around. */ + if (ca_operand (op, mode)) +return 0; + /* The only cases left are integral modes one word or smaller (we do not get called for MODE_CC values). These can be in any register. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5810f68..e2fa75f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1780,7 +1780,7 @@ rs6000_hard_regno_mode_ok (int regno, enum machine_mode mode) return GET_MODE_CLASS (mode) == MODE_CC; if (CA_REGNO_P (regno)) -return mode == BImode; +return mode == Pmode || mode == SImode; /* AltiVec only in AldyVec registers. */ if (ALTIVEC_REGNO_P (regno)) @@ -2475,7 +2475,7 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) rs6000_regno_regclass[LR_REGNO] = LINK_REGS; rs6000_regno_regclass[CTR_REGNO] = CTR_REGS; - rs6000_regno_regclass[CA_REGNO] = CA_REGS; + rs6000_regno_regclass[CA_REGNO] = NO_REGS; rs6000_regno_regclass[VRSAVE_REGNO] = VRSAVE_REGS; rs6000_regno_regclass[VSCR_REGNO] = VRSAVE_REGS; rs6000_regno_regclass[SPE_ACC_REGNO] = SPE_ACC_REGS; -- 1.8.1.4
[PATCH 3/9] rs6000: Clean up one_cmplmode2
Just the usual tidying. Also use the not extended mnemonic instead of the nor that translates to. 2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (*one_cmplmode2): Generate not insn. (two anonymous define_insn and two define_split): Delete. (*one_cmplmode2_dot, *one_cmplmode2_dot2): New. --- gcc/config/rs6000/rs6000.md | 68 +++-- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 1e73e6a..1a289d6 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1594,61 +1594,49 @@ (define_insn *one_cmplmode2 [(set (match_operand:GPR 0 gpc_reg_operand =r) (not:GPR (match_operand:GPR 1 gpc_reg_operand r)))] - nor %0,%1,%1) + not %0,%1) -(define_insn - [(set (match_operand:CC 0 cc_reg_operand =x,?y) - (compare:CC (not:P (match_operand:P 1 gpc_reg_operand r,r)) +(define_insn_and_split *one_cmplmode2_dot + [(set (match_operand:CC 2 cc_reg_operand =x,?y) + (compare:CC (not:GPR (match_operand:GPR 1 gpc_reg_operand r,r)) (const_int 0))) - (clobber (match_scratch:P 2 =r,r))] - + (clobber (match_scratch:GPR 0 =r,r))] + MODEmode == Pmode rs6000_gen_cell_microcode @ - nor. %2,%1,%1 + not. %0,%1 # - [(set_attr type logical,compare) + reload_completed cc_reg_not_cr0_operand (operands[2], CCmode) + [(set (match_dup 0) + (not:GPR (match_dup 1))) + (set (match_dup 2) + (compare:CC (match_dup 0) + (const_int 0)))] + + [(set_attr type logical) (set_attr dot yes) (set_attr length 4,8)]) -(define_split - [(set (match_operand:CC 0 cc_reg_not_micro_cr0_operand ) - (compare:CC (not:P (match_operand:P 1 gpc_reg_operand )) - (const_int 0))) - (clobber (match_scratch:P 2 ))] - reload_completed - [(set (match_dup 2) - (not:P (match_dup 1))) - (set (match_dup 0) - (compare:CC (match_dup 2) - (const_int 0)))] - ) - -(define_insn +(define_insn_and_split *one_cmplmode2_dot2 [(set (match_operand:CC 2 cc_reg_operand =x,?y) - (compare:CC (not:P (match_operand:P 1 gpc_reg_operand r,r)) + (compare:CC (not:GPR (match_operand:GPR 1 gpc_reg_operand r,r)) (const_int 0))) - (set (match_operand:P 0 gpc_reg_operand =r,r) - (not:P (match_dup 1)))] - + (set (match_operand:GPR 0 gpc_reg_operand =r,r) + (not:GPR (match_dup 1)))] + MODEmode == Pmode rs6000_gen_cell_microcode @ - nor. %0,%1,%1 + not. %0,%1 # - [(set_attr type logical,compare) - (set_attr dot yes) - (set_attr length 4,8)]) - -(define_split - [(set (match_operand:CC 2 cc_reg_not_micro_cr0_operand ) - (compare:CC (not:P (match_operand:P 1 gpc_reg_operand )) - (const_int 0))) - (set (match_operand:P 0 gpc_reg_operand ) - (not:P (match_dup 1)))] - reload_completed + reload_completed cc_reg_not_cr0_operand (operands[2], CCmode) [(set (match_dup 0) - (not:P (match_dup 1))) + (not:GPR (match_dup 1))) (set (match_dup 2) (compare:CC (match_dup 0) (const_int 0)))] - ) + + [(set_attr type logical) + (set_attr dot yes) + (set_attr length 4,8)]) + (define_insn [(set (match_operand:GPR 0 gpc_reg_operand =r,r) -- 1.8.1.4
[PATCH 2/9] rs6000: Handle rtx cost of NE
Currently NE isn't handled at all. Handle it the same as EQ, LTU, GTU. 2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.c (rs6000_rtx_costs) NE: New. --- gcc/config/rs6000/rs6000.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e2fa75f..7f1eb75 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -30111,6 +30111,7 @@ rs6000_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED, } break; +case NE: case EQ: case GTU: case LTU: -- 1.8.1.4
[PATCH 4/9] rs6000: Clean up negmode2
2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (*negmode2_internal): Delete. (two anonymous define_insn and two define_split): Delete. (*negmode2, *negmode2_dot, *negmode2_dot2): New. --- gcc/config/rs6000/rs6000.md | 65 +++-- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 1a289d6..0bb1a66 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1725,72 +1725,61 @@ (define_expand submode3 } }) + (define_expand negmode2 [(set (match_operand:SDI 0 gpc_reg_operand ) (neg:SDI (match_operand:SDI 1 gpc_reg_operand )))] ) -(define_insn *negmode2_internal +(define_insn *negmode2 [(set (match_operand:GPR 0 gpc_reg_operand =r) (neg:GPR (match_operand:GPR 1 gpc_reg_operand r)))] neg %0,%1 [(set_attr type add)]) -(define_insn - [(set (match_operand:CC 0 cc_reg_operand =x,?y) - (compare:CC (neg:P (match_operand:P 1 gpc_reg_operand r,r)) +(define_insn_and_split *negmode2_dot + [(set (match_operand:CC 2 cc_reg_operand =x,?y) + (compare:CC (neg:GPR (match_operand:GPR 1 gpc_reg_operand r,r)) (const_int 0))) - (clobber (match_scratch:P 2 =r,r))] - + (clobber (match_scratch:GPR 0 =r,r))] + MODEmode == Pmode @ - neg. %2,%1 + neg. %0,%1 # + reload_completed cc_reg_not_cr0_operand (operands[2], CCmode) + [(set (match_dup 0) + (neg:GPR (match_dup 1))) + (set (match_dup 2) + (compare:CC (match_dup 0) + (const_int 0)))] + [(set_attr type add) (set_attr dot yes) (set_attr length 4,8)]) -(define_split - [(set (match_operand:CC 0 cc_reg_not_cr0_operand ) - (compare:CC (neg:P (match_operand:P 1 gpc_reg_operand )) - (const_int 0))) - (clobber (match_scratch:P 2 ))] - reload_completed - [(set (match_dup 2) - (neg:P (match_dup 1))) - (set (match_dup 0) - (compare:CC (match_dup 2) - (const_int 0)))] - ) - -(define_insn +(define_insn_and_split *negmode2_dot2 [(set (match_operand:CC 2 cc_reg_operand =x,?y) - (compare:CC (neg:P (match_operand:P 1 gpc_reg_operand r,r)) + (compare:CC (neg:GPR (match_operand:GPR 1 gpc_reg_operand r,r)) (const_int 0))) - (set (match_operand:P 0 gpc_reg_operand =r,r) - (neg:P (match_dup 1)))] - + (set (match_operand:GPR 0 gpc_reg_operand =r,r) + (neg:GPR (match_dup 1)))] + MODEmode == Pmode @ neg. %0,%1 # - [(set_attr type add) - (set_attr dot yes) - (set_attr length 4,8)]) - -(define_split - [(set (match_operand:CC 2 cc_reg_not_cr0_operand ) - (compare:CC (neg:P (match_operand:P 1 gpc_reg_operand )) - (const_int 0))) - (set (match_operand:P 0 gpc_reg_operand ) - (neg:P (match_dup 1)))] - reload_completed + reload_completed cc_reg_not_cr0_operand (operands[2], CCmode) [(set (match_dup 0) - (neg:P (match_dup 1))) + (neg:GPR (match_dup 1))) (set (match_dup 2) (compare:CC (match_dup 0) (const_int 0)))] - ) + + [(set_attr type add) + (set_attr dot yes) + (set_attr length 4,8)]) + (define_insn clzmode2 [(set (match_operand:GPR 0 gpc_reg_operand =r) -- 1.8.1.4
Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner
On Sep 20, 2014, at 3:04 AM, Anthony Green gr...@moxielogic.com wrote: Why not just pass an FFI_TYPE_STRUCT with zero members? My information may be old or irrelevant but I have used structs with no members with gcc backend, but with nonzero size and alignment, and ran into backend problems, particularly on sparc64, passing them as parameters. Is that what is being used here? Maybe best to add some members to achieve equivalent size/alignment? - Jay
Re: Speedup int_bit_from_pos
Yep, tree_to_shwi will check it. The old code did generic expression folding and called tree_to_shwi on result, so the only difference is that old code will accept unfolded expressions that miraculously folds into constant. I think it is bug to have those in IL especially on places we do not expect variable offsets. Based on that observation, I think we can also drop handling of PLUS_EXPR in this case as follows. Concerning the function, it has documented in toplevel comment that parameter must be constant or it crashes, so I think it is fine. Conerning name, I am open for renaming, but we have those int_* variants in quite few copies, so I can do that incrementally (see int_byte_position and related functions in stor layout). I am testing the following simplified (and inline) variant. Perhaps we could do similar stuff for other int_* accessors even if they do not sit on hot paths in my test, just for the sake of code size. Note that I benchmarked libxul build. This patch makes devirtualization to go from 70% of compile time to 30%, so it is about twice as fast. I will care the rest by caching reorg (it went up from 4% to 70% by introducing the speculation) Honza
[PATCH 7/9] rs6000: Clean up ctz, ffs, popcount, parity
2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (ctzmode2, ffsmode2, popcountmode2, popcntbmode2, popcntdmode2, paritymode2, paritymode2_cmpb): Tidy. --- gcc/config/rs6000/rs6000.md | 70 ++--- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 5f5edaa..b03c6c1 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1796,12 +1796,12 @@ (define_expand ctzmode2 (match_dup 4))) (clobber (reg:GPR CA_REGNO))])] - { - operands[2] = gen_reg_rtx (MODEmode); - operands[3] = gen_reg_rtx (MODEmode); - operands[4] = gen_reg_rtx (MODEmode); - operands[5] = GEN_INT (GET_MODE_BITSIZE (MODEmode) - 1); - }) +{ + operands[2] = gen_reg_rtx (MODEmode); + operands[3] = gen_reg_rtx (MODEmode); + operands[4] = gen_reg_rtx (MODEmode); + operands[5] = GEN_INT (GET_MODE_BITSIZE (MODEmode) - 1); +}) (define_expand ffsmode2 [(set (match_dup 2) @@ -1816,55 +1816,55 @@ (define_expand ffsmode2 (match_dup 4))) (clobber (reg:GPR CA_REGNO))])] - { - operands[2] = gen_reg_rtx (MODEmode); - operands[3] = gen_reg_rtx (MODEmode); - operands[4] = gen_reg_rtx (MODEmode); - operands[5] = GEN_INT (GET_MODE_BITSIZE (MODEmode)); - }) +{ + operands[2] = gen_reg_rtx (MODEmode); + operands[3] = gen_reg_rtx (MODEmode); + operands[4] = gen_reg_rtx (MODEmode); + operands[5] = GEN_INT (GET_MODE_BITSIZE (MODEmode)); +}) + + +(define_expand popcountmode2 + [(set (match_operand:GPR 0 gpc_reg_operand ) + (popcount:GPR (match_operand:GPR 1 gpc_reg_operand )))] + TARGET_POPCNTB || TARGET_POPCNTD +{ + rs6000_emit_popcount (operands[0], operands[1]); + DONE; +}) (define_insn popcntbmode2 [(set (match_operand:GPR 0 gpc_reg_operand =r) -(unspec:GPR [(match_operand:GPR 1 gpc_reg_operand r)] - UNSPEC_POPCNTB))] + (unspec:GPR [(match_operand:GPR 1 gpc_reg_operand r)] + UNSPEC_POPCNTB))] TARGET_POPCNTB popcntb %0,%1 - [(set_attr length 4) - (set_attr type popcnt)]) + [(set_attr type popcnt)]) (define_insn popcntdmode2 [(set (match_operand:GPR 0 gpc_reg_operand =r) (popcount:GPR (match_operand:GPR 1 gpc_reg_operand r)))] TARGET_POPCNTD popcntwd %0,%1 - [(set_attr length 4) - (set_attr type popcnt)]) + [(set_attr type popcnt)]) -(define_expand popcountmode2 + +(define_expand paritymode2 [(set (match_operand:GPR 0 gpc_reg_operand ) - (popcount:GPR (match_operand:GPR 1 gpc_reg_operand )))] - TARGET_POPCNTB || TARGET_POPCNTD - { -rs6000_emit_popcount (operands[0], operands[1]); -DONE; - }) + (parity:GPR (match_operand:GPR 1 gpc_reg_operand )))] + TARGET_POPCNTB +{ + rs6000_emit_parity (operands[0], operands[1]); + DONE; +}) (define_insn paritymode2_cmpb [(set (match_operand:GPR 0 gpc_reg_operand =r) (unspec:GPR [(match_operand:GPR 1 gpc_reg_operand r)] UNSPEC_PARITY))] TARGET_CMPB TARGET_POPCNTB prtywd %0,%1 - [(set_attr length 4) - (set_attr type popcnt)]) + [(set_attr type popcnt)]) -(define_expand paritymode2 - [(set (match_operand:GPR 0 gpc_reg_operand ) - (parity:GPR (match_operand:GPR 1 gpc_reg_operand )))] - TARGET_POPCNTB - { -rs6000_emit_parity (operands[0], operands[1]); -DONE; - }) ;; Since the hardware zeros the upper part of the register, save generating the ;; AND immediate if we are converting to unsigned -- 1.8.1.4
[PATCH 5/9] rs6000: Clean up boolmode3
Use a new code iterator to handle IOR, XOR. Also, we can now fold the AND patterns together with the boolean_or_operator patterns. 2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (iorxor): New code_iterator. (iorxor): New code_attr. (IORXOR): New code_attr. (*andmode3, *andmode3_dot, *andmode3_dot2): Delete. (iormode3, xormode3): Delete. (iorxormode3): New. (splitter for big integer ior, xor): New. (*boolmode3): Move. Also handle AND. (*boolmode3_dot, *boolmode3_dot2): Also handle AND. (splitter for big integer ior, xor): Delete. --- gcc/config/rs6000/rs6000.md | 158 1 file changed, 41 insertions(+), 117 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 0bb1a66..4d07269 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -437,6 +437,11 @@ (define_code_attr return_pred [(return direct_return ()) (simple_return 1)]) (define_code_attr return_str [(return ) (simple_return simple_)]) +; Logical operators. +(define_code_iterator iorxor [ior xor]) +(define_code_attr iorxor [(ior ior) (xor xor)]) +(define_code_attr IORXOR [(ior IOR) (xor XOR)]) + ; Signed/unsigned variants of ops. (define_code_iterator any_extend [sign_extend zero_extend]) (define_code_attr u [(sign_extend ) (zero_extend u)]) @@ -2639,61 +2644,6 @@ (define_expand andmode3 }) -(define_insn *andmode3 - [(set (match_operand:GPR 0 gpc_reg_operand =r) - (and:GPR (match_operand:GPR 1 gpc_reg_operand r) -(match_operand:GPR 2 gpc_reg_operand r)))] - - and %0,%1,%2 - [(set_attr type logical)]) - -(define_insn_and_split *andmode3_dot - [(set (match_operand:CC 3 cc_reg_operand =x,?y) - (compare:CC (and:GPR (match_operand:GPR 1 gpc_reg_operand r,r) -(match_operand:GPR 2 gpc_reg_operand r,r)) - (const_int 0))) - (clobber (match_scratch:GPR 0 =r,r))] - MODEmode == Pmode rs6000_gen_cell_microcode - @ - and. %0,%1,%2 - # - reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) - [(set (match_dup 0) - (and:GPR (match_dup 1) -(match_dup 2))) - (set (match_dup 3) - (compare:CC (match_dup 0) - (const_int 0)))] - - [(set_attr type logical) - (set_attr dot yes) - (set_attr length 4,8)]) - -(define_insn_and_split *andmode3_dot2 - [(set (match_operand:CC 3 cc_reg_operand =x,?y) - (compare:CC (and:GPR (match_operand:GPR 1 gpc_reg_operand r,r) -(match_operand:GPR 2 gpc_reg_operand r,r)) - (const_int 0))) - (set (match_operand:GPR 0 gpc_reg_operand =r,r) - (and:GPR (match_dup 1) -(match_dup 2)))] - MODEmode == Pmode rs6000_gen_cell_microcode - @ - and. %0,%1,%2 - # - reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) - [(set (match_dup 0) - (and:GPR (match_dup 1) -(match_dup 2))) - (set (match_dup 3) - (compare:CC (match_dup 0) - (const_int 0)))] - - [(set_attr type logical) - (set_attr dot yes) - (set_attr length 4,8)]) - - (define_insn andmode3_imm [(set (match_operand:GPR 0 gpc_reg_operand =r) (and:GPR (match_operand:GPR 1 gpc_reg_operand %r) @@ -2912,15 +2862,15 @@ (define_insn_and_split *andsi3_internal6 [(set_attr length 8)]) -(define_expand iormode3 +(define_expand iorxormode3 [(set (match_operand:SDI 0 gpc_reg_operand ) - (ior:SDI (match_operand:SDI 1 gpc_reg_operand ) -(match_operand:SDI 2 reg_or_cint_operand )))] + (iorxor:SDI (match_operand:SDI 1 gpc_reg_operand ) + (match_operand:SDI 2 reg_or_cint_operand )))] { if (MODEmode == DImode !TARGET_POWERPC64) { - rs6000_split_logical (operands, IOR, false, false, false); + rs6000_split_logical (operands, IORXOR, false, false, false); DONE; } @@ -2929,12 +2879,13 @@ (define_expand iormode3 rtx tmp = ((!can_create_pseudo_p () || rtx_equal_p (operands[0], operands[1])) ? operands[0] : gen_reg_rtx (MODEmode)); - HOST_WIDE_INT value = INTVAL (operands[2]); - emit_insn (gen_iormode3 (tmp, operands[1], -GEN_INT (value (~ (HOST_WIDE_INT) 0x; + HOST_WIDE_INT value = INTVAL (operands[2]); + HOST_WIDE_INT lo = value 0x; + HOST_WIDE_INT hi = value - lo; - emit_insn (gen_iormode3 (operands[0], tmp, GEN_INT (value 0x))); + emit_insn (gen_iorxormode3 (tmp, operands[1], GEN_INT (hi))); + emit_insn (gen_iorxormode3 (operands[0], tmp, GEN_INT (lo))); DONE; } @@ -2942,45 +2893,30 @@ (define_expand iormode3 operands[2] = force_reg (MODEmode, operands[2]); }) -(define_expand xormode3 - [(set
[PATCH 8/9] rs6000: Clean up sra[wd]
2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (ashrmode3, *ashrmode3, *ashrsi3_64, *ashrmode3_dot, *ashrmode3_dot2): Clobber CA_REGNO. (floatdisf2_internal2): Ditto. (ashrdi3_no_power): Ditto. Fix formatting. --- gcc/config/rs6000/rs6000.md | 44 ++-- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index b03c6c1..13fbb7eb 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -4633,9 +4633,10 @@ (define_split (define_expand ashrmode3 - [(set (match_operand:GPR 0 gpc_reg_operand ) - (ashiftrt:GPR (match_operand:GPR 1 gpc_reg_operand ) - (match_operand:SI 2 reg_or_cint_operand )))] + [(parallel [(set (match_operand:GPR 0 gpc_reg_operand ) + (ashiftrt:GPR (match_operand:GPR 1 gpc_reg_operand ) +(match_operand:SI 2 reg_or_cint_operand ))) + (clobber (reg:GPR CA_REGNO))])] { /* The generic code does not generate optimal code for the low word @@ -4657,7 +4658,8 @@ (define_expand ashrmode3 (define_insn *ashrmode3 [(set (match_operand:GPR 0 gpc_reg_operand =r) (ashiftrt:GPR (match_operand:GPR 1 gpc_reg_operand r) - (match_operand:SI 2 reg_or_cint_operand rn)))] + (match_operand:SI 2 reg_or_cint_operand rn))) + (clobber (reg:GPR CA_REGNO))] srawd%I2 %0,%1,%hH2 [(set_attr type shift) @@ -4667,7 +4669,8 @@ (define_insn *ashrsi3_64 [(set (match_operand:DI 0 gpc_reg_operand =r) (sign_extend:DI (ashiftrt:SI (match_operand:SI 1 gpc_reg_operand r) -(match_operand:SI 2 reg_or_cint_operand rn] +(match_operand:SI 2 reg_or_cint_operand rn + (clobber (reg:SI CA_REGNO))] TARGET_POWERPC64 sraw%I2 %0,%1,%h2 [(set_attr type shift) @@ -4678,15 +4681,17 @@ (define_insn_and_split *ashrmode3_dot (compare:CC (ashiftrt:GPR (match_operand:GPR 1 gpc_reg_operand r,r) (match_operand:SI 2 reg_or_cint_operand rn,rn)) (const_int 0))) - (clobber (match_scratch:GPR 0 =r,r))] + (clobber (match_scratch:GPR 0 =r,r)) + (clobber (reg:GPR CA_REGNO))] MODEmode == Pmode rs6000_gen_cell_microcode @ srawd%I2. %0,%1,%hH2 # reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) - [(set (match_dup 0) - (ashiftrt:GPR (match_dup 1) - (match_dup 2))) + [(parallel [(set (match_dup 0) + (ashiftrt:GPR (match_dup 1) +(match_dup 2))) + (clobber (reg:GPR CA_REGNO))]) (set (match_dup 3) (compare:CC (match_dup 0) (const_int 0)))] @@ -4703,15 +4708,17 @@ (define_insn_and_split *ashrmode3_dot2 (const_int 0))) (set (match_operand:GPR 0 gpc_reg_operand =r,r) (ashiftrt:GPR (match_dup 1) - (match_dup 2)))] + (match_dup 2))) + (clobber (reg:GPR CA_REGNO))] MODEmode == Pmode rs6000_gen_cell_microcode @ srawd%I2. %0,%1,%hH2 # reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) - [(set (match_dup 0) - (ashiftrt:GPR (match_dup 1) - (match_dup 2))) + [(parallel [(set (match_dup 0) + (ashiftrt:GPR (match_dup 1) +(match_dup 2))) + (clobber (reg:GPR CA_REGNO))]) (set (match_dup 3) (compare:CC (match_dup 0) (const_int 0)))] @@ -6152,8 +6159,9 @@ (define_insn_and_split floatdisf2_internal1 ;; by a bit that won't be lost at that stage, but is below the SFmode ;; rounding position. (define_expand floatdisf2_internal2 - [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 ) - (const_int 53))) + [(parallel [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 ) + (const_int 53))) + (clobber (reg:DI CA_REGNO))]) (set (match_operand:DI 0 ) (and:DI (match_dup 1) (const_int 2047))) (set (match_dup 3) (plus:DI (match_dup 3) @@ -6316,9 +6324,9 @@ (define_insn *negdi2_noppc64 (define_insn ashrdi3_no_power [(set (match_operand:DI 0 gpc_reg_operand =r,r) (ashiftrt:DI (match_operand:DI 1 gpc_reg_operand r,r) -(match_operand:SI 2 const_int_operand M,i)))] +(match_operand:SI 2 const_int_operand M,i))) + (clobber (reg:SI CA_REGNO))] !TARGET_POWERPC64 - * { switch (which_alternative) { @@ -6335,7 +6343,7 @@ (define_insn ashrdi3_no_power else return \srwi %0,%1,%h2\;insrwi %0,%L1,%h2,0\;srawi %L0,%L1,%h2\; } -} +} [(set_attr type two,three) (set_attr length 8,12)]) --
[PATCH 6/9] rs6000: Clean up submode3
The instruction patterns are now called subf, with the corresponding operand order, to be less confusing. I tried using the sub extended mnemonics instead but that only made things way, way worse. Do not allow an integer as second operand of submode3; expand doesn't use it. Only strlensi used it, fix that. For an integer first operand, now use a separate insn submode3_imm, which clobbers the carry (it is subfic after all). ctz, ffz, plus_ltu, plus_gtu need changes for that (the latter two will be removed later). 2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (strlensi): Don't use subsi3 with a constant, use addsi3 directly. (three anonymous define_insn, two define_split): Delete. (submode3): Move. Do not allow constant second operand. Generate different insn for constant first operand. (*subfmode3, *subfmode3_dot, *subfmode3_dot2): New. (subfmode3_imm): New. (ctzmode2, ffsmode2): Clobber CA_REGNO where required. (*plus_ltumode): Only handle registers. (*plus_ltumode_1): New. Handle integer third operand. (*plus_gtumode): Only handle registers. (*plus_gtumode_1): New. Handle integer third operand. --- gcc/config/rs6000/rs6000.md | 168 1 file changed, 93 insertions(+), 75 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 4d07269..5f5edaa 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -1426,7 +1426,7 @@ (define_expand strlensi emit_label (end_label); emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb)); emit_insn (gen_subsi3 (result, scratch_string, addr)); - emit_insn (gen_subsi3 (result, result, const1_rtx)); + emit_insn (gen_addsi3 (result, result, constm1_rtx)); DONE; }) @@ -1643,92 +1643,82 @@ (define_insn_and_split *one_cmplmode2_dot2 (set_attr length 4,8)]) -(define_insn - [(set (match_operand:GPR 0 gpc_reg_operand =r,r) - (minus:GPR (match_operand:GPR 1 reg_or_short_operand r,I) - (match_operand:GPR 2 gpc_reg_operand r,r)))] +(define_expand submode3 + [(set (match_operand:SDI 0 gpc_reg_operand ) + (minus:SDI (match_operand:SDI 1 reg_or_short_operand ) + (match_operand:SDI 2 gpc_reg_operand )))] - @ - subf %0,%2,%1 - subfic %0,%2,%1 +{ + if (short_cint_operand (operands[1], MODEmode) + !(MODEmode == DImode !TARGET_POWERPC64)) +{ + emit_insn (gen_subfmode3_imm (operands[0], operands[2], operands[1])); + DONE; +} +}) + +(define_insn *subfmode3 + [(set (match_operand:GPR 0 gpc_reg_operand =r) + (minus:GPR (match_operand:GPR 2 gpc_reg_operand r) + (match_operand:GPR 1 gpc_reg_operand r)))] + + subf %0,%1,%2 [(set_attr type add)]) -(define_insn - [(set (match_operand:CC 0 cc_reg_operand =x,?y) - (compare:CC (minus:P (match_operand:P 1 gpc_reg_operand r,r) -(match_operand:P 2 gpc_reg_operand r,r)) +(define_insn_and_split *subfmode3_dot + [(set (match_operand:CC 3 cc_reg_operand =x,?y) + (compare:CC (minus:GPR (match_operand:GPR 2 gpc_reg_operand r,r) + (match_operand:GPR 1 gpc_reg_operand r,r)) (const_int 0))) - (clobber (match_scratch:P 3 =r,r))] - + (clobber (match_scratch:GPR 0 =r,r))] + MODEmode == Pmode @ - subf. %3,%2,%1 + subf. %0,%1,%2 # + reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) + [(set (match_dup 0) + (minus:GPR (match_dup 2) + (match_dup 1))) + (set (match_dup 3) + (compare:CC (match_dup 0) + (const_int 0)))] + [(set_attr type add) (set_attr dot yes) (set_attr length 4,8)]) -(define_split - [(set (match_operand:CC 0 cc_reg_not_cr0_operand ) - (compare:CC (minus:P (match_operand:P 1 gpc_reg_operand ) -(match_operand:P 2 gpc_reg_operand )) - (const_int 0))) - (clobber (match_scratch:P 3 ))] - reload_completed - [(set (match_dup 3) - (minus:P (match_dup 1) - (match_dup 2))) - (set (match_dup 0) - (compare:CC (match_dup 3) - (const_int 0)))] - ) - -(define_insn +(define_insn_and_split *subfmode3_dot2 [(set (match_operand:CC 3 cc_reg_operand =x,?y) - (compare:CC (minus:P (match_operand:P 1 gpc_reg_operand r,r) -(match_operand:P 2 gpc_reg_operand r,r)) + (compare:CC (minus:GPR (match_operand:GPR 2 gpc_reg_operand r,r) + (match_operand:GPR 1 gpc_reg_operand r,r)) (const_int 0))) - (set (match_operand:P 0 gpc_reg_operand =r,r) - (minus:P (match_dup 1) - (match_dup 2)))] - + (set (match_operand:GPR 0 gpc_reg_operand =r,r) + (minus:GPR (match_dup 2) +
[PATCH 9/9] rs6000: Clean up sra[wd]i;addze
Also change type compare to two for the dot forms. 2014-09-20 Segher Boessenkool seg...@kernel.crashing.org * config/rs6000/rs6000.md (divmode3): Fix comment. Use a different insn for divides by integer powers of two. (divmode3_sra, *divmode3_sra_dot, *divmode3_sra_dot2): New. (modmode3): Fix formatting. (three anonymous define_insn and two define_split): Delete. --- gcc/config/rs6000/rs6000.md | 147 +--- 1 file changed, 71 insertions(+), 76 deletions(-) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 13fbb7eb..2686ec3 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -2487,7 +2487,7 @@ (define_insn udivmode3 (set_attr size bits)]) -;; For powers of two we can do srai/aze for divide and then adjust for +;; For powers of two we can do sra[wd]i/addze for divide and then adjust for ;; modulus. If it isn't a power of two, force operands into register and do ;; a normal divide. (define_expand divmode3 @@ -2496,10 +2496,15 @@ (define_expand divmode3 (match_operand:GPR 2 reg_or_cint_operand )))] { - if (GET_CODE (operands[2]) != CONST_INT - || INTVAL (operands[2]) = 0 - || exact_log2 (INTVAL (operands[2])) 0) -operands[2] = force_reg (MODEmode, operands[2]); + if (CONST_INT_P (operands[2]) + INTVAL (operands[2]) 0 + exact_log2 (INTVAL (operands[2])) = 0) +{ + emit_insn (gen_divmode3_sra (operands[0], operands[1], operands[2])); + DONE; +} + + operands[2] = force_reg (MODEmode, operands[2]); }) (define_insn *divmode3 @@ -2511,12 +2516,71 @@ (define_insn *divmode3 [(set_attr type div) (set_attr size bits)]) +(define_insn divmode3_sra + [(set (match_operand:GPR 0 gpc_reg_operand =r) + (div:GPR (match_operand:GPR 1 gpc_reg_operand r) +(match_operand:GPR 2 exact_log2_cint_operand N))) + (clobber (reg:GPR CA_REGNO))] + + srawdi %0,%1,%p2\;addze %0,%0 + [(set_attr type two) + (set_attr length 8)]) + +(define_insn_and_split *divmode3_sra_dot + [(set (match_operand:CC 3 cc_reg_operand =x,?y) + (compare:CC (div:GPR (match_operand:GPR 1 gpc_reg_operand r,r) +(match_operand:GPR 2 exact_log2_cint_operand N,N)) + (const_int 0))) + (clobber (match_scratch:GPR 0 =r,r)) + (clobber (reg:GPR CA_REGNO))] + MODEmode == Pmode + @ + srawdi %0,%1,%p2\;addze. %0,%0 + # + reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) + [(parallel [(set (match_dup 0) + (div:GPR (match_dup 1) + (match_dup 2))) + (clobber (reg:GPR CA_REGNO))]) + (set (match_dup 3) + (compare:CC (match_dup 0) + (const_int 0)))] + + [(set_attr type two) + (set_attr length 8,12) + (set_attr cell_micro not)]) + +(define_insn_and_split *divmode3_sra_dot2 + [(set (match_operand:CC 3 cc_reg_operand =x,?y) + (compare:CC (div:GPR (match_operand:GPR 1 gpc_reg_operand r,r) +(match_operand:GPR 2 exact_log2_cint_operand N,N)) + (const_int 0))) + (set (match_operand:GPR 0 gpc_reg_operand =r,r) + (div:GPR (match_dup 1) +(match_dup 2))) + (clobber (reg:GPR CA_REGNO))] + MODEmode == Pmode + @ + srawdi %0,%1,%p2\;addze. %0,%0 + # + reload_completed cc_reg_not_cr0_operand (operands[3], CCmode) + [(parallel [(set (match_dup 0) + (div:GPR (match_dup 1) + (match_dup 2))) + (clobber (reg:GPR CA_REGNO))]) + (set (match_dup 3) + (compare:CC (match_dup 0) + (const_int 0)))] + + [(set_attr type two) + (set_attr length 8,12) + (set_attr cell_micro not)]) + (define_expand modmode3 [(use (match_operand:GPR 0 gpc_reg_operand )) (use (match_operand:GPR 1 gpc_reg_operand )) (use (match_operand:GPR 2 reg_or_cint_operand ))] - { int i; rtx temp1; @@ -2534,76 +2598,7 @@ (define_expand modmode3 emit_insn (gen_ashlmode3 (temp2, temp1, GEN_INT (i))); emit_insn (gen_submode3 (operands[0], operands[1], temp2)); DONE; -}) - -(define_insn - [(set (match_operand:GPR 0 gpc_reg_operand =r) - (div:GPR (match_operand:GPR 1 gpc_reg_operand r) -(match_operand:GPR 2 exact_log2_cint_operand N)))] - - srawdi %0,%1,%p2\;addze %0,%0 - [(set_attr type two) - (set_attr length 8)]) - -(define_insn - [(set (match_operand:CC 0 cc_reg_operand =x,?y) - (compare:CC (div:P (match_operand:P 1 gpc_reg_operand r,r) - (match_operand:P 2 exact_log2_cint_operand N,N)) - (const_int 0))) - (clobber (match_scratch:P 3 =r,r))] - - @ - srawdi %3,%1,%p2\;addze. %3,%3 - # - [(set_attr type compare) - (set_attr length 8,12) - (set_attr cell_micro not)]) - -(define_split - [(set (match_operand:CC 0
[BUILDROBOT] genrecog fix uncovers problem in bfin.md (was: [Patch] Teach genrecog/genoutput that scratch registers require write constraint modifiers)
Hi! On Thu, 2014-09-18 11:19:21 +0100, James Greenhalgh james.greenha...@arm.com wrote: As discussed in https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01334.html The construct (clobber (match_scratch 0 r)) is invalid - operand 0 must be marked either write or read/write. Likewise (match_* 0 r) is invalid, marking an operand earlyclobber does not remove the need to also mark it write or read/write. My build robot shows a new build error, which I guess is caused/uncovered by your genrecog change on bfin-elf (see eg. build http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=355667): build/genrecog /home/jbglaw/repos/gcc/gcc/common.md /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md \ insn-conditions.md tmp-recog.c /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:745: warning: operand 0 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:1953: warning: source missing a mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:1994: warning: source missing a mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:1994: warning: source missing a mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2005: warning: source missing a mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2005: warning: source missing a mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2128: warning: operand 1 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2139: warning: operand 1 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2150: warning: operand 2 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2162: warning: operand 2 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2228: warning: operand 1 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2238: warning: operand 1 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2248: warning: operand 2 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2259: warning: operand 2 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2720: warning: operand 0 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2742: warning: operand 0 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:2742: warning: operand 1 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:3231: warning: operand 4 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:3247: warning: operand 3 missing mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:1971: warning: source missing a mode? /home/jbglaw/repos/gcc/gcc/config/bfin/bfin.md:1971: constraints not supported in define_split make[1]: *** [s-recog] Error 1 make[1]: Leaving directory `/home/jbglaw/build/bfin-elf/build-gcc/gcc' make: *** [all-gcc] Error 2 Would be nice if the bfin maintainer or you would come up with a fix. Thanks, JBG -- Jan-Benedict Glaw jbg...@lug-owl.de +49-172-7608481 Signature of:http://www.chiark.greenend.org.uk/~sgtatham/bugs.html the second : signature.asc Description: Digital signature
libgo patch committed: Restore copyright notice
I committed this libgo patch to mainline to restore a copyright notice that was accidentally removed. Ian diff -r 408e2e4289f9 libgo/runtime/mgc0.c --- a/libgo/runtime/mgc0.c Fri Sep 19 11:53:15 2014 -0700 +++ b/libgo/runtime/mgc0.c Sat Sep 20 13:41:17 2014 -0700 @@ -1,4 +1,4 @@ - +// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
[PATCH] gcc-gdb-test.exp: Handle old GDB short int and long int types.
Old GDB might show short and long as short int and long int. This made gcc.dg/guality/const-volatile.c ans restrict.c fail on older GDBs. According to the patch that changed this in newer versions of GDB this was a bug: https://sourceware.org/ml/gdb-patches/2012-09/msg00455.html The patch transforms the types short int and long int coming from GDB to plain short and long. And a variant has been added to the const-volatile.c testcase to make sure short and long long are handled correctly now with older GDB. Tested against GDB 7.7.1 and 7.4.50. gcc/testsuite/ChangeLog * lib/gcc-gdb-test.exp (gdb-test): Transform gdb types short int and long int to plain short and long. * gcc.dg/guality/const-volatile.c (struct bar): New struct containing short and long long fields. (bar): New variable to test the type. --- gcc/testsuite/gcc.dg/guality/const-volatile.c | 11 +++ gcc/testsuite/lib/gcc-gdb-test.exp| 4 2 files changed, 15 insertions(+) diff --git a/gcc/testsuite/gcc.dg/guality/const-volatile.c b/gcc/testsuite/gcc.dg/guality/const-volatile.c index 86460e4..eb45ae5 100644 --- a/gcc/testsuite/gcc.dg/guality/const-volatile.c +++ b/gcc/testsuite/gcc.dg/guality/const-volatile.c @@ -28,6 +28,16 @@ struct foo const signed char csc; }; +struct bar +{ + short s; + const short cs; + volatile short vs; + const volatile short cvs; + volatile long long vll; +}; + +struct bar bar __attribute__((used)); struct foo foo; const struct foo cfoo; volatile struct foo vfoo; @@ -72,6 +82,7 @@ main (int argc, char **argv) /* { dg-final { gdb-test 50 type:cvip int * const volatile } } */ +/* { dg-final { gdb-test 50 type:bar struct bar { short s; const short cs; volatile short vs; const volatile short cvs; volatile long long vll; } } } */ /* { dg-final { gdb-test 50 type:foo struct foo { const long cli; const signed char csc; } } } */ /* { dg-final { gdb-test 50 type:cfoo const struct foo { const long cli; const signed char csc; } } } */ /* { dg-final { gdb-test 50 type:vfoo volatile struct foo { const long cli; const signed char csc; } } } */ diff --git a/gcc/testsuite/lib/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp index c729793..f43263d 100644 --- a/gcc/testsuite/lib/gcc-gdb-test.exp +++ b/gcc/testsuite/lib/gcc-gdb-test.exp @@ -111,6 +111,10 @@ proc gdb-test { args } { # Squash all extra whitespace/newlines that gdb might use for # pretty printing into one so result is just one line. regsub -all {[\n\r\t ]+} $type type + # Old gdb might output long int instead of just long + # and short int instead of just short. Canonicalize. +regsub -all {\mlong int\M} $type long type +regsub -all {\mshort int\M} $type short type set expected [lindex $args 2] if { $type == $expected } { pass $testname -- 1.9.3
[PATCH] PR63300 'const volatile' sometimes stripped in debug info.
When adding DW_TAG_restrict_type I made a mistake when updating the code that handled types with multiple modifiers. This patch fixes it by putting the logic for finding the sub-qualified type in a separate function and fall back to adding the modifiers separately if there is no such existing type. The old tests didn't catch this case because there always was an existing sub-qualified type already. The new testcase fails before and succeeds after this patch. gcc/ChangeLog * dwarf2out.c (existing_sub_qualified_type): New function. (modified_type_die): Use existing_sub_qualified_type. Fall back to adding modifiers one by one of there is no existing sub-qualified type. gcc/testsuite/ChangeLog * gcc.dg/guality/pr63300-const-volatile.c: New testcase. --- gcc/dwarf2out.c| 85 ++ .../gcc.dg/guality/pr63300-const-volatile.c| 12 +++ 2 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/guality/pr63300-const-volatile.c diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e87ade2..0cbc316 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10461,6 +10461,51 @@ decl_quals (const_tree decl) ? TYPE_QUAL_VOLATILE : TYPE_UNQUALIFIED)); } +/* Returns true if CV_QUALS contains QUAL and we have a qualified + variant of TYPE that has at least one other qualifier found in + CV_QUALS. Returns false if CV_QUALS doesn't contain QUAL, if + CV_QUALS is empty after subtracting QUAL, or if we don't have a + TYPE that has at least one qualifier from CV_QUALS minus QUAL. */ +static bool +existing_sub_qualified_type (tree type, int cv_quals, int qual) +{ + int sub_qual, sub_quals = cv_quals ~qual; + if ((cv_quals qual) == TYPE_UNQUALIFIED || sub_quals == TYPE_UNQUALIFIED) +return false; + + sub_qual = TYPE_QUAL_CONST; + if ((sub_quals ~sub_qual) != TYPE_UNQUALIFIED + get_qualified_type (type, sub_quals ~sub_qual) != NULL_TREE) +return true; + + sub_qual = TYPE_QUAL_VOLATILE; + if ((sub_quals ~sub_qual) != TYPE_UNQUALIFIED + get_qualified_type (type, sub_quals ~sub_qual) != NULL_TREE) +return true; + + sub_qual = TYPE_QUAL_RESTRICT; + if ((sub_quals ~sub_qual) != TYPE_UNQUALIFIED + get_qualified_type (type, sub_quals ~sub_qual) != NULL_TREE) +return true; + + sub_qual = TYPE_QUAL_CONST TYPE_QUAL_VOLATILE; + if ((sub_quals ~sub_qual) != TYPE_UNQUALIFIED + get_qualified_type (type, sub_quals ~sub_qual) != NULL_TREE) +return true; + + sub_qual = TYPE_QUAL_CONST TYPE_QUAL_RESTRICT; + if ((sub_quals ~sub_qual) != TYPE_UNQUALIFIED + get_qualified_type (type, sub_quals ~sub_qual) != NULL_TREE) +return true; + + sub_qual = TYPE_QUAL_VOLATILE TYPE_QUAL_RESTRICT; + if ((sub_quals ~sub_qual) != TYPE_UNQUALIFIED + get_qualified_type (type, sub_quals ~sub_qual) != NULL_TREE) +return true; + + return false; +} + /* Given a pointer to an arbitrary ..._TYPE tree node, return a debugging entry that chains various modifiers in front of the given type. */ @@ -10543,34 +10588,48 @@ modified_type_die (tree type, int cv_quals, dw_die_ref context_die) mod_scope = scope_die_for (type, context_die); - if ((cv_quals TYPE_QUAL_CONST) - /* If there are multiple type modifiers, prefer a path which -leads to a qualified type. */ - (((cv_quals ~TYPE_QUAL_CONST) == TYPE_UNQUALIFIED) - || get_qualified_type (type, cv_quals) == NULL_TREE - || (get_qualified_type (type, cv_quals ~TYPE_QUAL_CONST) - != NULL_TREE))) + /* If there are multiple type modifiers, prefer a path which + leads to a qualified type. */ + if (existing_sub_qualified_type (type, cv_quals, TYPE_QUAL_CONST)) { mod_type_die = new_die (DW_TAG_const_type, mod_scope, type); sub_die = modified_type_die (type, cv_quals ~TYPE_QUAL_CONST, context_die); } - else if ((cv_quals TYPE_QUAL_VOLATILE) - (((cv_quals ~TYPE_QUAL_VOLATILE) == TYPE_UNQUALIFIED) - || get_qualified_type (type, cv_quals) == NULL_TREE - || (get_qualified_type (type, cv_quals ~TYPE_QUAL_VOLATILE) - != NULL_TREE))) + else if (existing_sub_qualified_type (type, cv_quals, TYPE_QUAL_VOLATILE)) { mod_type_die = new_die (DW_TAG_volatile_type, mod_scope, type); sub_die = modified_type_die (type, cv_quals ~TYPE_QUAL_VOLATILE, context_die); } - else if (cv_quals TYPE_QUAL_RESTRICT) + else if (existing_sub_qualified_type (type, cv_quals, TYPE_QUAL_RESTRICT)) { mod_type_die = new_die (DW_TAG_restrict_type, mod_scope, type); sub_die = modified_type_die (type, cv_quals ~TYPE_QUAL_RESTRICT, context_die); } + else if (cv_quals) +{ + /* No existing path, just add
Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner
On Sat, Sep 20, 2014 at 3:04 AM, Anthony Green gr...@moxielogic.com wrote: Attached patch fixes libgo reflect test failure with libffi closures. The gccgo compiler started to use FFI closures recently; the compiler passes ffi_type_void for structures with zero members. Why not just pass an FFI_TYPE_STRUCT with zero members? Because when an empty struct is used as a return type libffi returns a failure from ffi_prep_cif_core: /* Initialize the return type if necessary */ if ((cif-rtype-size == 0) (initialize_aggregate(cif-rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; This is because initialize_aggregate fails: if (UNLIKELY(arg == NULL || arg-elements == NULL)) return FFI_BAD_TYPEDEF; I haven't looked farther. Ian
[PATCH] Make all gcc.dg/guality/const-volatile.c subtests PASS under LTO.
Some subtests were reported as UNSUPPORTED when running under LTO. That was just because the relevant variables were optimized out. Mark those variables as used. Now const-volatile reports 192 PASS. gcc/testsuite/ChangeLog * gcc.dg/guality/const-volatile.c (i): Mark as used. (ci): Likewise. (pci): Likewise. (pvi): Likewise. (pcvi): Likewise. (cip): Likewise. (foo): Likewise. (cfoo): Likewise. --- gcc/testsuite/gcc.dg/guality/const-volatile.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/gcc.dg/guality/const-volatile.c b/gcc/testsuite/gcc.dg/guality/const-volatile.c index eb45ae5..d657f48 100644 --- a/gcc/testsuite/gcc.dg/guality/const-volatile.c +++ b/gcc/testsuite/gcc.dg/guality/const-volatile.c @@ -2,17 +2,17 @@ /* { dg-do run } */ /* { dg-options -g } */ -int i; -const int ci; +int i __attribute__((used)); +const int ci __attribute__((used)); volatile int vi; const volatile int cvi; int *pi __attribute__((used)); -const int *pci; -volatile int *pvi; -const volatile int *pcvi; +const int *pci __attribute__((used)); +volatile int *pvi __attribute__((used)); +const volatile int *pcvi __attribute__((used)); -int * const cip; +int * const cip __attribute__((used)); int * volatile vip; int * const volatile cvip; @@ -38,8 +38,8 @@ struct bar }; struct bar bar __attribute__((used)); -struct foo foo; -const struct foo cfoo; +struct foo foo __attribute__((used)); +const struct foo cfoo __attribute__((used)); volatile struct foo vfoo; const volatile struct foo cvfoo; -- 1.9.3
Re: [committed] Don't instrument clobbers with asan (PR c++/62017)
On 09/18/2014 10:12 AM, Jakub Jelinek wrote: Clobber stmts, being artificial statements, were certainly never meant to be instrumented. In 4.8 when asan has been introduced into gcc, the lhs of clobber could be only a decl and as a whole decl store would not be really instrumented, but with *this clobbers in 4.9 that is no longer the case. And this patch fixes the clobber to only clobber the as-base part of the class, since any virtual bases might not be destroyed yet. This patch also fixes Jakub's testcase (without his patch). Tested x86_64-pc-linux-gnu, applying to trunk. commit e8c36b9fe6c1534925d809a7a15e599770466ee3 Author: Jason Merrill ja...@redhat.com Date: Thu Sep 18 11:15:57 2014 -0400 PR c++/62017 * decl.c (begin_destructor_body): Only clobber the as-base part of *this. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 59dada7..fe5a4af 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13808,10 +13808,12 @@ begin_destructor_body (void) /* Insert a cleanup to let the back end know that the object is dead when we exit the destructor, either normally or via exception. */ - tree clobber = build_constructor (current_class_type, NULL); + tree btype = CLASSTYPE_AS_BASE (current_class_type); + tree clobber = build_constructor (btype, NULL); TREE_THIS_VOLATILE (clobber) = true; - tree exprstmt = build2 (MODIFY_EXPR, current_class_type, - current_class_ref, clobber); + tree bref = build_nop (build_reference_type (btype), current_class_ptr); + bref = convert_from_reference (bref); + tree exprstmt = build2 (MODIFY_EXPR, btype, bref, clobber); finish_decl_cleanup (NULL_TREE, exprstmt); /* And insert cleanups for our bases and members so that they
Re: [committed] Don't instrument clobbers with asan (PR c++/62017)
On Sat, Sep 20, 2014 at 10:42:01PM -0400, Jason Merrill wrote: On 09/18/2014 10:12 AM, Jakub Jelinek wrote: Clobber stmts, being artificial statements, were certainly never meant to be instrumented. In 4.8 when asan has been introduced into gcc, the lhs of clobber could be only a decl and as a whole decl store would not be really instrumented, but with *this clobbers in 4.9 that is no longer the case. And this patch fixes the clobber to only clobber the as-base part of the class, since any virtual bases might not be destroyed yet. This patch also fixes Jakub's testcase (without his patch). Thanks. commit e8c36b9fe6c1534925d809a7a15e599770466ee3 Author: Jason Merrill ja...@redhat.com Date: Thu Sep 18 11:15:57 2014 -0400 PR c++/62017 * decl.c (begin_destructor_body): Only clobber the as-base part of *this. Jakub