]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
9 months agoDisable loop distribution for loops with estimated iterations 0
Jan Hubicka [Sun, 6 Aug 2023 20:33:33 +0000 (22:33 +0200)] 
Disable loop distribution for loops with estimated iterations 0

This prevents useless loop distribiton produced in hmmer.  With FDO we now
correctly work out that the loop created for last iteraiton is not going to
iterate however loop distribution still produces a verioned loop that has no
chance to survive loop vectorizer since we only keep distributed loops
when loop vectorization suceeds and it requires number of (header) iterations
to exceed the vectorization factor.

gcc/ChangeLog:

* tree-loop-distribution.cc (loop_distribution::execute): Disable
distribution for loops with estimated iterations 0.

9 months agoFix profile update after peeled epilogues
Jan Hubicka [Sun, 6 Aug 2023 19:23:31 +0000 (21:23 +0200)] 
Fix profile update after peeled epilogues

Epilogue peeling expects the scalar loop to have same number of executions as
the vector loop which is true at the beggining of vectorization. However if the
epilogues are vectorized, this is no longer the case.  In this situation the
loop preheader is replaced by new guard code with correct profile, however
loop body is left unscaled.  This leads to loop that exists more often then
it is entered.

This patch add slogic to scale the frequencies down and also to fix profile
of original preheader where necesary.

Bootstrapped/regtested x86_64-linux, comitted.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (vect_do_peeling): Fix profile update of peeled epilogues.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-bitfield-read-1.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-read-2.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-read-3.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-read-4.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-read-5.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-read-6.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-read-7.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-write-1.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-write-2.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-write-3.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-write-4.c: Check profile consistency.
* gcc.dg/vect/vect-bitfield-write-5.c: Check profile consistency.
* gcc.dg/vect/vect-epilogues-2.c: Check profile consistency.
* gcc.dg/vect/vect-epilogues.c: Check profile consistency.
* gcc.dg/vect/vect-mask-store-move-1.c: Check profile consistency.

9 months agolibstdc++: [_GLIBCXX_INLINE_VERSION] Add __cxa_call_terminate symbol export
François Dumont [Sat, 5 Aug 2023 15:18:16 +0000 (17:18 +0200)] 
libstdc++: [_GLIBCXX_INLINE_VERSION] Add __cxa_call_terminate symbol export

libstdc++-v3/ChangeLog:

* config/abi/pre/gnu-versioned-namespace.ver: Add __cxa_call_terminate
symbol export.

9 months agoDaily bump.
GCC Administrator [Sun, 6 Aug 2023 00:16:37 +0000 (00:16 +0000)] 
Daily bump.

9 months agoPR modula2/110779 SysClock can not read the clock
Gaius Mulley [Sat, 5 Aug 2023 16:35:12 +0000 (17:35 +0100)] 
PR modula2/110779 SysClock can not read the clock

This patch completes the implementation of the ISO module
SysClock.mod.  Three new testcases are provided.  wrapclock.{cc,def}
are new support files providing access to clock_settime, clock_gettime
and glibc timezone variables.

gcc/m2/ChangeLog:

PR modula2/110779
* gm2-libs-iso/SysClock.mod: Re-implement using wrapclock.
* gm2-libs-iso/wrapclock.def: New file.

libgm2/ChangeLog:

PR modula2/110779
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac (GM2_CHECK_LIB): Check for clock_gettime
and clock_settime.
* libm2iso/Makefile.am (M2DEFS): Add wrapclock.def.
* libm2iso/Makefile.in: Regenerate.
* libm2iso/wraptime.cc: Replace HAVE_TIMEVAL with
HAVE_STRUCT_TIMEVAL.
* libm2iso/wrapclock.cc: New file.

gcc/testsuite/ChangeLog:

PR modula2/110779
* gm2/iso/run/pass/m2date.mod: New test.
* gm2/iso/run/pass/testclock.mod: New test.
* gm2/iso/run/pass/testclock2.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
9 months agoc: Less warnings for parameters declared as arrays [PR98536]
Martin Uecker [Thu, 13 Apr 2023 17:35:15 +0000 (19:35 +0200)] 
c: Less warnings for parameters declared as arrays [PR98536]

To avoid false positivies, tune the warnings for parameters declared
as arrays with size expressions.  Do not warn when more bounds are
specified in the declaration than before.

PR c/98536

gcc/c-family/:
* c-warn.cc (warn_parm_array_mismatch): Do not warn if more
bounds are specified.

gcc/testsuite:
* gcc.dg/Wvla-parameter-4.c: Adapt test.
* gcc.dg/attr-access-2.c: Adapt test.

9 months agoc: _Generic should not warn in non-active branches [PR68193,PR97100,PR110703]
Martin Uecker [Fri, 4 Aug 2023 05:48:21 +0000 (07:48 +0200)] 
c: _Generic should not warn in non-active branches [PR68193,PR97100,PR110703]

To avoid false diagnostics, use c_inhibit_evaluation_warnings when
a generic association is known to not match during parsing.  We may
still generate false positives if the default branch comes earler than
a specific association that matches.

PR c/68193
PR c/97100
PR c/110703

gcc/c/:
* c-parser.cc (c_parser_generic_selection): Inhibit evaluation
warnings branches that are known not be taken during parsing.

gcc/testsuite/ChangeLog:
* gcc.dg/pr68193.c: New test.

9 months agoDaily bump.
GCC Administrator [Sat, 5 Aug 2023 00:17:11 +0000 (00:17 +0000)] 
Daily bump.

9 months ago[PATCH v3] [RISC-V] Generate Zicond instruction for select pattern with condition...
Xiao Zeng [Fri, 4 Aug 2023 21:23:56 +0000 (17:23 -0400)] 
[PATCH v3] [RISC-V] Generate Zicond instruction for select pattern with condition eq or neq to 0

This patch recognizes Zicond patterns when the select pattern
with condition eq or neq to 0 (using eq as an example), namely:

1 rd = (rs2 == 0) ? non-imm : 0
2 rd = (rs2 == 0) ? non-imm : non-imm
3 rd = (rs2 == 0) ? reg : non-imm
4 rd = (rs2 == 0) ? reg : reg

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_expand_conditional_move): Recognize
more Zicond patterns.  Fix whitespace typo.
(riscv_rtx_costs): Remove accidental code duplication.

Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
9 months agoanalyzer: handle function attribute "alloc_size" [PR110426]
David Malcolm [Fri, 4 Aug 2023 20:18:40 +0000 (16:18 -0400)] 
analyzer: handle function attribute "alloc_size" [PR110426]

This patch makes -fanalyzer make use of the function attribute
"alloc_size", allowing -fanalyzer to emit -Wanalyzer-allocation-size,
-Wanalyzer-out-of-bounds, and -Wanalyzer-tainted-allocation-size on
execution paths involving allocations using such functions.

gcc/analyzer/ChangeLog:
PR analyzer/110426
* bounds-checking.cc (region_model::check_region_bounds): Handle
symbolic base regions.
* call-details.cc: Include "stringpool.h" and "attribs.h".
(call_details::lookup_function_attribute): New function.
* call-details.h (call_details::lookup_function_attribute): New
function decl.
* region-model-manager.cc
(region_model_manager::maybe_fold_binop): Add reference to
PR analyzer/110902.
* region-model-reachability.cc (reachable_regions::handle_sval):
Add symbolic regions for pointers that are conjured svalues for
the LHS of a stmt.
* region-model.cc (region_model::canonicalize): Purge dynamic
extents for regions that aren't referenced.
(get_result_size_in_bytes): New function.
(region_model::on_call_pre): Use get_result_size_in_bytes and
potentially set the dynamic extents of the region pointed to by
the return value.
(region_model::deref_rvalue): Add param "add_nonnull_constraint"
and use it to conditionalize adding the constraint.
(pending_diagnostic_subclass::dubious_allocation_size): Add "stmt"
param to both ctors and use it to initialize new "m_stmt" field.
(pending_diagnostic_subclass::operator==): Use m_stmt; don't use
m_lhs or m_rhs.
(pending_diagnostic_subclass::m_stmt): New field.
(region_model::check_region_size): Generalize to any kind of
pointer svalue by using deref_rvalue rather than checking for
region_svalue.  Pass stmt to dubious_allocation_size ctor.
* region-model.h (region_model::deref_rvalue): Add param
"add_nonnull_constraint".
* svalue.cc (conjured_svalue::lhs_value_p): New function.
* svalue.h (conjured_svalue::lhs_value_p): New decl.

gcc/testsuite/ChangeLog:
PR analyzer/110426
* gcc.dg/analyzer/allocation-size-1.c: Update expected message to
reflect consolidation of size and assignment into a single event.
* gcc.dg/analyzer/allocation-size-2.c: Likewise.
* gcc.dg/analyzer/allocation-size-3.c: Likewise.
* gcc.dg/analyzer/allocation-size-4.c: Likewise.
* gcc.dg/analyzer/allocation-size-multiline-1.c: Likewise.
* gcc.dg/analyzer/allocation-size-multiline-2.c: Likewise.
* gcc.dg/analyzer/allocation-size-multiline-3.c: Likewise.
* gcc.dg/analyzer/attr-alloc_size-1.c: New test.
* gcc.dg/analyzer/attr-alloc_size-2.c: New test.
* gcc.dg/analyzer/attr-alloc_size-3.c: New test.
* gcc.dg/analyzer/explode-4.c: New test.
* gcc.dg/analyzer/taint-size-1.c: Add test coverage for
__attribute__ alloc_size.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
9 months agoanalyzer: fix some svalue::dump_to_pp implementations
David Malcolm [Fri, 4 Aug 2023 20:17:12 +0000 (16:17 -0400)] 
analyzer: fix some svalue::dump_to_pp implementations

gcc/analyzer/ChangeLog:
* svalue.cc (region_svalue::dump_to_pp): Support NULL type.
(constant_svalue::dump_to_pp): Likewise.
(initial_svalue::dump_to_pp): Likewise.
(conjured_svalue::dump_to_pp): Likewise.  Fix missing print of the
type.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
9 months agoi386: eliminate redundant operands of VPTERNLOG
Yan Simonaytes [Tue, 25 Jul 2023 17:43:19 +0000 (20:43 +0300)] 
i386: eliminate redundant operands of VPTERNLOG

As mentioned in PR 110202, GCC may be presented with input where control
word of the VPTERNLOG intrinsic implies that some of its operands do not
affect the result.  In that case, we can eliminate redundant operands
of the instruction by substituting any other operand in their place.
This removes false dependencies.

For instance, instead of (252 = 0xfc = _MM_TERNLOG_A | _MM_TERNLOG_B)

vpternlogq $252, %zmm2, %zmm1, %zmm0

emit

vpternlogq $252, %zmm0, %zmm1, %zmm0

When VPTERNLOG is invariant w.r.t first and second operands, and the
third operand is memory, load memory into the output operand first, i.e.
instead of (85 = 0x55 = ~_MM_TERNLOG_C)

vpternlogq $85, (%rdi), %zmm1, %zmm0

emit

vmovdqa64 (%rdi), %zmm0
vpternlogq $85, %zmm0, %zmm0, %zmm0

gcc/ChangeLog:

PR target/110202
* config/i386/i386-protos.h
(vpternlog_redundant_operand_mask): Declare.
(substitute_vpternlog_operands): Declare.
* config/i386/i386.cc
(vpternlog_redundant_operand_mask): New helper.
(substitute_vpternlog_operands): New function.  Use them...
* config/i386/sse.md: ... here in new VPTERNLOG define_splits.

gcc/testsuite/ChangeLog:

PR target/110202
* gcc.target/i386/invariant-ternlog-1.c: New test.
* gcc.target/i386/invariant-ternlog-2.c: New test.

9 months agoSpecify signed/unsigned/dontcare in calls to extract_bit_field_1.
Roger Sayle [Fri, 4 Aug 2023 15:26:06 +0000 (16:26 +0100)] 
Specify signed/unsigned/dontcare in calls to extract_bit_field_1.

This patch is inspired by Jakub's work on PR rtl-optimization/110717.
The bitfield example described in comment #2, looks like:

struct S { __int128 a : 69; };
unsigned type bar (struct S *p) {
  return p->a;
}

which on x86_64 with -O2 currently generates:

bar:    movzbl  8(%rdi), %ecx
        movq    (%rdi), %rax
        andl    $31, %ecx
        movq    %rcx, %rdx
        salq    $59, %rdx
        sarq    $59, %rdx
        ret

The ANDL $31 is interesting... we first extract an unsigned 69-bit bitfield
by masking/clearing the top bits of the most significant word, and then
it gets sign-extended, by left shifting and arithmetic right shifting.
Obviously, this bit-wise AND is redundant, for signed bit-fields, we don't
require these bits to be cleared, if we're about to set them appropriately.

This patch eliminates this redundancy in the middle-end, during RTL
expansion, but extending the extract_bit_field APIs so that the integer
UNSIGNEDP argument takes a special value; 0 indicates the field should
be sign extended, 1 (any non-zero value) indicates the field should be
zero extended, but -1 indicates a third option, that we don't care how
or whether the field is extended.  By passing and checking this sentinel
value at the appropriate places we avoid the useless bit masking (on
all targets).

For the test case above, with this patch we now generate:

bar:    movzbl  8(%rdi), %ecx
        movq    (%rdi), %rax
        movq    %rcx, %rdx
        salq    $59, %rdx
        sarq    $59, %rdx
        ret

2023-08-04  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* expmed.cc (extract_bit_field_1): Document that an UNSIGNEDP
value of -1 is equivalent to don't care.
(extract_integral_bit_field): Indicate that we don't require
the most significant word to be zero extended, if we're about
to sign extend it.
(extract_fixed_bit_field_1): Document that an UNSIGNEDP value
of -1 is equivalent to don't care.  Don't clear the most
significant bits with AND mask when UNSIGNEDP is -1.

gcc/testsuite/ChangeLog
* gcc.target/i386/pr110717-2.c: New test case.

9 months agoi386: Split SUBREGs of SSE vector registers into vec_select insns.
Roger Sayle [Fri, 4 Aug 2023 15:23:38 +0000 (16:23 +0100)] 
i386: Split SUBREGs of SSE vector registers into vec_select insns.

This patch is the final piece in the series to improve the ABI issues
affecting PR 88873.  The previous patches tackled inserting DFmode
values into V2DFmode registers, by introducing insvti_{low,high}part
patterns.  This patch improves the extraction of DFmode values from
V2DFmode registers via TImode intermediates.

I'd initially thought this would require new extvti_{low,high}part
patterns to be defined, but all that's required is to recognize that
the SUBREG idioms produced by combine are equivalent to (forms of)
vec_select patterns.  The target-independent middle-end can't be sure
that the appropriate vec_select instruction exists on the target,
hence doesn't canonicalize a SUBREG of a vector mode as a vec_select,
but the backend can provide a define_split stating where and when
this is useful, for example, considering whether the operand is in
memory, or whether !TARGET_SSE_MATH and the destination is i387.

For pr88873.c, gcc -O2 -march=cascadelake currently generates:

foo:    vpunpcklqdq     %xmm3, %xmm2, %xmm7
        vpunpcklqdq     %xmm1, %xmm0, %xmm6
        vpunpcklqdq     %xmm5, %xmm4, %xmm2
        vmovdqa %xmm7, -24(%rsp)
        vmovdqa %xmm6, %xmm1
        movq    -16(%rsp), %rax
        vpinsrq $1, %rax, %xmm7, %xmm4
        vmovapd %xmm4, %xmm6
        vfmadd132pd     %xmm1, %xmm2, %xmm6
        vmovapd %xmm6, -24(%rsp)
        vmovsd  -16(%rsp), %xmm1
        vmovsd  -24(%rsp), %xmm0
        ret

with this patch, we now generate:

foo: vpunpcklqdq     %xmm1, %xmm0, %xmm6
        vpunpcklqdq     %xmm3, %xmm2, %xmm7
        vpunpcklqdq     %xmm5, %xmm4, %xmm2
        vmovdqa %xmm6, %xmm1
        vfmadd132pd     %xmm7, %xmm2, %xmm1
        vmovsd  %xmm1, %xmm1, %xmm0
        vunpckhpd       %xmm1, %xmm1, %xmm1
        ret

