Skip to content
Snippets Groups Projects
  1. Aug 07, 2023
    • Nick Alcock's avatar
      libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case · f3307109
      Nick Alcock authored
      My previous nm patch handled all cases but one -- if the user set NM in
      the environment to a path which contained an option, libtool's nm
      detection tries to run nm against a copy of nm with the options in it:
      e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
      test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
      This is unlikely to be desirable: in this case we should run
      "/usr/bin/nm --blargle /usr/bin/nm".
      
      Furthermore, as part of this nm has to detect when the passed-in $NM
      contains a path, and in that case avoid doing a path search itself.
      This too was thrown off if an option contained something that looked
      like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
      "nm -B../prev-gcc nm" which rarely works well (and indeed it looks
      to see whether that nm exists, finds it doesn't, and wrongly concludes
      that nm -p or whatever does not work).
      
      Fix all of these by clipping all options (defined as everything
      including and after the first " -") before deciding whether nm
      contains a path (but not using the clipped value for anything else),
      and then removing all options from the path-modified nm before
      looking to see whether that nm existed.
      
      NM=my-nm now does a path search and runs e.g.
        /usr/bin/my-nm -B /usr/bin/my-nm
      
      NM=/usr/bin/my-nm now avoids a path search and runs e.g.
        /usr/bin/my-nm -B /usr/bin/my-nm
      
      NM="my-nm -p../wombat" now does a path search and runs e.g.
        /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm
      
      NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
        ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm
      
      This seems to be all combinations, including those used by GCC bootstrap
      (which, before this commit, fails to bootstrap when configured
      --with-build-config=bootstrap-lto, because the lto plugin is now using
      --export-symbols-regex, which requires libtool to find a working nm,
      while also using -B../prev-gcc to point at the lto plugin associated
      with the GCC just built.)
      
      Regenerate all affected configure scripts.
      
      ChangeLog:
      
      	* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
      	options, including options containing paths.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      Unverified
      f3307109
    • Nick Alcock's avatar
      libtool.m4: fix nm BSD flag detection · ab422974
      Nick Alcock authored
      Libtool needs to get BSD-format (or MS-format) output out of the system
      nm, so that it can scan generated object files for symbol names for
      -export-symbols-regex support.  Some nms need specific flags to turn on
      BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
      Unfortunately the code to do this has a pair of interlocking flaws:
      
       - it runs the test by doing an nm of /dev/null.  Some platforms
         reasonably refuse to do an nm on a device file, but before now this
         has only been worked around by assuming that the error message has a
         specific textual form emitted by Tru64 nm, and that getting this
         error means this is Tru64 nm and that nm -B would work to produce
         BSD-format output, even though the test never actually got anything
         but an error message out of nm -B.  This is fixable by nm'ing *nm
         itself* (since we necessarily have a path to it).
      
       - the test is entirely skipped if NM is set in the environment, on the
         grounds that the user has overridden the test: but the user cannot
         reasonably be expected to know that libtool wants not only nm but
         also flags forcing BSD-format output.  Worse yet, one such "user" is
         the top-level Cygnus configure script, which neither tests for
         nor specifies any BSD-format flags.  So platforms needing BSD-format
         flags always fail to set them when run in a Cygnus tree, breaking
         -export-symbols-regex on such platforms.  Libtool also needs to
         augment $LD on some platforms, but this is done unconditionally,
         augmenting whatever the user specified: the nm check should do the
         same.
      
         One wrinkle: if the user has overridden $NM, a path might have been
         provided: so we use the user-specified path if there was one, and
         otherwise do the path search as usual.  (If the nm specified doesn't
         work, this might lead to a few extra pointless path searches -- but
         the test is going to fail anyway, so that's not a problem.)
      
      (Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
      symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
      *that* is a symlink to /usr/bin/nm.)
      
      ChangeLog:
      
      	* libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
      	NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
      	errors from nms that refuse to work on non-regular files.  Remove
      	other workarounds for this problem.  Strip out blank lines from the
      	nm output.
      
      fixincludes/ChangeLog:
      
      	* configure: Regenerate.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      Unverified
      ab422974
    • Arsen Arsenović's avatar
      configure: reinstate 32b PA-RISC HP-UX target in toplevel · b48e9940
      Arsen Arsenović authored
      The Binutils still support this target.
      
      ChangeLog:
      
      	* configure.ac: Reinstate 32b PA-RISC HP-UX targets
      	* configure: Regenerate.
      Unverified
      b48e9940
    • Simon Marchi's avatar
      Pass PKG_CONFIG_PATH down from top-level Makefile · 1ddd41fd
      Simon Marchi authored
      [Sending to binutils, gdb-patches and gcc-patches, since it touches the
      top-level Makefile/configure]
      
      I have my debuginfod library installed in a non-standard location
      (/opt/debuginfod), which requires me to set
      PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
      configure:
      
          $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure --with-debuginfod
          $ make
      
      or
      
          $ ./configure --with-debuginfod PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
          $ make
      
      Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
      configure.  When running make (which runs gdb's and binutils'
      configure), PKG_CONFIG_PATH is not set, which results in their configure
      script not finding the library:
      
          checking for libdebuginfod >= 0.179... no
          configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable."
      
      Change the top-level configure/Makefile system to capture the value
      passed when configuring the top-level and pass it down to
      subdirectories (similar to CFLAGS, LDFLAGS, etc).
      
      I don't know much about the top-level build system, so I really don't
      know if I did this correctly.  The changes are:
      
       - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
         @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
         in config files (i.e. Makefile)
       - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
         to @PKG_CONFIG_PATH@
       - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
         variables set when running the sub-configures
      
      I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
      I don't think it's needed.  AFAIU, this defines the flags to pass down
      when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
      be passed down during configure.  After that, it's captured in
      gdb/config.status, so even if a "make" causes a re-configure later
      (because gdb/configure has changed, for example), the PKG_CONFIG_PATH
      value will be remembered.
      
      Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf
      
      ChangeLog:
      
      	* configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
      	* configure: Re-generate.
      	* Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
      	(PKG_CONFIG_PATH): New.
      	* Makefile.in: Re-generate.
      Unverified
      1ddd41fd
    • Luis Machado's avatar
      Disable year 2038 support on 32-bit hosts by default · a49d42e8
      Luis Machado authored
      With a recent import of gnulib, code has been pulled that tests and enables
      64-bit time_t by default on 32-bit hosts that support it.
      
      Although gdb can use the gnulib support, bfd doesn't use gnulib and currently
      doesn't do these checks.
      
      As a consequence, if we have a 32-bit host that supports 64-bit time_t, we'll
      have a mismatch between gdb's notion of time_t and bfd's notion of time_t.
      
      This will lead to mismatches in the struct stat size, leading to memory
      corruption and crashes.
      
      This patch disables the year 2038 check for now, which makes things work
      reliably again.
      
      I'd consider this a temporary fix until we have proper bfd checks for the year
      2038, if it makes sense.  64-bit hosts seems to be more common these days, so
      I'm not sure how important it is to have this support enabled and how soon
      we want to enable it.
      
      Thoughts?
      
      ChangeLog:
      
      	* configure.ac: Disable year2038 by default on 32-bit hosts.
      	* configure: Regenerate.
      Unverified
      a49d42e8
    • Vladimir Mezentsev's avatar
      gprofng: a new GNU profiler · 24552056
      Vladimir Mezentsev authored
      ChangeLog:
      
      	* Makefile.def: Add gprofng module.
      	* configure.ac: Add --enable-gprofng option.
      	* Makefile.in: Regenerate.
      	* configure: Regenerate.
      
      include/ChangeLog:
      
      	* collectorAPI.h: New file.
      	* libcollector.h: New file.
      	* libfcollector.h: New file.
      Unverified
      24552056
    • Martin Liska's avatar
      add --enable-default-compressed-debug-sections-algorithm configure option · c9884636
      Martin Liska authored
      ChangeLog:
      
      	* configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
      	* configure: Regenerate.
      Unverified
      c9884636
    • Christophe Lyon's avatar
      configure: require libzstd >= 1.4.0 · e61c0e3a
      Christophe Lyon authored
      gas uses ZSTD_compressStream2 which is only available with libzstd >=
      1.4.0, leading to build errors when an older version is installed.
      
      This patch updates the check libzstd presence to check its version is
      >= 1.4.0. However, since gas seems to be the only component requiring
      such a recent version this may imply that we disable ZSTD support for
      all components although some would still benefit from an older
      version.
      
      I ran 'autoreconf -f' in all directories containing a configure.ac
      file, using vanilla autoconf-2.69 and automake-1.15.1. I noticed
      several errors from autoheader in readline, as well as warnings in
      intl, but they are unrelated to this patch.
      
      This should fix some of the buildbots.
      
      OK for trunk?
      
      Thanks,
      
      Christophe
      
      config/ChangeLog:
      
      	* zstd.m4: Add minimum version requirement of 1.4.0.
      Unverified
      e61c0e3a
    • Fangrui Song's avatar
      binutils, gdb: support zstd compressed debug sections · 407a2c9a
      Fangrui Song authored
      PR29397 PR29563: Add new configure option --with-zstd which defaults to
      auto.  If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support
      zstd compressed debug sections for most tools.
      
      * bfd: for addr2line, objdump --dwarf, gdb, etc
      * gas: support --compress-debug-sections=zstd
      * ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd
      * objcopy: support ELFCOMPRESS_ZSTD input for
        --decompress-debug-sections and --compress-debug-sections=zstd
      * gdb: support ELFCOMPRESS_ZSTD input.  The bfd change references zstd
        symbols, so gdb has to link against -lzstd in this patch.
      
      If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error.  We
      can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this
      is too heavyweight, so don't do it for now.
      
      ```
      % ld/ld-new a.o
      ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support
      ...
      
      % ld/ld-new a.o --compress-debug-sections=zstd
      ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support
      
      % binutils/objcopy --compress-debug-sections=zstd a.o b.o
      binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with zstd support
      
      % binutils/objcopy b.o --decompress-debug-sections
      binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support
      ...
      ```
      
      config/ChangeLog:
      
      	* zstd.m4: New file.
      
      ChangeLog:
      	* configure: Regenerate.
      	* configure.ac: Add --with-zstd.
      Unverified
      407a2c9a
    • Arsen Arsenović's avatar
      toplevel: Recover tilegx/tilepro targets · a885ec24
      Arsen Arsenović authored
      These are still supported in Binutils.
      
      ChangeLog:
      
      	* configure: Regenerate.
      	* configure.ac: Recover tilegx/tilepro targets.
      Unverified
      a885ec24
    • H.J. Lu's avatar
      GCC: Check if AR works with --plugin and rc · 9c7797a8
      H.J. Lu authored
      AR from older binutils doesn't work with --plugin and rc:
      
      [hjl@gnu-cfl-2 bin]$ touch foo.c
      [hjl@gnu-cfl-2 bin]$ ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
      [hjl@gnu-cfl-2 bin]$ ./ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
      ./ar: no operation specified
      [hjl@gnu-cfl-2 bin]$ ./ar --version
      GNU ar (Linux/GNU Binutils) 2.29.51.0.1.20180112
      Copyright (C) 2018 Free Software Foundation, Inc.
      This program is free software; you may redistribute it under the terms of
      the GNU General Public License version 3 or (at your option) any later version.
      This program has absolutely no warranty.
      [hjl@gnu-cfl-2 bin]$
      
      Check if AR works with --plugin and rc before passing --plugin to AR and
      RANLIB.
      
      ChangeLog:
      
      	* configure: Regenerated.
      	* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with
      	--plugin and rc before enabling --plugin.
      
      config/ChangeLog:
      
      	* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
      	--plugin and rc before enabling --plugin.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libiberty/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      
      zlib/ChangeLog:
      
      	* configure: Regenerate.
      Unverified
      9c7797a8
    • H.J. Lu's avatar
      Sync with binutils: GCC: Pass --plugin to AR and RANLIB · 126f707e
      H.J. Lu authored
      Sync with binutils for building binutils with LTO:
      
      50ad1254d50 GCC: Pass --plugin to AR and RANLIB
      
      Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
      build.
      
      ChangeLog:
      
      	* Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
      	(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
      	* configure.ac: Include config/gcc-plugin.m4.
      	AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
      	* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
      	RANLIB if possible.
      	* Makefile.in: Regenerated.
      	* configure: Likewise.
      
      config/ChangeLog:
      
      	* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
      
      libiberty/ChangeLog:
      
      	* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
      	(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
      	(configure_deps): Depend on ../config/gcc-plugin.m4.
      	* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
      	RANLIB_PLUGIN_OPTION.
      	* aclocal.m4: Regenerated.
      	* configure: Likewise.
      
      zlib/ChangeLog:
      
      	* configure: Regenerated.
      
      gcc/ChangeLog:
      
      	* configure: Regenerate.
      
      libatomic/ChangeLog:
      
      	* configure: Regenerate.
      
      libbacktrace/ChangeLog:
      
      	* configure: Regenerate.
      
      libcc1/ChangeLog:
      
      	* configure: Regenerate.
      
      libffi/ChangeLog:
      
      	* configure: Regenerate.
      
      libgfortran/ChangeLog:
      
      	* configure: Regenerate.
      
      libgm2/ChangeLog:
      
      	* configure: Regenerate.
      
      libgomp/ChangeLog:
      
      	* configure: Regenerate.
      
      libitm/ChangeLog:
      
      	* configure: Regenerate.
      
      libobjc/ChangeLog:
      
      	* configure: Regenerate.
      
      libphobos/ChangeLog:
      
      	* configure: Regenerate.
      
      libquadmath/ChangeLog:
      
      	* configure: Regenerate.
      
      libsanitizer/ChangeLog:
      
      	* configure: Regenerate.
      
      libssp/ChangeLog:
      
      	* configure: Regenerate.
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      
      libvtv/ChangeLog:
      
      	* configure: Regenerate.
      
      lto-plugin/ChangeLog:
      
      	* configure: Regenerate.
      Unverified
      126f707e
    • Alan Modra's avatar
      gcc-4.5 build fixes · 432c6f05
      Alan Modra authored
      Trying to build binutils with an older gcc currently fails.  Working
      around these gcc bugs is not onerous so let's fix them.
      
      include/ChangeLog:
      
      	* xtensa-dynconfig.h (xtensa_isa_internal): Delete unnecessary
      	forward declaration.
      Unverified
      432c6f05
    • Alan Modra's avatar
      PR29961, plugin-api.h: "Could not detect architecture endianess" · 24f5a73a
      Alan Modra authored
      Found when attempting to build binutils on sparc sunos-5.8 where
      sys/byteorder.h defines _BIG_ENDIAN but not any of the BYTE_ORDER
      variants.  This patch adds the extra tests to cope with the old
      machine, and tidies the header a little.
      
      include/ChangeLog:
      
      	* plugin-api.h: When handling non-gcc or gcc < 4.6.0 include
      	necessary header files before testing macros.  Make more use
      	of #elif.  Test _LITTLE_ENDIAN and _BIG_ENDIAN in final tests.
      Unverified
      24f5a73a
    • Arsen Arsenović's avatar
      toplevel: Substitute GDCFLAGS instead of using CFLAGS · e4cd4f78
      Arsen Arsenović authored
      r14-2875-g1ed21e23d6d4da ("Use substituted GDCFLAGS") already
      implemented this change, but only on the generated file rather than in
      the template it is generated from.
      
      ChangeLog:
      
      	* Makefile.tpl: Substitute @GDCFLAGS@ instead of using
      	$(CFLAGS).
      Unverified
      e4cd4f78
    • Jeff Law's avatar
      [committed][RISC-V]Don't reject constants in cmov condition · 18c453f0
      Jeff Law authored
      This test is too aggressive.  Constants have VOIDmode, so we need to let the
      through this phase of conditional move support.
      
      Fixes several missed conditional moves with the trunk.
      
      gcc/
      	* config/riscv/riscv.cc (riscv_expand_conditional_move): Allow
      	VOIDmode operands to conditional before canonicalization.
      18c453f0
    • Manolis Tsamis's avatar
      cprop_hardreg: Allow propagation of stack pointer in more cases. · adfc236c
      Manolis Tsamis authored
      The stack pointer propagation fix 736f8fd3 turned out to be more
      restrictive than needed by rejecting propagation of the stack pointer
      when REG_POINTER didn't match.
      
      This commit removes this check:
        When the stack pointer is propagated it is fine for this to result in
        REG_POINTER becoming true from false, which is what the original code
        checked.
      
      This simplification makes the previously introduced function
      maybe_copy_reg_attrs obsolete and the logic can be inlined at the call
      sites, as it was before 736f8fd3.
      
      gcc/ChangeLog:
      
      	* regcprop.cc (maybe_copy_reg_attrs): Remove unnecessary function.
      	(find_oldest_value_reg): Inline stack_pointer_rtx check.
      	(copyprop_hardreg_forward_1): Inline stack_pointer_rtx check.
      adfc236c
    • David Faust's avatar
      MAINTAINERS: Add myself as a BPF port reviewer · f9d93f8c
      David Faust authored
      ChangeLog:
      
      	* MAINTAINERS: Add the BPF port to my reviewer listing.
      f9d93f8c
    • Martin Jambor's avatar
      ipa-sra: Don't consider CLOBBERS as writes preventing splitting · da1a888b
      Martin Jambor authored
      When IPA-SRA detects whether a parameter passed by reference is
      written to, it does not special case CLOBBERs which means it often
      bails out unnecessarily, especially when dealing with C++ destructors.
      Fixed by the obvious continue in the two relevant loops and by adding
      a simple function that marks the clobbers in the transformation code
      as statements to be removed.
      
      gcc/ChangeLog:
      
      2023-08-04  Martin Jambor  <mjambor@suse.cz>
      
      	PR ipa/110378
      	* ipa-param-manipulation.h (class ipa_param_body_adjustments): New
      	members get_ddef_if_exists_and_is_used and mark_clobbers_dead.
      	* ipa-sra.cc (isra_track_scalar_value_uses): Ignore clobbers.
      	(ptr_parm_has_nonarg_uses): Likewise.
      	* ipa-param-manipulation.cc
      	(ipa_param_body_adjustments::get_ddef_if_exists_and_is_used): New.
      	(ipa_param_body_adjustments::mark_dead_statements): Move initial
      	checks to get_ddef_if_exists_and_is_used.
      	(ipa_param_body_adjustments::mark_clobbers_dead): New.
      	(ipa_param_body_adjustments::common_initialization): Call
      	mark_clobbers_dead when splitting.
      
      gcc/testsuite/ChangeLog:
      
      2023-07-31  Martin Jambor  <mjambor@suse.cz>
      
      	PR ipa/110378
      	* g++.dg/ipa/pr110378-1.C: New test.
      Unverified
      da1a888b
    • Raphael Zinsly's avatar
      [committed] [RISC-V] Handle more cases in riscv_expand_conditional_move · 8ae83274
      Raphael Zinsly authored
      
      As I've mentioned in the main zicond thread, Ventana has had patches
      that support more cases by first emitting a suitable scc instruction
      essentially as a canonicalization step of the condition for zicond.
      
      For example if we have
      
      (set (target) (if_then_else (op (reg1) (reg2))
                                  (true_value)
                                  (false_value)))
      
      The two register comparison isn't handled by zicond directly.  But we
      can generate something like this instead
      
      (set (temp) (op (reg1) (reg2)))
      (set (target) (if_then_else (op (temp) (const_int 0))
                                  (true_value)
                                  (false_value)
      
      Then let the remaining code from Xiao handle the true_value/false_value
      to make sure it's zicond compatible.
      
      This is primarily Raphael's work.  My involvement has been mostly to
      move it from its original location (in the .md file) into the expander
      function and fix minor problems with the FP case.
      
      gcc/
      	* config/riscv/riscv.cc (riscv_expand_int_scc): Add invert_ptr
      	as an argument and pass it to riscv_emit_int_order_test.
      	(riscv_expand_conditional_move): Handle cases where the condition
      	is not EQ/NE or the second argument to the conditional is not
      	(const_int 0).
      	* config/riscv/riscv-protos.h (riscv_expand_int_scc): Update prototype.
      
      Co-authored-by: default avatarJeff Law <jlaw@ventanamicro.com>
      8ae83274
    • Andrew Pinski's avatar
      MATCH: [PR109959] `(uns <= 1) & uns` could be optimized to `uns == 1` · b57bd27c
      Andrew Pinski authored
      I noticed while looking into some code generation of bitmap_single_bit_set_p,
      that sometimes:
      ```
        if (uns > 1)
          return 0;
        return uns == 1;
      ```
      Would not optimize down to just:
      ```
      return uns == 1;
      ```
      
      In this case, VRP likes to change `a == 1` into `(bool)a` if
      a has a range of [0,1] due to `a <= 1` side of the branch.
      We might end up with this similar code even without VRP,
      in the case of builtin-sprintf-warn-23.c (and Wrestrict.c), we had:
      ```
      if (s < 0 || 1 < s)
        s = 0;
      ```
      Which is the same as `s = ((unsigned)s) <= 1 ? s : 0`;
      So we should be able to catch that also.
      
      This adds 2 patterns to catch `(uns <= 1) & uns` and
      `(uns > 1) ? 0 : uns` and convert those into:
      `(convert) uns == 1`.
      
      OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/109959
      
      gcc/ChangeLog:
      
      	* match.pd (`(a > 1) ? 0 : (cast)a`, `(a <= 1) & (cast)a`):
      	New patterns.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/tree-ssa/builtin-sprintf-warn-23.c: Remove xfail.
      	* c-c++-common/Wrestrict.c: Update test and remove some xfail.
      	* gcc.dg/tree-ssa/cmpeq-1.c: New test.
      	* gcc.dg/tree-ssa/cmpeq-2.c: New test.
      	* gcc.dg/tree-ssa/cmpeq-3.c: New test.
      b57bd27c
    • Richard Biener's avatar
      Use RPO order for sinking · d8efc44d
      Richard Biener authored
      The following makes us use RPO order instead of walking post-dominators.
      This ensures we visit a block before any predecessors.  I've seen
      some extra sinking because of this in a larger testcase but failed
      to reduce a smaller one (processing of post-dominator sons is unordered
      so I failed to have "luck").
      
      	* tree-ssa-sink.cc (pass_sink_code::execute): Do not
      	calculate post-dominators.  Calculate RPO on the inverted
      	graph and process blocks in that order.
      d8efc44d
    • liuhongt's avatar
      Fix ICE in rtl check when bootstrap. · af6cfd7b
      liuhongt authored
      /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/libgfortran/generated/matmul_i1.c: In function ‘matmul_i1_avx512f’:
      /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/libgfortran/generated/matmul_i1.c:1781:1: internal compiler error: RTL check: expected elt 0 type 'i' or 'n', have 'w' (rtx const_int) in vpternlog_redundant_operand_mask, at config/i386/i386.cc:19460
       1781 | }
            | ^
      0x5559de26dc2d rtl_check_failed_type2(rtx_def const*, int, int, int, char const*, int, char const*)
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/rtl.cc:761
      0x5559de340bfe vpternlog_redundant_operand_mask(rtx_def**)
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/i386.cc:19460
      0x5559dfec67a6 split_44
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/sse.md:12730
      0x5559dfec67a6 split_63
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/sse.md:28428
      0x5559deb8a682 try_split(rtx_def*, rtx_insn*, int)
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/emit-rtl.cc:3800
      0x5559deb8adf2 try_split(rtx_def*, rtx_insn*, int)
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/emit-rtl.cc:3972
      0x5559def69194 split_insn
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:3385
      0x5559def70c57 split_all_insns()
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:3489
      0x5559def70d0c execute
              /var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:4413
      
      Use INTVAL (imm_op) instead of XINT (imm_op, 0).
      
      gcc/ChangeLog:
      
      	PR target/110926
      	* config/i386/i386-protos.h
      	(vpternlog_redundant_operand_mask): Adjust parameter type.
      	* config/i386/i386.cc (vpternlog_redundant_operand_mask): Use
      	INTVAL instead of XINT, also adjust parameter type from rtx*
      	to rtx since the function only needs operands[4] in vpternlog
      	pattern.
      	(substitute_vpternlog_operands): Pass operands[4] instead of
      	operands to vpternlog_redundant_operand_mask.
      	* config/i386/sse.md: Ditto.
      af6cfd7b
    • Richard Biener's avatar
      Improve -fopt-info-vec for basic-block vectorization · aa63c204
      Richard Biener authored
      We currently dump notes like
      
      flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors
      flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors
      flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors
      flow_lam.f:65:72: optimized: basic block part vectorized using 32 byte vectors
      ..
      
      repeating the same location for multiple instances because we
      clobber vect_location during BB vectorization.  The following
      avoids this, improving things to
      
      flow_lam.f:15:72: optimized: basic block part vectorized using 32 byte vectors
      flow_lam.f:16:72: optimized: basic block part vectorized using 32 byte vectors
      flow_lam.f:17:72: optimized: basic block part vectorized using 32 byte vectors
      flow_lam.f:18:72: optimized: basic block part vectorized using 32 byte vectors
      ...
      
      	* tree-vect-slp.cc (vect_slp_region): Save/restore vect_location
      	around dumping code.
      aa63c204
    • liuhongt's avatar
      i386: Clear upper bits of XMM register for V4HFmode/V2HFmode operations [PR110762] · 831017d5
      liuhongt authored
      Similar like r14-2786-gade30fad6669e5, the patch is for V4HF/V2HFmode.
      
      gcc/ChangeLog:
      
      	PR target/110762
      	* config/i386/mmx.md (<insn><mode>3): Changed from define_insn
      	to define_expand and break into ..
      	(<insn>v4hf3): .. this.
      	(divv4hf3): .. this.
      	(<insn>v2hf3): .. this.
      	(divv2hf3): .. this.
      	(movd_v2hf_to_sse): New define_expand.
      	(movq_<mode>_to_sse): Extend to V4HFmode.
      	(mmxdoublevecmode): Ditto.
      	(V2FI_V4HF): New mode iterator.
      	* config/i386/sse.md (*vec_concatv4sf): Extend to hanlde V8HF
      	by using mode iterator V4SF_V8HF, renamed to ..
      	(*vec_concat<mode>): .. this.
      	(*vec_concatv4sf_0): Extend to handle V8HF by using mode
      	iterator V4SF_V8HF, renamed to ..
      	(*vec_concat<mode>_0): .. this.
      	(*vec_concatv8hf_movss): New define_insn.
      	(V4SF_V8HF): New mode iterator.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/i386/pr110762-v4hf.c: New test.
      831017d5
    • Sheri Bernstein's avatar
      ada: Refactor multiple returns · f51b8e5b
      Sheri Bernstein authored
      Replace multiple returns by a single return statement with a conditional
      expression. This is more readable and maintainable, and also conformant with
      a Highly Recommended design principle of ISO 26262-6.
      
      gcc/ada/
      
      	* libgnat/s-parame__qnx.adb: Refactor multiple returns.
      f51b8e5b
    • Piotr Trojanek's avatar
      ada: Extend precondition of Interfaces.C.String.Value with Length · 41d7d32c
      Piotr Trojanek authored
      The existing precondition guarded against exception Dereference_Error,
      but not against Constraint_Error.
      
      The RM rule B.3.1(36/3) only mentions Constraint_Error for the Value
      function which returns char_array, but the one which returns String
      has the same restriction, because it is equivalent to calling the
      variant which returns char_array and then converted.
      
      gcc/ada/
      
      	* libgnat/i-cstrin.ads (Value): Extend preconditions; adapt comment for
      	the package.
      41d7d32c
    • Yannick Moy's avatar
      ada: Crash in GNATprove due to wrong detection of inlining · 43057533
      Yannick Moy authored
      When a function is called in a predicate, it was not properly detected
      as not always inlined in GNATprove mode, which led to crashes later during
      analysis. Fixed now.
      
      gcc/ada/
      
      	* sem_res.adb (Resolve_Call): Always call Cannot_Inline so that
      	subprogram called is marked as not always inlined.
      43057533
    • Javier Miranda's avatar
      ada: Spurious error on class-wide preconditions · 3ad67df2
      Javier Miranda authored
      The compiler reports an spurious error when a class-wide precondition
      expression has a class-wide type conversion.
      
      gcc/ada/
      
      	* sem_res.adb (Resolve_Type_Conversion): Do not warn on conversion
      	to class-wide type on internally build helpers of class-wide
      	preconditions.
      3ad67df2
    • Juzhe-Zhong's avatar
      tree-optimization/110897 - Fix missed vectorization of shift on both RISC-V and aarch64 · c5f673db
      Juzhe-Zhong authored
      Consider this following case:
      
      #include <stdint.h>
      
      #define TEST2_TYPE(TYPE)					\
        __attribute__((noipa))					\
        void vshiftr_##TYPE (TYPE *__restrict dst, TYPE *__restrict a, TYPE *__restrict b, int n)	\
        {								\
          for (int i = 0; i < n; i++)					\
            dst[i] = (a[i]) >> b[i];					\
        }
      
      #define TEST_ALL()	\
       TEST2_TYPE(uint8_t)	\
       TEST2_TYPE(uint16_t)	\
       TEST2_TYPE(uint32_t)	\
       TEST2_TYPE(uint64_t)	\
      
      TEST_ALL()
      
      Both RISC-V and aarch64 of trunk GCC failed vectorize uint8_t/uint16_t with following missed report:
      
      <source>:17:1: missed: couldn't vectorize loop
      <source>:17:1: missed: not vectorized: relevant stmt not supported: patt_46 = MIN_EXPR <_6, 7>;
      <source>:17:1: missed: couldn't vectorize loop
      <source>:17:1: missed: not vectorized: relevant stmt not supported: patt_47 = MIN_EXPR <_7, 15>;
      Compiler returned: 0
      
      Both GCC 13.1 can vectorize, see:
      
      https://godbolt.org/z/6vaMK5M1o
      
      Bootstrap and regression on X86 passed.
      
      Ok for trunk ?
      
      gcc/ChangeLog:
      
      	* tree-vect-patterns.cc (vect_recog_over_widening_pattern): Add op vectype.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/binop/narrow-1.c: Adapt testcase.
      c5f673db
    • Jan Beulich's avatar
      x86: drop redundant "prefix_data16" attributes · a016c8cb
      Jan Beulich authored
      The attribute defaults to 1 for TI-mode insns of type sselog, sselog1,
      sseiadd, sseimul, and sseishft.
      
      In *<code>v8hi3 [smaxmin] and *<code>v16qi3 [umaxmin] also drop the
      similarly stray "prefix_extra" at this occasion. These two max/min
      flavors are encoded in 0f space.
      
      gcc/
      
      	* config/i386/mmx.md (*mmx_pinsrd): Drop "prefix_data16".
      	(*mmx_pinsrb): Likewise.
      	(*mmx_pextrb): Likewise.
      	(*mmx_pextrb_zext): Likewise.
      	(mmx_pshufbv8qi3): Likewise.
      	(mmx_pshufbv4qi3): Likewise.
      	(mmx_pswapdv2si2): Likewise.
      	(*pinsrb): Likewise.
      	(*pextrb): Likewise.
      	(*pextrb_zext): Likewise.
      	* config/i386/sse.md (*sse4_1_mulv2siv2di3<mask_name>): Likewise.
      	(*sse2_eq<mode>3): Likewise.
      	(*sse2_gt<mode>3): Likewise.
      	(<sse2p4_1>_pinsr<ssemodesuffix>): Likewise.
      	(*vec_extract<mode>): Likewise.
      	(*vec_extract<PEXTR_MODE12:mode>_zext): Likewise.
      	(*vec_extractv16qi_zext): Likewise.
      	(ssse3_ph<plusminus_mnemonic>wv8hi3): Likewise.
      	(ssse3_pmaddubsw128): Likewise.
      	(*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>): Likewise.
      	(<ssse3_avx2>_pshufb<mode>3<mask_name>): Likewise.
      	(<ssse3_avx2>_psign<mode>3): Likewise.
      	(<ssse3_avx2>_palignr<mode>): Likewise.
      	(*abs<mode>2): Likewise.
      	(sse4_2_pcmpestr): Likewise.
      	(sse4_2_pcmpestri): Likewise.
      	(sse4_2_pcmpestrm): Likewise.
      	(sse4_2_pcmpestr_cconly): Likewise.
      	(sse4_2_pcmpistr): Likewise.
      	(sse4_2_pcmpistri): Likewise.
      	(sse4_2_pcmpistrm): Likewise.
      	(sse4_2_pcmpistr_cconly): Likewise.
      	(vgf2p8affineinvqb_<mode><mask_name>): Likewise.
      	(vgf2p8affineqb_<mode><mask_name>): Likewise.
      	(vgf2p8mulb_<mode><mask_name>): Likewise.
      	(*<code>v8hi3 [smaxmin]): Drop "prefix_data16" and
      	"prefix_extra".
      	(*<code>v16qi3 [umaxmin]): Likewise.
      a016c8cb
    • Jan Beulich's avatar
      x86: correct "length_immediate" in a few cases · 1a98bee8
      Jan Beulich authored
      When first added explicitly in 3ddffba9 ("i386.md
      (sse4_1_round<mode>2): Add avx512f alternative"), "*" should not have
      been used for the pre-existing alternative. The attribute was plain
      missing. Subsequent changes adding more alternatives then generously
      extended the bogus pattern.
      
      Apparently something similar happened to the two mmx_pblendvb_* insns.
      
      gcc/
      
      	* config/i386/i386.md (sse4_1_round<mode>2): Make
      	"length_immediate" uniformly 1.
      	* config/i386/mmx.md (mmx_pblendvb_v8qi): Likewise.
      	(mmx_pblendvb_<mode>): Likewise.
      1a98bee8
    • Jan Beulich's avatar
      x86: add missing "prefix" attribute to VF{,C}MULC · 80770e90
      Jan Beulich authored
      gcc/
      
      	* config/i386/sse.md
      	(<avx512>_<complexopname>_<mode><maskc_name><round_name>): Add
      	"prefix" attribute.
      	(avx512fp16_<complexopname>sh_v8hf<mask_scalarc_name><round_scalarcz_name>):
      	Likewise.
      80770e90
    • Jan Beulich's avatar
      x86: add (adjust) XOP insn attributes · f6becc26
      Jan Beulich authored
      Many were lacking "prefix" and "prefix_extra", some had a bogus value of
      2 for "prefix_extra" (presumably inherited from their SSE5 counterparts,
      which are long gone) and a meaningless "prefix_data16" one. Where
      missing, "mode" attributes are also added. (Note that "sse4arg" and
      "ssemuladd" ones don't need further adjustment in this regard.)
      
      gcc/
      
      	* config/i386/sse.md (xop_phadd<u>bw): Add "prefix",
      	"prefix_extra", and "mode" attributes.
      	(xop_phadd<u>bd): Likewise.
      	(xop_phadd<u>bq): Likewise.
      	(xop_phadd<u>wd): Likewise.
      	(xop_phadd<u>wq): Likewise.
      	(xop_phadd<u>dq): Likewise.
      	(xop_phsubbw): Likewise.
      	(xop_phsubwd): Likewise.
      	(xop_phsubdq): Likewise.
      	(xop_rotl<mode>3): Add "prefix" and "prefix_extra" attributes.
      	(xop_rotr<mode>3): Likewise.
      	(xop_frcz<mode>2): Likewise.
      	(*xop_vmfrcz<mode>2): Likewise.
      	(xop_vrotl<mode>3): Add "prefix" attribute. Change
      	"prefix_extra" to 1.
      	(xop_sha<mode>3): Likewise.
      	(xop_shl<mode>3): Likewise.
      f6becc26
    • Jan Beulich's avatar
      x86: drop stray "prefix_extra" · 7d042d38
      Jan Beulich authored
      While the attribute is relevant for legacy- and VEX-encoded insns, it is
      of no relevance for EVEX-encoded ones.
      
      While there in <mask_codefor>avx512dq_broadcast<mode><mask_name>_1 add
      the missing "length_immediate".
      
      gcc/
      
      	* config/i386/sse.md
      	(*<avx512>_eq<mode>3<mask_scalar_merge_name>_1): Drop
      	"prefix_extra".
      	(avx512dq_vextract<shuffletype>64x2_1_mask): Likewise.
      	(*avx512dq_vextract<shuffletype>64x2_1): Likewise.
      	(avx512f_vextract<shuffletype>32x4_1_mask): Likewise.
      	(*avx512f_vextract<shuffletype>32x4_1): Likewise.
      	(vec_extract_lo_<mode>_mask [AVX512 forms]): Likewise.
      	(vec_extract_lo_<mode> [AVX512 forms]): Likewise.
      	(vec_extract_hi_<mode>_mask [AVX512 forms]): Likewise.
      	(vec_extract_hi_<mode> [AVX512 forms]): Likewise.
      	(@vec_extract_lo_<mode> [AVX512 forms]): Likewise.
      	(@vec_extract_hi_<mode> [AVX512 forms]): Likewise.
      	(vec_extract_lo_v64qi): Likewise.
      	(vec_extract_hi_v64qi): Likewise.
      	(*vec_widen_umult_even_v16si<mask_name>): Likewise.
      	(*vec_widen_smult_even_v16si<mask_name>): Likewise.
      	(*avx512f_<code><mode>3<mask_name>): Likewise.
      	(*vec_extractv4ti): Likewise.
      	(avx512bw_<code>v32qiv32hi2<mask_name>): Likewise.
      	(<mask_codefor>avx512dq_broadcast<mode><mask_name>_1): Likewise.
      	Add "length_immediate".
      7d042d38
    • Jan Beulich's avatar
      x86: replace/correct bogus "prefix_extra" · 31be253e
      Jan Beulich authored
      In the rdrand and rdseed cases "prefix_0f" is meant instead. For
      mmx_floatv2siv2sf2 1 is correct only for the first alternative. For
      the integer min/max cases 1 uniformly applies to legacy and VEX
      encodings (the UB and SW variants are dealt with separately anyway).
      Same for {,V}MOVNTDQA.
      
      Unlike {,V}PEXTRW, which has two encoding forms, {,V}PINSRW only has
      a single form in 0f space. (In *vec_extract<mode> note that the
      dropped part if the condition also referenced non-existing alternative
      2.)
      
      Of the integer compare insns, only the 64-bit element forms are encoded
      in 0f38 space.
      
      gcc/
      
      	* config/i386/i386.md (@rdrand<mode>): Add "prefix_0f". Drop
      	"prefix_extra".
      	(@rdseed<mode>): Likewise.
      	* config/i386/mmx.md (<code><mode>3 [smaxmin and umaxmin cases]):
      	Adjust "prefix_extra".
      	* config/i386/sse.md (@vec_set<mode>_0): Likewise.
      	(*sse4_1_<code><mode>3<mask_name>): Likewise.
      	(*avx2_eq<mode>3): Likewise.
      	(avx2_gt<mode>3): Likewise.
      	(<sse2p4_1>_pinsr<ssemodesuffix>): Likewise.
      	(*vec_extract<mode>): Likewise.
      	(<vi8_sse4_1_avx2_avx512>_movntdqa): Likewise.
      31be253e
    • Jan Beulich's avatar
      x86: "prefix_extra" can't really be "2" · 0e877fd1
      Jan Beulich authored
      In the three remaining instances separate "prefix_0f" and "prefix_rep"
      are what is wanted instead.
      
      gcc/
      
      	* config/i386/i386.md (rd<fsgs>base<mode>): Add "prefix_0f" and
      	"prefix_rep". Drop "prefix_extra".
      	(wr<fsgs>base<mode>): Likewise.
      	(ptwrite<mode>): Likewise.
      0e877fd1
    • Jan Beulich's avatar
      x86: "ssemuladd" adjustments · 9ac69f2d
      Jan Beulich authored
      They're all VEX3- (also covering XOP) or EVEX-encoded. Express that in
      the default calculation of "prefix". FMA4 insns also all have a 1-byte
      immediate operand.
      
      Where the default calculation is not sufficient / applicable, add
      explicit "prefix" attributes. While there also add a "mode" attribute to
      fma_<complexpairopname>_<mode>_pair.
      
      gcc/
      
      	* config/i386/i386.md (isa): Move up.
      	(length_immediate): Handle "fma4".
      	(prefix): Handle "ssemuladd".
      	* config/i386/sse.md (*fma_fmadd_<mode>): Add "prefix" attribute.
      	(<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>):
      	Likewise.
      	(<avx512>_fmadd_<mode>_mask<round_name>): Likewise.
      	(<avx512>_fmadd_<mode>_mask3<round_name>): Likewise.
      	(<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>):
      	Likewise.
      	(<avx512>_fmsub_<mode>_mask<round_name>): Likewise.
      	(<avx512>_fmsub_<mode>_mask3<round_name>): Likewise.
      	(*fma_fnmadd_<mode>): Likewise.
      	(<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>):
      	Likewise.
      	(<avx512>_fnmadd_<mode>_mask<round_name>): Likewise.
      	(<avx512>_fnmadd_<mode>_mask3<round_name>): Likewise.
      	(<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>):
      	Likewise.
      	(<avx512>_fnmsub_<mode>_mask<round_name>): Likewise.
      	(<avx512>_fnmsub_<mode>_mask3<round_name>): Likewise.
      	(<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>):
      	Likewise.
      	(<avx512>_fmaddsub_<mode>_mask<round_name>): Likewise.
      	(<avx512>_fmaddsub_<mode>_mask3<round_name>): Likewise.
      	(<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>):
      	Likewise.
      	(<avx512>_fmsubadd_<mode>_mask<round_name>): Likewise.
      	(<avx512>_fmsubadd_<mode>_mask3<round_name>): Likewise.
      	(*fmai_fmadd_<mode>): Likewise.
      	(*fmai_fmsub_<mode>): Likewise.
      	(*fmai_fnmadd_<mode><round_name>): Likewise.
      	(*fmai_fnmsub_<mode><round_name>): Likewise.
      	(avx512f_vmfmadd_<mode>_mask<round_name>): Likewise.
      	(avx512f_vmfmadd_<mode>_mask3<round_name>): Likewise.
      	(avx512f_vmfmadd_<mode>_maskz_1<round_name>): Likewise.
      	(*avx512f_vmfmsub_<mode>_mask<round_name>): Likewise.
      	(avx512f_vmfmsub_<mode>_mask3<round_name>): Likewise.
      	(*avx512f_vmfmsub_<mode>_maskz_1<round_name>): Likewise.
      	(avx512f_vmfnmadd_<mode>_mask<round_name>): Likewise.
      	(avx512f_vmfnmadd_<mode>_mask3<round_name>): Likewise.
      	(avx512f_vmfnmadd_<mode>_maskz_1<round_name>): Likewise.
      	(*avx512f_vmfnmsub_<mode>_mask<round_name>): Likewise.
      	(*avx512f_vmfnmsub_<mode>_mask3<round_name>): Likewise.
      	(*avx512f_vmfnmsub_<mode>_maskz_1<round_name>): Likewise.
      	(*fma4i_vmfmadd_<mode>): Likewise.
      	(*fma4i_vmfmsub_<mode>): Likewise.
      	(*fma4i_vmfnmadd_<mode>): Likewise.
      	(*fma4i_vmfnmsub_<mode>): Likewise.
      	(fma_<complexopname>_<mode><sdc_maskz_name><round_name>): Likewise.
      	(<avx512>_<complexopname>_<mode>_mask<round_name>): Likewise.
      	(avx512fp16_fma_<complexopname>sh_v8hf<mask_scalarcz_name><round_scalarcz_name>):
      	Likewise.
      	(avx512fp16_<complexopname>sh_v8hf_mask<round_name>): Likewise.
      	(xop_p<macs><ssemodesuffix><ssemodesuffix>): Likewise.
      	(xop_p<macs>dql): Likewise.
      	(xop_p<macs>dqh): Likewise.
      	(xop_p<macs>wd): Likewise.
      	(xop_p<madcs>wd): Likewise.
      	(fma_<complexpairopname>_<mode>_pair): Likewise. Add "mode" attribute.
      9ac69f2d
    • Jan Beulich's avatar
      x86: "sse4arg" adjustments · 98e9edad
      Jan Beulich authored
      Record common properties in other attributes' default calculations:
      There's always a 1-byte immediate, and they're always encoded in a VEX3-
      like manner (note that "prefix_extra" already evaluates to 1 in this
      case). The drop now (or already previously) redundant explicit
      attributes, adding "mode" ones where they were missing.
      
      Furthermore use "sse4arg" consistently for all VPCOM* insns; so far
      signed comparisons did use it, while unsigned ones used "ssecmp". Note
      that while they have (not counting the explicit or implicit immediate
      operand) they really only have 3 operands, the operator is also counted
      in those patterns. That's relevant for establishing the "memory"
      attribute's value, and at the same time benign when there are only
      register operands.
      
      Note that despite also having 4 operands, multiply-add insns aren't
      affected by this change, as they use "ssemuladd" for "type".
      
      gcc/
      
      	* config/i386/i386.md (length_immediate): Handle "sse4arg".
      	(prefix): Likewise.
      	(*xop_pcmov_<mode>): Add "mode" attribute.
      	* config/i386/mmx.md (*xop_maskcmp<mode>3): Drop "prefix_data16",
      	"prefix_rep", "prefix_extra", and "length_immediate" attributes.
      	(*xop_maskcmp_uns<mode>3): Likewise. Switch "type" to "sse4arg".
      	(*xop_pcmov_<mode>): Add "mode" attribute.
      	* config/i386/sse.md (xop_pcmov_<mode><avxsizesuffix>): Add "mode"
      	attribute.
      	(xop_maskcmp<mode>3): Drop "prefix_data16", "prefix_rep",
      	"prefix_extra", and "length_immediate" attributes.
      	(xop_maskcmp_uns<mode>3): Likewise. Switch "type" to "sse4arg".
      	(xop_maskcmp_uns2<mode>3): Drop "prefix_data16", "prefix_extra",
      	and "length_immediate" attributes. Switch "type" to "sse4arg".
      	(xop_pcom_tf<mode>3): Likewise.
      	(xop_vpermil2<mode>3): Drop "length_immediate" attribute.
      98e9edad
    • Jan Beulich's avatar
      x86: "prefix_extra" tidying · 328796de
      Jan Beulich authored
      Drop SSE5 leftovers from both its comment and its default calculation.
      A value of 2 simply cannot occur anymore. Instead extend the comment to
      mention the use of the attribute in "length_vex", clarifying why
      "prefix_extra" can actually be meaningful on VEX-encoded insns despite
      those not having any real prefixes except possibly segment overrides.
      
      gcc/
      
      	* config/i386/i386.md (prefix_extra): Correct comment. Fold
      	cases yielding 2 into ones yielding 1.
      328796de
Loading