Skip to content
Snippets Groups Projects
  1. Jun 02, 2023
    • Thomas Schwinge's avatar
      Support parallel testing in libgomp: fallback Perl 'flock' [PR66005] · 04abe194
      Thomas Schwinge authored
      Follow-up to commit 6c3b30ef
      "Support parallel testing in libgomp, part II [PR66005]"
      ("..., and enable if 'flock' is available for serializing execution testing"),
      where we saw:
      
      > On my Dell Precision 7530 laptop:
      >
      >     $ uname -srvi
      >     Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64
      >     $ grep '^model name' < /proc/cpuinfo | uniq -c
      >          12 model name      : Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      >     $ nvidia-smi -L
      >     GPU 0: Quadro P1000 (UUID: GPU-e043973b-b52a-d02b-c066-a8fdbf64e8ea)
      >
      > ... [...]: case (c) standard configuration, no offloading
      > configured, [...]
      
      >     $ \time make check-target-libgomp
      >
      > Case (c), baseline; [...]:
      >
      >     1180.98user 110.80system 19:36.40elapsed 109%CPU (0avgtext+0avgdata 505148maxresident)k
      >     1133.22user 111.08system 19:35.75elapsed 105%CPU (0avgtext+0avgdata 505212maxresident)k
      >
      > Case (c), parallelized [using 'flock']:
      >
      > [...]
      >     -j12 GCC_TEST_PARALLEL_SLOTS=12
      >     2591.04user 192.64system 4:44.98elapsed 976%CPU (0avgtext+0avgdata 505216maxresident)k
      >     2581.23user 195.21system 4:47.51elapsed 965%CPU (0avgtext+0avgdata 505212maxresident)k
      
      Quite the same when instead of 'flock' using this fallback Perl 'flock':
      
          2565.23user 194.35system 4:46.77elapsed 962%CPU (0avgtext+0avgdata 505216maxresident)k
          2549.38user 200.20system 4:46.08elapsed 961%CPU (0avgtext+0avgdata 505216maxresident)k
      
      	PR testsuite/66005
      	gcc/
      	* doc/install.texi: Document (optional) Perl usage for parallel
      	testing of libgomp.
      	libgomp/
      	* testsuite/lib/libgomp.exp: 'flock' through stdout.
      	* testsuite/flock: New.
      	* configure.ac (FLOCK): Point to that if no 'flock' available, but
      	'perl' is.
      	* configure: Regenerate.
      04abe194
    • Thomas Schwinge's avatar
      Remove stale Autoconf checks for Perl · 49153588
      Thomas Schwinge authored
      Subversion r110220 (Git commit 03b8fe49) for
      PR25884 "libgomp should not require perl to compile" removed all '$(PERL)'
      usage from libgomp -- but didn't remove the then-unused Autoconf Perl check
      itself.  Later, this Autoconf Perl check appears to have been copied from
      libgomp into other GCC libraries, likewise unused.
      
      	libgomp/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* testsuite/Makefile.in: Likewise.
      	libatomic/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* testsuite/Makefile.in: Likewise.
      	libgm2/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* libm2cor/Makefile.in: Likewise.
      	* libm2iso/Makefile.in: Likewise.
      	* libm2log/Makefile.in: Likewise.
      	* libm2min/Makefile.in: Likewise.
      	* libm2pim/Makefile.in: Likewise.
      	libitm/
      	* configure.ac (PERL): Remove.
      	* configure: Regenerate.
      	* Makefile.in: Likewise.
      	* testsuite/Makefile.in: Likewise.
      49153588
    • Thomas Schwinge's avatar
      Back to requiring "Perl version 5.6.1 (or later)" [PR82856] · 9edb6725
      Thomas Schwinge authored
      With Subversion r265695 (Git commit 22e05272)
      "Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856)" we're back
      to normal; per Automake 1.15.1 'configure.ac' still "[...] perl 5.6 or better
      is required [...]".
      
      	PR bootstrap/82856
      	gcc/
      	* doc/install.texi (Perl): Back to requiring "Perl version 5.6.1 (or
      	later)".
      9edb6725
    • Paul Thomas's avatar
      Fortran: Fix some problems blocking associate meta-bug [PR87477] · 3c2eba4b
      Paul Thomas authored
      2023-06-02  Paul Thomas  <pault@gcc.gnu.org>
      
      gcc/fortran
      	PR fortran/87477
      	* parse.cc (parse_associate): Replace the existing evaluation
      	of the target rank with calls to gfc_resolve_ref and
      	gfc_expression_rank. Identify untyped target function results
      	with structure constructors by finding the appropriate derived
      	type.
      	* resolve.cc (resolve_symbol): Allow associate variables to be
      	assumed shape.
      
      gcc/testsuite/
      	PR fortran/87477
      	* gfortran.dg/associate_54.f90 : Cope with extra error.
      
      	PR fortran/102109
      	* gfortran.dg/pr102109.f90 : New test.
      
      	PR fortran/102112
      	* gfortran.dg/pr102112.f90 : New test.
      
      	PR fortran/102190
      	* gfortran.dg/pr102190.f90 : New test.
      
      	PR fortran/102532
      	* gfortran.dg/pr102532.f90 : New test.
      
      	PR fortran/109948
      	* gfortran.dg/pr109948.f90 : New test.
      
      	PR fortran/99326
      	* gfortran.dg/pr99326.f90 : New test.
      3c2eba4b
    • Juzhe-Zhong's avatar
      RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid · a06b9435
      Juzhe-Zhong authored
      Base on these:
      https://github.com/riscv-non-isa/rvv-intrinsic-doc/issues/232
      https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/233
      
      
      
      Add _mu C++ overloaded intrinsics for load && viota && vid.
      
      Co-authored-by: default avatarKuanLin Chen <best124612@gmail.com>
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc: Add _mu overloaded intrinsics.
      	* config/riscv/riscv-vector-builtins-shapes.cc (struct fault_load_def): Ditto.
      a06b9435
    • Juzhe-Zhong's avatar
      RISC-V: Optimize reverse series index vector · 265357d4
      Juzhe-Zhong authored
      This patch optimizes the following seriese vector:
      [nunits - 1, nunits - 2, ...., 0]
      
      Before this patch:
      vid
      vmul
      vadd
      
      After this patch:
      vid
      vrsub
      
      This patch is an obvious and simple optimization, ok for trunk?
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-v.cc (expand_vec_series): Optimize reverse series index vector.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-4.c: Add assembly check.
      265357d4
    • Juzhe-Zhong's avatar
      RISC-V: Fix warning in predicated.md · 37ff12b9
      Juzhe-Zhong authored
      Notice there is warning in predicates.md:
      ../../../riscv-gcc/gcc/config/riscv/predicates.md: In function ‘bool arith_operand_or_mode_mask(rtx, machine_mode)’:
      ../../../riscv-gcc/gcc/config/riscv/predicates.md:33:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   (match_test "INTVAL (op) == GET_MODE_MASK (HImode)
      ../../../riscv-gcc/gcc/config/riscv/predicates.md:34:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           || INTVAL (op) == GET_MODE_MASK (SImode)"))))
      
      gcc/ChangeLog:
      
      	* config/riscv/predicates.md: Change INTVAL into UINTVAL.
      37ff12b9
    • YunQiang Su's avatar
      MAINTAINERS: Add myself as MIPS port maintainer · 4fe6e122
      YunQiang Su authored
      ChangeLog:
      
      	* MAINTAINERS (CPU Port Maintainers): Add myself as MIPS
      	port maintainer.
      	(Write After Approval): Remove myself.
      4fe6e122
    • Pan Li's avatar
      RISC-V: Add test for vfloat16*_t (non tuple) types · 691805ff
      Pan Li authored
      
      This patch would like to add some test cases of vfloat16*_t (non tuple),
      no 'zvfh' or 'zvfhmin' will meet unknown type.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/abi-16.c: Add test cases.
      	* gcc.target/riscv/rvv/base/user-7.c: Likewise.
      691805ff
    • Juzhe-Zhong's avatar
      RISC-V: Add __RISCV_ prefix to VXRM and FRM enum · d5ea84cd
      Juzhe-Zhong authored
      According to doc:
      https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/222/files
      https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/226
      
      Add __RISCV_ prefix to VXRM and FRM enum.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins.cc (DEF_RVV_VXRM_ENUM): Add
      	__RISCV_ prefix.
      	(DEF_RVV_FRM_ENUM): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/frm-1.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-1.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-10.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-11.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-12.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-6.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-7.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-8.c: Ditto.
      	* gcc.target/riscv/rvv/base/vxrm-9.c: Ditto.
      d5ea84cd
    • Juzhe-Zhong's avatar
      RISC-V: Add vwadd.wv/vwsub.wv auto-vectorization lowering optimization · 91430b73
      Juzhe-Zhong authored
      1. This patch optimize the codegen of the following auto-vectorization codes:
      
      void foo (int32_t * __restrict a, int64_t * __restrict b, int64_t * __restrict c, int n)
      {
          for (int i = 0; i < n; i++)
            c[i] = (int64_t)a[i] + b[i];
      }
      
      Combine instruction from:
      
      ...
      vsext.vf2
      vadd.vv
      ...
      
      into:
      
      ...
      vwadd.wv
      ...
      
      Since for PLUS operation, GCC prefer the following RTL operand order when combining:
      
      (plus: (sign_extend:..)
             (reg:)
      
      instead of
      
      (plus: (reg:..)
             (sign_extend:)
      
      which is different from MINUS pattern.
      
      I split patterns of vwadd/vwsub, and add dedicated patterns for them.
      
      2. This patch not only optimize the case as above (1) mentioned, also enhance vwadd.vv/vwsub.vv
         optimization for complicate PLUS/MINUS codes, consider this following codes:
      
      __attribute__ ((noipa)) void
      vwadd_int16_t_int8_t (int16_t *__restrict dst, int16_t *__restrict dst2,
      		      int16_t *__restrict dst3, int8_t *__restrict a,
      		      int8_t *__restrict b, int8_t *__restrict a2,
      		      int8_t *__restrict b2, int n)
      {
        for (int i = 0; i < n; i++)
          {
            dst[i] = (int16_t) a[i] + (int16_t) b[i];
            dst2[i] = (int16_t) a2[i] + (int16_t) b[i];
            dst3[i] = (int16_t) a2[i] + (int16_t) a[i];
          }
      }
      
      Before this patch:
      ...
      	vsetvli zero,a6,e8,mf2,ta,ma
      	vle8.v  v2,0(a3)
      	vle8.v  v1,0(a4)
      	vsetvli t1,zero,e16,m1,ta,ma
      	vsext.vf2       v3,v2
      	vsext.vf2       v2,v1
      	vadd.vv v1,v2,v3
      	vsetvli zero,a6,e16,m1,ta,ma
      	vse16.v v1,0(a0)
      	vle8.v  v4,0(a5)
      	vsetvli t1,zero,e16,m1,ta,ma
      	vsext.vf2       v1,v4
      	vadd.vv v2,v1,v2
      ...
      
      After this patch:
      ...
      	vsetvli	zero,a6,e8,mf2,ta,ma
      	vle8.v	v3,0(a4)
      	vle8.v	v1,0(a3)
      	vsetvli	t4,zero,e8,mf2,ta,ma
      	vwadd.vv	v2,v1,v3
      	vsetvli	zero,a6,e16,m1,ta,ma
      	vse16.v	v2,0(a0)
      	vle8.v	v2,0(a5)
      	vsetvli	t4,zero,e8,mf2,ta,ma
      	vwadd.vv	v4,v3,v2
      	vsetvli	zero,a6,e16,m1,ta,ma
      	vse16.v	v4,0(a1)
      	vsetvli	t4,zero,e8,mf2,ta,ma
      	sub	a7,a7,a6
      	vwadd.vv	v3,v2,v1
      	vsetvli	zero,a6,e16,m1,ta,ma
      	vse16.v	v3,0(a2)
      ...
      
      The reason why current upstream GCC can not optimize codes using vwadd thoroughly is combine PASS
      needs intermediate RTL IR (extend one of the operand pattern (vwadd.wv)), then base on this intermediate
      RTL IR, extend the other operand to generate vwadd.vv.
      
      So vwadd.wv/vwsub.wv definitely helps to vwadd.vv/vwsub.vv code optimizations.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins-bases.cc: Change vwadd.wv/vwsub.wv
      	intrinsic API expander
      	* config/riscv/vector.md
      	(@pred_single_widen_<plus_minus:optab><any_extend:su><mode>): Remove it.
      	(@pred_single_widen_sub<any_extend:su><mode>): New pattern.
      	(@pred_single_widen_add<any_extend:su><mode>): New pattern.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/widen/widen-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/widen/widen-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/widen/widen-complicate-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/widen/widen-complicate-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/widen/widen_run-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/widen/widen_run-6.c: New test.
      91430b73
    • Juzhe-Zhong's avatar
      RISC-V: Support RVV permutation auto-vectorization · bf9eee73
      Juzhe-Zhong authored
      This patch supports vector permutation for VLS only by vec_perm pattern.
      We will support TARGET_VECTORIZE_VEC_PERM_CONST to support VLA permutation
      in the future.
      
      Fixed following comments from Robin.
      
      gcc/ChangeLog:
      
      	* config/riscv/autovec.md (vec_perm<mode>): New pattern.
      	* config/riscv/predicates.md (vector_perm_operand): New predicate.
      	* config/riscv/riscv-protos.h (enum insn_type): New enum.
      	(expand_vec_perm): New function.
      	* config/riscv/riscv-v.cc (const_vec_all_in_range_p): Ditto.
      	(gen_const_vector_dup): Ditto.
      	(emit_vlmax_gather_insn): Ditto.
      	(emit_vlmax_masked_gather_mu_insn): Ditto.
      	(expand_vec_perm): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-3.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-4.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm-7.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm.h: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-1.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-2.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-3.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-4.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-5.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-6.c: New test.
      	* gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-7.c: New test.
      bf9eee73
    • GCC Administrator's avatar
      Daily bump. · 84749914
      GCC Administrator authored
      84749914
  2. Jun 01, 2023
    • Harald Anlauf's avatar
      Fortran: force error on bad KIND specifier [PR88552] · ff8f45d2
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/88552
      	* decl.cc (gfc_match_kind_spec): Use error path on missing right
      	parenthesis.
      	(gfc_match_decl_type_spec): Use error return when an error occurred
      	during matching a KIND specifier.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/88552
      	* gfortran.dg/pr88552.f90: New test.
      ff8f45d2
    • Vineet Gupta's avatar
      testsuite: print any leaking torture options for debugging · 3bb8ebb6
      Vineet Gupta authored
      
      This was helpful when debugging the recent multilib testsuite failure.
      
      gcc/testsuite:
      	* lib/torture-options.exp: print the value of non-empty options:
      	torture_without_loops, torture_with_loops, LTO_TORTURE_OPTIONS.
      
      Signed-off-by: default avatarVineet Gupta <vineetg@rivosinc.com>
      3bb8ebb6
    • Vineet Gupta's avatar
      testsuite: Unbork multilib setups using -march flags (RISC-V) · 8dde92fd
      Vineet Gupta authored
      
      RISC-V multilib testing is currently busted with follow splat all over:
      
      |    Schedule of variations:
      |        riscv-sim/-march=rv64imafdc/-mabi=lp64d/-mcmodel=medlow
      |        riscv-sim/-march=rv32imafdc/-mabi=ilp32d/-mcmodel=medlow
      |        riscv-sim/-march=rv32imac/-mabi=ilp32/-mcmodel=medlow
      |        riscv-sim/-march=rv64imac/-mabi=lp64/-mcmodel=medlow
      ...
      ...
      | ERROR: tcl error code NONE
      | ERROR: torture-init: torture_without_loops is not empty as expected
      
      causing insane amount of false failures.
      
      |               ========= Summary of gcc testsuite =========
      |                            | # of unexpected case / # of unique unexpected case
      |                            |          gcc |          g++ |     gfortran |
      | rv64imafdc/  lp64d/ medlow | 5421 /     4 |    1 /     1 |    6 /     1 |
      | rv32imafdc/ ilp32d/ medlow | 5422 /     5 |    3 /     2 |    6 /     1 |
      |   rv32imac/  ilp32/ medlow |  391 /     5 |    3 /     2 |   43 /     8 |
      |   rv64imac/   lp64/ medlow | 5422 /     5 |    1 /     1 |   43 /     8 |
      
      The error splat itself is from recent test harness improvements for stricter
      checks for torture-{init,finish} pairing. But the real issue is a latent bug
      from 2009: commit 3dd1415d, ("i386-prefetch.exp: Skip tests when multilib
      flags contain -march") which added an "early exit" condition to i386-prefetch.exp
      which could potentially cause an unpaired torture-{init,finish}.
      
      The early exit only happens in a multlib setup using -march in flags
      which is what RISC-V happens to use, hence the reason this was only seen
      on RISC-V multilib testing.
      
      Moving the early exit outside of torture-{init,finish} bracket
      reinstates RISC-V testing.
      
      | rv64imafdc/  lp64d/ medlow |    3 /     2 |    1 /     1 |    6 /     1 |
      | rv32imafdc/ ilp32d/ medlow |    4 /     3 |    3 /     2 |    6 /     1 |
      |   rv32imac/  ilp32/ medlow |    3 /     2 |    3 /     2 |   43 /     8 |
      |   rv64imac/   lp64/ medlow |    5 /     4 |    1 /     1 |   43 /     8 |
      
      gcc/testsuite:
      	* gcc.misc-tests/i386-prefetch.exp: Move early return outside
      	the torture-{init,finish}
      
      Signed-off-by: default avatarVineet Gupta <vineetg@rivosinc.com>
      8dde92fd
    • Jason Merrill's avatar
      doc: improve docs for -pedantic{,-errors} · 5fccebdb
      Jason Merrill authored
      Recent discussion of -Wimplicit led me to want to clarify this section of
      the documentation, and mark which diagnostics other than -Wpedantic are
      affected by -pedantic-errors.
      
      gcc/ChangeLog:
      
      	* doc/invoke.texi (-Wpedantic): Improve clarity.
      5fccebdb
    • David Edelsohn's avatar
      testsuite: Skip powerpc tests on AIX. · ed54532e
      David Edelsohn authored
      
      AIX does not support -mstrict-align.
      
      pr109566.c had skip directive in wrong order for DejaGNU.
      
      	* gcc.target/powerpc/pr100106-sa.c: Skip on AIX.
      	* gcc.target/powerpc/pr109566.c: Skip on AIX.
      
      Signed-off-by: default avatarDavid Edelsohn <dje.gcc@gmail.com>
      ed54532e
    • Jonathan Wakely's avatar
      libstdc++: Fix PSTL test that fails in C++20 · f8403c43
      Jonathan Wakely authored
      This test fails in C++20 and later due to a warning:
      
      warning: C++20 says that these are ambiguous, even though the second is reversed:
      note: candidate 1: 'bool MyClass::operator==(const MyClass&)'
      note: candidate 2: 'bool MyClass::operator==(const MyClass&)' (reversed)
      note: try making the operator a 'const' member function
      FAIL: 26_numerics/pstl/numeric_ops/transform_reduce.cc (test for excess errors)
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/26_numerics/pstl/numeric_ops/transform_reduce.cc:
      	Add const to equality operator.
      f8403c43
    • Jonathan Wakely's avatar
      libstdc++: Do not use std::expected::value() in monadic ops (LWG 3938) · fe94f8b7
      Jonathan Wakely authored
      The monadic operations in std::expected always check has_value() so we
      can avoid the execptional path in value() and the assertions in error()
      by accessing _M_val and _M_unex directly. This means that the monadic
      operations no longer require _M_unex to be copyable so that it can be
      thrown from value(), as modified by LWG 3938.
      
      This also fixes two incorrect uses of std::move in transform(F&&)& and
      transform(F&&) const& which I found while making these changes.
      
      Now that move-only error types are supported, it's possible to properly
      test the constraints that LWG 3877 added to and_then and transform. The
      lwg3877.cc test now does that.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/expected (expected::and_then, expected::or_else)
      	(expected::transform_error): Use _M_val and _M_unex instead of
      	calling value() and error(), as per LWG 3938.
      	(expected::transform): Likewise. Remove incorrect std::move
      	calls from lvalue overloads.
      	(expected<void, E>::and_then, expected<void, E>::or_else)
      	(expected<void, E>::transform): Use _M_unex instead of calling
      	error().
      	* testsuite/20_util/expected/lwg3877.cc: Add checks for and_then
      	and transform, and for std::expected<void, E>.
      	* testsuite/20_util/expected/lwg3938.cc: New test.
      fe94f8b7
    • Jonathan Wakely's avatar
      libstdc++: Fix code size regressions in std::vector [PR110060] · b7b255e7
      Jonathan Wakely authored
      My r14-1452-gfb409a15d9babc change to add optimization hints to
      std::vector causes regressions because it makes std::vector::size() and
      std::vector::capacity() too big to inline. That's the opposite of what
      I wanted, so revert the changes to those functions.
      
      To achieve the original aim of optimizing vec.assign(vec.size(), x) we
      can add a local optimization hint to _M_fill_assign, so that it doesn't
      affect all other uses of size() and capacity().
      
      Additionally, add the same hint to the _M_assign_aux overload for
      forward iterators and add that to the testcase.
      
      It would be nice to similarly optimize:
        if (vec1.size() == vec2.size()) vec1 = vec2;
      but adding hints to operator=(const vector&) doesn't help. Presumably
      the relationships between the two sizes and two capacities are too
      complex to track effectively.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110060
      	* include/bits/stl_vector.h (_Vector_base::_M_invariant):
      	Remove.
      	(vector::size, vector::capacity): Remove calls to _M_invariant.
      	* include/bits/vector.tcc (vector::_M_fill_assign): Add
      	optimization hint to reallocating path.
      	(vector::_M_assign_aux(FwdIter, FwdIter, forward_iterator_tag)):
      	Likewise.
      	* testsuite/23_containers/vector/capacity/invariant.cc: Moved
      	to...
      	* testsuite/23_containers/vector/modifiers/assign/no_realloc.cc:
      	...here. Check assign(FwdIter, FwdIter) too.
      	* testsuite/23_containers/vector/types/1.cc: Revert addition
      	of -Wno-stringop-overread option.
      b7b255e7
    • Jonathan Wakely's avatar
      libstdc++: Document removal of implicit allocator rebinding extensions · 8cbaf679
      Jonathan Wakely authored
      Traditionally libstdc++ allowed containers and strings to be
      instantiated with allocator's that have the wrong value type, implicitly
      rebinding the allocator to the container's value type. Since C++20 that
      has been explicitly ill-formed, so the extension is no longer supported
      in strict modes (e.g. -std=c++17) and in C++20 and later.
      
      libstdc++-v3/ChangeLog:
      
      	* doc/xml/manual/evolution.xml: Document removal of implicit
      	allocator rebinding extensions in strict mode and for C++20.
      	* doc/html/*: Regenerate.
      8cbaf679
    • Uros Bizjak's avatar
      cse: Change return type of predicate functions from int to bool · dec7aaab
      Uros Bizjak authored
      Also change some function arguments to bool and remove one instance
      of always zero function argument.
      
      gcc/ChangeLog:
      
      	* rtl.h (exp_equiv_p): Change return type from int to bool.
      	* cse.cc (mention_regs): Change return type from int to bool
      	and adjust function body accordingly.
      	(exp_equiv_p): Ditto.
      	(insert_regs): Ditto. Change "modified" function argument to bool
      	and update usage accordingly.
      	(record_jump_cond): Remove always zero "reversed_nonequality"
      	function argument and update usage accordingly.
      	(fold_rtx): Change "changed" variable to bool.
      	(record_jump_equiv): Remove unneeded "reversed_nonequality" variable.
      	(is_dead_reg): Change return type from int to bool.
      dec7aaab
    • Takayuki 'January June' Suwa's avatar
      xtensa: Add 'adddi3' and 'subdi3' insn patterns · fe3ce086
      Takayuki 'January June' Suwa authored
      More optimized than the default RTL generation.
      
      gcc/ChangeLog:
      
      	* config/xtensa/xtensa.md (adddi3, subdi3):
      	New RTL generation patterns implemented according to the instruc-
      	tion idioms described in the Xtensa ISA reference manual (p. 600).
      fe3ce086
    • Roger Sayle's avatar
      PR target/109973: CCZmode and CCCmode variants of [v]ptest on x86. · 3635e8c6
      Roger Sayle authored
      This is my proposed minimal fix for PR target/109973 (hopefully suitable
      for backporting) that follows Jakub Jelinek's suggestion that we introduce
      CCZmode and CCCmode variants of ptest and vptest, so that the i386
      backend treats [v]ptest instructions similarly to testl instructions;
      using different CCmodes to indicate which condition flags are desired,
      and then relying on the RTL cmpelim pass to eliminate redundant tests.
      
      This conveniently matches Intel's intrinsics, that provide different
      functions for retrieving different flags, _mm_testz_si128 tests the
      Z flag, _mm_testc_si128 tests the carry flag.  Currently we use the
      same instruction (pattern) for both, and unfortunately the *ptest<mode>_and
      optimization is only valid when the ptest/vptest instruction is used to
      set/test the Z flag.
      
      The downside, as predicted by Jakub, is that GCC's cmpelim pass is
      currently COMPARE-centric and not able to merge the ptests from expressions
      such as _mm256_testc_si256 (a, b) + _mm256_testz_si256 (a, b), which is a
      known issue, PR target/80040.
      
      2023-06-01  Roger Sayle  <roger@nextmovesoftware.com>
      	    Uros Bizjak  <ubizjak@gmail.com>
      
      gcc/ChangeLog
      	PR target/109973
      	* config/i386/i386-builtin.def (__builtin_ia32_ptestz128): Use new
      	CODE_for_sse4_1_ptestzv2di.
      	(__builtin_ia32_ptestc128): Use new CODE_for_sse4_1_ptestcv2di.
      	(__builtin_ia32_ptestz256): Use new CODE_for_avx_ptestzv4di.
      	(__builtin_ia32_ptestc256): Use new CODE_for_avx_ptestcv4di.
      	* config/i386/i386-expand.cc (ix86_expand_branch): Use CCZmode
      	when expanding UNSPEC_PTEST to compare against zero.
      	* config/i386/i386-features.cc (scalar_chain::convert_compare):
      	Likewise generate CCZmode UNSPEC_PTESTs when converting comparisons.
      	(general_scalar_chain::convert_insn): Use CCZmode for COMPARE result.
      	(timode_scalar_chain::convert_insn): Use CCZmode for COMPARE result.
      	* config/i386/i386-protos.h (ix86_match_ptest_ccmode): Prototype.
      	* config/i386/i386.cc (ix86_match_ptest_ccmode): New predicate to
      	check for suitable matching modes for the UNSPEC_PTEST pattern.
      	* config/i386/sse.md (define_split): When splitting UNSPEC_MOVMSK
      	to UNSPEC_PTEST, preserve the FLAG_REG mode as CCZ.
      	(*<sse4_1>_ptest<mode>): Add asterisk to hide define_insn.  Remove
      	":CC" mode of FLAGS_REG, instead use ix86_match_ptest_ccmode.
      	(<sse4_1>_ptestz<mode>): New define_expand to specify CCZ.
      	(<sse4_1>_ptestc<mode>): New define_expand to specify CCC.
      	(<sse4_1>_ptest<mode>): A define_expand using CC to preserve the
      	current behavior.
      	(*ptest<mode>_and): Specify CCZ to only perform this optimization
      	when only the Z flag is required.
      
      gcc/testsuite/ChangeLog
      	PR target/109973
      	* gcc.target/i386/pr109973-1.c: New test case.
      	* gcc.target/i386/pr109973-2.c: Likewise.
      3635e8c6
    • Jason Merrill's avatar
      libstdc++: optimize EH phase 2 · 5d9c9119
      Jason Merrill authored
      In the ABI's two-phase EH model, first we walk the stack looking for a
      handler, then we walk the stack running cleanups until we reach that
      handler.  In the cleanup phase, we shouldn't redundantly check the handlers
      along the way, e.g. when walking through g():
      
        void f() { throw 42; }
        void g() { try { f(); } catch (void *) { } }
        int main() { try { g(); } catch (int) { } }
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Don't check
      	handlers in the cleanup phase.
      5d9c9119
    • Jonathan Wakely's avatar
      doc: Fix description of x86 -m32 option [PR109954] · eeb92704
      Jonathan Wakely authored
      This option does not imply -march=i386 so it's incorrect to say it
      generates code that will run on "any i386 system".
      
      gcc/ChangeLog:
      
      	PR target/109954
      	* doc/invoke.texi (x86 Options): Fix description of -m32 option.
      eeb92704
    • Matthias Kretz's avatar
      libstdc++: Fix condition for supported SIMD types on ARMv8 · 2fbbaa77
      Matthias Kretz authored
      
      Signed-off-by: default avatarMatthias Kretz <m.kretz@gsi.de>
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110050
      	* include/experimental/bits/simd.h (__vectorized_sizeof): With
      	__have_neon_a32 only single-precision float works (in addition
      	to integers).
      2fbbaa77
    • Kyrylo Tkachov's avatar
      aarch64: Add =r,m and =m,r alternatives to 64-bit vector move patterns · 12e71b59
      Kyrylo Tkachov authored
      We can use the X registers to load and store 64-bit vector modes, we just need to add the alternatives
      to the mov patterns. This straightforward patch does that and for the pair variants too.
      For the testcase in the code we now generate the optimal assembly without any superfluous
      GP<->SIMD moves.
      
      Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-simd.md (*aarch64_simd_mov<VDMOV:mode>):
      	Add =r,m and =r,m alternatives.
      	(load_pair<DREG:mode><DREG2:mode>): Likewise.
      	(vec_store_pair<DREG:mode><DREG2:mode>): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/aarch64/xreg-vec-modes_1.c: New test.
      12e71b59
    • Tobias Burnus's avatar
      OpenMP/Fortran: Permit pure directives inside PURE · 2df7e451
      Tobias Burnus authored
      Update permitted directives for directives marked in OpenMP's 5.2 as pure.
      To ensure that list is updated, unimplemented directives are placed into
      pure-2.f90 such the test FAILs once a known to be pure directive is
      implemented without handling its pureness.
      
      gcc/fortran/ChangeLog:
      
      	* parse.cc (decode_omp_directive): Accept all pure directives
      	inside a PURE procedures; handle 'error at(execution).
      
      libgomp/ChangeLog:
      
      	* libgomp.texi (OpenMP 5.2): Mark pure-directive handling as 'Y'.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/gomp/nothing-2.f90: Remove one dg-error.
      	* gfortran.dg/gomp/pr79154-2.f90: Update expected dg-error wording.
      	* gfortran.dg/gomp/pr79154-simd.f90: Likewise.
      	* gfortran.dg/gomp/pure-1.f90: New test.
      	* gfortran.dg/gomp/pure-2.f90: New test.
      	* gfortran.dg/gomp/pure-3.f90: New test.
      	* gfortran.dg/gomp/pure-4.f90: New test.
      2df7e451
    • Pan Li's avatar
      RISC-V: Introduce vfloat16m{f}*_t and their machine mode. · 0b317a60
      Pan Li authored
      
      This patch would like to introduce the built-in type vfloat16m{f}*_t, as
      well as their machine mode VNx*HF. They depend on architecture zvfhmin
      or zvfh.
      
      When givn the zvfhmin or zvfh, the macro TARGET_VECTOR_ELEN_FP_16 will
      be true.
      
      The underlying PATCH will implement the zvfhmin extension based on this.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      
      gcc/ChangeLog:
      
      	* common/config/riscv/riscv-common.cc: Add FP_16 mask to zvfhmin
      	and zvfh.
      	* config/riscv/genrvv-type-indexer.cc (valid_type): Allow FP16.
      	(main): Disable FP16 tuple.
      	* config/riscv/riscv-opts.h (MASK_VECTOR_ELEN_FP_16): New macro.
      	(TARGET_VECTOR_ELEN_FP_16): Ditto.
      	* config/riscv/riscv-vector-builtins.cc (check_required_extensions):
      	Add FP16.
      	* config/riscv/riscv-vector-builtins.def (vfloat16mf4_t): New type.
      	(vfloat16mf2_t): Ditto.
      	(vfloat16m1_t): Ditto.
      	(vfloat16m2_t): Ditto.
      	(vfloat16m4_t): Ditto.
      	(vfloat16m8_t): Ditto.
      	* config/riscv/riscv-vector-builtins.h (RVV_REQUIRE_ELEN_FP_16):
      	New macro.
      	* config/riscv/riscv-vector-switch.def (ENTRY): Allow FP16
      	machine mode based on TARGET_VECTOR_ELEN_FP_16.
      0b317a60
    • François Dumont's avatar
      libstdc++: Reduce <functional> inclusion to <stl_algobase.h> · 940645ce
      François Dumont authored
      Move the std::search definition from stl_algo.h to stl_algobase.h and use
      the later in <functional>.
      
      For consistency also move std::__parallel::search and associated helpers from
      <parallel/stl_algo.h> to <parallel/stl_algobase.h> so that std::__parallel::search
      is accessible along with std::search.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_algo.h
      	(std::__search, std::search(_FwdIt1, _FwdIt1, _FwdIt2, _FwdIt2, _BinPred)): Move...
      	* include/bits/stl_algobase.h: ...here.
      	* include/std/functional: Replace <stl_algo.h> include by <stl_algobase.h>.
      	* include/parallel/algo.h (std::__parallel::search<_FIt1, _FIt2, _BinaryPred>)
      	(std::__parallel::__search_switch<_FIt1, _FIt2, _BinaryPred, _ItTag1, _ItTag2>):
      	Move...
      	* include/parallel/algobase.h: ...here.
      	* include/experimental/functional: Remove <bits/stl_algo.h> and <parallel/algorithm>
      	includes. Include <bits/stl_algobase.h>.
      940645ce
    • Jason Merrill's avatar
      c++: make -fpermissive avoid -Werror=narrowing · 0a479c31
      Jason Merrill authored
      Currently we make -Wnarrowing an error by default by forcing pedantic_errors
      on, but for consistency -fpermissive should prevent that.
      
      In general I'm inclined to move away from using permerror in favor of this
      kind of model, with specific flags for each diagnostic.
      
      gcc/cp/ChangeLog:
      
      	* typeck2.cc (check_narrowing): Check flag_permissive.
      0a479c31
    • GCC Administrator's avatar
      Daily bump. · 09ff83d4
      GCC Administrator authored
      09ff83d4
    • Juzhe-Zhong's avatar
      RISC-V: Add RVV FRM enum for floating-point rounding mode intriniscs · 443613ca
      Juzhe-Zhong authored
      gcc/ChangeLog:
      
      	* config/riscv/riscv-vector-builtins.cc (register_frm): New function.
      	(DEF_RVV_FRM_ENUM): New macro.
      	(handle_pragma_vector): Add FRM enum
      	* config/riscv/riscv-vector-builtins.def (DEF_RVV_FRM_ENUM): New macro.
      	(RNE): Ditto.
      	(RTZ): Ditto.
      	(RDN): Ditto.
      	(RUP): Ditto.
      	(RMM): Ditto.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/base/frm-1.c: New test.
      443613ca
  3. May 31, 2023
    • Roger Sayle's avatar
      Refactor wi::bswap as a function (instead of a method). · 0ede6b5a
      Roger Sayle authored
      This patch implements Richard Sandiford's suggestion from
      https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618215.html
      that wi::bswap (and a new wi::bitreverse) should be functions,
      and ideally only accessors are member functions.  This patch
      implements the first step, moving/refactoring wi::bswap.
      
      2023-05-31  Roger Sayle  <roger@nextmovesoftware.com>
      	    Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/ChangeLog
      	* fold-const-call.cc (fold_const_call_ss) <CFN_BUILT_IN_BSWAP*>:
      	Update call to wi::bswap.
      	* simplify-rtx.cc (simplify_const_unary_operation) <case BSWAP>:
      	Update call to wi::bswap.
      	* tree-ssa-ccp.cc (evaluate_stmt) <case BUILT_IN_BSWAP*>:
      	Update calls to wi::bswap.
      
      	* wide-int.cc (wide_int_storage::bswap): Remove/rename to...
      	(wi::bswap_large): New function, with revised API.
      	* wide-int.h (wi::bswap): New (template) function prototype.
      	(wide_int_storage::bswap): Remove method.
      	(sext_large, zext_large): Consistent indentation/line wrapping.
      	(bswap_large): Prototype helper function containing implementation.
      	(wi::bswap): New template wrapper around bswap_large.
      0ede6b5a
    • Jonathan Wakely's avatar
      libstdc++: Add separate autoconf macro for std::float_t and std::double_t [PR109818] · 49f59826
      Jonathan Wakely authored
      This should make it possible to use openlibm with djgpp (and other
      targets with missing C99 <math.h> functions). The <math.h> from openlibm
      provides all the functions, but not the float_t and double_t typedefs.
      By separating the autoconf checks for the functionsand the typedefs, we
      don't disable support for all the functions just because those typedefs
      are not present.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/109818
      	* acinclude.m4 (GLIBCXX_ENABLE_C99): Add separate check for
      	float_t and double_t and define HAVE_C99_FLT_EVAL_TYPES.
      	* config.h.in: Regenerate.
      	* configure: Regenerate.
      	* include/c_global/cmath (float_t, double_t): Guard using new
      	_GLIBCXX_HAVE_C99_FLT_EVAL_TYPES macro.
      49f59826
    • Jonathan Wakely's avatar
      libstdc++: Stop using _GLIBCXX_USE_C99_MATH_TR1 in <cmath> · 1f378f6d
      Jonathan Wakely authored
      Similar to the three commits r14-908, r14-909 and r14-910, the
      _GLIBCXX_USE_C99_MATH_TR1 macro is misleading when it is also used for
      <cmath>, not only for <tr1/cmath> headers. It is also wrong, because the
      configure checks for TR1 use -std=c++98 and a target might define the
      C99 features for C++11 but not for C++98.
      
      Add separate configure checks for the <math.h> functions using
      -std=c++11 for the checks. Use the new macro defined by those checks in
      the C++11-specific parts of <cmath>, and in <complex>, <random> etc.
      
      The check that defines _GLIBCXX_NO_C99_ROUNDING_FUNCS is only needed for
      the C++11 <cmath> checks, so remove that from GLIBCXX_CHECK_C99_TR1 and
      only do it for GLIBCXX_ENABLE_C99.
      
      libstdc++-v3/ChangeLog:
      
      	* acinclude.m4 (GLIBCXX_ENABLE_C99): Add checks for C99 math
      	functions and define _GLIBCXX_USE_C99_MATH_FUNCS. Move checks
      	for C99 rounding functions to here.
      	(GLIBCXX_CHECK_C99_TR1): Remove checks for C99 rounding
      	functions from here.
      	* config.h.in: Regenerate.
      	* configure: Regenerate.
      	* include/bits/random.h: Use _GLIBCXX_USE_C99_MATH_FUNCS instead
      	of _GLIBCXX_USE_C99_MATH_TR1.
      	* include/bits/random.tcc: Likewise.
      	* include/c_compatibility/math.h: Likewise.
      	* include/c_global/cmath: Likewise.
      	* include/ext/random: Likewise.
      	* include/ext/random.tcc: Likewise.
      	* include/std/complex: Likewise.
      	* testsuite/20_util/from_chars/4.cc: Likewise.
      	* testsuite/20_util/from_chars/8.cc: Likewise.
      	* testsuite/26_numerics/complex/proj.cc: Likewise.
      	* testsuite/26_numerics/headers/cmath/60401.cc: Likewise.
      	* testsuite/26_numerics/headers/cmath/types_std_c++0x.cc:
      	Likewise.
      	* testsuite/lib/libstdc++.exp (check_v3_target_cstdint):
      	Likewise.
      	* testsuite/util/testsuite_random.h: Likewise.
      1f378f6d
    • Jonathan Wakely's avatar
      libstdc++: Express std::vector's size() <= capacity() invariant in code · fb409a15
      Jonathan Wakely authored
      This adds optimizer hints so that GCC knows that size() <= capacity() is
      always true. This allows the compiler to optimize away re-allocating
      paths when assigning new values to the vector without resizing it, e.g.,
      vec.assign(vec.size(), new_val).
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_vector.h (_Vector_base::_M_invariant()): New
      	function.
      	(vector::size(), vector::capacity()): Call _M_invariant().
      	* testsuite/23_containers/vector/capacity/invariant.cc: New test.
      	* testsuite/23_containers/vector/types/1.cc: Add suppression for
      	false positive warning (PR110060).
      fb409a15
    • Jonathan Wakely's avatar
      libstdc++: Fix build for targets without _Float128 [PR109921] · a239a350
      Jonathan Wakely authored
      My r14-1431-g7037e7b6e4ac41 change caused the _Float128 overload to be
      compiled unconditionally, by moving the USE_STRTOF128_FOR_FROM_CHARS
      check into the function body. That function should still only be
      compiled if the target actually supports _Float128.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/109921
      	* src/c++17/floating_from_chars.cc: Check __FLT128_MANT_DIG__ is
      	defined before trying to use _Float128.
      a239a350
Loading