The improvement is even more dramatic when compared to the original
29 instructions shown in comment #8.  GCC 13, for example, required
12 transfers to/from memory.

2023-08-04  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/i386/sse.md (define_split): Convert highpart:DF extract
from V2DFmode register into a sse2_storehpd instruction.
(define_split): Likewise, convert lowpart:DF extract from V2DF
register into a sse2_storelpd instruction.

gcc/testsuite/ChangeLog
* gcc.target/i386/pr88873.c: Tweak to check for improved code.

9 months agoAdd documentation for -Wflex-array-member-not-at-end.
Qing Zhao [Fri, 4 Aug 2023 14:24:32 +0000 (14:24 +0000)] 
Add documentation for -Wflex-array-member-not-at-end.

'-Wflex-array-member-not-at-end (C and C++ only)'
     Warn when a structure containing a C99 flexible array member as the
     last field is not at the end of another structure.  This warning
     warns e.g.  about

          struct flex  { int length; char data[]; };
          struct mid_flex { int m; struct flex flex_data; int n; };

gcc/ChangeLog:

* doc/invoke.texi (-Wflex-array-member-not-at-end): Document
new option.

9 months agoLRA: Check input insn pattern hard regs against early clobber hard regs for live...
Vladimir N. Makarov [Fri, 4 Aug 2023 12:04:44 +0000 (08:04 -0400)] 
LRA: Check input insn pattern hard regs against early clobber hard regs for live info

For the test case LRA generates wrong code for AVR cpymem_qi insn:

