aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-08-02x86: fold two of vec_dupv2df<mask_name>'s alternativesJan Beulich1-8/+7
By using Yvm in the source, both can be expressed in one. gcc/ * config/i386/sse.md (vec_dupv2df<mask_name>): Fold the middle two of the alternatives.
2023-08-02MAINTAINERS: correct my email addressJan Beulich1-1/+1
The @novell.com one has been out of use for quite some time. ChangeLog: * MAINTAINERS: Correct my email address.
2023-08-02tree-optimization/92335 - Improve sinking heuristics for vectorizationRichard Biener4-6/+34
The following delays sinking of loads within the same innermost loop when it was unconditional before. That's a not uncommon issue preventing vectorization when masked loads are not available. PR tree-optimization/92335 * tree-ssa-sink.cc (select_best_block): Before loop optimizations avoid sinking unconditional loads/stores in innermost loops to conditional executed places. * gcc.dg/tree-ssa/ssa-sink-10.c: Disable vectorizing. * gcc.dg/tree-ssa/predcom-9.c: Clone from ssa-sink-10.c, expect predictive commoning to happen instead of sinking. * gcc.dg/vect/pr65947-3.c: Ajdust.
2023-08-02Slightly improve bitwise_inverted_equal_p comparisonsAndrew Pinski1-4/+4
This slighly improves bitwise_inverted_equal_p for comparisons. Instead of just comparing the comparisons operands also valueize them. This will allow ccp and others to match the 2 comparisons without an extra pass happening. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * gimple-match-head.cc (gimple_bitwise_inverted_equal_p): Valueize the comparison operands before comparing them.
2023-08-02Move `~X & X` and `~X | X` over to use bitwise_inverted_equal_pAndrew Pinski1-22/+6
This is a simple patch to move these 2 patterns over to use bitwise_inverted_equal_p. It also allows us to remove 2 other patterns which were used on comparisons as they are now handled by the original pattern. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * match.pd (`~X & X`, `~X | X`): Move over to use bitwise_inverted_equal_p, removing :c as bitwise_inverted_equal_p handles that already. Remove range test simplifications to true/false as they are now handled by these patterns.
2023-08-02PHIOPT: Mark the conditional lhs and rhs as to look at to see if DCEableAndrew Pinski1-5/+16
In some cases (usually dealing with bools only), there could be some statements left behind which are considered trivial dead. An example is: ``` bool f(bool a, bool b) { if (!a && !b) return 0; if (!a && b) return 0; if (a && !b) return 0; return 1; } ``` Where during phiopt2, the IR had: ``` _3 = ~b_7(D); _4 = _3 & a_6(D); _4 != 0 ? 0 : 1 ``` match-and-simplify would transform that into: ``` _11 = ~a_6(D); _12 = b_7(D) | _11; ``` But phiopt would leave around the statements defining _4 and _3. This helps by marking the conditional's lhs and rhs to see if they are trivial dead. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-phiopt.cc (match_simplify_replacement): Mark's cond statement's lhs and rhs to check if trivial dead. Rename inserted_exprs to exprs_maybe_dce; also move it so bitmap is not allocated if not needed.
2023-08-02RISC-V: Support RVV VFWADD rounding mode intrinsic APIPan Li7-13/+164
This patch would like to support the rounding mode API for the VFWADD VFSUB and VFRSUB as below samples. * __riscv_vfwadd_vv_f64m2_rm * __riscv_vfwadd_vv_f64m2_rm_m * __riscv_vfwadd_vf_f64m2_rm * __riscv_vfwadd_vf_f64m2_rm_m * __riscv_vfwadd_wv_f64m2_rm * __riscv_vfwadd_wv_f64m2_rm_m * __riscv_vfwadd_wf_f64m2_rm * __riscv_vfwadd_wf_f64m2_rm_m Signed-off-by: Pan Li <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (class widen_binop_frm): New class for binop frm. (BASE): Add vfwadd_frm. * config/riscv/riscv-vector-builtins-bases.h: New declaration. * config/riscv/riscv-vector-builtins-functions.def (vfwadd_frm): New function definition. * config/riscv/riscv-vector-builtins-shapes.cc (BASE_NAME_MAX_LEN): New macro. (struct alu_frm_def): Leverage new base class. (struct build_frm_base): New build base for frm. (struct widen_alu_frm_def): New struct for widen alu frm. (SHAPE): Add widen_alu_frm shape. * config/riscv/riscv-vector-builtins-shapes.h: New declaration. * config/riscv/vector.md (frm_mode): Add vfwalu type. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-widening-add.c: New test.
2023-08-02More profile updating clenaupsJan Hubicka4-51/+32
This patch commonizes loop_count_in computatoin with expected_loop_iterations_by_profile (and moves it to cfgloopanal.cc rather than manip) and fixes roundoff error in scale_loop_profile. I alos noticed that I managed to misapply the template change to gcc.dg/unroll-1.c. Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: * cfgloop.h (loop_count_in): Declare. * cfgloopanal.cc (expected_loop_iterations_by_profile): Use count_in. (loop_count_in): Move here from ... * cfgloopmanip.cc (loop_count_in): ... here. (scale_loop_profile): Improve dumping; cast iteration bound to sreal. gcc/testsuite/ChangeLog: * gcc.dg/unroll-1.c: Fix template.
2023-08-02Fix profile update after cancelled loop distributionJan Hubicka4-0/+66
Loop distribution and ifcvt introduces verisons of loops which may be removed later if vectorization fails. Ifcvt does this by temporarily breaking profile and producing conditional that has two arms with 100% probability because we know one of the versions will be removed. Loop distribution is trickier, since it introduces test for alignment that either survives to final code if vecotorization suceeds or is turned if it fails. Here we need to assign some reasonable probabilities for the case vectorization goes well, so this code adds logic to scale profile back in case we remove the call. This is not perfect since we drop precise BB counts to guessed. It is not big deal since we do not use much reliablity of bb counts after this point. Other option would be to apply scale only if vectorization succeeds which however needs bit more work at tree-loop-distribution side and would need all code in this patch with small change that fold_loop_internal_call will have to know how to adjust if conditional stays. I decided to go for easier solution for now. Bootstrapped/regtested x86_64-linux, committed. gcc/ChangeLog: * cfg.cc (scale_strictly_dominated_blocks): New function. * cfg.h (scale_strictly_dominated_blocks): Declare. * tree-cfg.cc (fold_loop_internal_call): Fixup CFG profile. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr98308.c: Check that profile is consistent.
2023-08-02rtl-optimization/110587 - remove quadratic regno_in_use_pRichard Biener1-68/+1
The following removes the code checking whether a noop copy is between something involved in the return sequence composed of a SET and USE. Instead of checking for this special-case the following makes us only ever remove noop copies between pseudos - which is the case that is necessary for IRA/LRA interfacing to function according to the comment. That makes looking for the return reg special case unnecessary, reducing the compile-time in LRA non-specific to zero for the testcase. PR rtl-optimization/110587 * lra-spills.cc (return_regno_p): Remove. (regno_in_use_p): Likewise. (lra_final_code_change): Do not remove noop moves between hard registers.
2023-08-02Support vec_fmaddsub/vec_fmsubadd for vector HFmode.liuhongt2-22/+44
AVX512FP16 supports vfmaddsubXXXph and vfmsubaddXXXph. Also remove scalar mode from fmaddsub/fmsubadd pattern since there's no scalar instruction for that. gcc/ChangeLog: PR target/81904 * config/i386/sse.md (vec_fmaddsub<mode>4): Extend to vector HFmode, use mode iterator VFH instead. (vec_fmsubadd<mode>4): Ditto. (<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>): Remove scalar mode from iterator, use VFH_AVX512VL instead. (<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr81904.c: New test.
2023-08-02Optimize vlddqu + inserti128 to vbroadcasti128liuhongt2-0/+29
vlddqu + vinserti128 will use shuffle port in addition to load port comparing to vbroadcasti128, For latency perspective,vbroadcasti is no worse than vlddqu + vinserti128. gcc/ChangeLog: * config/i386/sse.md (*avx2_lddqu_inserti_to_bcasti): New pre_reload define_insn_and_split. gcc/testsuite/ChangeLog: * gcc.target/i386/vlddqu_vinserti128.c: New test.
2023-08-02[PATCH 3/5] [RISC-V] Cost model for Zicond.Xiao Zeng1-0/+14
This patch implements a reasonable cost model for using Zicond to implement conditional moves. Essentially the Zicond insns are always COSTS_N_INSNS (1). Note there is still a problem with the costing model in general that results in failure to if-convert as often as we should. In simplest terms the insn costing model sums the cost of the SET_SRC and the cost of the SET_DEST. Thus the conditional move is considered twice as costly as it should be. That will have to be addressed separately. gcc/ * config/riscv/riscv.cc (riscv_rtx_costs): Add costing for using Zicond to implement some conditional moves.
2023-08-01[committed] [RISC-V] Avoid sub-word mode comparisons with ZicondJeff Law1-12/+12
c-torture/execute/pr59014-2.c fails with the Zicond work on rv64. We miscompile the "foo" routine because we have eliminated a required sign extension. The key routine looks like this: foo (long long int x, long long int y) { if (((int) x | (int) y) != 0) return 6; return x + y; } So we kindof do the expected thing. We IOR X and Y, sign extend the result from 32 to 64 bits, then emit a suitable conditional branch. ie: > (insn 10 4 12 2 (set (reg:DI 142) > (ior:DI (reg/v:DI 138 [ x ]) > (reg/v:DI 139 [ y ]))) "j.c":6:16 99 {iordi3} > (nil)) > (insn 12 10 13 2 (set (reg:DI 144) > (sign_extend:DI (subreg:SI (reg:DI 142) 0))) "j.c":6:6 116 {extendsidi2} > (nil)) > (jump_insn 13 12 14 2 (set (pc) > (if_then_else (ne (reg:DI 144) > (const_int 0 [0])) > (label_ref:DI 27) > (pc))) "j.c":6:6 243 {*branchdi} > (expr_list:REG_DEAD (reg:DI 144) > (int_list:REG_BR_PROB 233216732 (nil))) When we if-convert that we generate this sequence: > (insn 10 4 12 2 (set (reg:DI 142) > (ior:DI (reg/v:DI 138 [ x ]) > (reg/v:DI 139 [ y ]))) "j.c":6:16 99 {iordi3} > (nil)) > (insn 12 10 30 2 (set (reg:DI 144) > (sign_extend:DI (subreg:SI (reg:DI 142) 0))) "j.c":6:6 116 {extendsidi2} > (nil)) > (insn 30 12 31 2 (set (reg:DI 147) > (const_int 6 [0x6])) "j.c":8:12 179 {*movdi_64bit} > (nil)) > (insn 31 30 33 2 (set (reg:DI 146) > (plus:DI (reg/v:DI 138 [ x ]) > (reg/v:DI 139 [ y ]))) "j.c":8:12 5 {adddi3} > (nil)) > (insn 33 31 34 2 (set (reg:DI 149) > (if_then_else:DI (ne:DI (reg:DI 144) > (const_int 0 [0])) > (const_int 0 [0]) > (reg:DI 146))) "j.c":8:12 11368 {*czero.nez.didi} > (nil)) > (insn 34 33 35 2 (set (reg:DI 148) > (if_then_else:DI (eq:DI (reg:DI 144) > (const_int 0 [0])) > (const_int 0 [0]) > (reg:DI 147))) "j.c":8:12 11367 {*czero.eqz.didi} > (nil)) > (insn 35 34 21 2 (set (reg:DI 137 [ <retval> ]) > (ior:DI (reg:DI 148) > (reg:DI 149))) "j.c":8:12 99 {iordi3} > (nil)) Which looks basically OK. The sign extended subreg is a bit worrisome though. And sure enough when we get into combine: > Failed to match this instruction: > (parallel [ > (set (reg:DI 149) > (if_then_else:DI (eq:DI (subreg:SI (reg:DI 142) 0) > (const_int 0 [0])) > (reg:DI 146) > (const_int 0 [0]))) > (set (reg:DI 144) > (sign_extend:DI (subreg:SI (reg:DI 142) 0))) > ]) > Successfully matched this instruction: > (set (reg:DI 144) > (sign_extend:DI (subreg:SI (reg:DI 142) 0))) > Successfully matched this instruction: > (set (reg:DI 149) > (if_then_else:DI (eq:DI (subreg:SI (reg:DI 142) 0) > (const_int 0 [0])) > (reg:DI 146) > (const_int 0 [0]))) > allowing combination of insns 12 and 33 Since we need the side effect we first try the PARALLEL with two sets. That, as expected, fails. Generic combine code then tries to pull apart the two sets as distinct insns resulting in this conditional move: > (insn 33 31 34 2 (set (reg:DI 149) > (if_then_else:DI (eq:DI (subreg:SI (reg:DI 142) 0) > (const_int 0 [0])) > (reg:DI 146) > (const_int 0 [0]))) "j.c":8:12 11347 {*czero.nez.disi} > (expr_list:REG_DEAD (reg:DI 146) > (nil))) Bzzt. We can't actually implement this RTL in the hardware. Basically it's asking to do 32bit comparison on rv64, ignoring the upper 32 bits of the input register. That's not actually how zicond works. The operands to the comparison need to be in DImode for rv64 and SImode for rv32. That's the X iterator. Note the mode of the comparison operands may be different than the mode of the destination. ie, we might have a 64bit comparison and produce a 32bit sign extended result much like the setcc insns support. This patch changes the 6 zicond patterns to use the X iterator on the comparison inputs and fixes the testsuite failure. gcc/ * config/riscv/zicond.md: Use the X iterator instead of ANYI on the comparison input operands.
2023-08-01[PATCH 3/5] [RISC-V] RISC-V Conditional Move costing [was:Generate Zicond ↵Xiao Zeng1-0/+24
instruction for select pattern with condition eq or neq to 0] This provides some basic costing to conditional moves. The underlying primitive of an IF-THEN-ELSE which turns into czero is a single insn (COSTS_N_INSNS (1)). But these insns were still consistently showing up with the wrong cost (8 instead of 4). This was chased down to computing the cost of the destination and the cost of the source independently, then summing them. That seems horribly wrong for register destinations. So this patch special cases an INSN that is just a SET of a register destination so that the cost comes from the SET_SRC. Long term the whole costing model needs a review. gcc/ * config/riscv/riscv.cc (riscv_rtx_costs, case IF_THEN_ELSE): Add Zicond costing. (case SET): For INSNs that just set a REG, take the cost from the SET_SRC. Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
2023-08-02i386: refactor macros.Hu, Lin11-5/+5
gcc/ChangeLog: * common/config/i386/i386-common.cc (OPTION_MASK_ISA2_AMX_INT8_SET): Change OPTION_MASK_ISA2_AMX_TILE to OPTION_MASK_ISA2_AMX_TILE_SET. (OPTION_MASK_ISA2_AMX_BF16_SET): Ditto (OPTION_MASK_ISA2_AMX_FP16_SET): Ditto (OPTION_MASK_ISA2_AMX_COMPLEX_SET): Ditto (OPTION_MASK_ISA_ABM_SET): Change OPTION_MASK_ISA_POPCNT to OPTION_MASK_ISA_POPCNT_SET. Signed-off-by: Hu, Lin1 <lin1.hu@intel.com>
2023-08-02Add myself for write after approvalHu, Lin11-0/+1
ChangeLog: * MAINTAINERS (Write After Approval): Add myself.
2023-08-02Daily bump.GCC Administrator9-1/+403
2023-08-02PR modula2/110161 Comparing a typed procedure variable to 0 gives ICE or ↵Gaius Mulley3-9/+43
assertion This patch allows a proc type to be compared against an address. gcc/m2/ChangeLog: PR modula2/110161 * gm2-compiler/M2Check.mod (checkProcTypeEquivalence): New procedure function. (checkTypeKindEquivalence): Call checkProcTypeEquivalence if either left or right is a proc type. * gm2-compiler/M2Quads.mod (BuildRelOp): Create combinedTok prior to creating the range check quadruple. Use combinedTok when creating the range check quadruple. gcc/testsuite/ChangeLog: PR modula2/110161 * gm2/pim/fail/badxproc.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-01IBM Z: Handle unaligned symbolsAndreas Krebbel4-2/+54
The IBM Z ELF ABI mandates every symbol to reside on a 2 byte boundary in order to be able to use the larl instruction. However, in some situations it is difficult to enforce this, e.g. for common linker scripts as used in the Linux kernel. This patch introduces the -munaligned-symbols option. When that option is used, external symbols without an explicit alignment are considered unaligned and its address will be pushed into GOT or the literal pool. If the symbol in the final linker step turns out end up on a 2 byte boundary the linker is able to take this back and replace the indirect reference with larl again. This should minimize the effect to symbols which are actually unaligned in the end. gcc/ChangeLog: * config/s390/s390.cc (s390_encode_section_info): Assume external symbols without explicit alignment to be unaligned if -munaligned-symbols has been specified. * config/s390/s390.opt (-munaligned-symbols): New option. gcc/testsuite/ChangeLog: * gcc.target/s390/aligned-1.c: New test. * gcc.target/s390/unaligned-1.c: New test.
2023-08-01[PATCH] Add POLY_INT_CST support to fold_ctor_reference in gimple-fold.ccRichard Ball1-2/+2
Add POLY_INT_CST support to code within fold_ctor_reference. This code previously only supported INTEGER_CST which caused a bug when using VEC_PERM_EXPR with SVE vectors. gcc/ChangeLog: * gimple-fold.cc (fold_ctor_reference): Add support for poly_int.
2023-08-01MAINTAINERS: Add myself to write after approvalRichard Ball1-0/+1
Sponsored by Richard Sandiford <Richard.Sandiford@arm.com> ChangeLog: * MAINTAINERS: Add myself.
2023-08-01target/110220: Set JUMP_LABEL and LABEL_NUSES of new branch insn generated byGeorg-Johann Lay1-3/+5
target specific RTL optimization pass .avr-casesi. gcc/ PR target/110220 * config/avr/avr.cc (avr_optimize_casesi): Set JUMP_LABEL and LABEL_NUSES of new conditional branch instruction.
2023-08-01Fix profile update after prologue peeling in vectorizerJan Hubicka133-38/+271
This patch fixes update after constant peeling in profilogue. We now reached 0 profile update bugs on tramp3d vectorizaiton and also on quite few testcases, so I am enabling the testuiste checks so we do not regress again. gcc/ChangeLog: * tree-vect-loop-manip.cc (vect_do_peeling): Fix profile update after constant prologue peeling. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-1-big-array.c: Check profile consistency. * gcc.dg/vect/vect-1.c: Check profile consistency. * gcc.dg/vect/vect-10-big-array.c: Check profile consistency. * gcc.dg/vect/vect-10.c: Check profile consistency. * gcc.dg/vect/vect-100.c: Check profile consistency. * gcc.dg/vect/vect-103.c: Check profile consistency. * gcc.dg/vect/vect-104.c: Check profile consistency. * gcc.dg/vect/vect-105-big-array.c: Check profile consistency. * gcc.dg/vect/vect-105.c: Check profile consistency. * gcc.dg/vect/vect-106.c: Check profile consistency. * gcc.dg/vect/vect-107.c: Check profile consistency. * gcc.dg/vect/vect-108.c: Check profile consistency. * gcc.dg/vect/vect-109.c: Check profile consistency. * gcc.dg/vect/vect-11.c: Check profile consistency. * gcc.dg/vect/vect-110.c: Check profile consistency. * gcc.dg/vect/vect-112-big-array.c: Check profile consistency. * gcc.dg/vect/vect-112.c: Check profile consistency. * gcc.dg/vect/vect-113.c: Check profile consistency. * gcc.dg/vect/vect-114.c: Check profile consistency. * gcc.dg/vect/vect-115.c: Check profile consistency. * gcc.dg/vect/vect-116.c: Check profile consistency. * gcc.dg/vect/vect-117.c: Check profile consistency. * gcc.dg/vect/vect-118.c: Check profile consistency. * gcc.dg/vect/vect-119.c: Check profile consistency. * gcc.dg/vect/vect-11a.c: Check profile consistency. * gcc.dg/vect/vect-12.c: Check profile consistency. * gcc.dg/vect/vect-120.c: Check profile consistency. * gcc.dg/vect/vect-121.c: Check profile consistency. * gcc.dg/vect/vect-122.c: Check profile consistency. * gcc.dg/vect/vect-123.c: Check profile consistency. * gcc.dg/vect/vect-124.c: Check profile consistency. * gcc.dg/vect/vect-126.c: Check profile consistency. * gcc.dg/vect/vect-13.c: Check profile consistency. * gcc.dg/vect/vect-14.c: Check profile consistency. * gcc.dg/vect/vect-15-big-array.c: Check profile consistency. * gcc.dg/vect/vect-15.c: Check profile consistency. * gcc.dg/vect/vect-17.c: Check profile consistency. * gcc.dg/vect/vect-18.c: Check profile consistency. * gcc.dg/vect/vect-19.c: Check profile consistency. * gcc.dg/vect/vect-2-big-array.c: Check profile consistency. * gcc.dg/vect/vect-2.c: Check profile consistency. * gcc.dg/vect/vect-20.c: Check profile consistency. * gcc.dg/vect/vect-21.c: Check profile consistency. * gcc.dg/vect/vect-22.c: Check profile consistency. * gcc.dg/vect/vect-23.c: Check profile consistency. * gcc.dg/vect/vect-24.c: Check profile consistency. * gcc.dg/vect/vect-25.c: Check profile consistency. * gcc.dg/vect/vect-26.c: Check profile consistency. * gcc.dg/vect/vect-27.c: Check profile consistency. * gcc.dg/vect/vect-28.c: Check profile consistency. * gcc.dg/vect/vect-29.c: Check profile consistency. * gcc.dg/vect/vect-3.c: Check profile consistency. * gcc.dg/vect/vect-30.c: Check profile consistency. * gcc.dg/vect/vect-31-big-array.c: Check profile consistency. * gcc.dg/vect/vect-31.c: Check profile consistency. * gcc.dg/vect/vect-32-big-array.c: Check profile consistency. * gcc.dg/vect/vect-32-chars.c: Check profile consistency. * gcc.dg/vect/vect-32.c: Check profile consistency. * gcc.dg/vect/vect-33-big-array.c: Check profile consistency. * gcc.dg/vect/vect-33.c: Check profile consistency. * gcc.dg/vect/vect-34-big-array.c: Check profile consistency. * gcc.dg/vect/vect-34.c: Check profile consistency. * gcc.dg/vect/vect-35-big-array.c: Check profile consistency. * gcc.dg/vect/vect-35.c: Check profile consistency. * gcc.dg/vect/vect-36-big-array.c: Check profile consistency. * gcc.dg/vect/vect-36.c: Check profile consistency. * gcc.dg/vect/vect-38.c: Check profile consistency. * gcc.dg/vect/vect-4.c: Check profile consistency. * gcc.dg/vect/vect-40.c: Check profile consistency. * gcc.dg/vect/vect-42.c: Check profile consistency. * gcc.dg/vect/vect-44.c: Check profile consistency. * gcc.dg/vect/vect-46.c: Check profile consistency. * gcc.dg/vect/vect-48.c: Check profile consistency. * gcc.dg/vect/vect-5.c: Check profile consistency. * gcc.dg/vect/vect-50.c: Check profile consistency. * gcc.dg/vect/vect-52.c: Check profile consistency. * gcc.dg/vect/vect-54.c: Check profile consistency. * gcc.dg/vect/vect-56.c: Check profile consistency. * gcc.dg/vect/vect-58.c: Check profile consistency. * gcc.dg/vect/vect-6-big-array.c: Check profile consistency. * gcc.dg/vect/vect-6.c: Check profile consistency. * gcc.dg/vect/vect-60.c: Check profile consistency. * gcc.dg/vect/vect-62.c: Check profile consistency. * gcc.dg/vect/vect-63.c: Check profile consistency. * gcc.dg/vect/vect-64.c: Check profile consistency. * gcc.dg/vect/vect-65.c: Check profile consistency. * gcc.dg/vect/vect-66.c: Check profile consistency. * gcc.dg/vect/vect-67.c: Check profile consistency. * gcc.dg/vect/vect-68.c: Check profile consistency. * gcc.dg/vect/vect-7.c: Check profile consistency. * gcc.dg/vect/vect-70.c: Check profile consistency. * gcc.dg/vect/vect-71.c: Check profile consistency. * gcc.dg/vect/vect-72.c: Check profile consistency. * gcc.dg/vect/vect-73-big-array.c: Check profile consistency. * gcc.dg/vect/vect-73.c: Check profile consistency. * gcc.dg/vect/vect-74-big-array.c: Check profile consistency. * gcc.dg/vect/vect-74.c: Check profile consistency. * gcc.dg/vect/vect-75-big-array.c: Check profile consistency. * gcc.dg/vect/vect-75.c: Check profile consistency. * gcc.dg/vect/vect-76-big-array.c: Check profile consistency. * gcc.dg/vect/vect-76.c: Check profile consistency. * gcc.dg/vect/vect-77-alignchecks.c: Check profile consistency. * gcc.dg/vect/vect-77-global.c: Check profile consistency. * gcc.dg/vect/vect-77.c: Check profile consistency. * gcc.dg/vect/vect-78-alignchecks.c: Check profile consistency. * gcc.dg/vect/vect-78-global.c: Check profile consistency. * gcc.dg/vect/vect-78.c: Check profile consistency. * gcc.dg/vect/vect-8.c: Check profile consistency. * gcc.dg/vect/vect-80-big-array.c: Check profile consistency. * gcc.dg/vect/vect-80.c: Check profile consistency. * gcc.dg/vect/vect-82.c: Check profile consistency. * gcc.dg/vect/vect-82_64.c: Check profile consistency. * gcc.dg/vect/vect-83.c: Check profile consistency. * gcc.dg/vect/vect-83_64.c: Check profile consistency. * gcc.dg/vect/vect-85-big-array.c: Check profile consistency. * gcc.dg/vect/vect-85.c: Check profile consistency. * gcc.dg/vect/vect-86.c: Check profile consistency. * gcc.dg/vect/vect-87.c: Check profile consistency. * gcc.dg/vect/vect-88.c: Check profile consistency. * gcc.dg/vect/vect-89-big-array.c: Check profile consistency. * gcc.dg/vect/vect-89.c: Check profile consistency. * gcc.dg/vect/vect-9.c: Check profile consistency. * gcc.dg/vect/vect-91.c: Check profile consistency. * gcc.dg/vect/vect-92.c: Check profile consistency. * gcc.dg/vect/vect-93.c: Check profile consistency. * gcc.dg/vect/vect-95.c: Check profile consistency. * gcc.dg/vect/vect-96.c: Check profile consistency. * gcc.dg/vect/vect-97-big-array.c: Check profile consistency. * gcc.dg/vect/vect-97.c: Check profile consistency. * gcc.dg/vect/vect-98-big-array.c: Check profile consistency. * gcc.dg/vect/vect-98.c: Check profile consistency. * gcc.dg/vect/vect-99.c: Check profile consistency.
2023-08-01doc: Fix spelling in arm_v8_1m_main_cde_mve_fpChristophe Lyon1-2/+2
Fix spelling mistakes introduced by my previous patch in this area. 2023-08-01 Christophe Lyon <christophe.lyon@linaro.org> gcc/ * doc/sourcebuild.texi (arm_v8_1m_main_cde_mve_fp): Fix spelling.
2023-08-01ada: Fix printing of numbers in JSON output for data representationYannick Moy1-2/+2
When calling GNAT with -gnatRj to generate JSON output for the data representation of types and objects, it could happen that numbers are printed in the Ada syntax for hexadecimal numbers, which leads to an invalid JSON file being generated. Now fixed both for the JSON output and the Ada-like output. gcc/ada/ * repinfo.adb (Compute_Max_Length): Set parameter to print number in decimal notation. (List_Component_Layout): Same.
2023-08-01ada: Disable inlining of subprograms with Skip(_Flow_And)_Proof in GNATproveYannick Moy1-0/+49
Subprograms with these Skip(_Flow_And)_Proof annotations should not be inlined in GNATprove, as we want to skip part of the analysis for their body. gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Check for Skip_Proof and Skip_Flow_And_Proof annotations for deciding whether a subprogram can be inlined.
2023-08-01ada: Bugbox compiling Constrained_Protected_Object'ImageSteve Baird1-0/+2
In some cases, a bugbox is generated when compiling an example that references X'Image, where X is a constrained object of a discriminated protected type. gcc/ada/ * sem_ch3.adb (Constrain_Corresponding_Record): When copying information from the unconstrained record type to a newly constructed constrained record subtype, the Direct_Primitive_Operations attribute must be copied.
2023-08-01ada: Incorrect optimization for unconstrained limited record component typeSteve Baird1-18/+0
If the discriminants of an immutably limited record type have defaults, then it is safe to assume that a discriminant of an object of this type will never change once it is initialized. In some cases, this means that the default discriminant values can be treated like a constraint for purposes of determining the amount of storage needed for an unconstrained object. However, it is not safe to perform this optimization when determining the size needed for an unconstrained component of an enclosing type. This optimization was sometimes being incorrectly performed in this case. This could save storage in some cases, but in other cases a constraint check could incorrectly fail when initializing a component of an aggregate if the discriminant values of the component differ from the default values. gcc/ada/ * sem_ch3.adb (Analyze_Component_Declaration): Remove Build_Default_Subtype_OK call and code that could only executed in the case where the removed call would have returned True. Other calls to Build_Default_Subtype_Ok are unaffected by this change.
2023-08-01ada: Default Put_Image for composite derived types is missing informationPascal Obry5-20/+76
The output generated by a call to Some_Derived_Composite_Type'Put_Image (in Ada2022 code) is incomplete in some cases, notably for a type derived from a container type (i.e., from the Set/Map/List/Vector type declared in an instance of one of Ada's predefined container generics) with no user-specified Put_Image procedure. gcc/ada/ * aspects.ads (Find_Aspect): Add Boolean parameter Or_Rep_Item (defaulted to False). * aspects.adb (Find_Aspect): If new Boolean parameter Or_Rep_Item is True, then instead of returning an empty result if no appropriate N_Aspect_Specification node is found, return an appropriate N_Attribute_Definition_Clause if one is found. * exp_put_image.ads: Change name of Enable_Put_Image function to Put_Image_Enabled. * exp_put_image.adb (Build_Record_Put_Image_Procedure): Detect the case where a call to the Put_Image procedure of a derived type can be transformed into a call to the parent type's Put_Image procedure (with a type conversion to the parent type as the actual parameter). (Put_Image_Enabled): Change name of function (previously Enable_Put_Image). Return True in more cases. In particular, return True for a type with an explicitly specified Put_Image aspect even if the type is declared in a predefined unit (or in an instance of a predefined generic unit). * exp_attr.adb: Changes due to Put_Image_Enabled function name change.
2023-08-01ada: Fix generation of JSON output for data representationYannick Moy1-3/+12
Using -gnatRj to generate data representation in JSON format could lead to an ill-formed output or an assertion failure. Now fixed. gcc/ada/ * repinfo.adb (List_Common_Type_Info): Fix output when alignment is not statically known, and fix assertion when expansion is not enabled.
2023-08-01ada: check Atree.Get/Set_Field_ValueBob Duff1-0/+20
Get_Field_Value and Set_Field_Value now check that the Nkind or Ekind is correct. However, the checks are partially disabled, because they sometimes fail. gcc/ada/ * atree.adb (Field_Present): New function to detect whether or not a given field is present in a given node, based on either the node kind or the entity kind as appropriate. (Get_Field_Value): Check that the field begin fetched exists. However, disable the check in the case of Scope_Depth_Value, because we have failures in that case. Those failures need to be fixed, and then the check can be enabled for all fields. (Set_Field_Value): Check that the field begin set exists.
2023-08-01ada: Emit SCOs for nested decisions in quantified expressionsLéo Creuse1-1/+8
The tree traversal for decision SCO emission did not recurse in the iterator specification or loop parameter specification of quantified expressions, resulting in missing coverage obligations for nested decisions. This change fixes this by traversing all the attributes of quantified expressions nodes. gcc/ada/ * par_sco.adb (Process_Decisions): Traverse all attributes of quantified expressions nodes.
2023-08-01RISC-V: Support CALL for RVV floating-point dynamic roundingPan Li54-139/+1884
In basic dynamic rounding mode, we simply ignore call instructions and we would like to take care of call in this PATCH. During the call, the frm may be updated or keep as is. Thus, we must make sure at least 2 things. 1. The static frm before call should not pollute the frm value in call. 2. The updated frm value in call should be sticky after call completed. We will perfrom some steps to make above happen. 1. Mark call instruction with new mode DYN_CALL. 2. Mark the instruction after CALL from NONE to DYN. 3. When emit for a DYN_CALL, we will restore the frm value. 4. When emit from a DYN_CALL, we will backup the frm value. Let's take a flow for this. +-------------+ | Entry (DYN) | <- frrm a5 +-------------+ / \ +-------+ +-----------+ | VFADD | | VFADD RTZ | <- fsrmi 1(RTZ) +-------+ +-----------+ | | +-------+ +-----------+ | CALL | | CALL | <- fsrm a5 +-------+ +-----------+ | | +-----------+ +-------+ | SHIFT | <- frrm a5 | VFADD | <- frrm a5 +-----------+ +-------+ | / +-----------+ / | VFADD RUP | <- fsrm1 3(RUP) +-----------+ / \ / +-----------------+ | Exit (DYN_EXIT) | <- fsrm a5 +-----------------+ When call is the last insn of one bb, we take care of it when needed for each insn by inserting one frm backup (frrm) insn to the end of the current bb. Signed-off-by: Pan Li <pan2.li@intel.com> Co-Authored-By: Juzhe-Zhong <juzhe.zhong@rivai.ai> gcc/ChangeLog: * config/riscv/riscv.cc (DYNAMIC_FRM_RTL): New macro. (STATIC_FRM_P): Ditto. (struct mode_switching_info): New struct for mode switching. (struct machine_function): Add new field mode switching. (riscv_emit_frm_mode_set): Add DYN_CALL emit. (riscv_frm_adjust_mode_after_call): New function for call mode. (riscv_frm_emit_after_call_in_bb_end): New function for emit insn when call as the end of bb. (riscv_frm_mode_needed): New function for frm mode needed. (frm_unknown_dynamic_p): Remove call check. (riscv_mode_needed): Extrac function for frm. (riscv_frm_mode_after): Add DYN_CALL after. (riscv_mode_entry): Remove backup rtl initialization. * config/riscv/vector.md (frm_mode): Add dyn_call. (fsrmsi_restore_exit): Rename to _volatile. (fsrmsi_restore_volatile): Likewise. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-frm-insert-7.c: Adjust test cases. * gcc.target/riscv/rvv/base/float-point-frm-run-1.c: Ditto. * gcc.target/riscv/rvv/base/float-point-frm-run-2.c: Ditto. * gcc.target/riscv/rvv/base/float-point-frm-run-3.c: Ditto. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-33.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-34.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-35.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-36.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-37.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-38.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-39.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-40.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-41.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-42.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-43.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-44.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-45.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-46.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-47.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-48.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-49.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-50.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-51.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-52.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-53.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-54.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-55.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-56.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-57.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-58.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-59.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-60.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-61.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-62.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-63.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-64.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-65.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-66.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-67.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-68.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-69.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-70.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-71.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-72.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-73.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-74.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-75.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-76.c: New test. * gcc.target/riscv/rvv/base/float-point-dynamic-frm-77.c: New test. * gcc.target/riscv/rvv/base/float-point-frm-run-4.c: New test. * gcc.target/riscv/rvv/base/float-point-frm-run-5.c: New test. * gcc.target/riscv/rvv/base/float-point-frm-run.h: New test.
2023-08-01RISC-V: Support RVV VFSUB and VFRSUB rounding mode intrinsic APIPan Li5-0/+75
This patch would like to support the rounding mode API for both the VFSUB and VFRSUB as below samples. * __riscv_vfsub_vv_f32m1_rm * __riscv_vfsub_vv_f32m1_rm_m * __riscv_vfsub_vf_f32m1_rm * __riscv_vfsub_vf_f32m1_rm_m * __riscv_vfrsub_vf_f32m1_rm * __riscv_vfrsub_vf_f32m1_rm_m Signed-off-by: Pan Li <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (class reverse_binop_frm): Add new template for reversed frm. (vfsub_frm_obj): New obj. (vfrsub_frm_obj): Likewise. * config/riscv/riscv-vector-builtins-bases.h: (vfsub_frm): New declaration. (vfrsub_frm): Likewise. * config/riscv/riscv-vector-builtins-functions.def (vfsub_frm): New function define. (vfrsub_frm): Likewise. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-single-rsub.c: New test. * gcc.target/riscv/rvv/base/float-point-single-sub.c: New test.
2023-08-01Adjust testcase for more optimal codegen.liuhongt2-6/+6
After b9d7140c80bd3c7355b8291bb46f0895dcd8c3cb is the first bad commit commit b9d7140c80bd3c7355b8291bb46f0895dcd8c3cb Author: Jan Hubicka <jh@suse.cz> Date: Fri Jul 28 09:16:09 2023 +0200 loop-split improvements, part 1 Now we have vpbroadcastd %ecx, %xmm0 vpaddd .LC3(%rip), %xmm0, %xmm0 vpextrd $3, %xmm0, %eax vmovddup %xmm3, %xmm0 vrndscalepd $9, %xmm0, %xmm0 vunpckhpd %xmm0, %xmm0, %xmm3 for vrndscalepd, no need to insert pxor since it reuses input register xmm0 to avoid partial sse dependece. gcc/testsuite/ChangeLog: * gcc.target/i386/pr87007-4.c: Adjust testcase. * gcc.target/i386/pr87007-5.c: Ditto.
2023-07-31c-family: Implement pragma_lex () for preprocess-only modeLewis Hyatt7-53/+113
In order to support processing #pragma in preprocess-only mode (-E or -save-temps for gcc/g++), we need a way to obtain the #pragma tokens from libcpp. In full compilation modes, this is accomplished by calling pragma_lex (), which is a symbol that must be exported by the frontend, and which is currently implemented for C and C++. Neither of those frontends initializes its parser machinery in preprocess-only mode, and consequently pragma_lex () does not work in this case. Address that by adding a new function c_init_preprocess () for the frontends to implement, which arranges for pragma_lex () to work in preprocess-only mode, and adjusting pragma_lex () accordingly. In preprocess-only mode, the preprocessor is accustomed to controlling the interaction with libcpp, and it only knows about tokens that it has called into libcpp itself to obtain. Since it still needs to see the tokens obtained by pragma_lex () so that they can be streamed to the output, also adjust c_lex_with_flags () and related functions in c-family/c-lex.cc to inform the preprocessor about any tokens it won't be aware of. Currently, there is one place where we are already supporting #pragma in preprocess-only mode, namely the handling of `#pragma GCC diagnostic'. That was done by directly interfacing with libcpp, rather than making use of pragma_lex (). Now that pragma_lex () works, that code is no longer necessary; remove it. gcc/c-family/ChangeLog: * c-common.h (c_init_preprocess): Declare new function. * c-opts.cc (c_common_init): Call it. * c-lex.cc (cb_def_pragma): Add a comment. (get_token): New function wrapping cpp_get_token. (c_lex_with_flags): Use the new wrapper function to support obtaining tokens in preprocess_only mode. (lex_string): Likewise. * c-pragma.cc (pragma_diagnostic_lex_normal): Rename to... (pragma_diagnostic_lex): ...this. (pragma_diagnostic_lex_pp): Remove. (handle_pragma_diagnostic_impl): Call pragma_diagnostic_lex () in all modes. (c_pp_invoke_early_pragma_handler): Adapt to support pragma_lex () usage. * c-pragma.h (pragma_lex_discard_to_eol): Declare. gcc/c/ChangeLog: * c-parser.cc (pragma_lex_discard_to_eol): New function. (c_init_preprocess): New function. gcc/cp/ChangeLog: * parser.cc (c_init_preprocess): New function. (maybe_read_tokens_for_pragma_lex): New function. (pragma_lex): Support preprocess-only mode. (pragma_lex_discard_to_eol): New function.
2023-08-01PR modula2/110865 Unable to access copied const arrayGaius Mulley4-14/+83
This patch allows constants of an array type to be indexed. gcc/m2/ChangeLog: PR modula2/110865 * gm2-compiler/M2Quads.mod (BuildDesignatorArray): Rename t as type and d as dim. New variable result. Allow constants of an array type to be indexed. gcc/testsuite/ChangeLog: PR modula2/110865 * gm2/iso/pass/constvec.mod: New test. * gm2/iso/pass/constvec2.mod: New test. * gm2/iso/run/pass/constvec3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-01Daily bump.GCC Administrator10-1/+357
2023-08-01Fix PR 93044: extra cast is not removedAndrew Pinski3-0/+34
In this case we are not removing convert to a bigger size back to the same size (or smaller) if signedness does not match. For an example: ``` signed char _1; ... _1 = *a_4(D); b_5 = (short unsigned int) _1; _2 = (unsigned char) b_5; ``` The inner cast is not needed and can be removed but was not. The match pattern for removing the extra cast is overly complex so decided to add a new case for rather than trying to modify the current if statement here. Committed as approved. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/93044 * match.pd (nested int casts): A truncation (to the same size or smaller) can always remove the inner cast. gcc/testsuite/ChangeLog: PR tree-optimization/93044 * gcc.dg/tree-ssa/cast-1.c: New test. * gcc.dg/tree-ssa/cast-2.c: New test.
2023-07-31libbacktrace: look for _pgmptr on WindowsIan Lance Taylor4-6/+41
Patch from Andres Freund: * configure.ac: Check for _pgmptr declaration. * fileline.c (fileline_initialize): Check for _pgmfptr before /proc/self/exec. * configure, config.h.in: Regenerate.
2023-07-31c: add -Wmissing-variable-declarations [PR65213]Hamza Mahfooz4-3/+55
Resolves: PR c/65213 - Extend -Wmissing-declarations to variables [i.e. add -Wmissing-variable-declarations] gcc/c-family/ChangeLog: PR c/65213 * c.opt (-Wmissing-variable-declarations): New option. gcc/c/ChangeLog: PR c/65213 * c-decl.cc (start_decl): Handle -Wmissing-variable-declarations. gcc/ChangeLog: PR c/65213 * doc/invoke.texi (-Wmissing-variable-declarations): Document new option. gcc/testsuite/ChangeLog: PR c/65213 * gcc.dg/Wmissing-variable-declarations.c: New test. Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
2023-07-31MATCH: Add `a == b | a cmp b` and `a != b & a cmp b` simplificationsAndrew Pinski2-2/+69
Even though these are done by combine_comparisons, we can add them to match to allow simplifcations during match rather than just during reassoc/ifcombine. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/106164 * match.pd (`a != b & a <= b`, `a != b & a >= b`, `a == b | a < b`, `a == b | a > b`): Handle these cases too. gcc/testsuite/ChangeLog: PR tree-optimization/106164 * gcc.dg/tree-ssa/cmpbit-2.c: New test.
2023-07-31MATCH: PR 106164 : Optimize `(X CMP1 Y) AND/IOR (X CMP2 Y)`Andrew Pinski2-14/+90
I noticed that there are patterns that optimize `(X CMP1 CST1) AND/IOR (X CMP2 CST2)` and we can easily extend them to support the `(X CMP1 Y) AND/IOR (X CMP2 Y)` by saying they compare equal. This allows for this kind of optimization for integral and pointer types (which have the same semantics). OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/106164 * match.pd: Extend the `(X CMP1 CST1) AND/IOR (X CMP2 CST2)` patterns to support `(X CMP1 Y) AND/IOR (X CMP2 Y)`. gcc/testsuite/ChangeLog: PR tree-optimization/106164 * gcc.dg/tree-ssa/cmpbit-1.c: New test.
2023-07-31tree-optimization: [PR100864] `(a&!b) | b` is not opimized to `a | b` for ↵Andrew Pinski4-2/+183
comparisons This is a new version of the patch. Instead of doing the matching of inversion comparison directly inside match, creating a new function (bitwise_inverted_equal_p) to do it. It is very similar to bitwise_equal_p that was added in r14-2751-g2a3556376c69a1fb but instead it says `expr1 == ~expr2`. A follow on patch, will use this function in other patterns where we try to match `@0` and `(bit_not @0)`. Changed the name bitwise_not_equal_p to bitwise_inverted_equal_p. Committed as approved after a Bootstrapped and test on x86_64-linux-gnu with no regressions. PR tree-optimization/100864 gcc/ChangeLog: * generic-match-head.cc (bitwise_inverted_equal_p): New function. * gimple-match-head.cc (bitwise_inverted_equal_p): New macro. (gimple_bitwise_inverted_equal_p): New function. * match.pd ((~x | y) & x): Use bitwise_inverted_equal_p instead of direct matching bit_not. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bitops-3.c: New test.
2023-07-31Re: [PATCH] gcc-ar: Handle response files properly [PR77576]Costas Argyris1-0/+47
Problem: gcc-ar fails when a @file is passed to it: $ cat rsp --version $ gcc-ar @rsp /usr/bin/ar: invalid option -- '@' This is because a dash '-' is prepended to the first argument if it doesn't start with one, resulting in the wrong call 'ar -@rsp'. Fix: Expand argv to get rid of any @files and if any expansions were made, pass everything through a temporary response file. $ gcc-ar @rsp GNU ar (GNU Binutils for Debian) 2.35.2 ... gcc/ PR driver/77576 * gcc-ar.cc (main): Expand argv and use temporary response file to call ar if any expansions were made.
2023-07-31fur_list should not use the range vector for non-ssa operands.Andrew MacLeod2-1/+20
gcc/ PR tree-optimization/110582 * gimple-range-fold.cc (fur_list::get_operand): Do not use the range vector for non-ssa names. gcc/testsuite/ * gcc.dg/pr110582.c: New.
2023-07-31Update gcc sv.poJoseph Myers1-27/+17
* sv.po: Update.
2023-07-31SARIF and -ftime-report's output [PR109361]David Malcolm9-16/+326
This patch adds support for embeddding profiling information about the compiler itself into the SARIF output. Specifically, if SARIF diagnostic output is requested, via -fdiagnostics-format=sarif-file or -fdiagnostics-format=sarif-stderr, then any -ftime-report output is written in JSON form into the SARIF output, rather than to stderr. In earlier versions of this patch I extended -ftime-report so that *as well* as writing to stderr, it would embed the information in any SARIF output. This turned out to be awkward to use, in that I found myself needing to get the data in JSON form without also having it emitted on stderr (which was fouling my build scripts). The timing information is written to the SARIF as a "gcc/timeReport" property within a property bag of the "invocation" object. Here's an example of the output: "invocations": [ { "executionSuccessful": true, "toolExecutionNotifications": [], "properties": { "gcc/timeReport": { "timevars": [ { "name": "phase setup", "elapsed": { "user": 0.04, "sys": 0, "wall": 0.04, "ggc_mem": 1863472 } }, [...snip...] { "name": "analyzer: processing worklist", "elapsed": { "user": 0.06, "sys": 0, "wall": 0.06, "ggc_mem": 48 } }, { "name": "analyzer: emitting diagnostics", "elapsed": { "user": 0.01, "sys": 0, "wall": 0.01, "ggc_mem": 0 } }, { "name": "TOTAL", "elapsed": { "user": 0.21, "sys": 0.03, "wall": 0.24, "ggc_mem": 3368736 } } ], "CHECKING_P": true, "flag_checking": true } } } ] The documentation notes that the precise output format is subject to change. I have successfully used this in my analyzer integration tests to get timing information about which source files get slowed down by the analyzer. I've validated the generated .sarif files against the SARIF schema. gcc/ChangeLog: PR analyzer/109361 * diagnostic-client-data-hooks.h (class sarif_object): New forward decl. (diagnostic_client_data_hooks::add_sarif_invocation_properties): New vfunc. * diagnostic-format-sarif.cc: Include "diagnostic-format-sarif.h". (class sarif_invocation): Inherit from sarif_object rather than json::object. (class sarif_result): Likewise. (class sarif_ice_notification): Likewise. (sarif_object::get_or_create_properties): New. (sarif_invocation::prepare_to_flush): Add "context" param. Use it to call the context's add_sarif_invocation_properties hook. (sarif_builder::flush_to_file): Pass m_context to sarif_invocation::prepare_to_flush. * diagnostic-format-sarif.h: New header. * doc/invoke.texi (Developer Options): Clarify that -ftime-report writes to stderr. Document that if SARIF diagnostic output is requested then any timing information is written in JSON form as part of the SARIF output, rather than to stderr. * timevar.cc: Include "json.h". (timer::named_items::m_hash_map): Split out type into... (timer::named_items::hash_map_t): ...this new typedef. (timer::named_items::make_json): New function. (timevar_diff): New function. (make_json_for_timevar_time_def): New function. (timer::timevar_def::make_json): New function. (timer::make_json): New function. * timevar.h (class json::value): New forward decl. (timer::make_json): New decl. (timer::timevar_def::make_json): New decl. * tree-diagnostic-client-data-hooks.cc: Include "diagnostic-format-sarif.h" and "timevar.h". (compiler_data_hooks::add_sarif_invocation_properties): New vfunc implementation. gcc/testsuite/ChangeLog: PR analyzer/109361 * c-c++-common/diagnostic-format-sarif-file-timevars-1.c: New test. * c-c++-common/diagnostic-format-sarif-file-timevars-2.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-07-31OpenACC 2.7: host_data must have use_device clause requirementChung-Lin Tang6-7/+37
This patch implements the OpenACC 2.7 change requiring the host_data construct to have at least one use_device clause. gcc/c/ChangeLog: * c-parser.cc (c_parser_oacc_host_data): Add checking requiring OpenACC host_data construct to have an use_device clause. gcc/cp/ChangeLog: * parser.cc (cp_parser_oacc_host_data): Add checking requiring OpenACC host_data construct to have an use_device clause. gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Add checking requiring OpenACC host_data construct to have an use_device clause. gcc/testsuite/ChangeLog: * c-c++-common/goacc/host_data-2.c: Adjust testcase. * gfortran.dg/goacc/host_data-error.f90: New testcase. * gfortran.dg/goacc/pr71704.f90: Adjust testcase.