[PATCH] Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars

2022-07-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that when we mark the ssa name that was referenced in the now removed dead store (to a write only static variable), the inline-asm would also be removed even though it was defining another ssa name. This fixes the problem by checking to make sure that the

[COMMITTED] Fix tree-opt/PR106087: ICE with inline-asm with multiple output and assigned only static vars

2022-07-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that when we mark the ssa name that was referenced in the now removed dead store (to a write only static variable), the inline-asm would also be removed even though it was defining another ssa name. This fixes the problem by checking to make sure that the

[COMMITED] [RSIC-V] Fix 32bit riscv with zbs extension enabled

2022-08-04 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here was a disconnect between splittable_const_int_operand predicate and the function riscv_build_integer_1 for 32bits with zbs enabled. The splittable_const_int_operand predicate had a check for TARGET_64BIT which was not needed so this patch removed it. Committe

[COMMITTED] Move testcase gcc.dg/tree-ssa/pr93776.c to gcc.c-torture/compile/pr93776.c

2022-08-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since this testcase is not exactly SSA specific and it would be a good idea to compile this at more than just at -O1, moving it to gcc.c-torture/compile would do that. Committed as obvious after a test on x86_64-linux-gnu. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/

[PATCH] Fix middle-end/103645: empty struct store not removed when using compound literal

2022-08-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski For compound literals empty struct stores are not removed as they go down a different path of the gimplifier; trying to optimize the init constructor. This fixes the problem by not adding the gimple assignment at the end of gimplify_init_constructor if it was an empty type. N

[PATCH] Fix PR c++/66590: incorrect warning "reaches end of non-void function" for switch

2021-08-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem here is there is code in the C++ front-end not to add a break statement (to the IR) if the previous block does not fall through. The problem is the code which does the check to see if the block may fallthrough does not check a CLEANUP_STMT; it assumes it is alwa

[PATCH 1/2] Add gimple_truth_valued_p to match.pd and use it

2021-08-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski While working on some more boolean optimizations, I noticed that there are places which does SSA_NAME@0 and then look at then either use get_nonzero_bits or ssa_name_has_boolean_range to see if the ssa name had a boolean range. This cleans this up slightly by have a simple mat

[PATCH 2/2] Fix 101805: Simplify min/max of boolean arguments

2021-08-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski I noticed this while Richard B. fixing PR101756. Basically min of two bools is the same as doing an "and" and max of two bools is doing an "ior". gcc/ChangeLog: * match.pd: Add min/max patterns for bool types. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bool

[PATCH] Add range/nonzero info to generated ADD_OVERFLOW and simplify

2021-08-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski Even though this does not change the generated code, it does improve the initial RTL generation. gcc/ChangeLog: * tree-ssa-math-opts.c (match_arith_overflow): Add range and nonzero bits information to the new overflow ssa name. Also fold the

[PATCH] Fix a few problems with download_prerequisites.

2021-08-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski There are a few problems with download_prerequisites are described in PR 82704. The first is on busy-box version of shasum and md5sum the extended option --check don't exist so just use -c. The second issue is the code for which shasum program to use is included twice and is

[PATCH] Fix PR 90142: contrib/download_prerequisites uses test ==

2021-08-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski Since == is not portable, it is better to use = in contrib/ download_prerequisites. The only place == was used is inside the function md5_check which is used only on Mac OS X. Tested on Mac OS X as: ./contrib/download_prerequisites --md5 Both with all files having the correc

[PATCH] Fix PR driver/79181 (and others), not deleting some /tmp/cc* files for LTO.

2021-08-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the main issue here is that some signals are not setup unlike collect2. So this merges the setting up of the signal handlers to one function in collect-utils and has collect2 and lto-wrapper call that function. OK? Bootstrapped and tested on x86_64-linux-gnu with no regres

[PATCH] Fix gcc.dg/ipa/inline-8.c for -fPIC

2021-08-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is with -fPIC, both cmp and move don't bind locally so they are not even tried to be inlined. This fixes the issue by marking both functions as static and now the testcase passes for both -fPIC and -fno-PIC cases. OK? Tested on x86_64-linux-gnu. gcc/testsui

[PATCH] Fix tree-optimization/101941: IPA splitting out function with error attribute