(insn 16 15 17 3 (parallel [
            (set (mem:BLK (reg:HI 26 r26) [0  A8])
                (mem:BLK (reg:HI 30 r30) [0  A8]))
            (unspec [
                    (const_int 0 [0])
                ] UNSPEC_CPYMEM)
            (use (reg:QI 52))
            (clobber (reg:HI 26 r26))
            (clobber (reg:HI 30 r30))
            (clobber (reg:QI 0 r0))
            (clobber (reg:QI 52))
        ]) "t.c":16:22 132 {cpymem_qi}

The insn gets the same value in r26 and r30.  The culprit is clobbering
r30 and using r30 as input.  For such situation LRA wrongly assumes that
r30 does not live before the insn.  The patch is fixing it.

gcc/ChangeLog:

* lra-lives.cc (process_bb_lives): Check input insn pattern hard regs
against early clobber hard regs.

gcc/testsuite/ChangeLog:

* gcc.target/avr/lra-cpymem_qi.c: New.

9 months agomiddle-end: clean up vect testsuite using pragma novector
Tamar Christina [Fri, 4 Aug 2023 12:52:46 +0000 (13:52 +0100)] 
middle-end: clean up vect testsuite using pragma novector

The support for early break vectorization breaks lots of scan vect and slp
testcases because they assume that loops with abort () in them cannot be
vectorized.  Additionally it breaks the point of having a scalar loop to check
the output of the vectorizer if that loop is also vectorized.

For that reason this adds

vectorized using this patch series.

FWIW, none of these tests were failing to vectorize or run before the pragma.
The tests that did point to some issues were copies to the early break test
suit as well.

gcc/testsuite/ChangeLog:

* g++.dg/vect/pr84556.cc: Add novector pragma.
* g++.dg/vect/simd-1.cc: Add novector pragma.
* g++.dg/vect/simd-2.cc: Add novector pragma.
* g++.dg/vect/simd-3.cc: Add novector pragma.
* g++.dg/vect/simd-4.cc: Add novector pragma.
* g++.dg/vect/simd-5.cc: Add novector pragma.
* g++.dg/vect/simd-6.cc: Add novector pragma.
* g++.dg/vect/simd-7.cc: Add novector pragma.
* g++.dg/vect/simd-8.cc: Add novector pragma.
* g++.dg/vect/simd-9.cc: Add novector pragma.
* g++.dg/vect/simd-clone-6.cc: Add novector pragma.
* gcc.dg/vect/O3-pr70130.c: Add novector pragma.
* gcc.dg/vect/Os-vect-95.c: Add novector pragma.
* gcc.dg/vect/bb-slp-1.c: Add novector pragma.
* gcc.dg/vect/bb-slp-16.c: Add novector pragma.
* gcc.dg/vect/bb-slp-2.c: Add novector pragma.
* gcc.dg/vect/bb-slp-24.c: Add novector pragma.
* gcc.dg/vect/bb-slp-25.c: Add novector pragma.
* gcc.dg/vect/bb-slp-26.c: Add novector pragma.
* gcc.dg/vect/bb-slp-27.c: Add novector pragma.
* gcc.dg/vect/bb-slp-28.c: Add novector pragma.
* gcc.dg/vect/bb-slp-29.c: Add novector pragma.
* gcc.dg/vect/bb-slp-42.c: Add novector pragma.
* gcc.dg/vect/bb-slp-cond-1.c: Add novector pragma.
* gcc.dg/vect/bb-slp-over-widen-1.c: Add novector pragma.
* gcc.dg/vect/bb-slp-over-widen-2.c: Add novector pragma.
* gcc.dg/vect/bb-slp-pattern-1.c: Add novector pragma.
* gcc.dg/vect/bb-slp-pattern-2.c: Add novector pragma.
* gcc.dg/vect/bb-slp-pow-1.c: Add novector pragma.
* gcc.dg/vect/bb-slp-pr101615-2.c: Add novector pragma.
* gcc.dg/vect/bb-slp-pr65935.c: Add novector pragma.
* gcc.dg/vect/bb-slp-subgroups-1.c: Add novector pragma.
* gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: Add novector pragma.
* gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: Add novector pragma.
* gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-slp-12.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-slp-33.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-31b.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-31c.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-33.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-68a.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-68b.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-68c.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: Add novector pragma.
* gcc.dg/vect/costmodel/ppc/costmodel-vect-outer-fir.c: Add novector pragma.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: Add novector pragma.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: Add novector pragma.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: Add novector pragma.
* gcc.dg/vect/fast-math-bb-slp-call-1.c: Add novector pragma.
* gcc.dg/vect/fast-math-bb-slp-call-2.c: Add novector pragma.
* gcc.dg/vect/fast-math-vect-call-1.c: Add novector pragma.
* gcc.dg/vect/fast-math-vect-call-2.c: Add novector pragma.
* gcc.dg/vect/fast-math-vect-complex-3.c: Add novector pragma.
* gcc.dg/vect/if-cvt-stores-vect-ifcvt-18.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-noreassoc-outer-1.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-noreassoc-outer-2.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-noreassoc-outer-3.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-noreassoc-outer-5.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-10.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-10a.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-10b.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-11.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-12.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-15.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-16.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-17.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-18.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-19.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-20.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-21.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-22.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-3.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-4.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-5.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-6-global.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-6.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-7.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-8.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-9.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-9a.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-outer-9b.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-slp-30.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-slp-31.c: Add novector pragma.
* gcc.dg/vect/no-scevccp-vect-iv-2.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-31.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-34.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-36.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-64.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-65.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-66.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-68.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-69.c: Add novector pragma.
* gcc.dg/vect/no-section-anchors-vect-outer-4h.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-2.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-vect-111.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c: Add novector pragma.
* gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c: Add novector pragma.
* gcc.dg/vect/no-tree-dom-vect-bug.c: Add novector pragma.
* gcc.dg/vect/no-tree-pre-slp-29.c: Add novector pragma.
* gcc.dg/vect/no-vfa-pr29145.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-101.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-102.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-102a.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-37.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-43.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-45.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-49.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-51.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-53.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-57.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-61.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-79.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-depend-1.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-depend-2.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-depend-3.c: Add novector pragma.
* gcc.dg/vect/no-vfa-vect-dv-2.c: Add novector pragma.
* gcc.dg/vect/pr101445.c: Add novector pragma.
* gcc.dg/vect/pr103581.c: Add novector pragma.
* gcc.dg/vect/pr105219.c: Add novector pragma.
* gcc.dg/vect/pr108608.c: Add novector pragma.
* gcc.dg/vect/pr18400.c: Add novector pragma.
* gcc.dg/vect/pr18536.c: Add novector pragma.
* gcc.dg/vect/pr20122.c: Add novector pragma.
* gcc.dg/vect/pr25413.c: Add novector pragma.
* gcc.dg/vect/pr30784.c: Add novector pragma.
* gcc.dg/vect/pr37539.c: Add novector pragma.
* gcc.dg/vect/pr40074.c: Add novector pragma.
* gcc.dg/vect/pr45752.c: Add novector pragma.
* gcc.dg/vect/pr45902.c: Add novector pragma.
* gcc.dg/vect/pr46009.c: Add novector pragma.
* gcc.dg/vect/pr48172.c: Add novector pragma.
* gcc.dg/vect/pr51074.c: Add novector pragma.
* gcc.dg/vect/pr51581-3.c: Add novector pragma.
* gcc.dg/vect/pr51581-4.c: Add novector pragma.
* gcc.dg/vect/pr53185-2.c: Add novector pragma.
* gcc.dg/vect/pr56918.c: Add novector pragma.
* gcc.dg/vect/pr56920.c: Add novector pragma.
* gcc.dg/vect/pr56933.c: Add novector pragma.
* gcc.dg/vect/pr57705.c: Add novector pragma.
* gcc.dg/vect/pr57741-2.c: Add novector pragma.
* gcc.dg/vect/pr57741-3.c: Add novector pragma.
* gcc.dg/vect/pr59591-1.c: Add novector pragma.
* gcc.dg/vect/pr59591-2.c: Add novector pragma.
* gcc.dg/vect/pr59594.c: Add novector pragma.
* gcc.dg/vect/pr59984.c: Add novector pragma.
* gcc.dg/vect/pr60276.c: Add novector pragma.
* gcc.dg/vect/pr61194.c: Add novector pragma.
* gcc.dg/vect/pr61680.c: Add novector pragma.
* gcc.dg/vect/pr62021.c: Add novector pragma.
* gcc.dg/vect/pr63341-2.c: Add novector pragma.
* gcc.dg/vect/pr64252.c: Add novector pragma.
* gcc.dg/vect/pr64404.c: Add novector pragma.
* gcc.dg/vect/pr64421.c: Add novector pragma.
* gcc.dg/vect/pr64493.c: Add novector pragma.
* gcc.dg/vect/pr64495.c: Add novector pragma.
* gcc.dg/vect/pr66251.c: Add novector pragma.
* gcc.dg/vect/pr66253.c: Add novector pragma.
* gcc.dg/vect/pr68502-1.c: Add novector pragma.
* gcc.dg/vect/pr68502-2.c: Add novector pragma.
* gcc.dg/vect/pr69820.c: Add novector pragma.
* gcc.dg/vect/pr70021.c: Add novector pragma.
* gcc.dg/vect/pr70354-1.c: Add novector pragma.
* gcc.dg/vect/pr70354-2.c: Add novector pragma.
* gcc.dg/vect/pr71259.c: Add novector pragma.
* gcc.dg/vect/pr78005.c: Add novector pragma.
* gcc.dg/vect/pr78558.c: Add novector pragma.
* gcc.dg/vect/pr80815-2.c: Add novector pragma.
* gcc.dg/vect/pr80815-3.c: Add novector pragma.
* gcc.dg/vect/pr80928.c: Add novector pragma.
* gcc.dg/vect/pr81410.c: Add novector pragma.
* gcc.dg/vect/pr81633.c: Add novector pragma.
* gcc.dg/vect/pr81740-1.c: Add novector pragma.
* gcc.dg/vect/pr81740-2.c: Add novector pragma.
* gcc.dg/vect/pr85586.c: Add novector pragma.
* gcc.dg/vect/pr87288-1.c: Add novector pragma.
* gcc.dg/vect/pr87288-2.c: Add novector pragma.
* gcc.dg/vect/pr87288-3.c: Add novector pragma.
* gcc.dg/vect/pr88903-1.c: Add novector pragma.
* gcc.dg/vect/pr88903-2.c: Add novector pragma.
* gcc.dg/vect/pr90018.c: Add novector pragma.
* gcc.dg/vect/pr92420.c: Add novector pragma.
* gcc.dg/vect/pr94994.c: Add novector pragma.
* gcc.dg/vect/pr96783-1.c: Add novector pragma.
* gcc.dg/vect/pr96783-2.c: Add novector pragma.
* gcc.dg/vect/pr97081-2.c: Add novector pragma.
* gcc.dg/vect/pr97558-2.c: Add novector pragma.
* gcc.dg/vect/pr97678.c: Add novector pragma.
* gcc.dg/vect/section-anchors-pr27770.c: Add novector pragma.
* gcc.dg/vect/section-anchors-vect-69.c: Add novector pragma.
* gcc.dg/vect/slp-1.c: Add novector pragma.
* gcc.dg/vect/slp-10.c: Add novector pragma.
* gcc.dg/vect/slp-11a.c: Add novector pragma.
* gcc.dg/vect/slp-11b.c: Add novector pragma.
* gcc.dg/vect/slp-11c.c: Add novector pragma.
* gcc.dg/vect/slp-12a.c: Add novector pragma.
* gcc.dg/vect/slp-12b.c: Add novector pragma.
* gcc.dg/vect/slp-12c.c: Add novector pragma.
* gcc.dg/vect/slp-13-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-13.c: Add novector pragma.
* gcc.dg/vect/slp-14.c: Add novector pragma.
* gcc.dg/vect/slp-15.c: Add novector pragma.
* gcc.dg/vect/slp-16.c: Add novector pragma.
* gcc.dg/vect/slp-17.c: Add novector pragma.
* gcc.dg/vect/slp-18.c: Add novector pragma.
* gcc.dg/vect/slp-19a.c: Add novector pragma.
* gcc.dg/vect/slp-19b.c: Add novector pragma.
* gcc.dg/vect/slp-19c.c: Add novector pragma.
* gcc.dg/vect/slp-2.c: Add novector pragma.
* gcc.dg/vect/slp-20.c: Add novector pragma.
* gcc.dg/vect/slp-21.c: Add novector pragma.
* gcc.dg/vect/slp-22.c: Add novector pragma.
* gcc.dg/vect/slp-23.c: Add novector pragma.
* gcc.dg/vect/slp-24-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-24.c: Add novector pragma.
* gcc.dg/vect/slp-25.c: Add novector pragma.
* gcc.dg/vect/slp-26.c: Add novector pragma.
* gcc.dg/vect/slp-28.c: Add novector pragma.
* gcc.dg/vect/slp-3-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-3.c: Add novector pragma.
* gcc.dg/vect/slp-33.c: Add novector pragma.
* gcc.dg/vect/slp-34-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-34.c: Add novector pragma.
* gcc.dg/vect/slp-35.c: Add novector pragma.
* gcc.dg/vect/slp-37.c: Add novector pragma.
* gcc.dg/vect/slp-4-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-4.c: Add novector pragma.
* gcc.dg/vect/slp-41.c: Add novector pragma.
* gcc.dg/vect/slp-43.c: Add novector pragma.
* gcc.dg/vect/slp-45.c: Add novector pragma.
* gcc.dg/vect/slp-46.c: Add novector pragma.
* gcc.dg/vect/slp-47.c: Add novector pragma.
* gcc.dg/vect/slp-48.c: Add novector pragma.
* gcc.dg/vect/slp-49.c: Add novector pragma.
* gcc.dg/vect/slp-5.c: Add novector pragma.
* gcc.dg/vect/slp-6.c: Add novector pragma.
* gcc.dg/vect/slp-7.c: Add novector pragma.
* gcc.dg/vect/slp-8.c: Add novector pragma.
* gcc.dg/vect/slp-9.c: Add novector pragma.
* gcc.dg/vect/slp-cond-1.c: Add novector pragma.
* gcc.dg/vect/slp-cond-2-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-cond-2.c: Add novector pragma.
* gcc.dg/vect/slp-cond-3.c: Add novector pragma.
* gcc.dg/vect/slp-cond-4.c: Add novector pragma.
* gcc.dg/vect/slp-cond-5.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-1.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-10.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-11-big-array.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-11.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-12.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-2.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-3.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-4.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-5.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-6.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-7.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-8.c: Add novector pragma.
* gcc.dg/vect/slp-multitypes-9.c: Add novector pragma.
* gcc.dg/vect/slp-perm-1.c: Add novector pragma.
* gcc.dg/vect/slp-perm-10.c: Add novector pragma.
* gcc.dg/vect/slp-perm-11.c: Add novector pragma.
* gcc.dg/vect/slp-perm-12.c: Add novector pragma.
* gcc.dg/vect/slp-perm-2.c: Add novector pragma.
* gcc.dg/vect/slp-perm-3.c: Add novector pragma.
* gcc.dg/vect/slp-perm-4.c: Add novector pragma.
* gcc.dg/vect/slp-perm-5.c: Add novector pragma.
* gcc.dg/vect/slp-perm-6.c: Add novector pragma.
* gcc.dg/vect/slp-perm-7.c: Add novector pragma.
* gcc.dg/vect/slp-perm-8.c: Add novector pragma.
* gcc.dg/vect/slp-perm-9.c: Add novector pragma.
* gcc.dg/vect/slp-widen-mult-half.c: Add novector pragma.
* gcc.dg/vect/slp-widen-mult-s16.c: Add novector pragma.
* gcc.dg/vect/slp-widen-mult-u8.c: Add novector pragma.
* gcc.dg/vect/vect-100.c: Add novector pragma.
* gcc.dg/vect/vect-103.c: Add novector pragma.
* gcc.dg/vect/vect-104.c: Add novector pragma.
* gcc.dg/vect/vect-105-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-105.c: Add novector pragma.
* gcc.dg/vect/vect-106.c: Add novector pragma.
* gcc.dg/vect/vect-107.c: Add novector pragma.
* gcc.dg/vect/vect-108.c: Add novector pragma.
* gcc.dg/vect/vect-109.c: Add novector pragma.
* gcc.dg/vect/vect-11.c: Add novector pragma.
* gcc.dg/vect/vect-110.c: Add novector pragma.
* gcc.dg/vect/vect-113.c: Add novector pragma.
* gcc.dg/vect/vect-114.c: Add novector pragma.
* gcc.dg/vect/vect-115.c: Add novector pragma.
* gcc.dg/vect/vect-116.c: Add novector pragma.
* gcc.dg/vect/vect-117.c: Add novector pragma.
* gcc.dg/vect/vect-11a.c: Add novector pragma.
* gcc.dg/vect/vect-12.c: Add novector pragma.
* gcc.dg/vect/vect-122.c: Add novector pragma.
* gcc.dg/vect/vect-124.c: Add novector pragma.
* gcc.dg/vect/vect-13.c: Add novector pragma.
* gcc.dg/vect/vect-14.c: Add novector pragma.
* gcc.dg/vect/vect-15-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-15.c: Add novector pragma.
* gcc.dg/vect/vect-17.c: Add novector pragma.
* gcc.dg/vect/vect-18.c: Add novector pragma.
* gcc.dg/vect/vect-19.c: Add novector pragma.
* gcc.dg/vect/vect-2-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-2.c: Add novector pragma.
* gcc.dg/vect/vect-20.c: Add novector pragma.
* gcc.dg/vect/vect-21.c: Add novector pragma.
* gcc.dg/vect/vect-22.c: Add novector pragma.
* gcc.dg/vect/vect-23.c: Add novector pragma.
* gcc.dg/vect/vect-24.c: Add novector pragma.
* gcc.dg/vect/vect-25.c: Add novector pragma.
* gcc.dg/vect/vect-26.c: Add novector pragma.
* gcc.dg/vect/vect-27.c: Add novector pragma.
* gcc.dg/vect/vect-28.c: Add novector pragma.
* gcc.dg/vect/vect-29.c: Add novector pragma.
* gcc.dg/vect/vect-3.c: Add novector pragma.
* gcc.dg/vect/vect-30.c: Add novector pragma.
* gcc.dg/vect/vect-31-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-31.c: Add novector pragma.
* gcc.dg/vect/vect-32-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-32.c: Add novector pragma.
* gcc.dg/vect/vect-33-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-33.c: Add novector pragma.
* gcc.dg/vect/vect-34-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-34.c: Add novector pragma.
* gcc.dg/vect/vect-35-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-35.c: Add novector pragma.
* gcc.dg/vect/vect-36-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-36.c: Add novector pragma.
* gcc.dg/vect/vect-38.c: Add novector pragma.
* gcc.dg/vect/vect-4.c: Add novector pragma.
* gcc.dg/vect/vect-40.c: Add novector pragma.
* gcc.dg/vect/vect-42.c: Add novector pragma.
* gcc.dg/vect/vect-44.c: Add novector pragma.
* gcc.dg/vect/vect-46.c: Add novector pragma.
* gcc.dg/vect/vect-48.c: Add novector pragma.
* gcc.dg/vect/vect-5.c: Add novector pragma.
* gcc.dg/vect/vect-50.c: Add novector pragma.
* gcc.dg/vect/vect-52.c: Add novector pragma.
* gcc.dg/vect/vect-54.c: Add novector pragma.
* gcc.dg/vect/vect-56.c: Add novector pragma.
* gcc.dg/vect/vect-58.c: Add novector pragma.
* gcc.dg/vect/vect-6-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-6.c: Add novector pragma.
* gcc.dg/vect/vect-60.c: Add novector pragma.
* gcc.dg/vect/vect-62.c: Add novector pragma.
* gcc.dg/vect/vect-63.c: Add novector pragma.
* gcc.dg/vect/vect-64.c: Add novector pragma.
* gcc.dg/vect/vect-65.c: Add novector pragma.
* gcc.dg/vect/vect-66.c: Add novector pragma.
* gcc.dg/vect/vect-67.c: Add novector pragma.
* gcc.dg/vect/vect-68.c: Add novector pragma.
* gcc.dg/vect/vect-7.c: Add novector pragma.
* gcc.dg/vect/vect-70.c: Add novector pragma.
* gcc.dg/vect/vect-71.c: Add novector pragma.
* gcc.dg/vect/vect-72.c: Add novector pragma.
* gcc.dg/vect/vect-73-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-73.c: Add novector pragma.
* gcc.dg/vect/vect-74-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-74.c: Add novector pragma.
* gcc.dg/vect/vect-75-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-75.c: Add novector pragma.
* gcc.dg/vect/vect-76-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-76.c: Add novector pragma.
* gcc.dg/vect/vect-77-alignchecks.c: Add novector pragma.
* gcc.dg/vect/vect-77-global.c: Add novector pragma.
* gcc.dg/vect/vect-77.c: Add novector pragma.
* gcc.dg/vect/vect-78-alignchecks.c: Add novector pragma.
* gcc.dg/vect/vect-78-global.c: Add novector pragma.
* gcc.dg/vect/vect-78.c: Add novector pragma.
* gcc.dg/vect/vect-8.c: Add novector pragma.
* gcc.dg/vect/vect-80-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-80.c: Add novector pragma.
* gcc.dg/vect/vect-82.c: Add novector pragma.
* gcc.dg/vect/vect-82_64.c: Add novector pragma.
* gcc.dg/vect/vect-83.c: Add novector pragma.
* gcc.dg/vect/vect-83_64.c: Add novector pragma.
* gcc.dg/vect/vect-85-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-85.c: Add novector pragma.
* gcc.dg/vect/vect-86.c: Add novector pragma.
* gcc.dg/vect/vect-87.c: Add novector pragma.
* gcc.dg/vect/vect-88.c: Add novector pragma.
* gcc.dg/vect/vect-89-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-89.c: Add novector pragma.
* gcc.dg/vect/vect-9.c: Add novector pragma.
* gcc.dg/vect/vect-92.c: Add novector pragma.
* gcc.dg/vect/vect-93.c: Add novector pragma.
* gcc.dg/vect/vect-95.c: Add novector pragma.
* gcc.dg/vect/vect-96.c: Add novector pragma.
* gcc.dg/vect/vect-97-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-97.c: Add novector pragma.
* gcc.dg/vect/vect-98-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-98.c: Add novector pragma.
* gcc.dg/vect/vect-99.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-10.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-11.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-12.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-14.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-15.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-16.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-18.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-19.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-20.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-8.c: Add novector pragma.
* gcc.dg/vect/vect-alias-check-9.c: Add novector pragma.
* gcc.dg/vect/vect-align-1.c: Add novector pragma.
* gcc.dg/vect/vect-align-2.c: Add novector pragma.
* gcc.dg/vect/vect-all-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-all.c: Add novector pragma.
* gcc.dg/vect/vect-avg-1.c: Add novector pragma.
* gcc.dg/vect/vect-avg-11.c: Add novector pragma.
* gcc.dg/vect/vect-avg-15.c: Add novector pragma.
* gcc.dg/vect/vect-avg-16.c: Add novector pragma.
* gcc.dg/vect/vect-avg-5.c: Add novector pragma.
* gcc.dg/vect/vect-bitfield-write-1.c: Add novector pragma.
* gcc.dg/vect/vect-bitfield-write-2.c: Add novector pragma.
* gcc.dg/vect/vect-bitfield-write-3.c: Add novector pragma.
* gcc.dg/vect/vect-bitfield-write-4.c: Add novector pragma.
* gcc.dg/vect/vect-bitfield-write-5.c: Add novector pragma.
* gcc.dg/vect/vect-bool-cmp.c: Add novector pragma.
* gcc.dg/vect/vect-bswap16.c: Add novector pragma.
* gcc.dg/vect/vect-bswap32.c: Add novector pragma.
* gcc.dg/vect/vect-bswap64.c: Add novector pragma.
* gcc.dg/vect/vect-complex-1.c: Add novector pragma.
* gcc.dg/vect/vect-complex-2.c: Add novector pragma.
* gcc.dg/vect/vect-complex-4.c: Add novector pragma.
* gcc.dg/vect/vect-cond-1.c: Add novector pragma.
* gcc.dg/vect/vect-cond-10.c: Add novector pragma.
* gcc.dg/vect/vect-cond-11.c: Add novector pragma.
* gcc.dg/vect/vect-cond-3.c: Add novector pragma.
* gcc.dg/vect/vect-cond-4.c: Add novector pragma.
* gcc.dg/vect/vect-cond-5.c: Add novector pragma.
* gcc.dg/vect/vect-cond-6.c: Add novector pragma.
* gcc.dg/vect/vect-cond-7.c: Add novector pragma.
* gcc.dg/vect/vect-cond-8.c: Add novector pragma.
* gcc.dg/vect/vect-cond-9.c: Add novector pragma.
* gcc.dg/vect/vect-cond-arith-1.c: Add novector pragma.
* gcc.dg/vect/vect-cond-arith-3.c: Add novector pragma.
* gcc.dg/vect/vect-cond-arith-4.c: Add novector pragma.
* gcc.dg/vect/vect-cond-arith-5.c: Add novector pragma.
* gcc.dg/vect/vect-cond-arith-6.c: Add novector pragma.
* gcc.dg/vect/vect-cond-arith-7.c: Add novector pragma.
* gcc.dg/vect/vect-cselim-1.c: Add novector pragma.
* gcc.dg/vect/vect-cselim-2.c: Add novector pragma.
* gcc.dg/vect/vect-div-bitmask-4.c: Add novector pragma.
* gcc.dg/vect/vect-div-bitmask-5.c: Add novector pragma.
* gcc.dg/vect/vect-div-bitmask.h: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-1.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-2.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-3.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-4.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-5.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-6-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-6.c: Add novector pragma.
* gcc.dg/vect/vect-double-reduc-7.c: Add novector pragma.
* gcc.dg/vect/vect-float-extend-1.c: Add novector pragma.
* gcc.dg/vect/vect-float-truncate-1.c: Add novector pragma.
* gcc.dg/vect/vect-floatint-conversion-1.c: Add novector pragma.
* gcc.dg/vect/vect-floatint-conversion-2.c: Add novector pragma.
* gcc.dg/vect/vect-fma-1.c: Add novector pragma.
* gcc.dg/vect/vect-gather-1.c: Add novector pragma.
* gcc.dg/vect/vect-gather-3.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-11.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-16.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-17.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-2.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-3.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-4.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-5.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-6.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-7.c: Add novector pragma.
* gcc.dg/vect/vect-ifcvt-9.c: Add novector pragma.
* gcc.dg/vect/vect-intfloat-conversion-1.c: Add novector pragma.
* gcc.dg/vect/vect-intfloat-conversion-2.c: Add novector pragma.
* gcc.dg/vect/vect-intfloat-conversion-3.c: Add novector pragma.
* gcc.dg/vect/vect-intfloat-conversion-4a.c: Add novector pragma.
* gcc.dg/vect/vect-intfloat-conversion-4b.c: Add novector pragma.
* gcc.dg/vect/vect-iv-1.c: Add novector pragma.
* gcc.dg/vect/vect-iv-10.c: Add novector pragma.
* gcc.dg/vect/vect-iv-2.c: Add novector pragma.
* gcc.dg/vect/vect-iv-3.c: Add novector pragma.
* gcc.dg/vect/vect-iv-4.c: Add novector pragma.
* gcc.dg/vect/vect-iv-5.c: Add novector pragma.
* gcc.dg/vect/vect-iv-6.c: Add novector pragma.
* gcc.dg/vect/vect-iv-7.c: Add novector pragma.
* gcc.dg/vect/vect-iv-8-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-iv-8.c: Add novector pragma.
* gcc.dg/vect/vect-iv-8a-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-iv-8a.c: Add novector pragma.
* gcc.dg/vect/vect-live-1.c: Add novector pragma.
* gcc.dg/vect/vect-live-2.c: Add novector pragma.
* gcc.dg/vect/vect-live-3.c: Add novector pragma.
* gcc.dg/vect/vect-live-4.c: Add novector pragma.
* gcc.dg/vect/vect-live-5.c: Add novector pragma.
* gcc.dg/vect/vect-live-slp-1.c: Add novector pragma.
* gcc.dg/vect/vect-live-slp-2.c: Add novector pragma.
* gcc.dg/vect/vect-live-slp-3.c: Add novector pragma.
* gcc.dg/vect/vect-mask-load-1.c: Add novector pragma.
* gcc.dg/vect/vect-mask-loadstore-1.c: Add novector pragma.
* gcc.dg/vect/vect-mulhrs-1.c: Add novector pragma.
* gcc.dg/vect/vect-mult-const-pattern-1.c: Add novector pragma.
* gcc.dg/vect/vect-mult-const-pattern-2.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-1.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-10.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-11.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-12.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-13.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-14.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-16.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-17.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-2.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-3.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-4.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-5.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-6.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-8.c: Add novector pragma.
* gcc.dg/vect/vect-multitypes-9.c: Add novector pragma.
* gcc.dg/vect/vect-nb-iter-ub-1.c: Add novector pragma.
* gcc.dg/vect/vect-nb-iter-ub-2.c: Add novector pragma.
* gcc.dg/vect/vect-nb-iter-ub-3.c: Add novector pragma.
* gcc.dg/vect/vect-neg-store-1.c: Add novector pragma.
* gcc.dg/vect/vect-neg-store-2.c: Add novector pragma.
* gcc.dg/vect/vect-nest-cycle-1.c: Add novector pragma.
* gcc.dg/vect/vect-nest-cycle-2.c: Add novector pragma.
* gcc.dg/vect/vect-nest-cycle-3.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2a-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2a.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2b.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2c-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2c.c: Add novector pragma.
* gcc.dg/vect/vect-outer-2d.c: Add novector pragma.
* gcc.dg/vect/vect-outer-3-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-3.c: Add novector pragma.
* gcc.dg/vect/vect-outer-3a-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-3a.c: Add novector pragma.
* gcc.dg/vect/vect-outer-3b.c: Add novector pragma.
* gcc.dg/vect/vect-outer-3c.c: Add novector pragma.
* gcc.dg/vect/vect-outer-4.c: Add novector pragma.
* gcc.dg/vect/vect-outer-4d-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-4d.c: Add novector pragma.
* gcc.dg/vect/vect-outer-5.c: Add novector pragma.
* gcc.dg/vect/vect-outer-6.c: Add novector pragma.
* gcc.dg/vect/vect-outer-fir-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-fir-lb-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-outer-fir-lb.c: Add novector pragma.
* gcc.dg/vect/vect-outer-fir.c: Add novector pragma.
* gcc.dg/vect/vect-outer-simd-1.c: Add novector pragma.
* gcc.dg/vect/vect-outer-simd-2.c: Add novector pragma.
* gcc.dg/vect/vect-outer-simd-3.c: Add novector pragma.
* gcc.dg/vect/vect-outer-slp-2.c: Add novector pragma.
* gcc.dg/vect/vect-outer-slp-3.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-1-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-1.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-11.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-13.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-15.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-17.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-18.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-19.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-2-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-2.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-20.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-21.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-22.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-3-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-3.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-4-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-4.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-5.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-7.c: Add novector pragma.
* gcc.dg/vect/vect-over-widen-9.c: Add novector pragma.
* gcc.dg/vect/vect-peel-1-src.c: Add novector pragma.
* gcc.dg/vect/vect-peel-2-src.c: Add novector pragma.
* gcc.dg/vect/vect-peel-4-src.c: Add novector pragma.
* gcc.dg/vect/vect-recurr-1.c: Add novector pragma.
* gcc.dg/vect/vect-recurr-2.c: Add novector pragma.
* gcc.dg/vect/vect-recurr-3.c: Add novector pragma.
* gcc.dg/vect/vect-recurr-4.c: Add novector pragma.
* gcc.dg/vect/vect-recurr-5.c: Add novector pragma.
* gcc.dg/vect/vect-recurr-6.c: Add novector pragma.
* gcc.dg/vect/vect-sdiv-pow2-1.c: Add novector pragma.
* gcc.dg/vect/vect-sdivmod-1.c: Add novector pragma.
* gcc.dg/vect/vect-shift-1.c: Add novector pragma.
* gcc.dg/vect/vect-shift-3.c: Add novector pragma.
* gcc.dg/vect/vect-shift-4.c: Add novector pragma.
* gcc.dg/vect/vect-simd-1.c: Add novector pragma.
* gcc.dg/vect/vect-simd-10.c: Add novector pragma.
* gcc.dg/vect/vect-simd-11.c: Add novector pragma.
* gcc.dg/vect/vect-simd-12.c: Add novector pragma.
* gcc.dg/vect/vect-simd-13.c: Add novector pragma.
* gcc.dg/vect/vect-simd-14.c: Add novector pragma.
* gcc.dg/vect/vect-simd-15.c: Add novector pragma.
* gcc.dg/vect/vect-simd-16.c: Add novector pragma.
* gcc.dg/vect/vect-simd-17.c: Add novector pragma.
* gcc.dg/vect/vect-simd-18.c: Add novector pragma.
* gcc.dg/vect/vect-simd-19.c: Add novector pragma.
* gcc.dg/vect/vect-simd-20.c: Add novector pragma.
* gcc.dg/vect/vect-simd-8.c: Add novector pragma.
* gcc.dg/vect/vect-simd-9.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-1.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-10.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-11.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-15.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-2.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-3.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-4.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-5.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-6.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-7.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-8.c: Add novector pragma.
* gcc.dg/vect/vect-simd-clone-9.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-mult.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u16-i2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u16-i4.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u16-mult.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u32-mult.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u8-i2-gap.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Add novector pragma.
* gcc.dg/vect/vect-strided-float.c: Add novector pragma.
* gcc.dg/vect/vect-strided-mult-char-ls.c: Add novector pragma.
* gcc.dg/vect/vect-strided-mult.c: Add novector pragma.
* gcc.dg/vect/vect-strided-same-dr.c: Add novector pragma.
* gcc.dg/vect/vect-strided-shift-1.c: Add novector pragma.
* gcc.dg/vect/vect-strided-store-a-u8-i2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-store-u16-i4.c: Add novector pragma.
* gcc.dg/vect/vect-strided-store-u32-i2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-store.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u16-i2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u16-i3.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u16-i4.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u32-i4.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u32-i8.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u32-mult.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i2-gap.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap2.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap4.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8-gap7.c: Add novector pragma.
* gcc.dg/vect/vect-strided-u8-i8.c: Add novector pragma.
* gcc.dg/vect/vect-vfa-01.c: Add novector pragma.
* gcc.dg/vect/vect-vfa-02.c: Add novector pragma.
* gcc.dg/vect/vect-vfa-03.c: Add novector pragma.
* gcc.dg/vect/vect-vfa-04.c: Add novector pragma.
* gcc.dg/vect/vect-vfa-slp.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-1.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-const-s16.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-const-u16.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-half-u8.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-half.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-s16.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-s8.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-u16.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-u8-s16-s32.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-u8-u32.c: Add novector pragma.
* gcc.dg/vect/vect-widen-mult-u8.c: Add novector pragma.
* gcc.dg/vect/vect-widen-shift-s16.c: Add novector pragma.
* gcc.dg/vect/vect-widen-shift-s8.c: Add novector pragma.
* gcc.dg/vect/vect-widen-shift-u16.c: Add novector pragma.
* gcc.dg/vect/vect-widen-shift-u8.c: Add novector pragma.
* gcc.dg/vect/wrapv-vect-7.c: Add novector pragma.

9 months agofrontend: Add novector C pragma
Tamar Christina [Fri, 4 Aug 2023 12:51:16 +0000 (13:51 +0100)] 
frontend: Add novector C pragma

FORTRAN currently has a pragma NOVECTOR for indicating that vectorization should
not be applied to a particular loop.

ICC/ICX also has such a pragma for C and C++ called #pragma novector.

As part of this patch series I need a way to easily turn off vectorization of
particular loops, particularly for testsuite reasons.

This patch proposes a #pragma GCC novector that does the same for C
as gfortan does for FORTRAN and what ICX/ICX does for C.

I added only some basic tests here, but the next patch in the series uses this
in the testsuite in about ~800 tests.

gcc/c-family/ChangeLog:

* c-pragma.h (enum pragma_kind): Add PRAGMA_NOVECTOR.
* c-pragma.cc (init_pragma): Use it.

gcc/c/ChangeLog:

* c-parser.cc (c_parser_while_statement, c_parser_do_statement,
c_parser_for_statement, c_parser_statement_after_labels,
c_parse_pragma_novector, c_parser_pragma): Wire through novector and
default to false.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-novector-pragma.c: New test.

9 months agofrontend: Add novector C++ pragma
Tamar Christina [Fri, 4 Aug 2023 12:50:53 +0000 (13:50 +0100)] 
frontend: Add novector C++ pragma

FORTRAN currently has a pragma NOVECTOR for indicating that vectorization should
not be applied to a particular loop.

ICC/ICX also has such a pragma for C and C++ called #pragma novector.

As part of this patch series I need a way to easily turn off vectorization of
particular loops, particularly for testsuite reasons.

This patch proposes a #pragma GCC novector that does the same for C++
as gfortan does for FORTRAN and what ICX/ICX does for C++.

I added only some basic tests here, but the next patch in the series uses this
in the testsuite in about ~800 tests.

gcc/cp/ChangeLog:

* cp-tree.h (RANGE_FOR_NOVECTOR): New.
(cp_convert_range_for, finish_while_stmt_cond, finish_do_stmt,
finish_for_cond): Add novector param.
* init.cc (build_vec_init): Default novector to false.
* method.cc (build_comparison_op): Likewise.
* parser.cc (cp_parser_statement): Likewise.
(cp_parser_for, cp_parser_c_for, cp_parser_range_for,
cp_convert_range_for, cp_parser_iteration_statement,
cp_parser_omp_for_loop, cp_parser_pragma): Support novector.
(cp_parser_pragma_novector): New.
* pt.cc (tsubst_expr): Likewise.
* semantics.cc (finish_while_stmt_cond, finish_do_stmt,
finish_for_cond): Likewise.

gcc/ChangeLog:

* doc/extend.texi: Document it.

gcc/testsuite/ChangeLog:

* g++.dg/vect/vect.exp (support vect- prefix).
* g++.dg/vect/vect-novector-pragma.cc: New test.

9 months agoAArch64: Undo vec_widen_<sur>shiftl optabs [PR106346]
Tamar Christina [Fri, 4 Aug 2023 12:49:23 +0000 (13:49 +0100)] 
AArch64: Undo vec_widen_<sur>shiftl optabs [PR106346]

In GCC 11 we implemented the vectorizer optab for widening left shifts,
however this optab is only supported for uniform shift constants.

At the moment GCC still has two loop vectorization strategy (classical loop and
SLP based loop vec) and the optab is implemented as a scalar pattern.

This means that when we apply it to a non-uniform constant inside a loop we only
find out during SLP build that the constants aren't uniform.  At this point it's
too late and we lose SLP entirely.

Over the years I've tried various options but none of it works well:

1. Dissolving patterns during SLP built (problematic, also dissolves them for
non-slp).
2. Optionally ignoring patterns for SLP build (problematic, ends up interfearing
with relevancy detection).
3. Relaxing contraint on SLP build to allow non-constant values and dissolving
them after SLP build using an SLP pattern.  (problematic, ends up breaking
shift reassociation).

As a result we've concluded that for now this pattern should just be removed
and formed during RTL.

The plan is to move this to an SLP only pattern once we remove classical loop
vectorization support from GCC, at which time we can also properly support SVE's
Top and Bottom variants.

This removes the optab and reworks the RTL to recognize both the vector variant
and the intrinsics variant.  Also just simplifies all these patterns.

gcc/ChangeLog:

PR target/106346
* config/aarch64/aarch64-simd.md (vec_widen_<sur>shiftl_lo_<mode>,
vec_widen_<sur>shiftl_hi_<mode>): Remove.
(aarch64_<sur>shll<mode>_internal): Renamed to...
(aarch64_<su>shll<mode>): .. This.
(aarch64_<sur>shll2<mode>_internal): Renamed to...
(aarch64_<su>shll2<mode>): .. This.
(aarch64_<sur>shll_n<mode>, aarch64_<sur>shll2_n<mode>): Re-use new
optabs.
* config/aarch64/constraints.md (D2, DL): New.
* config/aarch64/predicates.md (aarch64_simd_shll_imm_vec): New.

gcc/testsuite/ChangeLog:

PR target/106346
* gcc.target/aarch64/pr98772.c: Adjust assembly.
* gcc.target/aarch64/vect-widen-shift.c: New test.

9 months agogensupport: Don't segfault on empty attrs list
Tamar Christina [Fri, 4 Aug 2023 12:48:56 +0000 (13:48 +0100)] 
gensupport: Don't segfault on empty attrs list

Currently we segfault when len == 0 for an attribute list.

essentially [cons: =0, 1, 2, 3; attrs: ] segfaults but should be equivalent to
[cons: =0, 1, 2, 3] and [cons: =0, 1, 2, 3; attrs:].  This fixes it by just
returning early and leaving it to the validators whether this should error out
or not.

gcc/ChangeLog:

* gensupport.cc (conlist): Support length 0 attribute.

9 months agoAArch64: update costing for combining vector conditionals
Tamar Christina [Fri, 4 Aug 2023 12:48:35 +0000 (13:48 +0100)] 
AArch64: update costing for combining vector conditionals

boolean comparisons have different cost depending on the mode. e.g.
for SVE, a && b doesn't require an additional instruction when a or b
is predicated by combining the predicate of the one operation into the
second one.  At the moment though we only fuse compares so this update
requires one of the operands to be a comparison.

Scalars also don't require this because the non-ifcvt variant is a series of
branches where following the branch sequences themselves are natural ANDs.

Advanced SIMD however does require an actual AND to combine the boolean values.

As such this patch discounts Scalar and SVE boolean operation latency and
throughput.

With this patch comparison heavy code prefers SVE as it should, especially in
cases with SVE VL == Advanced SIMD VL where previously the SVE prologue costs
would tip it towards Advanced SIMD.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_bool_compound_p): New.
(aarch64_adjust_stmt_cost, aarch64_vector_costs::count_ops): Use it.

