1. 14 Jul, 2018 2 commits
  2. 13 Jul, 2018 19 commits
    • runtime: skip zero-sized fields in structs when converting to FFI · 867b003f
          
          The libffi library doesn't understand zero-sized objects.
          When we see a zero-sized field in a struct, just skip it when
          converting to the FFI data structures. There is no value to pass in
          any case, so not telling libffi about the field doesn't affect
          anything.
          
          The test case for this is https://golang.org/cl/123316.
          
          Fixes golang/go#26335
          
          Reviewed-on: https://go-review.googlesource.com/123335
      
      From-SVN: r262651
      Ian Lance Taylor committed
    • x86: Tune Skylake, Cannonlake and Icelake as Haswell · 7264261f
      r259399, which added PROCESSOR_SKYLAKE, disabled many x86 optimizations
      which are enabled by PROCESSOR_HASWELL.  As the result, -mtune=skylake
      generates slower codes on Skylake than before.  The same also applies
      to Cannonlake and Icelak tuning.
      
      This patch changes -mtune={skylake|cannonlake|icelake} to tune like
      -mtune=haswell for until their tuning is properly adjusted. It also
      enables -mprefer-vector-width=256 for -mtune=haswell, which has no
      impact on codegen when AVX512 isn't enabled.
      
      Performance impacts on SPEC CPU 2017 rate with 1 copy using
      
      -march=native -mfpmath=sse -O2 -m64
      
      are
      
      1. On Broadwell server:
      
      500.perlbench_r		-0.56%
      502.gcc_r		-0.18%
      505.mcf_r		0.24%
      520.omnetpp_r		0.00%
      523.xalancbmk_r		-0.32%
      525.x264_r		-0.17%
      531.deepsjeng_r		0.00%
      541.leela_r		0.00%
      548.exchange2_r		0.12%
      557.xz_r		0.00%
      Geomean			0.00%
      
      503.bwaves_r		0.00%
      507.cactuBSSN_r		0.21%
      508.namd_r		0.00%
      510.parest_r		0.19%
      511.povray_r		-0.48%
      519.lbm_r		0.00%
      521.wrf_r		0.28%
      526.blender_r		0.19%
      527.cam4_r		0.39%
      538.imagick_r		0.00%
      544.nab_r		-0.36%
      549.fotonik3d_r		0.51%
      554.roms_r		0.00%
      Geomean			0.17%
      
      On Skylake client:
      
      500.perlbench_r		0.96%
      502.gcc_r		0.13%
      505.mcf_r		-1.03%
      520.omnetpp_r		-1.11%
      523.xalancbmk_r		1.02%
      525.x264_r		0.50%
      531.deepsjeng_r		2.97%
      541.leela_r		0.50%
      548.exchange2_r		-0.95%
      557.xz_r		2.41%
      Geomean			0.56%
      
      503.bwaves_r		0.49%
      507.cactuBSSN_r		3.17%
      508.namd_r		4.05%
      510.parest_r		0.15%
      511.povray_r		0.80%
      519.lbm_r		3.15%
      521.wrf_r		10.56%
      526.blender_r		2.97%
      527.cam4_r		2.36%
      538.imagick_r		46.40%
      544.nab_r		2.04%
      549.fotonik3d_r		0.00%
      554.roms_r		1.27%
      Geomean			5.49%
      
      On Skylake server:
      
      500.perlbench_r		0.71%
      502.gcc_r		-0.51%
      505.mcf_r		-1.06%
      520.omnetpp_r		-0.33%
      523.xalancbmk_r		-0.22%
      525.x264_r		1.72%
      531.deepsjeng_r		-0.26%
      541.leela_r		0.57%
      548.exchange2_r		-0.75%
      557.xz_r		-1.28%
      Geomean			-0.21%
      
      503.bwaves_r		0.00%
      507.cactuBSSN_r		2.66%
      508.namd_r		3.67%
      510.parest_r		1.25%
      511.povray_r		2.26%
      519.lbm_r		1.69%
      521.wrf_r		11.03%
      526.blender_r		3.39%
      527.cam4_r		1.69%
      538.imagick_r		64.59%
      544.nab_r		-0.54%
      549.fotonik3d_r		2.68%
      554.roms_r		0.00%
      Geomean			6.19%
      
      This patch improves -march=native performance on Skylake up to 60% and
      leaves -march=native performance unchanged on Haswell.
      
      gcc/
      
      2018-07-13  H.J. Lu  <hongjiu.lu@intel.com>
      	    Sunil K Pandey  <sunil.k.pandey@intel.com>
      
      	PR target/84413
      	* config/i386/i386.c (m_CORE_AVX512): New.
      	(m_CORE_AVX2): Likewise.
      	(m_CORE_ALL): Add m_CORE_AVX2.
      	* config/i386/x86-tune.def: Replace m_HASWELL with m_CORE_AVX2.
      	Replace m_SKYLAKE_AVX512 with m_CORE_AVX512 on avx256_optimal
      	and remove the rest of m_SKYLAKE_AVX512.
      
      gcc/testsuite/
      
      2018-07-13  H.J. Lu  <hongjiu.lu@intel.com>
      	    Sunil K Pandey  <sunil.k.pandey@intel.com>
      
      	PR target/84413
      	* gcc.target/i386/pr84413-1.c: New test.
      	* gcc.target/i386/pr84413-2.c: Likewise.
      	* gcc.target/i386/pr84413-3.c: Likewise.
      
      Co-Authored-By: Sunil K Pandey <sunil.k.pandey@intel.com>
      
      From-SVN: r262649
      H.J. Lu committed
    • lto.c (do_stream_out): Add PART parameter; open dump file. · 814f3331
      
      	* lto.c (do_stream_out): Add PART parameter; open dump file.
      	(stream_out): Add PART parameter; pass it to do_stream_out.
      	(lto_wpa_write_files): Update call of stream_out.
      
      	* lto-streamer-out.c (copy_function_or_variable): Dump info about
      	copying section.
      
      From-SVN: r262645
      Jan Hubicka committed
    • emmintrin.h (_mm_and_si128): New function. · fb5f0c20
      [gcc]
      
      2018-07-13  Bill Schmidt  <wschmidt@linux.ibm.com>
      	    Steve Munroe  <munroesj52@gmail.com>
      
      	* config/rs6000/emmintrin.h (_mm_and_si128): New function.
      	(_mm_andnot_si128): Likewise.
      	(_mm_or_si128): Likewise.
      	(_mm_xor_si128): Likewise.
      
      [gcc/testsuite]
      
      2018-07-13  Bill Schmidt  <wschmidt@linux.ibm.com>
      	    Steve Munroe  <munroesj52@gmail.com>
      
      	* gcc.target/powerpc/sse2-pand-1.c: New file.
      	* gcc.target/powerpc/sse2-pandn-1.c: Likewise.
      	* gcc.target/powerpc/sse2-por-1.c: Likewise.
      	* gcc.target/powerpc/sse2-pxor-1.c: Likewise.
      
      
      Co-Authored-By: Steve Munroe <munroesj52@gmail.com>
      
      From-SVN: r262642
      Bill Schmidt committed
    • compiler: fix parsing of composite literals with omitted pointer types · 113950b7
          
          The frontend could parse omitted pointer typess at the end of the
          type, but not in the middle, so code like []*[][]int{{{1}}} failed.
          
          Test case is in https://golang.org/cl/123477.
          
          Fixes golang/go#26340
          
          Reviewed-on: https://go-review.googlesource.com/123479
      
      From-SVN: r262641
      Ian Lance Taylor committed
    • [PR c++/86374] Name lookup failure in enclosing template · 6b34716b
      https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00701.html
      	PR c++/86374
      	* pt.c (lookup_template_class_1): Use tsubst_aggr_type for
      	contexts that are classes.
      	* parser.c (cp_parser_template_id): Combine entering_scope decl &
      	initializer.
      
      	PR c++/86374
      	* g++.dg/pr86374.C: New.
      
      From-SVN: r262637
      Nathan Sidwell committed
    • 3nd Patch for PR78009 · b2272b13
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809
      Inline strcmp with small constant strings
      
      The design doc for PR78809 is at:
      https://www.mail-archive.com/gcc@gcc.gnu.org/msg83822.html
      
      this patch is for the third part of change of PR78809.
      
      C. for strcmp (s1, s2), strncmp (s1, s2, n), and memcmp (s1, s2, n)
         if the result is NOT used to do simple equality test against zero, one of
      "s1" or "s2" is a small constant string, n is a constant, and the Min value of
      the length of the constant string and "n" is smaller than a predefined
      threshold T,
         inline the call by a byte-to-byte comparision sequence to avoid calling
      overhead.
      
      adding test case strcmpopt_5.c into gcc.dg for part C of PR78809.
      adding test case strcmpopt_6.c into gcc.dg to test the following case:
         When the specified length exceeds one of the arguments of the call to memcmp,
         the call to memcmp should NOT be inlined.
      
      From-SVN: r262636
      Qing Zhao committed
    • arm - Add vendor and CPU id information to arm-cpus.in · b02160e5
      This patch moves the vendor and CPU id data from driver-arm.c to the
      main table of CPU data in arm-cpus.in.  It then adds rules to
      parsecpu.awk to build data tables that can be used by the driver for
      automatic CPU detection when running natively.  This is the last major
      bit of CPU-specific data that can be usefully moved to the CPU data
      tables (I don't think it is sensible to move the per-cpu tuning data
      from its current location).
      
      The syntax and parser can support revision ranges, but at present
      nothing is done with that data: no supported cpu currently needs that
      capability.
      
      	* config/arm/driver-arm.c: Include arm-native.h.
      	(host_detect_local_cpu): Use auto-generated data tables.
      	(vendors, arm_cpu_table): Delete.  Move part information to ...
      	* config/arm/arm-cpus.in: ... here.
      	* config/arm/parsecpu.awk (gen_native): New function.
      	(vendor, part): New CPU fields.
      	(END): Add support for building the native CPU detection tables.
      	* config/arm/t-arm (arm-native.h): Add build rule.
      	(driver-arm.o): Add dependency on arm-native.h.
      
      From-SVN: r262633
      Richard Earnshaw committed
    • re PR middle-end/85974 (Failure to optimize difference of two pointers into a… · 67fccea4
      re PR middle-end/85974 (Failure to optimize difference of two pointers into a compile time constant)
      
      2018-07-13  Richard Biener  <rguenther@suse.de>
      
      	PR middle-end/85974
      	* match.pd (addr1 - addr2): Allow either of the operand to
      	have a conversion.
      
      	* gcc.c-torture/compile/930326-1.c: Adjust to cover widening.
      
      From-SVN: r262632
      Richard Biener committed
    • [testsuite, guality] Add -fno-ipa-icf in gcc.dg/guality · 22539827
      Optimization fipa-icf breaks debug info (as is noted in PR63572 - "ICF
      breaks user debugging experience"), which make guality tests clztest.c,
      ctztest.c and sra-1.c unsupported for option combination "-O2 -flto
      -fuse-linker-plugin -fno-fat-lto-objects".  F.i., in clztest.c foo and bar are
      merged, and gdb can set a breakpoint on a line in foo, but trying to set a
      breakpoint on a line in bar results in a breakpoint in main instead.
      
      This patch works around the problem by adding -fno-ipa-icf (as is already done
      in csttest.c and pr43077-1.c) to those testcases:
      ...
      -UNSUPPORTED: gcc.dg/guality/clztest.c ... line . g == f
      +PASS:        gcc.dg/guality/clztest.c ... line . g == f
      -UNSUPPORTED: gcc.dg/guality/ctztest.c ... line . g == f
      +PASS:        gcc.dg/guality/ctztest.c ... line . g == f
      -UNSUPPORTED: gcc.dg/guality/sra-1.c ... line .+1 a[0] == 4
      +PASS:        gcc.dg/guality/sra-1.c ... line .+1 a[0] == 4
      -UNSUPPORTED: gcc.dg/guality/sra-1.c ... line . a[1] == 14
      +PASS:        gcc.dg/guality/sra-1.c ... line . a[1] == 14
      ...
      
      Tested on x86_64.
      
      2018-07-13  Tom de Vries  <tdevries@suse.de>
      
      	* gcc.dg/guality/clztest.c: Add -fno-ipa-icf in dg-options.
      	* gcc.dg/guality/ctztest.c: Same.
      	* gcc.dg/guality/sra-1.c: Same.
      
      From-SVN: r262631
      Tom de Vries committed
    • DFix typo · e52b0aab
      From-SVN: r262630
      Eric Botcazou committed
    • lang.opt (funsigned-char): New option. · 86b43436
      	* gcc-interface/lang.opt (funsigned-char): New option.
      	* gcc-interface/misc.c (gnat_handle_option): Accept it.
      	* gcc-interface/utils.c (finish_character_type): Tweak comment.
      
      From-SVN: r262629
      Eric Botcazou committed
    • [debug] Reuse debug exprs generated in remap_ssa_name · bdaa2c54
      When compiling gcc.dg/vla-1.c with -O3 -g, vla a and b in f1 are optimized
      away, and f1 is cloned to a version f1.constprop with no parameters, eliminating
      parameter i.  Debug info is generated to describe the sizes of a and b, but
      that process generates debug expressions that are not reused.
      
      Fix the duplication by saving and reusing the generated debug expressions in
      remap_ssa_name.  Concretely: reuse D#7 here instead of generating D#8:
      ...
       __attribute__((noinline))
       f1.constprop ()
       {
         intD.6 iD.1935;
      
         <bb 3>
         # DEBUG D#10 s=> iD.1897
         # DEBUG iD.1935 => D#10
      
         <bb 2>
      -  # DEBUG D#8 s=> iD.1935
         # DEBUG D#7 s=> iD.1935
         saved_stack.2_1 = __builtin_stack_save ();
         # DEBUG BEGIN_STMT
         # DEBUG D#6 => D#7 + 1
         # DEBUG D#5 => (long intD.8) D#6
         # DEBUG D#4 => D#5 + -1
         # DEBUG D.1937 => (sizetype) D#4
         # DEBUG a.0D.1942 => NULL
         # DEBUG BEGIN_STMT
      -  # DEBUG D#3 => D#8 + 2
      +  # DEBUG D#3 => D#7 + 2
         # DEBUG D#2 => (long intD.8) D#3
         # DEBUG D#1 => D#2 + -1
         # DEBUG D.1944 => (sizetype) D#1
         # DEBUG b.1D.1949 => NULL
      ...
      
      Bootstrapped and reg-tested on x86_64.
      
      2018-07-13  Tom de Vries  <tdevries@suse.de>
      
      	* tree-inline.c (remap_ssa_name): Save and reuse debug exprs generated
      	in remap_ssa_name.
      
      	* gcc.dg/vla-1.c: Update.
      
      From-SVN: r262628
      Tom de Vries committed
    • [contrib] Add contrib/maintainers-verify.sh · bddcac9d
      2018-07-13  Tom de Vries  <tdevries@suse.de>
      
      	* maintainers-verify.sh: New file.
      
      	* gcc.src/maintainers.exp: New file.
      
      From-SVN: r262627
      Tom de Vries committed
    • aarch64.c (aarch64_operands_adjust_ok_for_ldpstp): Use arrays instead of numbered variables. · 34d7854d
      
      	* config/aarch64/aarch64.c (aarch64_operands_adjust_ok_for_ldpstp): Use
      	arrays instead of numbered variables.
      
      From-SVN: r262626
      Jackson Woodruff committed
    • sparc-protos.h (sparc_compute_frame_size): Delete. · f77c5a3f
      	* config/sparc/sparc-protos.h (sparc_compute_frame_size): Delete.
      	* config/sparc/sparc.c (sparc_compute_frame_size): Make static
      
      From-SVN: r262625
      Eric Botcazou committed
    • re PR debug/86452 (ICE in force_decl_die, at dwarf2out.c:25922 with -g1 and -flto) · 77e61ab0
      2018-07-13  Richard Biener  <rguenther@suse.de>
      
      	PR debug/86452
      	* dwarf2out.c (gen_type_die_with_usage): Use scope_die_for
      	instead of get_context_die.
      
      From-SVN: r262624
      Richard Biener committed
    • re PR tree-optimization/86489 (ICE in gimple_phi_arg starting with r261682 when… · 061d40da
      re PR tree-optimization/86489 (ICE in gimple_phi_arg starting with r261682 when building 531.deepsjeng_r with FDO + LTO)
      
      gcc/ChangeLog:
      
      2018-07-13  Kugan Vivekanandarajah  <kuganv@linaro.org>
      	    Richard Biener  <rguenther@suse.de>
      
      	PR middle-end/86489
      	* tree-ssa-loop-niter.c (number_of_iterations_popcount): Check
      	that the loop latch destination where phi is defined.
      
      gcc/testsuite/ChangeLog:
      
      2018-07-13  Kugan Vivekanandarajah  <kuganv@linaro.org>
      
      	PR middle-end/86489
      	* gcc.dg/pr86489.c: New test.
      
      
      Co-Authored-By: Richard Biener <rguenther@suse.de>
      
      From-SVN: r262622
      Kugan Vivekanandarajah committed
    • Daily bump. · b18bb376
      From-SVN: r262620
      GCC Administrator committed
  3. 12 Jul, 2018 19 commits
    • PR testsuite/86510 - test case g++.dg/warn/pr86453.C fails starting with r262596 · 68d71a31
      gcc/testsuite/ChangeLog:
      	g++.dg/warn/pr86453.C: Adjust.
      
      From-SVN: r262609
      Martin Sebor committed
    • RISC-V: Silence expected Ada testsuite warning. · ac07bbf2
      	gcc/testsuite/
      	* gnat.dg/warn5.adb: Expect warning for riscv*-*-*.
      
      From-SVN: r262608
      Jim Wilson committed
    • RISC-V: Error if function declared with different interrupt modes. · 8528f27b
      	gcc/
      	2018-07-06  Kito Cheng  <kito.cheng@gmail.com>
              * config/riscv/riscv.c (enum riscv_privilege_levels): Add UNKNOWN_MODE.
              (riscv_expand_epilogue): Add assertion to check interrupt mode.
              (riscv_set_current_function): Extract getting interrupt type to new
              function.
              (riscv_get_interrupt_type): New function.
              (riscv_merge_decl_attributes): New function, checking interrupt type is
              same.
              (TARGET_MERGE_DECL_ATTRIBUTES): Define.
      
      	gcc/testsuite/
      	2018-07-06  Kito Cheng  <kito.cheng@gmail.com>
              * gcc.target/riscv/interrupt-conflict-mode.c: New.
      
      From-SVN: r262607
      Kito Cheng committed
    • c-attribs.c (c_common_attribute_table): Add "omp declare target implicit" attribute. · 9b452033
      	* c-attribs.c (c_common_attribute_table): Add
      	"omp declare target implicit" attribute.
      
      	* c-decl.c (c_decl_attributes): Don't diagnose vars without mappable
      	type here, instead add "omp declare target implicit" attribute.
      	(finish_decl): Diagnose vars without mappable type here.
      
      	* decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
      	type here, instead add "omp declare target implicit" attribute.  Add
      	that attribute instead of "omp declare target" also when
      	processing_template_decl.
      	* decl.c (cp_finish_decl): Diagnose vars without mappable type here,
      	and before calling cp_omp_mappable_type call complete_type.
      
      	* c-c++-common/gomp/declare-target-3.c: New test.
      	* g++.dg/gomp/declare-target-2.C: New test.
      
      From-SVN: r262605
      Jakub Jelinek committed
    • pdp11.c (pdp11_output_def): Fix typo in .set directive. · f3475629
      	* config/pdp11/pdp11.c (pdp11_output_def): Fix typo in .set
      	directive.
      
      From-SVN: r262604
      Paul Koning committed
    • rtl.texi (REG_NONNEG): Remove decrement and branch until zero reference, add doloop_end instead. · f9adcdec
      	* doc/rtl.texi (REG_NONNEG): Remove decrement and branch until
      	zero reference, add doloop_end instead.
      	* doc/md.texi (decrement_and_branch_until_zero): Remove.
      	(Looping patterns): Remove decrement_and_branch_until_zero.  Add
      	detail for doloop_end.
      
      From-SVN: r262603
      Paul Koning committed
    • [contrib] compare_tests: Print number of tests · e57aae39
      2018-07-12  Christophe Lyon  <christophe.lyon@linaro.org>
      
      	* compare_tests: Print number of tests in each category.
      
      From-SVN: r262600
      Christophe Lyon committed
    • PR c/86453 - error: type variant differs by TYPE_PACKED in free_lang_data since r255469 · bffc6270
      gcc/ChangeLog:
      
      	PR c/86453
      	* attribs.c (decl_attributes): Reject conflicting attributes before
      	calling attribute handlers.
      
      gcc/testsuite/ChangeLog:
      
      	PR c/86453
      	* c-c++-common/Wattributes.c: Adjust.
      	* gcc.dg/Wattributes-10.c: New test.
      	* g++.dg/Wattributes-3.C: Adjust.
      	* gcc.dg/Wattributes-6.c: Adjust.
      	* gcc.dg/pr18079.c: Adjust.
      	* gcc.dg/torture/pr42363.c: Adjust.
      
      From-SVN: r262596
      Martin Sebor committed
    • avx512vl-vpclmulqdq-2.c: Remove 128bit version · d59442fa
      Remove 128bit version from gcc.target/i386/avx512vl-vpclmulqdq-2.c for:
      
      commit 336f029101465aad8f497c753a3d5a77ff78ec88
      Author: kyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>
      Date:   Mon Jun 11 11:10:38 2018 +0000
      
          Remove redundant intrinsics
      
          gcc/
                  * config/i386/vaesintrin.h (_mm_aesdec_epi128, _mm_aesdeclast_epi128)
                  _mm_aesenc_epi128, _mm_aesenclast_epi128: Remove.
                  * config/i386/vpclmulqdqintrin.h (_mm_clmulepi64_epi128): Remove.
          gcc/testsuite/
                  * gcc.target/i386/avx512fvl-vaes-1.c: Remove 128bit versions from test.
                  * gcc.target/i386/vpclmulqdq.c: Ditto.
      
      	 * gcc.target/i386/avx512vl-vpclmulqdq-2.c: Remove 128bit
      	 version.
      
      From-SVN: r262595
      Julia Koval committed
    • dumpfile.c (gcc::dump_manager::get_dump_file_name): Add PART parameter. · 75fdb07e
      
      	* dumpfile.c (gcc::dump_manager::get_dump_file_name): Add PART
      	 parameter.
      	(gcc::dump_manager::get_dump_file_name): likewise.
      	(dump_begin): Likewise.
      	* dumpfile.h (dump_begin): Update prototype.
      	(gcc::dump_manager::get_dump_file_name,
      	gcc::dump_manager::get_dump_file_name): Update prototype.
      
      From-SVN: r262591
      Jan Hubicka committed
    • Implement SLP of internal functions · 5249ee4d
      SLP of calls was previously restricted to built-in functions.
      This patch extends it to internal functions.
      
      2018-07-12  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* internal-fn.h (vectorizable_internal_fn_p): New function.
      	* tree-vect-slp.c (compatible_calls_p): Likewise.
      	(vect_build_slp_tree_1): Remove nops argument.  Handle calls
      	to internal functions.
      	(vect_build_slp_tree_2): Update call to vect_build_slp_tree_1.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-cond-arith-6.c: New test.
      	* gcc.target/aarch64/sve/cond_arith_4.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_4_run.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_5.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_5_run.c: Likewise.
      	* gcc.target/aarch64/sve/slp_14.c: Likewise.
      	* gcc.target/aarch64/sve/slp_14_run.c: Likewise.
      
      From-SVN: r262590
      Richard Sandiford committed
    • Use conditional internal functions in if-conversion · 2c58d42c
      This patch uses IFN_COND_* to vectorise conditionally-executed,
      potentially-trapping arithmetic, such as most floating-point
      ops with -ftrapping-math.  E.g.:
      
          if (cond) { ... x = a + b; ... }
      
      becomes:
      
          ...
          x = .COND_ADD (cond, a, b, else_value);
          ...
      
      When this transformation is done on its own, the value of x for
      !cond isn't important, so else_value is simply the target's
      preferred_else_value (i.e. the value it can handle the most
      efficiently).
      
      However, the patch also looks for the equivalent of:
      
          y = cond ? x : c;
      
      in which the "then" value is the result of the conditionally-executed
      operation and the "else" value "c" is some value that is available at x.
      In that case we can instead use:
      
          x = .COND_ADD (cond, a, b, c);
      
      and replace uses of y with uses of x.
      
      The patch also looks for:
      
          y = !cond ? c : x;
      
      which can be transformed in the same way.  This involved adding a new
      utility function inverse_conditions_p, which was already open-coded
      in a more limited way in match.pd.
      
      2018-07-12  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* fold-const.h (inverse_conditions_p): Declare.
      	* fold-const.c (inverse_conditions_p): New function.
      	* match.pd: Use inverse_conditions_p.  Add folds of view_converts
      	that test the inverse condition of a conditional internal function.
      	* internal-fn.h (vectorized_internal_fn_supported_p): Declare.
      	* internal-fn.c (internal_fn_mask_index): Handle conditional
      	internal functions.
      	(vectorized_internal_fn_supported_p): New function.
      	* tree-if-conv.c: Include internal-fn.h and fold-const.h.
      	(any_pred_load_store): Replace with...
      	(need_to_predicate): ...this new variable.
      	(redundant_ssa_names): New variable.
      	(ifcvt_can_use_mask_load_store): Move initial checks to...
      	(ifcvt_can_predicate): ...this new function.  Handle tree codes
      	for which a conditional internal function exists.
      	(if_convertible_gimple_assign_stmt_p): Use ifcvt_can_predicate
      	instead of ifcvt_can_use_mask_load_store.  Update after variable
      	name change.
      	(predicate_load_or_store): New function, split out from
      	predicate_mem_writes.
      	(check_redundant_cond_expr): New function.
      	(value_available_p): Likewise.
      	(predicate_rhs_code): Likewise.
      	(predicate_mem_writes): Rename to...
      	(predicate_statements): ...this.  Use predicate_load_or_store
      	and predicate_rhs_code.
      	(combine_blocks, tree_if_conversion): Update after above name changes.
      	(ifcvt_local_dce): Handle redundant_ssa_names.
      	* tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Handle
      	general conditional functions.
      	* tree-vect-stmts.c (vectorizable_call): Likewise.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-cond-arith-4.c: New test.
      	* gcc.dg/vect/vect-cond-arith-5.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_1.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_1_run.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_2.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_2_run.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_3.c: Likewise.
      	* gcc.target/aarch64/sve/cond_arith_3_run.c: Likewise.
      
      From-SVN: r262589
      Richard Sandiford committed
    • Support fused multiply-adds in fully-masked reductions · 0936858f
      This patch adds support for fusing a conditional add or subtract
      with a multiplication, so that we can use fused multiply-add and
      multiply-subtract operations for fully-masked reductions.  E.g.
      for SVE we vectorise:
      
        double res = 0.0;
        for (int i = 0; i < n; ++i)
          res += x[i] * y[i];
      
      using a fully-masked loop in which the loop body has the form:
      
        res_1 = PHI<0(preheader), res_2(latch)>;
        avec = .MASK_LOAD (loop_mask, a)
        bvec = .MASK_LOAD (loop_mask, b)
        prod = avec * bvec;
        res_2 = .COND_ADD (loop_mask, res_1, prod, res_1);
      
      where the last statement does the equivalent of:
      
        res_2 = loop_mask ? res_1 + prod : res_1;
      
      (operating elementwise).  The point of the patch is to convert the last
      two statements into:
      
        res_s = .COND_FMA (loop_mask, avec, bvec, res_1, res_1);
      
      which is equivalent to:
      
        res_2 = loop_mask ? fma (avec, bvec, res_1) : res_1;
      
      (again operating elementwise).
      
      2018-07-12  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* internal-fn.h (can_interpret_as_conditional_op_p): Declare.
      	* internal-fn.c (can_interpret_as_conditional_op_p): New function.
      	* tree-ssa-math-opts.c (convert_mult_to_fma_1): Handle conditional
      	plus and minus and convert them into IFN_COND_FMA-based sequences.
      	(convert_mult_to_fma): Handle conditional plus and minus.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-fma-2.c: New test.
      	* gcc.target/aarch64/sve/reduc_4.c: Likewise.
      	* gcc.target/aarch64/sve/reduc_6.c: Likewise.
      	* gcc.target/aarch64/sve/reduc_7.c: Likewise.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r262588
      Richard Sandiford committed
    • Add IFN_COND_FMA functions · b41d1f6e
      This patch adds conditional equivalents of the IFN_FMA built-in functions.
      Most of it is just a mechanical extension of the binary stuff.
      
      2018-07-12  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* doc/md.texi (cond_fma, cond_fms, cond_fnma, cond_fnms): Document.
      	* optabs.def (cond_fma_optab, cond_fms_optab, cond_fnma_optab)
      	(cond_fnms_optab): New optabs.
      	* internal-fn.def (COND_FMA, COND_FMS, COND_FNMA, COND_FNMS): New
      	internal functions.
      	(FMA): Use DEF_INTERNAL_FLT_FN rather than DEF_INTERNAL_FLT_FLOATN_FN.
      	* internal-fn.h (get_conditional_internal_fn): Declare.
      	(get_unconditional_internal_fn): Likewise.
      	* internal-fn.c (cond_ternary_direct): New macro.
      	(expand_cond_ternary_optab_fn): Likewise.
      	(direct_cond_ternary_optab_supported_p): Likewise.
      	(FOR_EACH_COND_FN_PAIR): Likewise.
      	(get_conditional_internal_fn): New function.
      	(get_unconditional_internal_fn): Likewise.
      	* gimple-match.h (gimple_match_op::MAX_NUM_OPS): Bump to 5.
      	(gimple_match_op::gimple_match_op): Add a new overload for 5
      	operands.
      	(gimple_match_op::set_op): Likewise.
      	(gimple_resimplify5): Declare.
      	* genmatch.c (decision_tree::gen): Generate simplifications for
      	5 operands.
      	* gimple-match-head.c (gimple_simplify): Define an overload for
      	5 operands.  Handle calls with 5 arguments in the top-level overload.
      	(convert_conditional_op): Handle conversions from unconditional
      	internal functions to conditional ones.
      	(gimple_resimplify5): New function.
      	(build_call_internal): Pass a fifth operand.
      	(maybe_push_res_to_seq): Likewise.
      	(try_conditional_simplification): Try converting conditional
      	internal functions to unconditional internal functions.
      	Handle 3-operand unconditional forms.
      	* match.pd (UNCOND_TERNARY, COND_TERNARY): Operator lists.
      	Define ternary equivalents of the current rules for binary conditional
      	internal functions.
      	* config/aarch64/aarch64.c (aarch64_preferred_else_value): Handle
      	ternary operations.
      	* config/aarch64/iterators.md (UNSPEC_COND_FMLA, UNSPEC_COND_FMLS)
      	(UNSPEC_COND_FNMLA, UNSPEC_COND_FNMLS): New unspecs.
      	(optab): Handle them.
      	(SVE_COND_FP_TERNARY): New int iterator.
      	(sve_fmla_op, sve_fmad_op): New int attributes.
      	* config/aarch64/aarch64-sve.md (cond_<optab><mode>)
      	(*cond_<optab><mode>_2, *cond_<optab><mode_4)
      	(*cond_<optab><mode>_any): New SVE_COND_FP_TERNARY patterns.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-cond-arith-3.c: New test.
      	* gcc.target/aarch64/sve/vcond_13.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_13_run.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_14.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_14_run.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_15.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_15_run.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_16.c: Likewise.
      	* gcc.target/aarch64/sve/vcond_16_run.c: Likewise.
      
      From-SVN: r262587
      Richard Sandiford committed
    • Extend tree code folds to IFN_COND_* · 6a86928d
      This patch adds match.pd support for applying normal folds to their
      IFN_COND_* forms.  E.g. the rule:
      
        (plus @0 (negate @1)) -> (minus @0 @1)
      
      also allows the fold:
      
        (IFN_COND_ADD @0 @1 (negate @2) @3) -> (IFN_COND_SUB @0 @1 @2 @3)
      
      Actually doing this by direct matches in gimple-match.c would
      probably lead to combinatorial explosion, so instead, the patch
      makes gimple_match_op carry a condition under which the operation
      happens ("cond"), and the value to use when the condition is false
      ("else_value").  Thus in the example above we'd do the following
      
      (a) convert:
      
            cond:NULL_TREE (IFN_COND_ADD @0 @1 @4 @3) else_value:NULL_TREE
      
          to:
      
            cond:@0 (plus @1 @4) else_value:@3
      
      (b) apply gimple_resimplify to (plus @1 @4)
      
      (c) reintroduce cond and else_value when constructing the result.
      
      Nested operations inherit the condition of the outer operation
      (so that we don't introduce extra faults) but have a null else_value.
      If we try to build such an operation, the target gets to choose what
      else_value it can handle efficiently: obvious choices include one of
      the operands or a zero constant.  (The alternative would be to have some
      representation for an undefined value, but that seems a bit invasive,
      and isn't likely to be useful here.)
      
      I've made the condition a mandatory part of the gimple_match_op
      constructor so that it doesn't accidentally get dropped.
      
      2018-07-12  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* target.def (preferred_else_value): New target hook.
      	* doc/tm.texi.in (TARGET_PREFERRED_ELSE_VALUE): New hook.
      	* doc/tm.texi: Regenerate.
      	* targhooks.h (default_preferred_else_value): Declare.
      	* targhooks.c (default_preferred_else_value): New function.
      	* internal-fn.h (conditional_internal_fn_code): Declare.
      	* internal-fn.c (FOR_EACH_CODE_MAPPING): New macro.
      	(get_conditional_internal_fn): Use it.
      	(conditional_internal_fn_code): New function.
      	* gimple-match.h (gimple_match_cond): New struct.
      	(gimple_match_op): Add a cond member function.
      	(gimple_match_op::gimple_match_op): Update all forms to take a
      	gimple_match_cond.
      	* genmatch.c (expr::gen_transform): Use the same condition as res_op
      	for the suboperation, but don't specify a particular else_value.
      	* tree-ssa-sccvn.c (vn_nary_simplify, vn_reference_lookup_3)
      	(visit_nary_op, visit_reference_op_load): Pass
      	gimple_match_cond::UNCOND to the gimple_match_op constructor.
      	* gimple-match-head.c: Include tree-eh.h
      	(convert_conditional_op): New function.
      	(maybe_resimplify_conditional_op): Likewise.
      	(gimple_resimplify1): Call maybe_resimplify_conditional_op.
      	(gimple_resimplify2): Likewise.
      	(gimple_resimplify3): Likewise.
      	(gimple_resimplify4): Likewise.
      	(maybe_push_res_to_seq): Return null for conditional operations.
      	(try_conditional_simplification): New function.
      	(gimple_simplify): Call it.  Pass conditions to the gimple_match_op
      	constructor.
      	* match.pd: Fold VEC_COND_EXPRs of an IFN_COND_* call to a new
      	IFN_COND_* call.
      	* config/aarch64/aarch64.c (aarch64_preferred_else_value): New
      	function.
      	(TARGET_PREFERRED_ELSE_VALUE): Redefine.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-cond-arith-2.c: New test.
      	* gcc.target/aarch64/sve/loop_add_6.c: Likewise.
      
      From-SVN: r262586
      Richard Sandiford committed
    • lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream DECL_FCONTEXT · d5cbbf87
      
      	* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
      	DECL_FCONTEXT
      	(hash_tree): Do not hash DECL_FCONTEXT
      	* tree-streamer-in.c (lto_input_ts_field_decl_tree_pointers):
      	Do not stream DECL_FCONTEXT.
      	* tree-streamer-out.c (write_ts_field_decl_tree_pointers): Likewise.
      	* tree.c (free_lang_data_in_decl): Free DECL_FCONTEXT.
      
      From-SVN: r262585
      Jan Hubicka committed
    • re PR debug/86462 (Quite huge debug info size increase introduced in r262511) · 4405d067
      2018-07-12  Richard Biener  <rguenther@suse.de>
      
      	PR debug/86462
      	* dwarf2out.c (gen_block_die): Only output blocks when they have
      	at least one !DECL_IGNORED_P variable.
      
      From-SVN: r262583
      Richard Biener committed
    • re PR target/84829 (-mieee-fp causes to link with -lieee but that is no longer available) · 42d406b9
      2018-07-12  Richard Biener  <rguenther@suse.de>
      
      	PR target/84829
      	* config/gnu-user.h (GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC):
      	Remove -mieee-fp handling.
      
      	* gcc.target/i386/pr84829.c: New testcase.
      
      From-SVN: r262582
      Richard Biener committed
    • * gcc.dg/torture/20180712-1.c: New test. · 38eb12ee
      From-SVN: r262579
      Jakub Jelinek committed