2022-01-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The Linux kernel started to fail compile when the jump threader was improved (r12-2591-g2e96b5f14e4025691). This failure was due to the IPA splitting code decided now to split off the basic block which contained two functions, one of those functions included the error attribut

[PATCH] [COMMITTED] Improve coment for the newly added code in ipa-split.

2022-01-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski It was pointed out to me by Jakub, that the comment in front of the new code which handles warning/error attribute was not really understandable. This fixes the comment to be understandable; I don't know why I wrote the original comment that way even. Committed as obvious aft

[PATCH] [aarch64/64821]: Simplify __builtin_aarch64_sqrt* into internal function .SQRT.

2022-01-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a simple patch which simplifies the __builtin_aarch64_sqrt* builtins into the internal function SQRT which allows for constant folding and other optimizations at the gimple level. It was originally suggested we do to __builtin_sqrt just for __builtin_aarch64_sqrtdf whe

[PATCH v3] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2022-01-25 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that aarch64_expand_setmem does not change the alignment for strict alignment case. This is version 3 of this patch, is is based on version 2 and moves the check for the number of instructions from the optimizing for size case to be always and change the co

[PATCH] aarch64: [PR101529] Fix vector shuffle insertion expansion

2022-01-26 Thread apinski--- via Gcc-patches
From: Andrew Pinski The function aarch64_evpc_ins would reuse the target even though it might be the same register as the two inputs. Instead of checking to see if we can reuse the target, just use the original input directly. Committed as approved after bootstrapped and tested on aarch64-linux-

[PATCH] Fix aarch64/104201: branch-protection-attr.c fails after quoting difference

2022-01-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski After the quoting changes in r12-6521-g03a1a86b5ee40d4e240, branch-protection-attr.c fails due to expecting a different quoting type for "leaf". This patch changes the quoting from "" to '' as that is what is used now. Committed as obvious after a test of the testcase. gcc/

[PATCH] Fix comment for operand_compare::operand_equal_p.

2022-01-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski The OEP_* enums were moved to tree-core.h in r0-124973-g5e351e960763 but the comment was correct when it was added added to fold-const.h in r10-4231-g7f4a8ee03d40. This fixes the reference to the OEP_* enum to reference tree-core. Committed as obvious after a bootstrap/test o

[PATCH] [COMMITTED] Change multiprecision.org to use https

2022-02-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski As reported at https://gcc.gnu.org/pipermail/gcc/2022-February/238216.html, multiprecision.org now uses https so this updates the documentation to use https instead of http. Committed as obvious. gcc/ChangeLog: * doc/install.texi: --- gcc/doc/install.texi | 2 +- 1

[PATCH] [COMMITTED] Fix PR aarch64/104474: ICE with vector float initializers and non-consts.

2022-02-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that the aarch64 back-end was placing const0_rtx into the constant vector RTL even if the mode was a floating point mode. The fix is instead to use CONST0_RTX and pass the mode to select the correct zero (either const_int or const_double). Committed as obv

[PATCH] c: [PR104506] Fix ICE after error due to change of type to error_mark_node

2022-02-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we end up with an error_mark_node when calling useless_type_conversion_p and that ICEs. STRIP_NOPS/tree_nop_conversion has had a check for the inner type being an error_mark_node since g9a6bb3f78c96 (2000). This just adds the check also to tree_ssa_useless_

[PATCH v2] Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST where type is a nop convert

2021-11-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski Currently we fold (type) X op CST into (type) (X op ((type-x) CST)) when the conversion widens but not when the conversion is a nop. For the same reason why we move the widening conversion (the possibility of removing an extra conversion), we should do the same if the conve

[PATCH] Fix PR 103317, ICE after PHI-OPT, minmax_replacement producing invalid SSA

2021-11-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem is r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks but missed one location where the basic block does not need to be empty but still needs to have a single predecessor. This patch fixes that over sight. OK? Bootstrapped and tested on x86_

[PATCH v2] [AARCH64] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2021-11-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that aarch64_expand_setmem does not change the alignment for strict alignment case. This is a simplified patch from what I had previously. So constraining copy_limit to the alignment of the mem in the case of strict align fixes the issue without checking

[PATCH] Fix tree-optimization/103314 : Limit folding of (type) X op CST where type is a nop convert to gimple

2021-11-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski There is some re-association code in fold_binary which conflicts with this optimization due keeping around some "constants" which are not INTEGER_CST (1 << -1) so we end up in an infinite loop because of that. So we need to limit this case to GIMPLE level only. OK? Bootstrapp