9 months agoAArch64: update costing for MLA by invariant
Tamar Christina [Fri, 4 Aug 2023 12:46:36 +0000 (13:46 +0100)] 
AArch64: update costing for MLA by invariant

When determining issue rates we currently discount non-constant MLA accumulators
for Advanced SIMD but don't do it for the latency.

This means the costs for Advanced SIMD with a constant accumulator are wrong and
results in us costing SVE and Advanced SIMD the same.  This can cauze us to
vectorize with Advanced SIMD instead of SVE in some cases.

This patch adds the same discount for SVE and Scalar as we do for issue rate.

This gives a 5% improvement in fotonik3d_r in SPECCPU 2017 on large
Neoverse cores.

gcc/ChangeLog:

* config/aarch64/aarch64.cc (aarch64_multiply_add_p): Update handling
of constants.
(aarch64_adjust_stmt_cost): Use it.
(aarch64_vector_costs::count_ops): Likewise.
(aarch64_vector_costs::add_stmt_cost): Pass vinfo to
aarch64_adjust_stmt_cost.

9 months agotree-optimization/110838 - vectorization of widened right shifts
Richard Biener [Fri, 4 Aug 2023 10:11:45 +0000 (12:11 +0200)] 
tree-optimization/110838 - vectorization of widened right shifts

The following fixes a problem with my last attempt of avoiding
out-of-bound shift values for vectorized right shifts of widened
operands.  Instead of truncating the shift amount with a bitwise
and we actually need to saturate it to the target precision.

The following does that and adds test coverage for the constant
and invariant but variable case that would previously have failed.

PR tree-optimization/110838
* tree-vect-patterns.cc (vect_recog_over_widening_pattern):
Fix right-shift value sanitizing.  Properly emit external
def mangling in the preheader rather than in the pattern
def sequence where it will fail vectorizing.

* gcc.dg/vect/pr110838.c: New testcase.

9 months agomid-end: Use integral time intervals in timevar.cc
Matthew Malcomson [Fri, 4 Aug 2023 10:26:47 +0000 (11:26 +0100)] 
mid-end: Use integral time intervals in timevar.cc

On some AArch64 bootstrapped builds, we were getting a flaky test
because the floating point operations in `get_time` were being fused
with the floating point operations in `timevar_accumulate`.

This meant that the rounding behaviour of our multiplication with
`ticks_to_msec` was different when used in `timer::start` and when
performed in `timer::stop`.  These extra inaccuracies led to the
testcase `g++.dg/ext/timevar1.C` being flaky on some hardware.

------------------------------
Avoiding the inlining which was agreed to be undesirable.  Three
alternative approaches:
1) Use `-ffp-contract=on` to avoid this particular optimisation.
2) Adjusting the code so that the "tolerance" is always of the order of
   a "tick".
3) Recording times and elapsed differences in integral values.
   - Could be in terms of a standard measurement (e.g. nanoseconds or
     microseconds).
   - Could be in terms of whatever integral value ("ticks" /
     seconds&microseconds / "clock ticks") is returned from the syscall
     chosen at configure time.

While `-ffp-contract=on` removes the problem that I bumped into, there
has been a similar bug on x86 that was to do with a different floating
point problem that also happens after `get_time` and
`timevar_accumulate` both being inlined into the same function.  Hence
it seems worth choosing a different approach.

Of the two other solutions, recording measurements in integral values
seems the most robust against slightly "off" measurements being
presented to the user -- even though it could avoid the ICE that creates
a flaky test.

I considered storing time in whatever units our syscall returns and
normalising them at the time we print out rather than normalising them
to nanoseconds at the point we record our "current time".  The logic
being that normalisation could have some rounding affect (e.g. if
TICKS_PER_SECOND is 3) that would be taken into account in calculations.

I decided against it in order to give the values recorded in
`timevar_time_def` some interpretive value so it's easier to read the
code.  Compared to the small rounding that would represent a tiny amount
of time and AIUI can not trigger the same kind of ICE's as we are
attempting to fix, said interpretive value seems more valuable.

