Skip to content
Snippets Groups Projects
  1. Jan 15, 2021
    • Alexandre Oliva's avatar
      gcc.dg/analyzer tests: use __builtin_alloca, not alloca.h · c0194736
      Alexandre Oliva authored
      
      Use __builtin_alloca.  Some systems don't have alloca.h or alloca.
      
      
      Co-Authored-By: default avatarOlivier Hainque <hainque@adacore.com>
      
      for  gcc/testsuite/ChangeLog
      
      	* gcc.dg/analyzer/alloca-leak.c: Drop alloca.h, use builtin.
      	* gcc.dg/analyzer/data-model-1.c: Likewise.
      	* gcc.dg/analyzer/malloc-1.c: Likewise.
      	* gcc.dg/analyzer/malloc-paths-8.c: Likewise.
      c0194736
    • Jakub Jelinek's avatar
      testsuite: Add testcase coverage for already fixed [PR96671] · aaec7392
      Jakub Jelinek authored
      The fix for this PR didn't come with any test coverage, I've added
      tests that make sure we optimize it no matter what order of the x ^ y ^ z
      operands is used.
      
      2021-01-15  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/96671
      	* gcc.dg/tree-ssa/pr96671-1.c: New test.
      	* gcc.dg/tree-ssa/pr96671-2.c: New test.
      aaec7392
    • David Malcolm's avatar
      bootstrap: fix failing diagnostic selftest on Windows [PR98696] · a3128bf0
      David Malcolm authored
      In one of the selftests in g:f1096055
      I didn't consider that paths can contain backslashes, which happens
      for the tempfiles on Windows hosts.
      
      gcc/ChangeLog:
      	PR bootstrap/98696
      	* diagnostic.c
      	(selftest::test_print_parseable_fixits_bytes_vs_display_columns):
      	Escape the tempfile name when constructing the expected output.
      a3128bf0
    • Jakub Jelinek's avatar
      c-family: Improve MEM_REF printing for diagnostics [PR98597] · adb52060
      Jakub Jelinek authored
      Ok, here is an updated patch which fixes what I found, and implements what
      has been discussed on the mailing list and on IRC, i.e. if the types
      are compatible as well as alias sets are same, then it prints
      what c_fold_indirect_ref_for_warn managed to create, otherwise it uses
      that info for printing offsets using offsetof (except when it starts
      with ARRAY_REFs, because one can't have offsetof (struct T[2][2], [1][0].x.y)
      
      The uninit-38.c test (which was the only one I believe which had tests on the
      exact spelling of MEM_REF printing) contains mainly changes to have space
      before * for pointer types (as that is how the C pretty-printers normally
      print types, int * rather than int*), plus what might be considered a
      regression from what Martin printed, but it is actually a correctness fix.
      
      When the arg is a pointer with type pointer to VLA with char element type
      (let's say the pointer is p), which is what happens in several of the
      uninit-38.c tests, omitting the (char *) cast is incorrect, as p + 1
      is not the 1 byte after p, but pointer to the end of the VLA.
      It only happened to work because of the hacks (which I don't like at all
      and are dangerous, DECL_ARTIFICIAL var names with dot inside can be pretty
      much anything, e.g. a lot of passes construct their helper vars from some
      prefix that designates intended use of the var plus numeric suffix), where
      the a.1 pointer to VLA is printed as a which if one is lucky happens to be
      a variable with VLA type (rather than pointer to it), and for such vars
      a + 1 is indeed &a[0] + 1 rather than &a + 1.  But if we want to do this
      reliably, we'd need to make sure it comes from VLA (e.g. verify that the
      SSA_NAME is defined to __builtin_alloca_with_align and that there exists
      a corresponding VAR_DECL with DECL_VALUE_EXPR that has the a.1 variable
      in it).
      
      2021-01-15  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/98597
      	* c-pretty-print.c: Include options.h.
      	(c_fold_indirect_ref_for_warn): New function.
      	(print_mem_ref): Use it.  If it returns something that has compatible
      	type and is TBAA compatible with zero offset, print it and return,
      	otherwise print it using offsetof syntax or array ref syntax.  Fix up
      	printing if MEM_REFs first operand is ADDR_EXPR, or when the first
      	argument has pointer to array type.  Print pointers using the standard
      	formatting.
      
      	* gcc.dg/uninit-38.c: Expect a space in between type name and asterisk.
      	Expect for now a (char *) cast for VLAs.
      	* gcc.dg/uninit-40.c: New test.
      adb52060
    • Jakub Jelinek's avatar
      openmp: Change the way of building of reduction array type · 50dbced2
      Jakub Jelinek authored
      The PR98597 patch regresses on _Atomic-3.c, as in the C FE building an
      array type with qualified elements results in a type incompatible with
      when an array type with unqualified elements is qualified afterwards.
      This patch adds a workaround for that.
      
      2021-01-15  Jakub Jelinek  <jakub@redhat.com>
      
      	* c-typeck.c (c_finish_omp_clauses): For reduction build array with
      	unqualified element type and then call c_build_qualified_type on the
      	ARRAY_TYPE.
      50dbced2
    • Kyrylo Tkachov's avatar
      [PATCH] aarch64: Implement vmlsl[_high]* intrinsics using builtins · d3959070
      Kyrylo Tkachov authored
      This patch reimplements some more intrinsics using RTL builtins in the
      straightforward way.
      Thankfully most of the RTL infrastructure is already in place for it.
      
      gcc/
      	* config/aarch64/aarch64-simd.md (*aarch64_<su>mlsl_hi<mode>):
      	Rename to...
      	(aarch64_<su>mlsl_hi<mode>): ... This.
      	(aarch64_<su>mlsl_hi<mode>): Define.
      	(*aarch64_<su>mlsl<mode): Rename to...
      	(aarch64_<su>mlsl<mode): ... This.
      	* config/aarch64/aarch64-simd-builtins.def (smlsl, umlsl,
      	smlsl_hi, umlsl_hi): Define builtins.
      	* config/aarch64/arm_neon.h (vmlsl_high_s8, vmlsl_high_s16,
      	vmlsl_high_s32, vmlsl_high_u8, vmlsl_high_u16, vmlsl_high_u32,
      	vmlsl_s8, vmlsl_s16, vmlsl_s32, vmlsl_u8,
      	vmlsl_u16, vmlsl_u32): Reimplement with builtins.
      d3959070
    • Uros Bizjak's avatar
      i386: Use cpp_define_formatted for __SIZEOF_FLOAT80__ definition · 7d0df0ae
      Uros Bizjak authored
      2021-01-15  Uroš Bizjak  <ubizjak@gmail.com>
      
      gcc/
      	* config/i386/i386-c.c (ix86_target_macros):
      	Use cpp_define_formatted for __SIZEOF_FLOAT80__ definition.
      7d0df0ae
    • Nathan Sidwell's avatar
      preprocessor: Make quoting : [PR 95253] · 1ba71fab
      Nathan Sidwell authored
      Make doesn't need ':' quoting (in a filename).
      
      	PR preprocessor/95253
      	libcpp/
      	* mkdeps.c (munge): Do not escape ':'.
      1ba71fab
    • Nathan Sidwell's avatar
      c++: Fix langspecs with -fsyntax-only [PR98591] · 492b90f3
      Nathan Sidwell authored
      -fsyntax-only is handled specially in the driver and causes it to add
       '-o /dev/null' (or a suitable OS-specific variant thereof).  PCH is
       handled in the language driver.  I'd not sufficiently protected the
       -fmodule-only action of adding a dummy assembler from the actions of
       -fsyntax-only, so we ended up with two -o options.
      
      	PR c++/98591
      	gcc/cp/
      	* lang-specs.h: Fix handling of -fmodule-only with -fsyntax-only.
      492b90f3
    • Richard Sandiford's avatar
      aarch64: Add a minipass for fusing CC insns [PR88836] · 5a783f42
      Richard Sandiford authored
      This patch adds a small target-specific pass to remove redundant SVE
      PTEST instructions.  There are two important uses of this:
      
      - Removing PTESTs after WHILELOs (PR88836).  The original testcase
        no longer exhibits the problem due to more recent optimisations,
        but it can still be seen in simple cases like the one in the patch.
        It also shows up in 450.soplex.
      
      - Removing PTESTs after RDFFRs in ACLE code.
      
      This is just an interim “solution” for GCC 11.  I hope to replace
      it with something generic and target-independent for GCC 12.
      However, the use cases above are very important for performance,
      so I'd rather not leave the bug unfixed for yet another release cycle.
      
      Since the pass is intended to be short-lived, I've not added
      a command-line option for it.  The pass can be disabled using
      -fdisable-rtl-cc_fusion if necessary.
      
      Although what the pass does is independent of SVE, it's motivated
      only by SVE cases and doesn't trigger for any non-SVE test I've seen.
      I've therefore gated it on TARGET_SVE and restricted it to PTEST
      patterns.
      
      gcc/
      	PR target/88836
      	* config.gcc (aarch64*-*-*): Add aarch64-cc-fusion.o to extra_objs.
      	* Makefile.in (RTL_SSA_H): New variable.
      	* config/aarch64/t-aarch64 (aarch64-cc-fusion.o): New rule.
      	* config/aarch64/aarch64-protos.h (make_pass_cc_fusion): Declare.
      	* config/aarch64/aarch64-passes.def: Add pass_cc_fusion after
      	pass_combine.
      	* config/aarch64/aarch64-cc-fusion.cc: New file.
      
      gcc/testsuite/
      	PR target/88836
      	* gcc.target/aarch64/sve/acle/general/ldff1_8.c: New test.
      	* gcc.target/aarch64/sve/ptest_1.c: Likewise.
      5a783f42
    • Richard Sandiford's avatar
      recog: Fix insn_change_watermark destructor · f2cc526f
      Richard Sandiford authored
      Noticed while working on something else that the insn_change_watermark
      destructor could call cancel_changes for changes that no longer exist.
      The loop in cancel_changes is a nop in that case, but:
      
        num_changes = num;
      
      can mess things up.
      
      I think this would only affect nested uses of insn_change_watermark.
      
      gcc/
      	* recog.h (insn_change_watermark::~insn_change_watermark): Avoid
      	calling cancel_changes for changes that no longer exist.
      f2cc526f
    • Richard Sandiford's avatar
      rtl-ssa: Fix a silly typo · 7f6cdaa9
      Richard Sandiford authored
      s/ref/reg/ on a previously unused function name.
      
      gcc/
      	* rtl-ssa/functions.h (function_info::ref_defs): Rename to...
      	(function_info::reg_defs): ...this.
      	* rtl-ssa/member-fns.inl (function_info::ref_defs): Rename to...
      	(function_info::reg_defs): ...this.
      7f6cdaa9
    • Marius Hillenbrand's avatar
      IBM Z: Fix linking to libatomic in target test cases · f9a57792
      Marius Hillenbrand authored
      One of the test cases failed to link because of missing paths to
      libatomic. Reuse procedures in lib/atomic-dg.exp to gather these paths.
      
      gcc/testsuite/ChangeLog:
      
      2021-01-15  Marius Hillenbrand  <mhillen@linux.ibm.com>
      
      	* gcc.target/s390/s390.exp: Call lib atomic-dg.exp to link
      	libatomic into testcases in gcc.target/s390/md.
      	* gcc.target/s390/md/atomic_exchange-1.c: Remove no unnecessary
      	-latomic.
      f9a57792
    • Christophe Lyon's avatar
      arm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics · 63999d75
      Christophe Lyon authored
      This patch adds implementations for vceqq_p64, vceqz_p64 and
      vceqzq_p64 intrinsics.
      
      vceqq_p64 uses the existing vceq_p64 after splitting the input vectors
      into their high and low halves.
      
      vceqz[q] simply call the vceq and vceqq with a second argument equal
      to zero.
      
      The added (executable) testcases make sure that the poly64x2_t
      variants have results with one element of all zeroes (false) and the
      other element with all bits set to one (true).
      
      2021-01-15  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	gcc/
      	PR target/71233
      	* config/arm/arm_neon.h (vceqz_p64, vceqq_p64, vceqzq_p64): New.
      
      	gcc/testsuite/
      	PR target/71233
      	* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c: Add tests for
      	vceqz_p64, vceqq_p64 and vceqzq_p64.
      	* gcc.target/arm/simd/vceqz_p64.c: New test.
      	* gcc.target/arm/simd/vceqzq_p64.c: New test.
      63999d75
    • Christophe Lyon's avatar
      f1d05401
    • Richard Biener's avatar
      tree-optimization/96376 - do not check alignment for invariant loads · 446703cc
      Richard Biener authored
      The testcases show that we fail to disregard alignment for invariant
      loads.  The patch handles them like we handle gather and scatter.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/96376
      	* tree-vect-stmts.c (get_load_store_type): Disregard alignment
      	for VMAT_INVARIANT.
      446703cc
    • Martin Liska's avatar
      Pytest in tests: improve · dc8475e3
      Martin Liska authored
      gcc/ChangeLog:
      
      	* doc/install.texi: Document that some tests need pytest module.
      	* doc/sourcebuild.texi: Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* lib/gcov.exp: Use 'env python3' for execution of pytests.
      	Check that pytest accepts all needed options first.
      	Improve formatting of PASS/FAIL lines.
      dc8475e3
    • Richard Biener's avatar
      testsuite/96147 - align vector access · b36c9cd0
      Richard Biener authored
      This aligns p so that the testcase is meaningful for targets
      without a hw misaligned access.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/96147
      	* gcc.dg/vect/bb-slp-32.c: Align p.
      b36c9cd0
    • Richard Biener's avatar
      testsuite/96147 - scan for vectorized load · aa4ee579
      Richard Biener authored
      This changes gcc.dg/vect/bb-slp-9.c to scan for a vectorized load
      instead of a vectorized BB which then correctly captures the
      unaligned load we try to test and not some intermediate built
      from scalar vector.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/96147
      	* gcc.dg/vect/bb-slp-9.c: Scan for a vector load transform.
      aa4ee579
    • Richard Biener's avatar
      testsuite/96147 - key scanning on vect_hw_misalign · e1bd80fb
      Richard Biener authored
      gcc.dg/vect/slp-45.c failed to key the vectorization capability
      scanning on vect_hw_misalign.  Since the stores are strided
      they cannot be (all) analyzed to be aligned.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/96147
      	* gcc.dg/vect/slp-45.c: Key scanning on
      	vect_hw_misalign.
      e1bd80fb
    • Richard Biener's avatar
      testsuite/96147 - remove scanning for ! vect_hw_misalign · d03f14c3
      Richard Biener authored
      This removes scanning that's too difficult to get correct for all
      targets, leaving the correctness test for them and keeping the
      vectorization capability check to vect_hw_misalign targets.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/96147
      	* gcc.dg/vect/slp-43.c: Remove ! vect_hw_misalign scan.
      d03f14c3
    • Christophe Lyon's avatar
      arm: Implement vceqq_p64, vceqz_p64 and vceqzq_p64 intrinsics · 1a630642
      Christophe Lyon authored
      This patch adds implementations for vceqq_p64, vceqz_p64 and
      vceqzq_p64 intrinsics.
      
      vceqq_p64 uses the existing vceq_p64 after splitting the input vectors
      into their high and low halves.
      
      vceqz[q] simply call the vceq and vceqq with a second argument equal
      to zero.
      
      The added (executable) testcases make sure that the poly64x2_t
      variants have results with one element of all zeroes (false) and the
      other element with all bits set to one (true).
      
      2021-01-15  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	gcc/
      	PR target/71233
      	* config/arm/arm_neon.h (vceqz_p64, vceqq_p64, vceqzq_p64): New.
      
      	gcc/testsuite/
      	PR target/71233
      	* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c: Add tests for
      	vceqz_p64, vceqq_p64 and vceqzq_p64.
      1a630642
    • Richard Biener's avatar
      testsuite/96098 - remove redundant testcase · cb60334b
      Richard Biener authored
      The testcase morphed in a way no longer testing what it was originally supposed to do and slightly altering it shows the original issue isn't fixed (anymore).
      The limit as set as result of PR91403 (and dups) prevents the issue for larger
      arrays but the testcase has
      
      double a[128][128];
      
      which results in a group size of "just" 512 (the limit is 4096).  Avoiding
      the 'BB vectorization with gaps at the end of a load is not supported'
      by altering it to do
      
      void foo(void)
      {
        b[0] = a[0][0];
        b[1] = a[1][0];
        b[2] = a[2][0];
        b[3] = a[3][127];
      }
      
      shows that costing has improved further to not account the dead loads making
      the previous test inefficient.  In fact the underlying issue isn't fixed
      (we do code-generate dead loads).
      
      In fact the vector permute load is even profitable, just the excessive
      code-generation issue exists (and is "fixed" by capping it a constant
      boundary, just too high for this particular testcase).
      
      The testcase now has "dups", so I'll simply remove it.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/96098
      	* gcc.dg/vect/bb-slp-pr68892.c: Remove.
      cb60334b
    • Jakub Jelinek's avatar
      libatomic, libgomp, libitc: Fix bootstrap [PR70454] · 0411ae7f
      Jakub Jelinek authored
      The recent changes to error on mixing -march=i386 and -fcf-protection broke
      bootstrap.  This patch changes lib{atomic,gomp,itm} configury, so that it
      only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't
      on by default already).  Similarly, it will not use ifuncs if -mcx16
      (or -march=i686 for 32-bit) is on by default.
      
      2021-01-15  Jakub Jelinek  <jakub@redhat.com>
      
      	PR target/70454
      libatomic/
      	* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
      	be added through preprocessor check on
      	__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.  Determine if try_ifunc is needed
      	based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
      	or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.
      libgomp/
      	* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
      	be added through preprocessor check on
      	__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
      libitm/
      	* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
      	be added through preprocessor check on
      	__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
      0411ae7f
    • Christophe Lyon's avatar
      arm: Auto-vectorization for MVE: vshr · bfab3550
      Christophe Lyon authored
      This patch enables MVE vshr instructions for auto-vectorization.  New
      MVE patterns are introduced that take a vector of constants as second
      operand, all constants being equal.
      
      The existing mve_vshrq_n_<supf><mode> is kept, as it takes a single
      immediate as second operand, and is used by arm_mve.h.
      
      The vashr<mode>3 and vlshr<mode>3 expanders are moved fron neon.md to
      vec-common.md, updated to rely on the normal expansion scheme to
      generate shifts by immediate.
      
      2020-12-03  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	gcc/
      	* config/arm/mve.md (mve_vshrq_n_s<mode>_imm): New entry.
      	(mve_vshrq_n_u<mode>_imm): Likewise.
      	* config/arm/neon.md (vashr<mode>3, vlshr<mode>3): Move to ...
      	* config/arm/vec-common.md: ... here.
      
      	gcc/testsuite/
      	* gcc.target/arm/simd/mve-vshr.c: Add tests for vshr.
      bfab3550
    • Christophe Lyon's avatar
      arm: Auto-vectorization for MVE: vshl · 7432f255
      Christophe Lyon authored
      This patch enables MVE vshlq instructions for auto-vectorization.
      
      The existing mve_vshlq_n_<supf><mode> is kept, as it takes a single
      immediate as second operand, and is used by arm_mve.h.
      
      We move the vashl<mode>3 insn from neon.md to an expander in
      vec-common.md, and the mve_vshlq_<supf><mode> insn from mve.md to
      vec-common.md, adding the second alternative fron neon.md.
      
      mve_vshlq_<supf><mode> will be used by a later patch enabling
      vectorization for vshr, as a unified version of
      ashl3<mode3>_[signed|unsigned] from neon.md. Keeping the use of unspec
      VSHLQ enables to generate both 's' and 'u' variants.
      
      It is not clear whether the neon_shift_[reg|imm]<q> attribute is still
      suitable, since this insn is also used for MVE.
      
      I kept the mve_vshlq_<supf><mode> naming instead of renaming it to
      ashl3_<supf>_<mode> as discussed because the reference in
      arm_mve_builtins.def automatically inserts the "mve_" prefix and I
      didn't want to make a special case for this.
      
      I haven't yet found why the v16qi and v8hi tests are not vectorized.
      With dest[i] = a[i] << b[i] and:
        {
          int i;
          unsigned int i.24_1;
          unsigned int _2;
          int16_t * _3;
          short int _4;
          int _5;
          int16_t * _6;
          short int _7;
          int _8;
          int _9;
          int16_t * _10;
          short int _11;
          unsigned int ivtmp_42;
          unsigned int ivtmp_43;
      
          <bb 2> [local count: 119292720]:
      
          <bb 3> [local count: 954449105]:
          i.24_1 = (unsigned int) i_23;
          _2 = i.24_1 * 2;
          _3 = a_15(D) + _2;
          _4 = *_3;
          _5 = (int) _4;
          _6 = b_16(D) + _2;
          _7 = *_6;
          _8 = (int) _7;
          _9 = _5 << _8;
          _10 = dest_17(D) + _2;
          _11 = (short int) _9;
          *_10 = _11;
          i_19 = i_23 + 1;
          ivtmp_42 = ivtmp_43 - 1;
          if (ivtmp_42 != 0)
            goto <bb 5>; [87.50%]
          else
            goto <bb 4>; [12.50%]
      
          <bb 5> [local count: 835156386]:
          goto <bb 3>; [100.00%]
      
          <bb 4> [local count: 119292720]:
          return;
      
        }
      the vectorizer says:
      mve-vshl.c:37:96: note:   ==> examining statement: _5 = (int) _4;
      mve-vshl.c:37:96: note:   vect_is_simple_use: operand *_3, type of def: internal
      mve-vshl.c:37:96: note:   vect_is_simple_use: vectype vector(8) short int
      mve-vshl.c:37:96: missed:   conversion not supported by target.
      mve-vshl.c:37:96: note:   vect_is_simple_use: operand *_3, type of def: internal
      mve-vshl.c:37:96: note:   vect_is_simple_use: vectype vector(8) short int
      mve-vshl.c:37:96: note:   vect_is_simple_use: operand *_3, type of def: internal
      mve-vshl.c:37:96: note:   vect_is_simple_use: vectype vector(8) short int
      mve-vshl.c:37:117: missed:   not vectorized: relevant stmt not supported: _5 = (int) _4;
      mve-vshl.c:37:96: missed:  bad operation or unsupported loop bound.
      mve-vshl.c:37:96: note:  ***** Analysis failed with vector mode V8HI
      
      2020-12-03  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	gcc/
      	* config/arm/mve.md (mve_vshlq_<supf><mode>): Move to
      	vec-commond.md.
      	* config/arm/neon.md (vashl<mode>3): Delete.
      	* config/arm/vec-common.md (mve_vshlq_<supf><mode>): New.
      	(vasl<mode>3): New expander.
      
      	gcc/testsuite/
      	* gcc.target/arm/simd/mve-vshl.c: Add tests for vshl.
      7432f255
    • Richard Biener's avatar
      tree-optimization/98685 - fix placement of extern converts · 2ea6f4a3
      Richard Biener authored
      Avoid advancing to the next stmt when inserting at region boundary
      and deal with a vector def being not the only child.
      
      2021-01-15  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/98685
      	* tree-vect-slp.c (vect_schedule_slp_node): Refactor handling
      	of vector extern defs.
      
      	* gcc.dg/vect/bb-slp-pr98685.c: New testcase.
      2ea6f4a3
    • Tamar Christina's avatar
      testsuite: Fix sed script errors in complex tests · c4eec1ef
      Tamar Christina authored
      I ran sed script late over the tests which accidentally
      introduced a syntax error in the tests.
      
      This fixes it.
      
      Committed under the obvious rule.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/complex/complex-mla-template.c: Fix sed.
      	* gcc.dg/vect/complex/complex-mls-template.c: Likewise.
      c4eec1ef
    • Ian Lance Taylor's avatar
      compiler: add support for reading embedcfg files · b0ccd392
      Ian Lance Taylor authored
      This is the code that parses an embedcfg file, which is a JSON file
      created by the go command when it sees go:embed directives.  This code
      is not yet called, and does not yet do anything.  It's being sent as a
      separate CL to isolate just the JSON parsing code.
      
      	* Make-lang.in (GO_OBJS): Add go/embed.o.
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281532
      b0ccd392
    • GCC Administrator's avatar
      Daily bump. · 5fff80fd
      GCC Administrator authored
      5fff80fd
  2. Jan 14, 2021
    • David Malcolm's avatar
      jit: remove "Alpha" warning from docs · b95d97f1
      David Malcolm authored
      I removed the "Alpha" warning from the JIT wiki page on
      2020-05-18:
        https://gcc.gnu.org/wiki/JIT?action=diff&rev1=47&rev2=48
      but forgot to remove it from the documentation, which this
      patch does.
      
      gcc/jit/ChangeLog:
      	* docs/cp/index.rst: Remove "Alpha" warning.
      	* docs/index.rst: Likewise.
      	* docs/_build/texinfo/libgccjit.texi: Regenerate
      b95d97f1
    • Jason Merrill's avatar
      c++: Minor refactoring in process_init_constructor_record · f1fc27b6
      Jason Merrill authored
      This function had two different local variables for TREE_TYPE (field), one
      of which shadowed a parameter, and wasn't using them consistently.
      
      gcc/cp/ChangeLog:
      
      	* typeck2.c (process_init_constructor_record): Use fldtype
      	variable consistently.
      f1fc27b6
    • David Malcolm's avatar
      Handle fancy_abort before diagnostic initialization [PR98586] · 387f6c15
      David Malcolm authored
      If fancy_abort is called before the diagnostic subsystem is initialized,
      internal_error will crash internally in a way that prevents a useful
      message reaching the user.
      
      This can happen with libgccjit in the case of gcc_assert failures
      that occur outside of the libgccjit mutex that guards the rest of
      gcc's state, including global_dc (when global_dc may not be
      initialized yet, or might be in use by another thread).
      
      I tried a few approaches to fixing this as noted in PR jit/98586
      e.g. using a temporary diagnostic_context and initializing it for
      the call to internal_error, however the more code that runs, the
      more chance there is for other errors to occur.
      
      The best fix appears to be to simply fall back to a minimal abort
      implementation that only relies on i18n, as implemented by this
      patch.
      
      gcc/ChangeLog:
      	PR jit/98586
      	* diagnostic.c (diagnostic_kind_text): Break out this array
      	from...
      	(diagnostic_build_prefix): ...here.
      	(fancy_abort): Detect when diagnostic_initialize has not yet been
      	called and fall back to a minimal implementation of printing the
      	ICE, rather than segfaulting in internal_error.
      387f6c15
    • François Dumont's avatar
      libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators · 02e7af11
      François Dumont authored
      libstdc++-v3/ChangeLog:
      
      	* testsuite/23_containers/deque/debug/98466.cc: Make it pre-C++11
      	compliant.
      02e7af11
    • David Malcolm's avatar
      Add GCC_EXTRA_DIAGNOSTIC_OUTPUT environment variable for fix-it hints · f1096055
      David Malcolm authored
      GCC has had the ability to emit fix-it hints in machine-readable form
      since GCC 7 via -fdiagnostics-parseable-fixits and
      -fdiagnostics-generate-patch.
      
      The former emits additional specially-formatted lines to stderr; the
      option and its format were directly taken from a pre-existing option
      in clang.
      
      Ideally this could be used by IDEs so that the user can select specific
      fix-it hints and have the IDE apply them to the user's source code
      (perhaps turning them into clickable elements, perhaps with an
      "Apply All" option, etc).  Eclipse CDT has supported this option in
      this way for a few years:
        https://bugs.eclipse.org/bugs/show_bug.cgi?id=497670
      
      As a user of Emacs I would like Emacs to support such a feature.
      https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25987 tracks supporting
      GCC fix-it output in Emacs.  The discussion there identifies two issues
      with the existing option:
      
      (a) columns in the output are specified as byte-offsets within the
      line (for exact compatibility with the option in clang), whereas emacs
      would prefer to consume them as what GCC 11 calls "display columns".
      https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-column-unit
      
      (b) injecting a command-line option into the build is a fiddly manual
      step, varying between build systems.  It's far easier for the
      user if Emacs simply sets an environment variable when compiling,
      GCC uses this to enable the option if it recognizes the value, and
      the emacs compilation buffer decodes the additional lines of output
      and adds appropriate widgets.  In some ways it is a workaround for
      not having a language server.  Doing it this way means that for the
      various combinations of older and newer GCC and older and newer Emacs
      that a sufficiently modern combination of both can automatically
      support the rich fix-it UI, whereas other combinations will either
      not provide the envvar, or silently ignore it, gracefully doing
      nothing extra.
      
      Hence this patch adds a new GCC_EXTRA_DIAGNOSTIC_OUTPUT environment
      variable to GCC which enables output of machine-parseable fix-it hints.
      
      GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v1 is equivalent to the existing
      -fdiagnostics-parseable-fixits option.
      
      GCC_EXTRA_DIAGNOSTIC_OUTPUT=fixits-v2 is the same, but changes the
      column output mode to "display columns" rather than bytes, as
      required by Emacs.
      
      The discussion in that Emacs bug has some concerns about the encoding
      of these lines, and, indeed, the encoding of GCC's stderr in general:
      currently we emit a mixture of bytes and UTF-8; I believe we emit
      filenames as bytes, diagnostic messages as UTF-8, and quote source code
      in the original encoding (PR other/93067 covers converting it to UTF-8 on
      output).  This patch prints octal-escaped bytes for bytes within
      filenames and replacement text that aren't printable (as per
      -fdiagnostics-parseable-fixits).
      
      gcc/ChangeLog:
      	* diagnostic.c (diagnostic_initialize): Eliminate
      	parseable_fixits_p in favor of initializing extra_output_kind from
      	GCC_EXTRA_DIAGNOSTIC_OUTPUT.
      	(convert_column_unit): New function, split out from...
      	(diagnostic_converted_column): ...this.
      	(print_parseable_fixits): Add "column_unit" and "tabstop" params.
      	Use them to call convert_column_unit on the column values.
      	(diagnostic_report_diagnostic): Eliminate conditional on
      	parseable_fixits_p in favor of a switch statement on
      	extra_output_kind, passing the appropriate values to the new
      	params of print_parseable_fixits.
      	(selftest::test_print_parseable_fixits_none): Update for new
      	params of print_parseable_fixits.
      	(selftest::test_print_parseable_fixits_insert): Likewise.
      	(selftest::test_print_parseable_fixits_remove): Likewise.
      	(selftest::test_print_parseable_fixits_replace): Likewise.
      	(selftest::test_print_parseable_fixits_bytes_vs_display_columns):
      	New.
      	(selftest::diagnostic_c_tests): Call it.
      	* diagnostic.h (enum diagnostics_extra_output_kind): New.
      	(diagnostic_context::parseable_fixits_p): Delete field in favor
      	of...
      	(diagnostic_context::extra_output_kind): ...this new field.
      	* doc/invoke.texi (Environment Variables): Add
      	GCC_EXTRA_DIAGNOSTIC_OUTPUT.
      	* opts.c (common_handle_option): Update handling of
      	OPT_fdiagnostics_parseable_fixits for change to diagnostic_context
      	fields.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/diagnostic-test-show-locus-GCC_EXTRA_DIAGNOSTIC_OUTPUT-fixits-v1.c:
      	New file.
      	* gcc.dg/plugin/diagnostic-test-show-locus-GCC_EXTRA_DIAGNOSTIC_OUTPUT-fixits-v2.c:
      	New file.
      	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.
      f1096055
    • Tamar Christina's avatar
      slp: Add Tests for complex mul, mls and mla" · 59832db9
      Tamar Christina authored
      This adds the initial tests for the complex mul, mls and mla.
      These will be enabled in the commits that add the optabs.
      
      Committed as obvious variations of existing tests.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/vect/complex/complex-mla-template.c: New test.
      	* gcc.dg/vect/complex/complex-mls-template.c: New test.
      	* gcc.dg/vect/complex/complex-mul-template.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-double.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mla-half-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-double.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mls-half-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-double.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-bb-slp-complex-mul-half-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mla-double.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mla-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mla-half-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mls-double.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mls-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mls-half-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mul-double.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mul-float.c: New test.
      	* gcc.dg/vect/complex/fast-math-complex-mul-half-float.c: New test.
      59832db9
    • Tamar Christina's avatar
      slp: Add complex operations class to share first match among all matchers · b50df1e7
      Tamar Christina authored
      This introduces a common class complex_operations_pattern which encapsulates
      the complex add, mul, fma and fms pattern in such a way so that the first match
      is shared.
      
      gcc/ChangeLog:
      
      	* tree-vect-slp-patterns.c (class complex_operations_pattern,
      	complex_operations_pattern::matches,
      	complex_operations_pattern::recognize,
      	complex_operations_pattern::build): New.
      	(slp_patterns): Use it.
      b50df1e7
    • Tamar Christina's avatar
      slp: support complex FMS and complex FMS conjugate · 478e571a
      Tamar Christina authored
      This adds support for FMS and FMS conjugated to the slp pattern matcher.
      
      Example of matches:
      
      #include <stdio.h>
      #include <complex.h>
      
      #define N 200
      #define ROT
      #define TYPE float
      #define TYPE2 float
      
      void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] -=  a[i] * (b[i] ROT);
          }
      }
      
      void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] -=  conjf (a[i]) * (b[i]);
          }
      }
      
      void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] -=  a[i] * conjf (b[i] ROT);
          }
      }
      
      void caxpy_sub(double complex * restrict y, double complex * restrict x, size_t N, double complex f) {
        for (size_t i = 0; i < N; ++i)
          y[i] -= x[i]* f;
      }
      
      gcc/ChangeLog:
      
      	* internal-fn.def (COMPLEX_FMS, COMPLEX_FMS_CONJ): New.
      	* optabs.def (cmls_optab, cmls_conj_optab): New.
      	* doc/md.texi: Document them.
      	* tree-vect-slp-patterns.c (class complex_fms_pattern,
      	complex_fms_pattern::matches, complex_fms_pattern::recognize,
      	complex_fms_pattern::build): New.
      478e571a
    • Tamar Christina's avatar
      slp: support complex FMA and complex FMA conjugate · 31fac318
      Tamar Christina authored
      This adds support for FMA and FMA conjugated to the slp pattern matcher.
      
      Example of instructions matched:
      
      #include <stdio.h>
      #include <complex.h>
      
      #define N 200
      #define ROT
      #define TYPE float
      #define TYPE2 float
      
      void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] +=  a[i] * (b[i] ROT);
          }
      }
      
      void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] +=  conjf (a[i]) * (b[i] ROT);
          }
      }
      
      void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] +=  a[i] * conjf (b[i] ROT);
          }
      }
      
      void caxpy_add(double complex * restrict y, double complex * restrict x, size_t N, double complex f) {
        for (size_t i = 0; i < N; ++i)
          y[i] += x[i]* f;
      }
      
      gcc/ChangeLog:
      
      	* internal-fn.def (COMPLEX_FMA, COMPLEX_FMA_CONJ): New.
      	* optabs.def (cmla_optab, cmla_conj_optab): New.
      	* doc/md.texi: Document them.
      	* tree-vect-slp-patterns.c (vect_match_call_p,
      	class complex_fma_pattern, vect_slp_reset_pattern,
      	complex_fma_pattern::matches, complex_fma_pattern::recognize,
      	complex_fma_pattern::build): New.
      31fac318
    • Tamar Christina's avatar
      slp: support complex multiply and complex multiply conjugate · e09173d8
      Tamar Christina authored
      This adds support for complex multiply and complex multiply and accumulate to
      the vect pattern detector.
      
      Example of instructions matched:
      
      #include <stdio.h>
      #include <complex.h>
      
      #define N 200
      #define ROT
      #define TYPE float
      #define TYPE2 float
      
      void g (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] =  a[i] * (b[i] ROT);
          }
      }
      
      void g_f1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] =  conjf (a[i]) * (b[i] ROT);
          }
      }
      
      void g_s1 (TYPE2 complex a[restrict N], TYPE complex b[restrict N], TYPE complex c[restrict N])
      {
        for (int i=0; i < N; i++)
          {
            c[i] =  a[i] * conjf (b[i] ROT);
          }
      }
      
      gcc/ChangeLog:
      
      	* internal-fn.def (COMPLEX_MUL, COMPLEX_MUL_CONJ): New.
      	* optabs.def (cmul_optab, cmul_conj_optab): New.
      	* doc/md.texi: Document them.
      	* tree-vect-slp-patterns.c (vect_match_call_complex_mla,
      	vect_normalize_conj_loc, is_eq_or_top, vect_validate_multiplication,
      	vect_build_combine_node, class complex_mul_pattern,
      	complex_mul_pattern::matches, complex_mul_pattern::recognize,
      	complex_mul_pattern::build): New.
      e09173d8
Loading