[PATCH] Fix tree-optimization/103220: Another missing folding of (type) X op CST where type is a nop convert

2021-11-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is that int_fits_type_p will return false if we just change the sign of things like -2 (or 254) so we should accept the case where we just change the sign (and not the precision) of the type. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions

[PATCH] tree-optimization: [PR31531] Improve ~a < CST, allow a nop cast inbetween ~ and a

2021-11-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski This PR was orignally for the missed optimization of a few isnegative which had been solved a long time ago (sometime before 4.4.0). I noticed there was one missed optimization on the gimple level. There is a match.pd pattern for ~a < CST but we miss that there could be a nop_

[PATCH 1/2] Improve/Fix (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0 pattern.

2021-11-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski The pattern here was not catching all comparisons and the multiply was not commutative when it should have been. This patches fixes that by using tcc_comparison and adding :c to the multiply. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog:

[PATCH 2/2] tree-optimization: [PR92342] Move b & -(a==c) optimization to the gimple level

2021-11-21 Thread apinski--- via Gcc-patches
From: Andrew Pinski Combine disabled this optimization in r10-254-gddbb5da5199fb42 but it makes sense to do this on the gimple level and then let expand decide which way is better. So this adds the transformation on the gimple level (late like was done for the multiply case). OK? Bootstrapped an

[PATCH v2] Canonicalize &MEM[ssa_n, CST] to ssa_n p+ CST in fold_stmt_1

2021-11-22 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a new version of the patch to fix PR 102216. Instead of doing the canonicalization inside forwprop, Richi mentioned we should do it inside fold_stmt_1 and that is what this patch does. PR tree-optimization/102216 gcc/ChangeLog: * gimple-fold.c (fold_

[PATCH] Fix PR 62157: disclean in libsanitizer not working

2021-11-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski So what is happening is DIST_SUBDIRS contains the conditional directories which is wrong, so we need to force DIST_SUBDIRS to be the same as SUBDIRS as recommened by the automake manual. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Also now make distcl

[PATCH] Fix PR 19089: Environment variable TMP may yield gcc: abort

2021-11-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski Even though I cannot reproduce the ICE any more, this is still a bug. We check already to see if we can access the directory but never check to see if the path is actually a directory. This adds the check and now we reject the file as not usable as a tmp directory. OK? Boots

[PATCH] tree-optimization: [PR101540] Simplify CONSTRUCTOR for vector(1) to be VCE

2021-11-28 Thread apinski--- via Gcc-patches
From: Andrew Pinski This just adds a simplification to simplify_vector_constructor for vector of 1 element to be VCE which should reduce memory usage in the compiler and maybe allow for some more optimizations. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree

[PATCH] [Committed] New testcase for C++/71792, bitfields and auto

2021-12-03 Thread apinski--- via Gcc-patches
From: Andrew Pinski This testcase used to fail before GCC 6.4.0 due to the wrong type being used for auto when used with bitfields, the C++ front-end was using the "bitfield" type rather than the underlaying type. Committed the testcase after a quick check. PR c++/71792 gcc/testsuite/C

[PATCH] Fix C++/93809 and C++/83469: typenames and unions

2021-12-07 Thread apinski--- via Gcc-patches
From: Andrew Pinski There are a few issues here with typenames and unions (and even struct keywords with unions). First in cp_parser_check_class_key, we need to allow typenames to name union types and union key to be able to use with typenames. The next issue is we need to record if we had a uni

[PATCH] Use simple_dce_from_worklist with match_simplify_replacement.

2022-10-27 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is a simple patch to do some DCE after a successful match and simplify replacement in PHI-OPT. match and simplify likes to generate some extra statements which should be cleaned up. OK? Bootstrapped and tested on x86_64-linux with no regressions. Thanks, Andrew Pinski

[PATCH 1/2] Fix PR 105532: match.pd patterns calling tree_nonzero_bits with vector types

2022-11-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski Even though this PR was reported with an ubsan issue, the problem is tree_nonzero_bits is being called with an expression which is a vector type. This fixes three patterns I noticed which does that. And adds a testcase for one of the patterns. OK? Bootstrapped and tested on x

[PATCH 0/2] tree_nonzero_bits vs vector and complex types

2022-11-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski While looking at older unconfirmed bug reports, I noticed there was an ubsan found issue and noticed tree_nonzero_bits was being called with a vector type. How ubsan found it was at the end of tree_nonzero_bits, did "return wi::shwi (-1, TYPE_PRECISION (TREE_TYPE (t)));" and

[PATCH 2/2] Add assert for type on tree_nonzero_bits

2022-11-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski Right now anyone could call tree_nonzero_bits with either complex or vector types and this will return the wrong thing. So just assert that nobody calls it with this. OK? Bootstrapped and tested with no regressions on x86_64-linux-gnu. gcc/ChangeLog: * fold-const.cc

[COMMITTED] [AARCH64] Remove reference to MD_INCLUDES

2022-08-11 Thread apinski--- via Gcc-patches
From: Andrew Pinski The comment reference to MD_INCLUDES is not needed as it is auto generated for long time now even before aarch64 target was added. MD_INCLUDES has been auto generated since r0-64489. Note some targets still manually set MD_INCLUDES and I suspect those can be changed but I don

[PATCH 04/10] [RISCV] Add the list of operand modifiers to riscv.md too

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make it easier to find operands modifiers while in the md file, add the list of modifiers to the top of the md file. This is similar to i386 target. OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_pr

[PATCH 00/10] [RISCV] Fix/improve the RISCV backend

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This set of patches fixes a few RISCV issues and does a few cleanups. Including moving all of the iterators to iterators.md like many newer backends. It also fixes a few PRs which I filed including the RISCV32 issue with ZBS enabled. Thanks, Andrew Pinski Andrew Pinski (10):

[PATCH 02/10] [RISCV] Move iterators from bitmanip.md to iterators.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just like the previous patch this move all of the iterators of bitmanip.md to iterators.md. All modern backends put the iterators in iterators.md for easier access. OK? Built and tested for riscv32-linux-gnu with --with-arch=rv32imafdc_zba_zbb_zbc_zbs. Thanks, Andrew Pinsk

[PATCH 03/10] [RISCV] Move iterators from sync.md to iterators.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Like the previous two patches this moves the iterators that are in sync.md to iterators.md. OK? build and tested for riscv64-linux-gnu. gcc/ChangeLog: * config/riscv/sync.md (any_atomic, atomic_optab): Move to ... * config/riscv/iterators.md: Here. --- gcc/

[PATCH 01/10] [RISCV] Move iterators from riscv.md to iterators.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This moves the iterators out from riscv.md to iterators.md like most modern backends. I have not moved the iterators from the other .md files yet. OK? Build and tested on riscv64-linux-gnu and riscv32-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/r

[PATCH 06/10] [RISCV] Use constraints/predicates instead of checking const_int directly for shNadd patterns

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski This simplifies the code by adding a predicate and a constraint for 1/2/3. The aarch64 backend has a similar predicate called aarch64_shift_imm_ which they use there. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with no regressions. Thanks, Andrew Pinski

[PATCH 08/10] [RISCV] Fix PR 106586: riscv32 vs ZBS

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is two fold. With RISCV32, 32bit const_int are always signed extended to 64bit in HWI. So that means for SINGLE_BIT_MASK_OPERAND, it should mask off the upper bits to see it is a single bit for !TARGET_64BIT. Plus there are a few locations which forget to call

[PATCH 09/10] [RISCV] Add constraints for not_single_bit_mask_operand/single_bit_mask_operand

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski Like a previous patch, just add constraints for predicates not_single_bit_mask_operand and single_bit_mask_operand. OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu. Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/constraints.md (DbS): New const

[PATCH 10/10] [RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski The constraints should be n instead of i. Also there needs to a check for out of bounds zero_extract for *bexti. gcc/ChangeLog: PR target/106632 PR target/106588 * config/riscv/bitmanip.md (*shNadduw): Use n constraint instead of i. (*

[PATCH 07/10] [RISCV] Use a constraint for bset_mask and bset_1_mask

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski A constraint here just makes it easier to understand what the operands are. OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with --with-arch=rvNimafdc_zba_zbb_zbc_zbs (where N is 32 and 64). Thanks, Andrew Pinski gcc/ChangeLog: * config/riscv/constr

[PATCH 05/10] [RISCV] Add %~ to print w if TARGET_64BIT and use it

2022-08-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski To make things easier and more maintainable, we need to add support printing out w if TARGET_64BIT so this patch adds %~ to do that, similar how the x86 backend uses %~ to print out i/f for TARGET_AVX2. We could have chosen any punctuation symbol but ~ looks the closest to w.

[PATCH 2/3] Fix PR 106601: __builtin_bswap16 code gen could be improved with ZBB enabled

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski The default expansion for bswap16 is two extractions (shift/and) followed by an insertation (ior) and then a zero extend. This can be improved with ZBB enabled to just full byteswap followed by a (logical) shift right. This patch adds a new pattern for this which does that. O

[PATCH 0/3] [RISCV] Improve bswap for ZBB

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski Just some improvements for bswap and ZBB including a testsuite change that will allow more testing to happen. Thanks, Andrew Pinski Andrew Pinski (3): Fix PR 106600: __builtin_bswap32 is not hooked up for ZBB for 32bit Fix PR 106601: __builtin_bswap16 code gen could be

[PATCH 1/3] Fix PR 106600: __builtin_bswap32 is not hooked up for ZBB for 32bit

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is the bswap2 pattern had a check for TARGET_64BIT but then used the X iterator. Since the X iterator is either SI or DI depending on the setting TARGET_64BIT, there is no reason for the TARGET_64BIT. OK? Built and tested on both riscv32-linux-gnu and riscv64

[PATCH 3/3] Fix PR 106690: enable effective_target_bswap for RISCV targets with ZBB enabled by default

2022-08-20 Thread apinski--- via Gcc-patches
From: Andrew Pinski While looking for testcases to quickly test, I Noticed that check_effective_target_bswap was not enabled for riscv when ZBB is enabled. This patch checks if ZBB is enabled when targeting RISCV* for bswap. OK? Ran the testsuite for riscv32-linux-gnu both with and without ZBB e

[PATCH] Fix target/101934: aarch64 memset code creates unaligned stores for -mstrict-align

2021-08-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is the aarch64_expand_setmem code did not check STRICT_ALIGNMENT if it is creating an overlapping store. This patch adds that check and the testcase works. gcc/ChangeLog: PR target/101934 * config/aarch64/aarch64.c (aarch64_expand_setmem):

[PATCH] Add MIPS Linux support to gcc.misc-tests/linkage.c (testsuite/51748)

2021-08-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski This adds MIPS Linux support to gcc.misc-tests/linkage.exp. Basically copying what was done for MIPS IRIX and changing the options to be correct. OK? gcc/testsuite/ChangeLog: PR testsuite/51748 * gcc.misc-tests/linkage.exp: Add mips*-linux-* support. --- g

[PATCH] Fix target/102173 ICE after error recovery

2021-09-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski After the recent r12-3278-823685221de986a change, the testcase gcc.target/aarch64/sve/acle/general-c/type_redef_1.c started to ICE as the code was not ready for error_mark_node in the type. This fixes that and the testcase now passes. gcc/ChangeLog: * config/aarch64

[PATCH] [aarch64] Fix target/95969: __builtin_aarch64_im_lane_boundsi interferes with gimple

2021-09-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski This patch adds simple folding of __builtin_aarch64_im_lane_boundsi where we are not going to error out. It fixes the problem by the removal of the function from the IR. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: * config/aa

[PATCH] Fix some GC issues in the aarch64 back-end.

2021-09-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski I got some ICEs in my latest testsing while running the libstdc++ testsuite. I had noticed the problem was connected to types and had just touched the builtins code but nothing which could have caused this and I looked for some types/variables that were not being marked with G

[PATCHv2] [aarch64] Fix target/95969: __builtin_aarch64_im_lane_boundsi interferes with gimple

2021-09-03 Thread apinski--- via Gcc-patches
From: Andrew Pinski This patch adds simple folding of __builtin_aarch64_im_lane_boundsi where we are not going to error out. It fixes the problem by the removal of the function from the IR. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: PR target/9

[PATCH] Fix PR tree-opt/63184: add simplification of (& + A) != (& + B)

2021-09-05 Thread apinski--- via Gcc-patches
From: Andrew Pinski These two testcases have been failing since GCC 5 but things have improved such that adding a simplification to match.pd for this case is easier than before. In the end we have the following IR: _5 = &a[1] + _4; _7 = &a + _13; if (_5 != _7) So we can fold the _5 !=

[PATCH] Fix PR lto/49664: liblto_plugin.so exports too many symbols

2021-09-12 Thread apinski--- via Gcc-patches
From: Andrew Pinski So right now liblto_plugin.so exports many libiberty symbols and simple_object file symbols but really it just needs to export onload. This fixes the problem by using "-export-symbols-regex onload" on the libtool link line. lto-plugin/ChangeLog: * Makefile.am: Expor

[PATCH] Remove m32r{,le}-*-linux* support from GCC

2021-09-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski m32r support never made it to glibc and the support for the Linux kernel was removed with 4.18. It does not remove much but no reason to keep around a port which never worked or one which the support in other projects is gone. OK? Checked to make sure m32r-linux and m32rle-li

[PATCH] Fix PR 67102: Add libstdc++ dependancy to libffi

2021-09-15 Thread apinski--- via Gcc-patches
From: Andrew Pinski The error message is obvious -funconfigured-libstdc++-v3 is used on the g++ command line. So we just add the dependancy. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. ChangeLog: * Makefile.def: Have configure-target-libffi depend on a

[PATCH 1/2] Fix PR bootstrap/102389: --with-build-config=bootstrap-lto is broken

2021-09-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski So the problem here is that now the lto-plugin requires NM that works with LTO to work so we need to pass down NM just like we do for ranlib and ar. OK? Bootstrapped and tested with --with-build-config=bootstrap-lto on aarch64-linux-gnu. Note you need to use binutils 2.35 or

[PATCH 2/2] Update the section on binutils version

2021-09-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski LTO usage requires binutils 2.35 or newer due to https://sourceware.org/PR25355. This adds a note in the prerequisites page about it. Ok? gcc/ChangeLog: * doc/install.texi: Add note about binutils 2.35 is required for LTO usage. --- gcc/doc/install.texi | 3

[PATCH] Fix middle-end/102395: reg_class having only NO_REGS and ALL_REGS.

2021-09-18 Thread apinski--- via Gcc-patches
From: Andrew Pinski So this is a simple fix is to just add to the assert that sclass and dclass are both greater than or equal to NO_REGS. NO_REGS is documented as the first register class so it should have the value of 0. gcc/ChangeLog: * lra-constraints.c (check_and_process_move): Ass

[PATCH] c: [PR32122] Require pointer types for computed gotos

2021-09-19 Thread apinski--- via Gcc-patches
From: Andrew Pinski So GCC has always accepted non-pointer types in computed gotos but that was wrong based on the documentation: Any expression of type void * is allowed. So this fixes the problem by requiring the type to be a pointer type. OK? Bootstrapped and tested on x86_64-linux-gnu with

[PATCH] Fix PR c/94726: ICE with __builtin_shuffle and changing of types

2021-09-26 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is __builtin_shuffle when called with two arguments instead of 1, uses a SAVE_EXPR to put in for the 1st and 2nd operand of VEC_PERM_EXPR and when we go and gimplify the SAVE_EXPR, the type is now error_mark_node and that fails hard. This fixes the problem by

[COMMITTED] Fix some testcases after my computed goto patch

2021-09-29 Thread apinski--- via Gcc-patches
From: Andrew Pinski For some reason I did not see these failures in my testing. Sorry about that. Anyways this fixes the testcases by adding a cast to __INTPTR_TYPE__ and then a cast to void*. Committed after testing them on x86_64-linux-gnu. gcc/testsuite/ChangeLog: * gcc.c-torture/c

[PATCH] [www] Add note about computed gotos to changes and porting guide

2021-09-29 Thread apinski--- via Gcc-patches
From: Andrew Pinski Even though there is not many computed gotos in the wild and even less that would use an integer type, it would still be a good idea to add this new error message to both changes and the porting to guide. OK? --- htdocs/gcc-12/changes.html| 6 ++-- htdocs/gcc-12/porting

[PATCH] Fix PR target/103100 -mstrict-align and memset on not aligned buffers

2021-11-05 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is with -mstrict-align, aarch64_expand_setmem needs to check the alginment of the mode to make sure we can use it for doing the stores. gcc/ChangeLog: PR target/103100 * config/aarch64/aarch64.c (aarch64_expand_setmem): Add check for

[PATCH] aarch64: [PR101529] Fix vector shuffle insertion expansion

2021-11-06 Thread apinski--- via Gcc-patches
From: Andrew Pinski The function aarch64_evpc_ins would reuse the target even though it might be the same register as the two inputs. Instead of checking to see if we can reuse the target, creating a new register always is better. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressi

[PATCH] Fix aarch64 PR 99657: ICE with SVE types used without an error

2021-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski This fixes fully where SVE types were being used without sve being enabled. Instead of trying to fix it such that we error out during RTL time, it is better to error out in front-ends. This expands verify_type_context to have a context of auto storage decl which is used for b

[PATCH] [Committed] Fix tree-optimization/103152: Still one more -signed1bit issue

2021-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski When I fixed PR 102622, I accidently left behind a TYPE_PRECISION check which I had there for checking before hand. This check is not needed as the code will handle it correctly anyways. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimi

[PATCH] aarch64: [PR101529] Fix vector shuffle insertion expansion

2021-11-09 Thread apinski--- via Gcc-patches
From: Andrew Pinski The function aarch64_evpc_ins would reuse the target even though it might be the same register as the two inputs. Instead of checking to see if we can reuse the target, just use the original input directly. Committed as approved after bootstrapped and tested on aarch64-linux-

[PATCH] [COMMITTED] aarch64: [PR103170] Fix aarch64_simd_dup

2021-11-10 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is aarch64_simd_dup use the vw iterator rather than vwcore iterator. This causes problems for the V4SF and V2DF modes. I changed both of aarch64_simd_dup patterns to be consistent. Committed as obvious after a bootstrap/test on aarch64-linux-gnu. PR

[PATCH] tree-optimization: [PR103218] Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit

2021-11-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski This folds Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit inside match.pd. This was already handled in fold-cost by: /* A < 0 ? : 0 is simply (A & ). */ I have not removed as we only simplify "a ? POW2 : 0" at the gimple level to "a << CST1" and fold actually do

[PATCH] [Commmitted] Move some testcases to torture from tree-ssa

2021-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski While writing up some testcases, I noticed some newer testcases just had "dg-do compile/run" on them with dg-options of either -O1 or -O2. Since it is always better to run them over all optimization levels I put them in gcc.c-torture/compile or gcc.c-torture/execute. Committe

[PATCH] PR tree-optimization/103216: optimize some A ? (b op CST) : b into b op (A?CST:CST2)

2021-11-14 Thread apinski--- via Gcc-patches
From: Andrew Pinski For this PR, we have: if (d_5 < 0) goto ; [INV] else goto ; [INV] : v_7 = c_4 | -128; : # v_1 = PHI Which PHI-OPT will try to simplify "(d_5 < 0) ? (c_4 | -128) : c_4" which is not handled currently. This adds a few patterns which allows to try to see

[PATCH] tree-optimization: [PR103245] Improve detection of abs pattern using multiplication

2021-11-15 Thread apinski--- via Gcc-patches
From: Andrew Pinski So while working on PR 103228 (and a few others), I noticed the testcase for PR 94785 was failing. The problem is that the nop_convert moved from being inside the IOR to be outside of it. I also noticed the patch for PR 103228 was not needed to reproduce the issue either. T

[PATCH] Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST where type is a nop convert

2021-11-15 Thread apinski--- via Gcc-patches
From: Andrew Pinski Currently we fold (type) X op CST into (type) (X op ((type-x) CST)) when the conversion widens but not when the conversion is a nop. For the same reason why we move the widening conversion (the possibility of removing an extra conversion), we should do the same if the conve

[PATCH] Fix tree-optimization/101941: IPA splitting out function with error attribute

2021-11-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski The Linux kernel started to fail compile when the jump threader was improved (r12-2591-g2e96b5f14e4025691). This failure was due to the IPA splitting code decided now to split off the basic block which contained two functions, one of those functions included the error attribut

[PATCH] Fix PR 103288, ICE after PHI-OPT, move an assigment when still in use for another bb

2021-11-16 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem is r12-5300-gf98f373dd822b35c allows phiopt to recognize more basic blocks but missed one location where phiopt could move an assignment from the middle block to the non-middle one. This patch fixes that. OK? Bootstrapped and tested on x86_64-linux-gnu with no

[PATCH] Fix tree-optimization/103257: Missed jump threading due too early conversion of bool*A into bool?A:0

2021-11-17 Thread apinski--- via Gcc-patches
From: Andrew Pinski So like many optimizations on the gimple level, sometimes it makes sense to do the optimization early or later. In this case, creating a cond expression early causes other optimizations to be missed. So just disable it until canonicalize_math_p () is false. OK? Bootstrapp

[PATCHv2] Add a couple of A?CST1:CST2 match and simplify optimizations

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of some of the more manual optimizations inside phi-opt, it would be good idea to do a lot of the heavy lifting inside match and simplify instead. In the process, this moves the three simple A?CST1:CST2 (where CST1 or CST2 is zero) simplifications. OK? Boostrapped and

[PATCH] Optimize x < 0 ? ~y : y to (x >> 31) ^ y in match.pd

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski This copies the optimization that is done in phiopt for "x < 0 ? ~y : y to (x >> 31) ^ y" into match.pd. The code for phiopt is kept around until phiopt uses match.pd (which I am working towards). Note the original testcase is now optimized early on and I added a new testcase

[PATCH] Fix two testcases for ssa names which are more than 1 digit

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski phi-opt-10.c and phi-opt-7.c both depend on currently that some ssa name versions are one digit long which is not always correct. This fixes the problem by detecting digits rather than just using '.'. Committed as obvious after a bootstrap/test. Thanks, Andrew Pinski gcc/te

[PATCHv2] Optimize x < 0 ? ~y : y to (x >> 31) ^ y in match.pd

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski This copies the optimization that is done in phiopt for "x < 0 ? ~y : y to (x >> 31) ^ y" into match.pd. The code for phiopt is kept around until phiopt uses match.pd (which I am working towards). Note the original testcase is now optimized early on and I added a new testcase

[PATCH] Use match-and-simplify in phi-opt

2021-05-23 Thread apinski--- via Gcc-patches
From: Andrew Pinski To simplify PHI-OPT and future improvements to it in most (but not all) cases, using match-and-simplify simplifies how much code is needed to be added. This depends on the following two patches: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571033.html https://gcc.gnu.or

[PATCH] Fix PR 95481: tail call fails with empty struct types

2021-05-30 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we don't have an assignment type any more for zero-length structs as they were removed during gimplifcation. This adds a special case where the assignment var does not exist and the return decl is zero-length. OK? Tested on aarch64-linux-gnu with no regres

[PATCH 1/2] Use is_empty_type instead of zero-sized type.

2021-05-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski Instead of only removing assignments of zero-sized types, assignments of all empty types should be removed during gimplification. This moves to use is_empty_type which will be used in other places too. OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions. Th

[PATCH 2/2] Fix PR 95481: tail call fails with empty struct types

2021-05-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski The problem here is we don't have an assignment type any more for empty structs as they were removed during gimplifcation. This adds a special case where the assignment var does not exist and the return decl is empty typed. OK? Tested on aarch64-linux-gnu with no regressions.

[PATCH] Replace conditional_replacement with match and simplify

2021-05-31 Thread apinski--- via Gcc-patches
From: Andrew Pinski This is the first of series of patches to simplify phi-opt to use match and simplify in many cases. This simplification will more things to optimize. This is what Richard requested in https://gcc.gnu.org/pipermail/gcc-patches/2021-May/571197.html and I think it is the right

[PATCH] Improve match_simplify_replacement in phi-opt

2021-06-01 Thread apinski--- via Gcc-patches
From: Andrew Pinski This improves match_simplify_replace in phi-opt to handle the case where there is one cheap preparation statement in the middle basic block similar to xor_replacement and others. This allows to remove xor_replacement too. OK? Bootstrapped and tested on x86_64-linux-gnu with

[PATCH] Improve match_simplify_replacement in phi-opt

2021-06-02 Thread apinski--- via Gcc-patches
From: Andrew Pinski This improves match_simplify_replace in phi-opt to handle the case where there is one cheap (non-call) preparation statement in the middle basic block similar to xor_replacement and others. This allows to remove xor_replacement which it does too. OK? Bootstrapped and tested

[commited] Improve match_simplify_replacement in phi-opt

2021-06-08 Thread apinski--- via Gcc-patches
From: Andrew Pinski This improves match_simplify_replace in phi-opt to handle the case where there is one cheap (non-call) preparation statement in the middle basic block similar to xor_replacement and others. This allows to remove xor_replacement which it does too. OK? Bootstrapped and tested

  1   2   >