Recording time in microseconds seemed reasonable since all obvious
values for ticks and `getrusage` are at microsecond granularity or less
precise.  That said, since TICKS_PER_SECOND and CLOCKS_PER_SEC are both
variables given to use by the host system I was not sure of that enough
to make this decision.

------------------------------
timer::all_zero is ignoring rows which are inconsequential to the user
and would be printed out as all zeros.  Since upon printing rows we
convert to the same double value and print out the same precision as
before, we return true/false based on the same amount of time as before.

timer::print_row casts to a floating point measurement in units of
seconds as was printed out before.

timer::validate_phases -- I'm printing out nanoseconds here rather than
floating point seconds since this is an error message for when things
have "gone wrong" printing out the actual nanoseconds that have been
recorded seems like the best approach.
N.b. since we now print out nanoseconds instead of floating point value
the padding requirements are different.  Originally we were padding to
24 characters and printing 18 decimal places.  This looked odd with the
now visually smaller values getting printed.  I judged 13 characters
(corresponding to 2 hours) to be a reasonable point at which our
alignment could start to degrade and this provides a more compact output
for the majority of cases (checked by triggering the error case via
GDB).

------------------------------
N.b. I use a literal 1000000000 for "NANOSEC_PER_SEC".  I believe this
would fit in an integer on all hosts that GCC supports, but am not
certain there are not strange integer sizes we support hence am pointing
it out for special attention during review.

------------------------------
No expected change in generated code.
Bootstrapped and regtested on AArch64 with no regressions.

Hope this is acceptable -- I had originally planned to use
`-ffp-contract` as agreed until I saw mention of the old x86 bug in the
same area which was not to do with floating point contraction of
operations (PR 99903).

gcc/ChangeLog:

PR middle-end/110316
PR middle-end/9903
* timevar.cc (NANOSEC_PER_SEC, TICKS_TO_NANOSEC,
CLOCKS_TO_NANOSEC, nanosec_to_floating_sec, percent_of): New.
(TICKS_TO_MSEC, CLOCKS_TO_MSEC): Remove these macros.
(timer::validate_phases): Use integral arithmetic to check
validity.
(timer::print_row, timer::print): Convert from integral
nanoseconds to floating point seconds before printing.
(timer::all_zero): Change limit to nanosec count instead of
fractional count of seconds.
(make_json_for_timevar_time_def): Convert from integral
nanoseconds to floating point seconds before recording.
* timevar.h (struct timevar_time_def): Update all measurements
to use uint64_t nanoseconds rather than seconds stored in a
double.

9 months agotree-optimization/110838 - less aggressively fold out-of-bound shifts
Richard Biener [Fri, 4 Aug 2023 09:24:49 +0000 (11:24 +0200)] 
tree-optimization/110838 - less aggressively fold out-of-bound shifts

The following adjusts the shift simplification patterns to avoid
touching out-of-bound shift value arithmetic right shifts of
possibly negative values.  While simplifying those to zero isn't
wrong it's violating the principle of least surprise.

PR tree-optimization/110838
* match.pd (([rl]shift @0 out-of-bounds) -> zero): Restrict
the arithmetic right-shift case to non-negative operands.

9 months agoRevert "RISC-V: Support RVV VFMACC rounding mode intrinsic API"
Pan Li [Fri, 4 Aug 2023 09:11:26 +0000 (17:11 +0800)] 
Revert "RISC-V: Support RVV VFMACC rounding mode intrinsic API"

This reverts commit 51e5a5cefb11d8a7b2216e866abcc225ba16d127.

9 months agoRevert "RISC-V: Support RVV VFNMACC rounding mode intrinsic API"
Pan Li [Fri, 4 Aug 2023 09:11:12 +0000 (17:11 +0800)] 
Revert "RISC-V: Support RVV VFNMACC rounding mode intrinsic API"

This reverts commit 62d9c1dd8eb1152d8fbe0e1df101b99c9141417a.

9 months agoRevert "RISC-V: Support RVV VFMSAC rounding mode intrinsic API"
Pan Li [Fri, 4 Aug 2023 09:10:49 +0000 (17:10 +0800)] 
Revert "RISC-V: Support RVV VFMSAC rounding mode intrinsic API"

This reverts commit dccd7e8a7215f3f2e295e11b20680d3add08cd7e.

9 months agoRevert "RISC-V: Support RVV VFNMSAC rounding mode intrinsic API"
Pan Li [Fri, 4 Aug 2023 09:10:29 +0000 (17:10 +0800)] 
Revert "RISC-V: Support RVV VFNMSAC rounding mode intrinsic API"

This reverts commit 236ec7aac051a062dc961b3c1482925893ee6e21.

9 months agoAVR: Add some more devices: AVR16DD*, AVR32DD*, AVR64DD*, AVR64EA*, ATtiny42*, ATtiny...
Georg-Johann Lay [Fri, 4 Aug 2023 08:24:39 +0000 (10:24 +0200)] 
AVR: Add some more devices: AVR16DD*, AVR32DD*, AVR64DD*, AVR64EA*, ATtiny42*, ATtiny82*, ATtiny162*, ATtiny322*, ATtiny10*.

gcc/
* config/avr/avr-mcus.def (avr64dd14, avr64dd20, avr64dd28, avr64dd32)
(avr64ea28, avr64ea32, avr64ea48, attiny424, attiny426, attiny427)
(attiny824, attiny826, attiny827, attiny1624, attiny1626, attiny1627)
(attiny3224, attiny3226, attiny3227, avr16dd14, avr16dd20, avr16dd28)
(avr16dd32, avr32dd14, avr32dd20, avr32dd28, avr32dd32)
(attiny102, attiny104): New devices.
* doc/avr-mmcu.texi: Regenerate.

9 months agoFix some minor typos in avr-mcus.def.
Georg-Johann Lay [Fri, 4 Aug 2023 07:51:11 +0000 (09:51 +0200)] 
Fix some minor typos in avr-mcus.def.

gcc/
* config/avr/avr-mcus.def (avr128d*, avr64d*): Fix their FLASH_SIZE
and PM_OFFSET entries.

9 months agoFix PR 110874: infinite loop in gimple_bitwise_inverted_equal_p with fre
Andrew Pinski [Wed, 2 Aug 2023 21:49:00 +0000 (14:49 -0700)] 
Fix PR 110874: infinite loop in gimple_bitwise_inverted_equal_p with fre

This changes gimple_bitwise_inverted_equal_p to use a 2 different match patterns
to try to match bit_not wrapped with a possible nop_convert and a comparison
also wrapped with a possible nop_convert. This is to avoid being recursive.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

PR tree-optimization/110874
* gimple-match-head.cc (gimple_bit_not_with_nop): New declaration.
(gimple_maybe_cmp): Likewise.
(gimple_bitwise_inverted_equal_p): Rewrite to use gimple_bit_not_with_nop
and gimple_maybe_cmp instead of being recursive.
* match.pd (bit_not_with_nop): New match pattern.
(maybe_cmp): Likewise.

gcc/testsuite/ChangeLog:

PR tree-optimization/110874
* gcc.c-torture/compile/pr110874-a.c: New test.

9 months agomatch.pd: Canonicalize (signed x << c) >> c [PR101955]
Drew Ross [Fri, 4 Aug 2023 07:08:05 +0000 (09:08 +0200)] 
match.pd: Canonicalize (signed x << c) >> c [PR101955]

Canonicalizes (signed x << c) >> c into the lowest
precision(type) - c bits of x IF those bits have a mode precision or a
precision of 1. Also combines this rule with (unsigned x << c) >> c -> x &
((unsigned)-1 >> c) to prevent duplicate pattern.

PR middle-end/101955
* match.pd ((signed x << c) >> c): New canonicalization.

* gcc.dg/pr101955.c: New test.

9 months agoRISC-V: Support RVV VFNMSAC rounding mode intrinsic API
Pan Li [Fri, 4 Aug 2023 03:25:13 +0000 (11:25 +0800)] 
RISC-V: Support RVV VFNMSAC rounding mode intrinsic API

This patch would like to support the rounding mode API for the
VFNMSAC for the below samples.

* __riscv_vfnmsac_vv_f32m1_rm
* __riscv_vfnmsac_vv_f32m1_rm_m
* __riscv_vfnmsac_vf_f32m1_rm
* __riscv_vfnmsac_vf_f32m1_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(class vfnmsac_frm): New class for vfnmsac frm.
(vfnmsac_frm_obj): New declaration.
(BASE): Ditto.
* config/riscv/riscv-vector-builtins-bases.h: Ditto.
* config/riscv/riscv-vector-builtins-functions.def
(vfnmsac_frm): New function definition.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-single-negate-multiply-sub.c:
New test.

9 months agoRISC-V: Support RVV VFMSAC rounding mode intrinsic API
Pan Li [Fri, 4 Aug 2023 02:55:09 +0000 (10:55 +0800)] 
RISC-V: Support RVV VFMSAC rounding mode intrinsic API

This patch would like to support the rounding mode API for the
VFMSAC for the below samples.

* __riscv_vfmsac_vv_f32m1_rm
* __riscv_vfmsac_vv_f32m1_rm_m
* __riscv_vfmsac_vf_f32m1_rm
* __riscv_vfmsac_vf_f32m1_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(class vfmsac_frm): New class for vfmsac frm.
(vfmsac_frm_obj): New declaration.
(BASE): Ditto.
* config/riscv/riscv-vector-builtins-bases.h: Ditto.
* config/riscv/riscv-vector-builtins-functions.def
(vfmsac_frm): New function definition.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-single-multiply-sub.c: New test.

9 months agoRISC-V: Support RVV VFNMACC rounding mode intrinsic API
Pan Li [Fri, 4 Aug 2023 02:17:35 +0000 (10:17 +0800)] 
RISC-V: Support RVV VFNMACC rounding mode intrinsic API

This patch would like to support the rounding mode API for the
VFNMACC for the below samples.

* __riscv_vfnmacc_vv_f32m1_rm
* __riscv_vfnmacc_vv_f32m1_rm_m
* __riscv_vfnmacc_vf_f32m1_rm
* __riscv_vfnmacc_vf_f32m1_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(class vfnmacc_frm): New class for vfnmacc.
(vfnmacc_frm_obj): New declaration.
(BASE): Ditto.
* config/riscv/riscv-vector-builtins-bases.h: Ditto.
* config/riscv/riscv-vector-builtins-functions.def
(vfnmacc_frm): New function definition.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-single-negate-multiply-add.c:
New test.

9 months agoAArch64: Avoid the ICE on empty reduction definition in info_for_reduction [PR110625]
Hao Liu [Fri, 4 Aug 2023 02:32:52 +0000 (10:32 +0800)] 
AArch64: Avoid the ICE on empty reduction definition in info_for_reduction [PR110625]

Fix the assertion failure on empty reduction define in info_for_reduction.
Even a stmt is live, it may still have empty reduction define.  Check the
reduction definition instead of live info before calling info_for_reduction.

gcc/ChangeLog:

PR target/110625
* config/aarch64/aarch64.cc (aarch64_force_single_cycle): check
STMT_VINFO_REDUC_DEF to avoid failures in info_for_reduction.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr110625_3.c: New testcase.

9 months agoRISC-V: Support RVV VFMACC rounding mode intrinsic API
Pan Li [Thu, 3 Aug 2023 14:32:58 +0000 (22:32 +0800)] 
RISC-V: Support RVV VFMACC rounding mode intrinsic API

This patch would like to support the rounding mode API for the
VFMACC for the below samples.

* __riscv_vfmacc_vv_f32m1_rm
* __riscv_vfmacc_vv_f32m1_rm_m
* __riscv_vfmacc_vf_f32m1_rm
* __riscv_vfmacc_vf_f32m1_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(class vfmacc_frm): New class for vfmacc frm.
(vfmacc_frm_obj): New declaration.
(BASE): Ditto.
* config/riscv/riscv-vector-builtins-bases.h: Ditto.
* config/riscv/riscv-vector-builtins-functions.def
(vfmacc_frm): New function definition.
* config/riscv/riscv-vector-builtins.cc
(function_expander::use_ternop_insn): Add frm operand support.
* config/riscv/vector.md: Add vfmuladd to frm_mode.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-single-multiply-add.c: New test.

9 months agoRISC-V: Support RVV VFWMUL rounding mode intrinsic API
Pan Li [Thu, 3 Aug 2023 05:18:30 +0000 (13:18 +0800)] 
RISC-V: Support RVV VFWMUL rounding mode intrinsic API

This patch would like to support the rounding mode API for the
VFWMUL for the below samples.

* __riscv_vfwmul_vv_f64m2_rm
* __riscv_vfwmul_vv_f64m2_rm_m
* __riscv_vfwmul_vf_f64m2_rm
* __riscv_vfwmul_vf_f64m2_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(vfwmul_frm_obj): New declaration.
(vfwmul_frm): Ditto.
* config/riscv/riscv-vector-builtins-bases.h:
(vfwmul_frm): Ditto.
* config/riscv/riscv-vector-builtins-functions.def
(vfwmul_frm): New function definition.
* config/riscv/vector.md: (frm_mode) Add vfwmul to frm_mode.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-widening-mul.c: New test.

9 months agoRISC-V: Support RVV VFDIV and VFRDIV rounding mode intrinsic API
Pan Li [Thu, 3 Aug 2023 03:11:17 +0000 (11:11 +0800)] 
RISC-V: Support RVV VFDIV and VFRDIV rounding mode intrinsic API

This patch would like to support the rounding mode API for the
VFDIV and VFRDIV for the below samples.

* __riscv_vfdiv_vv_f32m1_rm
* __riscv_vfdiv_vv_f32m1_rm_m
* __riscv_vfdiv_vf_f32m1_rm
* __riscv_vfdiv_vf_f32m1_rm_m
* __riscv_vfrdiv_vf_f32m1_rm
* __riscv_vfrdiv_vf_f32m1_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(binop_frm): New declaration.
(reverse_binop_frm): Likewise.
(BASE): Likewise.
* config/riscv/riscv-vector-builtins-bases.h:
(vfdiv_frm): New extern declaration.
(vfrdiv_frm): Likewise.
* config/riscv/riscv-vector-builtins-functions.def
(vfdiv_frm): New function definition.
(vfrdiv_frm): Likewise.
* config/riscv/vector.md: Add vfdiv to frm_mode.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-single-div.c: New test.
* gcc.target/riscv/rvv/base/float-point-single-rdiv.c: New test.

9 months agoDaily bump.
GCC Administrator [Fri, 4 Aug 2023 00:17:17 +0000 (00:17 +0000)] 
Daily bump.

9 months agoPrint entry count in print_loop_info
Jan Hubicka [Thu, 3 Aug 2023 20:49:22 +0000 (22:49 +0200)] 
Print entry count in print_loop_info

gcc/ChangeLog:

* tree-cfg.cc (print_loop_info): Print entry count.

9 months agoUpdate loop iteration estimates after splitting
Jan Hubicka [Thu, 3 Aug 2023 20:47:55 +0000 (22:47 +0200)] 
Update loop iteration estimates after splitting

Hmmer's internal function has 4 loops.  The following is the profile at start:

  loop 1:
  estimate 472
  iterations by profile: 473.497707 (reliable) count in:84821 (precise, freq 0.9979)

    loop 2:
    estimate 99
    iterations by profile: 100.000000 (reliable) count in:39848881 (precise, freq 468.8104)

    loop 3:
    estimate 99
    iterations by profile: 100.000000 (reliable) count in:39848881 (precise, freq 468.8104)

  loop 4:
  estimate 100
  iterations by profile: 100.999596 (reliable) execution count:84167 (precise, freq 0.9902)

So the first loops is outer loop and second/third loops are nesed. Fourth loop is not critical.
Precise iteraiton counts are unknown (473 and 100 comes from profile)
Nested loop has following form:

    for (k = 1; k <= M; k++) {
      mc[k] = mpp[k-1]   + tpmm[k-1];
      if ((sc = ip[k-1]  + tpim[k-1]) > mc[k])  mc[k] = sc;
      if ((sc = dpp[k-1] + tpdm[k-1]) > mc[k])  mc[k] = sc;
      if ((sc = xmb  + bp[k])         > mc[k])  mc[k] = sc;
      mc[k] += ms[k];
      if (mc[k] < -INFTY) mc[k] = -INFTY;

      dc[k] = dc[k-1] + tpdd[k-1];
      if ((sc = mc[k-1] + tpmd[k-1]) > dc[k]) dc[k] = sc;
      if (dc[k] < -INFTY) dc[k] = -INFTY;

      if (k < M) {
        ic[k] = mpp[k] + tpmi[k];
        if ((sc = ip[k] + tpii[k]) > ic[k]) ic[k] = sc;
        ic[k] += is[k];
        if (ic[k] < -INFTY) ic[k] = -INFTY;
      }

We do quite some belly dancing here.
 1) loop-ch slightly misupdates profile, so the estimates of 99
    does not match profile setimate of 100.
 2) loops-split splits on if (k < M) and produces two loops.
    It fails to notice that the second loop never iterates.
    It used to misupdate profile a lot which later caused internal
    loop to become cold.  This is fixed now.
 3) loop-dist introduces runtime aliasing checks for both loops
 4) tree vectorizer vectorizes some of the copies of the loop produces
    and drops expected iteration counts
 5) loop peeling peels the loops with expected low iteration counts
 6) complete loop unrolling kills some loops in prologues/epilogues.

We end up with quite many loops and run out of registers:

  iterations by profile: 5.312499 (unreliable, maybe flat)
    this is vectorized internal loops after loop peeling

  iterations by profile: 0.009495 (unreliable, maybe flat)
  iterations by profile: 0.009495 (unreliable, maybe flat)
  iterations by profile: 0.009495 (unreliable, maybe flat)
  iterations by profile: 0.009495 (unreliable, maybe flat)
    Those are all versioned/peeled and vectorized variants of the loop never looping

  iterations by profile: 100.000008 (unreliable)
  iterations by profile: 100.000000 (unreliable)
    Those are variants with failed aliasing checks

  iterations by profile: 9.662853 (unreliable, maybe flat)
  iterations by profile: 4.646072 (unreliable)
  iterations by profile: 100.000007 (unreliable)
  iterations by profile: 5.312500 (unreliable)
  iterations by profile: 473.497707 (reliable)
    This is loop 1

  iterations by profile: 100.999596 (reliable)
    This is the loop 4.

This patch fixes loop iteration estimate update after loop split so we get:

  iterations by profile: 5.312499 (unreliable, maybe flat) entry count:12742188 (guessed, freq 149.9081)
    This is remainder of the peeled vectorized loop 2.  It misses estimate that is correct since after peeling it 6 times it is essentially
    impossible to tell what the remaining loop profile is (without histograms)

  iterations by profile: 0.009496 (unreliable, maybe flat) entry count:374801 (guessed, freq 4.4094)
    Peeled split part of loop 2 (one that never loops).  We ought to work this out
    but at least w

  estimate 99
  iterations by profile: 100.000008 (unreliable) entry count:3945039 (guessed, freq 46.4122)
  estimate 99
  iterations by profile: 100.000000 (unreliable) entry count:35505353 (guessed, freq 417.7100)

  estimate 99
  iterations by profile: 9.662853 (unreliable, maybe flat) entry count:35505353 (guessed, freq 417.7100)
    Profile here mismatches estimate - I will need to work out why.

  estimate 5
  iterations by profile: 4.646072 (unreliable) entry count:31954818 (guessed, freq 375.9390)
    This is vectorized but not peeled loop 3
  estimate 99
  iterations by profile: 100.000007 (unreliable) entry count:7101070 (guessed, freq 83.5420)
    Unvectorized variant of loop 3
  estimate 5
  iterations by profile: 5.312500 (unreliable) entry count:25563855 (guessed, freq 300.7512)
    Another vectorized variant of loop 3
  estimate 472
  iterations by profile: 473.497707 (reliable) entry count:84821 (precise, freq 0.9979)
    Outer loop

  estimate 100
  iterations by profile: 100.999596 (reliable) entry count:84167 (precise, freq 0.9902)
    loop 4, not vectorized/peeled

So there is still work to do on this testcase, but with the patch we prevent 3 useless loops.

Bootstrapped/regtested x86_64-linux, plan to commit it later today.

gcc/ChangeLog:

* tree-ssa-loop-split.cc (split_loop): Update estimated iteration counts.

9 months agoFix profiledbootstrap
Jan Hubicka [Thu, 3 Aug 2023 20:42:27 +0000 (22:42 +0200)] 
Fix profiledbootstrap

Profiledbootstrap fails with ICE in update_loop_exit_probability_scale_dom_bbs
called from loop unroling.
The reason is that under relatively rare situations, we may run into case where
loop has multiple exits and all are considered as likely but then we scale down
the profile and one of the exits becomes unlikely.

We pass around unadjusted_exit_count to scale exit probability correctly.  In this
case we may end up using uninitialized value and profile-count type intentionally
bombs on that.

gcc/ChangeLog:

PR bootstrap/110857
* cfgloopmanip.cc (scale_loop_profile): (Un)initialize
unadjusted_exit_count.

9 months agoRead global value/mask in IPA.
Aldy Hernandez [Fri, 14 Jul 2023 10:38:16 +0000 (12:38 +0200)] 
Read global value/mask in IPA.

Instead of reading the known zero bits in IPA, read the value/mask
pair which is available.

There is a slight change of behavior here.  I have removed the check
for SSA_NAME, as the ranger can calculate the range and value/mask for
INTEGER_CST.  This simplifies the code a bit, since there's no special
casing when setting the jfunc bits.  The default range for VR is
undefined, so I think it's safe just to check for undefined_p().

gcc/ChangeLog:

* ipa-prop.cc (ipa_compute_jump_functions_for_edge): Read global
value/mask.

gcc/testsuite/ChangeLog:

* g++.dg/ipa/pure-const-3.C: Move source to...
* g++.dg/ipa/pure-const-3.h: ...here, and adjust original test
accordingly.
* g++.dg/ipa/pure-const-3b.C: New.

9 months ago[PATCH 3/5] [RISC-V] Generate Zicond instruction for select pattern with condition...
Xiao Zeng [Thu, 3 Aug 2023 20:09:46 +0000 (16:09 -0400)] 
[PATCH 3/5] [RISC-V] Generate Zicond instruction for select pattern with condition eq or neq to 0

[ This is a partial commit.  So not all the cases mentioned by
  Xiao are currently handled. ]

This patch recognizes Zicond patterns when the select pattern
with condition eq or neq to 0 (using eq as an example), namely:

1 rd = (rs2 == 0) ? non-imm : 0
2 rd = (rs2 == 0) ? non-imm : non-imm
3 rd = (rs2 == 0) ? reg : non-imm
4 rd = (rs2 == 0) ? reg : reg

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_expand_conditional_move): Recognize
various Zicond patterns.
* config/riscv/riscv.md (mov<mode>cc): Allow TARGET_ZICOND.  Use
sfb_alu_operand for both arms of the conditional move.

Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
9 months agobpf: CO-RE builtins support tests.
Cupertino Miranda [Thu, 27 Jul 2023 17:05:22 +0000 (18:05 +0100)] 
bpf: CO-RE builtins support tests.

This patch adds tests for the following builtins:
  __builtin_preserve_enum_value
  __builtin_btf_type_id
  __builtin_preserve_type_info

gcc/testsuite/ChangeLog:

* gcc.target/bpf/core-builtin-enumvalue.c: New test.
* gcc.target/bpf/core-builtin-enumvalue-errors.c: New test.
* gcc.target/bpf/core-builtin-enumvalue-opt.c: New test.
* gcc.target/bpf/core-builtin-fieldinfo-const-elimination.c: New test.
* gcc.target/bpf/core-builtin-fieldinfo-errors-1.c: Changed.
* gcc.target/bpf/core-builtin-fieldinfo-errors-2.c: Changed.
* gcc.target/bpf/core-builtin-type-based.c: New test.
* gcc.target/bpf/core-builtin-type-id.c: New test.
* gcc.target/bpf/core-support.h: New test.

9 months agobpf: Implementation of BPF CO-RE builtins
Cupertino Miranda [Thu, 6 Apr 2023 14:22:48 +0000 (15:22 +0100)] 
bpf: Implementation of BPF CO-RE builtins

This patch updates the support for the BPF CO-RE builtins
__builtin_preserve_access_index and __builtin_preserve_field_info,
and adds support for the CO-RE builtins __builtin_btf_type_id,
__builtin_preserve_type_info and __builtin_preserve_enum_value.

These CO-RE relocations are now converted to __builtin_core_reloc which
abstracts all of the original builtins in a polymorphic relocation
specific builtin.

The builtin processing is now split in 2 stages, the first (pack) is
executed right after the front-end and the second (process) right before
the asm output.

In expand pass the __builtin_core_reloc is converted to a
unspec:UNSPEC_CORE_RELOC rtx entry.

The data required to process the builtin is now collected in the packing
stage (after front-end), not allowing the compiler to optimize any of
the relevant information required to compose the relocation when
necessary.
At expansion, that information is recovered and CTF/BTF is queried to
construct the information that will be used in the relocation.
At this point the relocation is added to specific section and the
builtin is expanded to the expected default value for the builtin.

In order to process __builtin_preserve_enum_value, it was necessary to
hook the front-end to collect the original enum value reference.
This is needed since the parser folds all the enum values to its
integer_cst representation.

More details can be found within the core-builtins.cc.

Regtested in host x86_64-linux-gnu and target bpf-unknown-none.

gcc/ChangeLog:

PR target/107844
PR target/107479
PR target/107480
PR target/107481
* config.gcc: Added core-builtins.cc and .o files.
* config/bpf/bpf-passes.def: Removed file.
* config/bpf/bpf-protos.h (bpf_add_core_reloc,
bpf_replace_core_move_operands): New prototypes.
* config/bpf/bpf.cc (enum bpf_builtins, is_attr_preserve_access,
maybe_make_core_relo, bpf_core_field_info, bpf_core_compute,
bpf_core_get_index, bpf_core_new_decl, bpf_core_walk,
bpf_is_valid_preserve_field_info_arg, is_attr_preserve_access,
handle_attr_preserve, pass_data_bpf_core_attr, pass_bpf_core_attr):
Removed.
(def_builtin, bpf_expand_builtin, bpf_resolve_overloaded_builtin): Changed.
* config/bpf/bpf.md (define_expand mov<MM:mode>): Changed.
(mov_reloc_core<mode>): Added.
* config/bpf/core-builtins.cc (struct cr_builtin, enum
cr_decision struct cr_local, struct cr_final, struct
core_builtin_helpers, enum bpf_plugin_states): Added types.
(builtins_data, core_builtin_helpers, core_builtin_type_defs):
Added variables.
(allocate_builtin_data, get_builtin-data, search_builtin_data,
remove_parser_plugin, compare_same_kind, compare_same_ptr_expr,
compare_same_ptr_type, is_attr_preserve_access, core_field_info,
bpf_core_get_index, compute_field_expr,
pack_field_expr_for_access_index, pack_field_expr_for_preserve_field,
process_field_expr, pack_enum_value, process_enum_value, pack_type,
process_type, bpf_require_core_support, make_core_relo, read_kind,
kind_access_index, kind_preserve_field_info, kind_enum_value,
kind_type_id, kind_preserve_type_info, get_core_builtin_fndecl_for_type,
bpf_handle_plugin_finish_type, bpf_init_core_builtins,
construct_builtin_core_reloc, bpf_resolve_overloaded_core_builtin,
bpf_expand_core_builtin, bpf_add_core_reloc,
bpf_replace_core_move_operands): Added functions.
* config/bpf/core-builtins.h (enum bpf_builtins): Added.
(bpf_init_core_builtins, bpf_expand_core_builtin,
bpf_resolve_overloaded_core_builtin): Added functions.
* config/bpf/coreout.cc (struct bpf_core_extra): Added.
(bpf_core_reloc_add, output_asm_btfext_core_reloc): Changed.
* config/bpf/coreout.h (bpf_core_reloc_add) Changed prototype.
* config/bpf/t-bpf: Added core-builtins.o.
* doc/extend.texi: Added documentation for new BPF builtins.

9 months agoAdd operand ranges to op1_op2_relation API.
Andrew MacLeod [Tue, 1 Aug 2023 18:33:09 +0000 (14:33 -0400)] 
Add operand ranges to op1_op2_relation API.

With additional floating point relations in the pipeline, we can no
longer tell based on the LHS what the relation of X < Y is without knowing
the type of X and Y.

* gimple-range-fold.cc (fold_using_range::range_of_range_op): Add
ranges to the call to relation_fold_and_or.
(fold_using_range::relation_fold_and_or): Add op1 and op2 ranges.
(fur_source::register_outgoing_edges): Add op1 and op2 ranges.
* gimple-range-fold.h (relation_fold_and_or): Adjust params.
* gimple-range-gori.cc (gori_compute::compute_operand_range): Add
a varying op1 and op2 to call.
* range-op-float.cc (range_operator::op1_op2_relation): New dafaults.
(operator_equal::op1_op2_relation): New float version.
(operator_not_equal::op1_op2_relation): Ditto.
(operator_lt::op1_op2_relation): Ditto.
(operator_le::op1_op2_relation): Ditto.
(operator_gt::op1_op2_relation): Ditto.
(operator_ge::op1_op2_relation) Ditto.
* range-op-mixed.h (operator_equal::op1_op2_relation): New float
prototype.
(operator_not_equal::op1_op2_relation): Ditto.
(operator_lt::op1_op2_relation): Ditto.
(operator_le::op1_op2_relation): Ditto.
(operator_gt::op1_op2_relation): Ditto.
(operator_ge::op1_op2_relation): Ditto.
* range-op.cc (range_op_handler::op1_op2_relation): Dispatch new
variations.
(range_operator::op1_op2_relation): Add extra params.
(operator_equal::op1_op2_relation): Ditto.
(operator_not_equal::op1_op2_relation): Ditto.
(operator_lt::op1_op2_relation): Ditto.
(operator_le::op1_op2_relation): Ditto.
(operator_gt::op1_op2_relation): Ditto.
(operator_ge::op1_op2_relation): Ditto.
* range-op.h (range_operator): New prototypes.
(range_op_handler): Ditto.

9 months agoProvide a routine for NAME == NAME relation.
Andrew MacLeod [Wed, 2 Aug 2023 14:58:37 +0000 (10:58 -0400)] 
Provide a routine for NAME == NAME relation.

We've been assuming x == x s VREL_EQ in GORI, but this is not always going to
be true with floating point.  Provide an API to return the relation.

* gimple-range-gori.cc (gori_compute::compute_operand1_range):
Use identity relation.
(gori_compute::compute_operand2_range): Ditto.
* value-relation.cc (get_identity_relation): New.
* value-relation.h (get_identity_relation): New prototype.

9 months agoAutomatically set type is certain Value_Range routines.
Andrew MacLeod [Wed, 2 Aug 2023 21:46:58 +0000 (17:46 -0400)] 
Automatically set type is certain Value_Range routines.

Set routines which take a type shouldn't have to pre-set the type of the
underlying range as it is specified as a parameter already.

* value-range.h (Value_Range::set_varying): Set the type.
(Value_Range::set_zero): Ditto.
(Value_Range::set_nonzero): Ditto.

9 months ago[committed][RISC-V] Remove errant hunk of code
Jeff Law [Thu, 3 Aug 2023 14:57:23 +0000 (10:57 -0400)] 
[committed][RISC-V] Remove errant hunk of code

I'm using this hunk locally to more thoroughly exercise the zicond paths
due to inaccuracies elsewhere in the costing model.  It was never
supposed to be part of the costing commit though.  And as we've seen
it's causing problems with the vector bits.

While my testing isn't complete, this hunk was never supposed to be
pushed and it's causing problems.  So I'm just ripping it out.

There's a bigger TODO in this space WRT a top-to-bottom evaluation of
the costing on RISC-V.  I'm still formulating what that evaluation is
going to look like, so don't hold your breath waiting on it.

Pushed to the trunk.

gcc/

* config/riscv/riscv.cc (riscv_rtx_costs): Remove errant hunk from
recent commit.

9 months agotestsuite, analyzer: add test case [PR108171]
David Malcolm [Thu, 3 Aug 2023 14:47:22 +0000 (10:47 -0400)] 
testsuite, analyzer: add test case [PR108171]

The ICE in PR analyzer/108171 appears to be a dup of the recently fixed
PR analyzer/110882 and is likewise fixed by it; adding this test case.

gcc/testsuite/ChangeLog:
PR analyzer/108171
* gcc.dg/analyzer/pr108171.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
9 months agoRISC-V: Fix one comment for binop_frm insn
Pan Li [Thu, 3 Aug 2023 14:27:56 +0000 (22:27 +0800)] 
RISC-V: Fix one comment for binop_frm insn

The previous patch missed the vfsub comment for binop_frm, this
patch would like to fix this.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc: Add vfsub.

9 months agoanalyzer: fix ICE on zero-sized arrays [PR110882]
David Malcolm [Thu, 3 Aug 2023 13:47:44 +0000 (09:47 -0400)] 
analyzer: fix ICE on zero-sized arrays [PR110882]

gcc/analyzer/ChangeLog:
PR analyzer/110882
* region.cc (int_size_in_bits): Fail on zero-sized types.

gcc/testsuite/ChangeLog:
PR analyzer/110882
* gcc.dg/analyzer/pr110882.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
9 months ago[libbacktrace] fix up broken test
Richard Biener [Thu, 3 Aug 2023 13:21:51 +0000 (15:21 +0200)] 
[libbacktrace] fix up broken test

zstdtest has some inline data where some testcases lack the
uncompressed length field.  Thus it computes that but still
ends up allocating memory for the uncompressed buffer based on
that (zero) length.  Oops.  Causes memory corruption if the
allocator returns non-NULL.

libbacktrace/
* zstdtest.c (test_samples): Properly compute the allocation
size for the uncompressed data.

9 months agopoly_int: Handle more can_div_trunc_p cases
Richard Sandiford [Thu, 3 Aug 2023 12:54:11 +0000 (13:54 +0100)] 
poly_int: Handle more can_div_trunc_p cases

can_div_trunc_p (a, b, &Q, &r) tries to compute a Q and r that
satisfy the usual conditions for truncating division:

     (1) a = b * Q + r
     (2) |b * Q| <= |a|
     (3) |r| < |b|

We can compute Q using the constant component (the case when
all indeterminates are zero).  Since |r| < |b| for the constant
case, the requirements for indeterminate xi with coefficients
ai (for a) and bi (for b) are:

     (2') |bi * Q| <= |ai|
     (3') |ai - bi * Q| <= |bi|

(See the big comment for more details, restrictions, and reasoning).

However, the function works on abstract arithmetic types, and so
it has to be careful not to introduce new overflow.  The code
therefore only handled the extreme for (3'), that is:

     |ai - bi * Q| = |bi|

for the case where Q is zero.

Looking at it again, the overflow issue is a bit easier to handle than
I'd originally thought (or so I hope).  This patch therefore extends the
code to handle |ai - bi * Q| = |bi| for all Q, with Q = 0 no longer
being a separate case.

The net effect is to allow the function to succeed for things like:

     (a0 + b1 (Q+1) x) / (b0 + b1 x)

where Q = a0 / b0, with various sign conditions.  E.g. we now handle:

     (7 + 8x) / (4 + 4x)

with Q = 1 and r = 3 + 4x,

gcc/
* poly-int.h (can_div_trunc_p): Succeed for more boundary conditions.

gcc/testsuite/
* gcc.dg/plugin/poly-int-tests.h (test_can_div_trunc_p_const)
(test_can_div_trunc_p_const): Add more tests.

9 months agotree-optimization/110838 - vectorization of widened shifts
Richard Biener [Mon, 31 Jul 2023 12:44:52 +0000 (14:44 +0200)] 
tree-optimization/110838 - vectorization of widened shifts

The following makes sure to limit the shift operand when vectorizing
(short)((int)x >> 31) via (short)x >> 31 as the out of bounds shift
operand otherwise invokes undefined behavior.  When we determine
whether we can demote the operand we know we at most shift in the
sign bit so we can adjust the shift amount.

Note this has the possibility of un-CSEing common shift operands
as there's no good way to share pattern stmts between patterns.
We'd have to separately pattern recognize the definition.

PR tree-optimization/110838
* tree-vect-patterns.cc (vect_recog_over_widening_pattern):
Adjust the shift operand of RSHIFT_EXPRs.

* gcc.dg/torture/pr110838.c: New testcase.

9 months agotree-optimization/110702 - avoid zero-based memory references in IVOPTs
Richard Biener [Thu, 3 Aug 2023 11:11:12 +0000 (13:11 +0200)] 
tree-optimization/110702 - avoid zero-based memory references in IVOPTs

Sometimes IVOPTs chooses a weird induction variable which downstream
leads to issues.  Most of the times we can fend those off during costing
by rejecting the candidate but it looks like the address description
costing synthesizes is different from what we end up generating so
the following fixes things up at code generation time.  Specifically
we avoid the create_mem_ref_raw fallback which uses a literal zero
address base with the actual base in index2.  For the case in question
we have the address

  type = unsigned long
  offset = 0
  elements = {
    [0] = &e * -3,
    [1] = (sizetype) a.9_30 * 232,
    [2] = ivtmp.28_44 * 4
  }

from which we code generate the problematical

  _3 = MEM[(long int *)0B + ivtmp.36_9 + ivtmp.28_44 * 4];

which references the object at address zero.  The patch below
recognizes the fallback after the fact and transforms the
TARGET_MEM_REF memory reference into a LEA for which this form
isn't problematic:

  _24 = &MEM[(long int *)0B + ivtmp.36_34 + ivtmp.28_44 * 4];
  _3 = *_24;

hereby avoiding the correctness issue.  We'd later conclude the
program terminates at the null pointer dereference and make the
function pure, miscompling the main function of the testcase.

PR tree-optimization/110702
* tree-ssa-loop-ivopts.cc (rewrite_use_address): When
we created a NULL pointer based access rewrite that to
a LEA.

* gcc.dg/torture/pr110702.c: New testcase.

9 months agoada: Add pragma Annotate for GNATcheck exemptions
Sheri Bernstein [Tue, 25 Jul 2023 17:16:55 +0000 (17:16 +0000)] 
ada: Add pragma Annotate for GNATcheck exemptions

Exempt the GNATcheck rule "Improper_Returns" with the rationale
"early returns for performance".

gcc/ada/

* libgnat/s-aridou.adb: Add pragma to exempt Improper_Returns.
* libgnat/s-atopri.adb (Lock_Free_Try_Write): Likewise.
* libgnat/s-bitops.adb (Bit_Eq): Likewise.
* libgnat/s-carsi8.adb: Likewise.
* libgnat/s-carun8.adb: Likewise.
* libgnat/s-casi16.adb: Likewise.
* libgnat/s-casi32.adb: Likewise.
* libgnat/s-casi64.adb: Likewise.
* libgnat/s-caun16.adb: Likewise.
* libgnat/s-caun32.adb: Likewise.
* libgnat/s-caun64.adb: Likewise.
* libgnat/s-exponn.adb: Likewise.
* libgnat/s-expont.adb: Likewise.
* libgnat/s-valspe.adb: Likewise.
* libgnat/s-vauspe.adb: Likewise.

9 months agoada: Rewrite Set_Image_*_Unsigned routines to remove recursion.
Vasiliy Fofanov [Wed, 26 Jul 2023 08:33:18 +0000 (08:33 +0000)] 
ada: Rewrite Set_Image_*_Unsigned routines to remove recursion.

This rewriting removes algorithm inefficiencies due to unnecessary
recursion and copying. The new version has much smaller and statically known
stack requirements and is additionally up to 2x faster.

gcc/ada/

* libgnat/s-imageb.adb (Set_Image_Based_Unsigned): Rewritten.
* libgnat/s-imagew.adb (Set_Image_Width_Unsigned): Likewise.

9 months agoada: Fix spurious error on 'Input of private type with Type_Invariant aspect
Eric Botcazou [Tue, 25 Jul 2023 21:03:22 +0000 (23:03 +0200)] 
ada: Fix spurious error on 'Input of private type with Type_Invariant aspect

The problem is that it is necessary to break the privacy during the
expansion of the Input attribute, which may introduce a view mismatch
with the parameter of the routine checking the invariant of the type.

gcc/ada/

* exp_util.adb (Make_Invariant_Call): Convert the expression to
the type of the formal parameter if need be.

9 months agoada: Adjust again address arithmetics in System.Dwarf_Lines
Eric Botcazou [Mon, 24 Jul 2023 13:02:25 +0000 (15:02 +0200)] 
ada: Adjust again address arithmetics in System.Dwarf_Lines

Using the operator of System.Storage_Elements has introduced a range check
that may be tripped on, so this removes the intermediate conversion to the
Storage_Count subtype that is responsible for it.

gcc/ada/

* libgnat/s-dwalin.adb ("-"): New subtraction operator.
(Enable_Cache): Use it to compute the offset.
(Symbolic_Address): Likewise.

9 months agoImprove sinking with unrelated defs
Richard Biener [Wed, 26 Jul 2023 13:23:45 +0000 (15:23 +0200)] 
Improve sinking with unrelated defs

statement_sink_location for loads is currently confused about
stores that are not on the paths we are sinking across.  The
following replaces the logic that tries to ensure we are not
sinking across stores by instead of walking all immediate virtual
uses and then checking whether found stores are on the paths
we sink through with checking the live virtual operand at the
sinking location.  To obtain the live virtual operand we rely
on the new virtual_operand_live class which provides an overall
cheaper and also more precise way to check the constraints.

* tree-ssa-sink.cc: Include tree-ssa-live.h.
(pass_sink_code::execute): Instantiate virtual_operand_live
and pass it down.
(sink_code_in_bb): Pass down virtual_operand_live.
(statement_sink_location): Get virtual_operand_live and
verify we are not sinking loads across stores by looking up
the live virtual operand at the sink location.

* gcc.dg/tree-ssa/ssa-sink-20.c: New testcase.

9 months agoAdd virtual operand global liveness computation class
Richard Biener [Wed, 2 Aug 2023 11:33:43 +0000 (13:33 +0200)] 
Add virtual operand global liveness computation class

The following adds an on-demand global liveness computation class
computing and caching the live-out virtual operand of basic blocks
and answering live-out, live-in and live-on-edge queries.  The flow
is optimized for the intended use in code sinking which will query
live-in and possibly can be optimized further when the originating
query is for live-out.

The code relies on up-to-date immediate dominator information and
on an unchanging virtual operand state.

* tree-ssa-live.h (class virtual_operand_live): New.
* tree-ssa-live.cc (virtual_operand_live::init): New.
(virtual_operand_live::get_live_in): Likewise.
(virtual_operand_live::get_live_out): Likewise.

9 months agoSwap loop splitting and final value replacement
Richard Biener [Thu, 3 Aug 2023 08:59:52 +0000 (10:59 +0200)] 
Swap loop splitting and final value replacement

The following swaps the loop splitting pass and the final value
replacement pass to avoid keeping the IV of the earlier loop
live when not necessary.  The existing gcc.target/i386/pr87007-5.c
testcase shows that we otherwise fail to elide an empty loop
later.  I don't see any good reason why loop splitting would need
final value replacement, all exit values honor the constraints
we place on loop header PHIs automatically.

* passes.def: Exchange loop splitting and final value
replacement passes.

* gcc.target/i386/pr87007-5.c: Make sure we split the loop
and eliminate both in the end.

9 months agos390: Try to emit vlbr/vstbr instead of vperm et al.
Stefan Schulze Frielinghaus [Thu, 3 Aug 2023 08:30:08 +0000 (10:30 +0200)] 
s390: Try to emit vlbr/vstbr instead of vperm et al.

gcc/ChangeLog:

* config/s390/s390.cc (expand_perm_as_a_vlbr_vstbr_candidate):
New function which handles bswap patterns for vec_perm_const.
(vectorize_vec_perm_const_1): Call new function.
* config/s390/vector.md (*bswap<mode>): Fix operands in output
template.
(*vstbr<mode>): New insn.

gcc/testsuite/ChangeLog:

* gcc.target/s390/s390.exp: Add subdirectory vxe2.
* gcc.target/s390/vxe2/vlbr-1.c: New test.
* gcc.target/s390/vxe2/vstbr-1.c: New test.
* gcc.target/s390/vxe2/vstbr-2.c: New test.

9 months agos390: Enable vect_bswap test cases
Stefan Schulze Frielinghaus [Thu, 3 Aug 2023 08:29:51 +0000 (10:29 +0200)] 
s390: Enable vect_bswap test cases

This enables the following tests which rely on instruction vperm which
is available since z13 with the initial vector support.

testsuite/gcc.dg/vect/vect-bswap16.c
42:/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_bswap || sse4_runtime } } } } */

testsuite/gcc.dg/vect/vect-bswap32.c
42:/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_bswap || sse4_runtime } } } } */

testsuite/gcc.dg/vect/vect-bswap64.c
42:/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_bswap || sse4_runtime } } } } */

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_vect_bswap):
Add s390.

9 months agoIntroduce -msmp to select /lib_smp/ on ppc-vx6
Alexandre Oliva [Thu, 3 Aug 2023 06:34:31 +0000 (03:34 -0300)] 
Introduce -msmp to select /lib_smp/ on ppc-vx6

The .spec files used for linking on ppc-vx6, when the rtp-smp runtime
is selected, add -L flags for /lib_smp/ and /lib/.

There was a problem, though: although /lib_smp/ and /lib/ were to be
searched in this order, and the specs files do that correctly, the
compiler would search /lib/ first regardless, because
STARTFILE_PREFIX_SPEC said so, and specs files cannot override that.

With this patch, we arrange for the presence of -msmp to affect
STARTFILE_PREFIX_SPEC, so that the compiler searches /lib_smp/ rather
than /lib/ for crt files.  A separate patch for GNAT ensures that when
the rtp-smp runtime is selected, -msmp is passed to the compiler
driver for linking, along with the --specs flags.

for  gcc/ChangeLog

* config/vxworks-smp.opt: New.  Introduce -msmp.
* config.gcc: Enable it on powerpc* vxworks prior to 7r*.
* config/rs6000/vxworks.h (STARTFILE_PREFIX_SPEC): Choose
lib_smp when -msmp is present in the command line.
* doc/invoke.texi: Document it.

9 months agoRISCV: Add -m(no)-omit-leaf-frame-pointer support.
Yanzhang Wang [Tue, 18 Jul 2023 07:49:58 +0000 (15:49 +0800)] 
RISCV: Add -m(no)-omit-leaf-frame-pointer support.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_save_reg_p): Save ra for leaf
when enabling -mno-omit-leaf-frame-pointer
(riscv_option_override): Override omit-frame-pointer.
(riscv_frame_pointer_required): Save s0 for non-leaf function
(TARGET_FRAME_POINTER_REQUIRED): Override defination
* config/riscv/riscv.opt: Add option support.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/omit-frame-pointer-1.c: New test.
* gcc.target/riscv/omit-frame-pointer-2.c: New test.
* gcc.target/riscv/omit-frame-pointer-3.c: New test.
* gcc.target/riscv/omit-frame-pointer-4.c: New test.
* gcc.target/riscv/omit-frame-pointer-test.c: New test.

Signed-off-by: Yanzhang Wang <yanzhang.wang@intel.com>
9 months agoPR target/110792: Early clobber issues with rot32di2_doubleword on i386.
Roger Sayle [Thu, 3 Aug 2023 06:12:04 +0000 (07:12 +0100)] 
PR target/110792: Early clobber issues with rot32di2_doubleword on i386.

This patch is a conservative fix for PR target/110792, a wrong-code
regression affecting doubleword rotations by BITS_PER_WORD, which
effectively swaps the highpart and lowpart words, when the source to be
rotated resides in memory. The issue is that if the register used to
hold the lowpart of the destination is mentioned in the address of
the memory operand, the current define_insn_and_split unintentionally
clobbers it before reading the highpart.

Hence, for the testcase, the incorrectly generated code looks like:

        salq    $4, %rdi // calculate address
        movq    WHIRL_S+8(%rdi), %rdi // accidentally clobber addr
        movq    WHIRL_S(%rdi), %rbp // load (wrong) lowpart

Traditionally, the textbook way to fix this would be to add an
explicit early clobber to the instruction's constraints.

 (define_insn_and_split "<insn>32di2_doubleword"
- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r")
        (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o")
                       (const_int 32)))]

but unfortunately this currently generates significantly worse code,
due to a strange choice of reloads (effectively memcpy), which ends up
looking like:

        salq    $4, %rdi // calculate address
        movdqa  WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg.
        movaps  %xmm0, -16(%rsp) // store the SSE reg back to the stack
        movq    -8(%rsp), %rdi // load highpart
        movq    -16(%rsp), %rbp // load lowpart

Note that reload's "&" doesn't distinguish between the memory being
early clobbered, vs the registers used in an addressing mode being
early clobbered.

The fix proposed in this patch is to remove the third alternative, that
allowed offsetable memory as an operand, forcing reload to place the
operand into a register before the rotation.  This results in:

        salq    $4, %rdi
        movq    WHIRL_S(%rdi), %rax
        movq    WHIRL_S+8(%rdi), %rdi
        movq    %rax, %rbp

I believe there's a more advanced solution, by swapping the order of
the loads (if first destination register is mentioned in the address),
or inserting a lea insn (if both destination registers are mentioned
in the address), but this fix is a minimal "safe" solution, that
should hopefully be suitable for backporting.

2023-08-03  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR target/110792
* config/i386/i386.md (<any_rotate>ti3): For rotations by 64 bits
place operand in a register before gen_<insn>64ti2_doubleword.
(<any_rotate>di3): Likewise, for rotations by 32 bits, place
operand in a register before gen_<insn>32di2_doubleword.
(<any_rotate>32di2_doubleword): Constrain operand to be in register.
(<any_rotate>64ti2_doubleword): Likewise.

gcc/testsuite/ChangeLog
PR target/110792
* g++.target/i386/pr110792.C: New 32-bit C++ test case.
* gcc.target/i386/pr110792.c: New 64-bit C test case.

9 months agoRISC-V: Support RVV VFMUL rounding mode intrinsic API
Pan Li [Thu, 3 Aug 2023 01:30:24 +0000 (09:30 +0800)] 
RISC-V: Support RVV VFMUL rounding mode intrinsic API

Update in v2:

* Sync with upstream for the vfmul duplicated declaration.

Original log:

This patch would like to support the rounding mode API for the VFMUL
for the below samples.

* __riscv_vfmul_vv_f32m1_rm
* __riscv_vfmul_vv_f32m1_rm_m
* __riscv_vfmul_vf_f32m1_rm
* __riscv_vfmul_vf_f32m1_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc
(vfmul_frm_obj): New declaration.
(Base): Likewise.
* config/riscv/riscv-vector-builtins-bases.h: Likewise.
* config/riscv/riscv-vector-builtins-functions.def
(vfmul_frm): New function definition.
* config/riscv/vector.md: Add vfmul to frm_mode.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-single-mul.c: New test.

9 months agoFix `~X & X` and `~X | X` patterns
Andrew Pinski [Wed, 2 Aug 2023 22:54:20 +0000 (15:54 -0700)] 
Fix `~X & X` and `~X | X` patterns

As Jakub noticed in https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626039.html
what I did was not totally correct because sometimes chosing the wrong type.
So to get back to what the original code but keeping around the use of bitwise_inverted_equal_p,
we just need to check if the types of the two catupures are the same type.

Also adds a testcase for the problem Jakub found.

Committed as obvious after a bootstrap and test.

gcc/ChangeLog:

* match.pd (`~X & X`): Check that the types match.
(`~x | x`, `~x ^ x`): Likewise.

gcc/testsuite/ChangeLog:

* gcc.c-torture/execute/20230802-1.c: New test.

9 months agoRISC-V: Remove redudant extern declaration in function base
Pan Li [Thu, 3 Aug 2023 02:08:54 +0000 (10:08 +0800)] 
RISC-V: Remove redudant extern declaration in function base

This patch would like to remove the redudant declaration.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.h: Remove
redudant declaration.

9 months agoRISC-V: Support RVV VFWSUB rounding mode intrinsic API
Pan Li [Wed, 2 Aug 2023 10:15:47 +0000 (18:15 +0800)] 
RISC-V: Support RVV VFWSUB rounding mode intrinsic API

This patch would like to support the rounding mode API for the VFWSUB
for the below samples.

    * __riscv_vfwsub_vv_f64m2_rm
    * __riscv_vfwsub_vv_f64m2_rm_m
    * __riscv_vfwsub_vf_f64m2_rm
    * __riscv_vfwsub_vf_f64m2_rm_m
    * __riscv_vfwsub_wv_f64m2_rm
    * __riscv_vfwsub_wv_f64m2_rm_m
    * __riscv_vfwsub_wf_f64m2_rm
    * __riscv_vfwsub_wf_f64m2_rm_m

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc (BASE): Add
vfwsub frm.
* config/riscv/riscv-vector-builtins-bases.h: Add declaration.
* config/riscv/riscv-vector-builtins-functions.def (vfwsub_frm):
Add vfwsub function definitions.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/float-point-widening-sub.c: New test.

9 months agoDaily bump.
GCC Administrator [Thu, 3 Aug 2023 00:17:10 +0000 (00:17 +0000)] 
Daily bump.

9 months agoanalyzer: stash values for CPython plugin [PR107646]
Eric Feng [Wed, 2 Aug 2023 20:54:55 +0000 (16:54 -0400)] 
analyzer: stash values for CPython plugin [PR107646]

This patch adds a hook to the end of ana::on_finish_translation_unit
which calls relevant stashing-related callbacks registered during plugin
initialization. This feature is used to stash named types and global
variables for a CPython analyzer plugin [PR107646].

gcc/analyzer/ChangeLog:
PR analyzer/107646
* analyzer-language.cc (run_callbacks): New function.
(on_finish_translation_unit): New function.
* analyzer-language.h (GCC_ANALYZER_LANGUAGE_H): New include.
(class translation_unit): New vfuncs.

gcc/c/ChangeLog:
PR analyzer/107646
* c-parser.cc: New functions on stashing values for the
analyzer.

gcc/testsuite/ChangeLog:
PR analyzer/107646
* gcc.dg/plugin/plugin.exp: Add new plugin and test.
* gcc.dg/plugin/analyzer_cpython_plugin.c: New plugin.
* gcc.dg/plugin/cpython-plugin-test-1.c: New test.

Signed-off-by: Eric Feng <ef2648@columbia.edu>
9 months agortl-optimization/110867 Fix narrow comparison of memory and constant
Stefan Schulze Frielinghaus [Wed, 2 Aug 2023 19:43:22 +0000 (21:43 +0200)] 
rtl-optimization/110867 Fix narrow comparison of memory and constant

In certain cases a constant may not fit into the mode used to perform a
comparison.  This may be the case for sign-extended constants which are
used during an unsigned comparison as e.g. in

(set (reg:CC 100 cc)
    (compare:CC (mem:SI (reg/v/f:SI 115 [ a ]) [1 *a_4(D)+0 S4 A64])
        (const_int -2147483648 [0xffffffff80000000])))

Fixed by ensuring that the constant fits into comparison mode.

Furthermore, on some targets as e.g. sparc the constant used in a
comparison is chopped off before combine which leads to failing test
cases (see PR 110869).  Fixed by not requiring that the source mode has
to be DImode, and excluding sparc from the last two test cases entirely
since there the constant cannot be further reduced.

gcc/ChangeLog:

PR rtl-optimization/110867
* combine.cc (simplify_compare_const): Try the optimization only
in case the constant fits into the comparison mode.

gcc/testsuite/ChangeLog:

PR rtl-optimization/110869
* gcc.dg/cmp-mem-const-1.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-2.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-3.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-4.c: Relax mode for constant.
* gcc.dg/cmp-mem-const-5.c: Exclude sparc since here the
constant is already reduced.
* gcc.dg/cmp-mem-const-6.c: Exclude sparc since here the
constant is already reduced.

9 months ago[committed][RISC-V] Fix 20010221-1.c with zicond
Jeff Law [Wed, 2 Aug 2023 17:16:23 +0000 (13:16 -0400)] 
[committed][RISC-V] Fix 20010221-1.c with zicond

So we're being a bit too aggressive with the .opt zicond patterns.

> (define_insn "*czero.eqz.<GPR:mode><X:mode>.opt1"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (eq (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "1")
>                           (match_operand:GPR 3 "register_operand" "r")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1], operands[2])"
>   "czero.eqz\t%0,%3,%1"
> )
The RTL semantics here are op0 = (op1 == 0) ? op1 : op2.  That maps
directly to czero.eqz.  ie, we select op1 when we know it's zero, op2
otherwise.  So this pattern is fine.

> (define_insn "*czero.eqz.<GPR:mode><X:mode>.opt2"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (eq (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "r")
>                           (match_operand:GPR 3 "register_operand" "1")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1],  operands[3])"
>   "czero.nez\t%0,%2,%1"
> )

The RTL semantics of this pattern are are: op0 = (op1 == 0) ? op2 : op1;

That's not something that can be expressed by the zicond extension as it
selects op1 if and only if op1 is not equal to zero.

> (define_insn "*czero.nez.<GPR:mode><X:mode>.opt3"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (ne (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "r")
>                           (match_operand:GPR 3 "register_operand" "1")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1], operands[3])"
>   "czero.eqz\t%0,%2,%1"
> )
The RTL semantics of this pattern are op0 = (op1 != 0) ? op2 : op1.
That maps to czero.nez.  But the output template uses czero.eqz.  Opps.

> (define_insn "*czero.nez.<GPR:mode><X:mode>.opt4"
>   [(set (match_operand:GPR 0 "register_operand"                   "=r")
>         (if_then_else:GPR (ne (match_operand:X 1 "register_operand" "r")
>                               (const_int 0))
>                           (match_operand:GPR 2 "register_operand" "1")
>                           (match_operand:GPR 3 "register_operand" "r")))]
>   "(TARGET_ZICOND || 1) && rtx_equal_p (operands[1], operands[2])"
>   "czero.nez\t%0,%3,%1"
> )

The RTL semantics of this pattern are op0 = (op1 != 0) ? op1 : op2 which
obviously doesn't match to any zicond instruction as op1 is selected
when it is not zero.

So two of the patterns are just totally bogus as they are not
implementable with zicond.  They are removed.  The asm template for the
.opt3 pattern is fixed to use czero.nez and its name is changed to
.opt2.

gcc/
* config/riscv/zicond.md: Remove incorrect zicond patterns and
renumber/rename them.
(zero.nez.<GPR:MODE><X:mode>.opt2): Fix output string.

9 months agoMake add_phi_node_to_bb static
Richard Biener [Wed, 2 Aug 2023 11:26:06 +0000 (13:26 +0200)] 
Make add_phi_node_to_bb static

The only exported PHI allocation already adds the PHI node to a block.

* tree-phinodes.h (add_phi_node_to_bb): Remove.
* tree-phinodes.cc  (add_phi_node_to_bb): Make static.

9 months agox86: fold two of vec_dupv2df<mask_name>'s alternatives
Jan Beulich [Wed, 2 Aug 2023 09:04:37 +0000 (11:04 +0200)] 
x86: fold two of vec_dupv2df<mask_name>'s alternatives

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.

9 months agoMAINTAINERS: correct my email address
Jan Beulich [Wed, 2 Aug 2023 09:00:35 +0000 (11:00 +0200)] 
MAINTAINERS: correct my email address

The @novell.com one has been out of use for quite some time.

ChangeLog:

* MAINTAINERS: Correct my email address.

9 months agotree-optimization/92335 - Improve sinking heuristics for vectorization
Richard Biener [Thu, 27 Jul 2023 13:34:12 +0000 (15:34 +0200)] 
tree-optimization/92335 - Improve sinking heuristics for vectorization

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.

9 months agoSlightly improve bitwise_inverted_equal_p comparisons
Andrew Pinski [Sat, 29 Jul 2023 23:29:09 +0000 (16:29 -0700)] 
Slightly improve bitwise_inverted_equal_p comparisons

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.

9 months agoMove `~X & X` and `~X | X` over to use bitwise_inverted_equal_p
Andrew Pinski [Sat, 29 Jul 2023 20:00:04 +0000 (13:00 -0700)] 
Move `~X & X` and `~X | X` over to use bitwise_inverted_equal_p

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.

9 months agoPHIOPT: Mark the conditional lhs and rhs as to look at to see if DCEable
Andrew Pinski [Tue, 13 Jun 2023 16:17:45 +0000 (09:17 -0700)] 
PHIOPT: Mark the conditional lhs and rhs as to look at to see if DCEable

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.

9 months agoRISC-V: Support RVV VFWADD rounding mode intrinsic API
Pan Li [Wed, 2 Aug 2023 02:24:39 +0000 (10:24 +0800)] 
RISC-V: Support RVV VFWADD rounding mode intrinsic API

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.

9 months agoMore profile updating clenaups
Jan Hubicka [Wed, 2 Aug 2023 07:44:06 +0000 (09:44 +0200)] 
More profile updating clenaups

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.

9 months agoFix profile update after cancelled loop distribution
Jan Hubicka [Wed, 2 Aug 2023 07:25:12 +0000 (09:25 +0200)] 
Fix profile update after cancelled loop distribution

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.

9 months agortl-optimization/110587 - remove quadratic regno_in_use_p
Richard Biener [Tue, 25 Jul 2023 13:32:11 +0000 (15:32 +0200)] 
rtl-optimization/110587 - remove quadratic regno_in_use_p

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.

9 months agoSupport vec_fmaddsub/vec_fmsubadd for vector HFmode.
liuhongt [Mon, 31 Jul 2023 08:03:45 +0000 (16:03 +0800)] 
Support vec_fmaddsub/vec_fmsubadd for vector HFmode.

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.

9 months agoOptimize vlddqu + inserti128 to vbroadcasti128
liuhongt [Tue, 18 Jul 2023 08:32:54 +0000 (16:32 +0800)] 
Optimize vlddqu + inserti128 to vbroadcasti128

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.

9 months ago[PATCH 3/5] [RISC-V] Cost model for Zicond.
Xiao Zeng [Wed, 2 Aug 2023 06:17:12 +0000 (00:17 -0600)] 
[PATCH 3/5] [RISC-V] Cost model for Zicond.

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.

9 months ago[committed] [RISC-V] Avoid sub-word mode comparisons with Zicond
Jeff Law [Wed, 2 Aug 2023 05:12:16 +0000 (23:12 -0600)] 
[committed] [RISC-V] Avoid sub-word mode comparisons with Zicond

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.

9 months ago[PATCH 3/5] [RISC-V] RISC-V Conditional Move costing [was:Generate Zicond instruction...
Xiao Zeng [Mon, 31 Jul 2023 18:26:51 +0000 (12:26 -0600)] 
[PATCH 3/5] [RISC-V] RISC-V Conditional Move costing [was:Generate Zicond 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>
9 months agoi386: refactor macros.
Hu, Lin1 [Tue, 27 Jun 2023 06:06:20 +0000 (14:06 +0800)] 
i386: refactor macros.

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>
9 months agoAdd myself for write after approval
Hu, Lin1 [Wed, 2 Aug 2023 01:58:29 +0000 (09:58 +0800)] 
Add myself for write after approval

ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.

9 months agoDaily bump.
GCC Administrator [Wed, 2 Aug 2023 00:17:45 +0000 (00:17 +0000)] 
Daily bump.

9 months agoPR modula2/110161 Comparing a typed procedure variable to 0 gives ICE or assertion
Gaius Mulley [Tue, 1 Aug 2023 23:34:29 +0000 (00:34 +0100)] 
PR modula2/110161 Comparing a typed procedure variable to 0 gives ICE or 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>