[PATCH] DWARF5: Don't generate DW_AT_loclists_base for split compile unit DIEs.

2018-05-26 Thread Mark Wielaard
The loclists_base attribute is used to point to the beginning of the
loclists index of a DWARF5 loclists table when using DW_FORM_loclistsx.
For split compile units the base is not given by the attribute, but is
either the first (and only) index in the .debug_loclists section, or
(when placed in a .dwp file) given by the DW_SECT_LOCLISTS row in the
.debug_cu_index section.

The loclists_base attribute is only valid for the full (or skeleton)
compile unit DIE in the main (relocatable) object. But GCC only ever
generates a loclists table index for the .debug_loclists section put
into the split DWARF .dwo file.

For split compile unit DIEs it is confusing (and not according to spec)
to also have a DW_AT_loclists_base attribute (which might be wrong,
since its relocatable offset won't actually be relocated).

gcc/ChangeLog

* dwarf2out.c (dwarf2out_finish): Remove generation of
DW_AT_loclists_base.
---

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c05bfe4..103ded0 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -31292,11 +31292,17 @@ dwarf2out_finish (const char *)
   if (dwarf_split_debug_info)
 {
   if (have_location_lists)
{
- if (dwarf_version >= 5)
-   add_AT_loclistsptr (comp_unit_die (), DW_AT_loclists_base,
-   loc_section_label);
+ /* Since we generate the loclists in the split DWARF .dwo
+file itself, we don't need to generate a loclists_base
+attribute for the split compile unit DIE.  That attribute
+(and using relocatable sec_offset FORMs) isn't allowed
+for a split compile unit.  Only if the .debug_loclists
+section was in the main file, would we need to generate a
+loclists_base attribute here (for the full or skeleton
+unit DIE).  */
+
  /* optimize_location_lists calculates the size of the lists,
 so index them first, and assign indices to the entries.
 Although optimize_location_lists will remove entries from
 the table, it only does so for duplicates, and therefore


[patch, committed, libgfortran] PR85906 - Conditional jump depends on uninitialized value in write_integer

2018-05-26 Thread Jerry DeLisle
I biffed the ChangeLog on this with a flip of two digits on the PR 
number (fixed).


Anyway, the following was committed as obvious to trunk.  The 
BUF_STACK_SZ I bumped up because I noticed on PR85840 test case that 
even small kind floats were asking for a buffer size of 323. This avoids 
a few allocs for every write operation.


2018-05-26  Jerry DeLisle  

PR libgfortran/85906
* io/write.c (write_integer): Initialise the fnode format to
FMT_NONE, used for list directed write.
(BUF_STACK_SZ): Bump default buffer size up to avoid allocs on
small stuff.


--- trunk/libgfortran/io/write.c2018/05/26 17:30:52 260793
+++ trunk/libgfortran/io/write.c2018/05/26 18:22:18 260795
@@ -1348,6 +1348,7 @@
 }
   f.u.integer.w = width;
   f.u.integer.m = -1;
+  f.format = FMT_NONE;
   write_decimal (dtp, , source, kind, (void *) gfc_itoa);
 }

@@ -1465,7 +1466,7 @@

 /* Floating point helper functions.  */

-#define BUF_STACK_SZ 256
+#define BUF_STACK_SZ 384

 static int
 get_precision (st_parameter_dt *dtp, const fnode *f, const char 
*source, int kind)


Re: [PATCH] Warn for ignored ASM labels on typdef declarations PR 85444 (v.3)

2018-05-26 Thread Will Hawkins
Hello everyone!

I know every member of the community is very busy, but I am following
up on this patch to conform to the 'ping' etiquette.

Please let me know what comments you have about this patch and how I
can modify it to make sure that it meets standards.

Thanks for everything that you all do to make GCC the best compiler out there.

Will


On Fri, May 18, 2018 at 5:34 PM, Will Hawkins  wrote:
> Hello again!
>
> Thanks to the feedback of Mr. Myers and those on the PR, I have
> created a version 3 of this patch. This version introduces a new
> warning flag (enabled at Wall) -Wignored-asm-name that will flag cases
> where the user specifies an ASM name that the compiler ignores.
>
> Test cases included. Results from make bootstrap and/or make -k check
> are available upon request.
>
> Please let me know what I can do to make this better and bring it up
> to the standards of the community! Thanks again for the feedback on
> this patch during the previous two revisions!
>
> Sincerely,
> Will Hawkins
>
>
> 2018-05-18 Will Hawkins 
>
> PR c,c++/85444
> * gcc/c/c-decl.c: Warn about ignored asm label for
> typedef declaration
> * gcc/cp/decl.c: Warn about ignored asm label for
> typedef declaration
> * gcc/testsuite/gcc.dg/asm-pr85444.c: c testcase.
> * gcc/testsuite/g++.dg/asm-pr85444.C: c++ testcase.
>
> diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> index c48d6dc..ab3a9af 100644
> --- a/gcc/c-family/c.opt
> +++ b/gcc/c-family/c.opt
> @@ -595,6 +595,10 @@ Wignored-attributes
>  C C++ Var(warn_ignored_attributes) Init(1) Warning
>  Warn whenever attributes are ignored.
>
> +Wignored-asm-name
> +C C++ Var(warn_ignored_asm_name) Warning LangEnabledBy(C C++,Wall)
> +Warn whenever assembler names are specified but ignored.
> +
>  Wincompatible-pointer-types
>  C ObjC Var(warn_incompatible_pointer_types) Init(1) Warning
>  Warn when there is a conversion between pointers that have incompatible 
> types.
> diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
> index 3c4b18e..5a1ecd7 100644
> --- a/gcc/c/c-decl.c
> +++ b/gcc/c/c-decl.c
> @@ -5177,7 +5177,11 @@ finish_decl (tree decl, location_t init_loc, tree init,
>if (!DECL_FILE_SCOPE_P (decl)
>&& variably_modified_type_p (TREE_TYPE (decl), NULL_TREE))
>  add_stmt (build_stmt (DECL_SOURCE_LOCATION (decl), DECL_EXPR, decl));
> -
> +  if (asmspec_tree != NULL_TREE)
> +{
> +  warning (OPT_Wignored_asm_name, "asm-specifier is ignored in "
> +   "typedef declaration");
> +}
>rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl), 0);
>  }
>
> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
> index 10e3079..4c3ee36 100644
> --- a/gcc/cp/decl.c
> +++ b/gcc/cp/decl.c
> @@ -6981,6 +6981,11 @@ cp_finish_decl (tree decl, tree init, bool
> init_const_expr_p,
>/* Take care of TYPE_DECLs up front.  */
>if (TREE_CODE (decl) == TYPE_DECL)
>  {
> +  if (asmspec_tree != NULL_TREE)
> +{
> +  warning (OPT_Wignored_asm_name, "asm-specifier is ignored for "
> +   "typedef declarations");
> +}
>if (type != error_mark_node
>&& MAYBE_CLASS_TYPE_P (type) && DECL_NAME (decl))
>  {
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index ca3772b..63f81f4 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -286,7 +286,8 @@ Objective-C and Objective-C++ Dialects}.
>  -Wformat-y2k  -Wframe-address @gol
>  -Wframe-larger-than=@var{len}  -Wno-free-nonheap-object
> -Wjump-misses-init @gol
>  -Wif-not-aligned @gol
> --Wignored-qualifiers  -Wignored-attributes  -Wincompatible-pointer-types @gol
> +-Wignored-qualifiers  -Wignored-attributes  -Wignored-asm-name @gol
> +-Wincompatible-pointer-types @gol
>  -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n} @gol
>  -Wimplicit-function-declaration  -Wimplicit-int @gol
>  -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context @gol
> @@ -4523,6 +4524,14 @@ Warn when an attribute is ignored.  This is
> different from the
>  to drop an attribute, not that the attribute is either unknown, used in a
>  wrong place, etc.  This warning is enabled by default.
>
> +@item -Wignored-asm-name @r{(C and C++ only)}
> +@opindex Wignored-asm-name
> +@opindex Wno-ignored-asm-name
> +Warn when an assembler name is given but ignored. For C and C++, this
> +happens when a @code{typdef} declaration is given an assembler name.
> +
> +This warning is also enabled by @option{-Wall}.
> +
>  @item -Wmain
>  @opindex Wmain
>  @opindex Wno-main
> diff --git a/gcc/testsuite/g++.dg/asm-pr85444.C
> b/gcc/testsuite/g++.dg/asm-pr85444.C
> new file mode 100644
> index 000..f1f8f61
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/asm-pr85444.C
> @@ -0,0 +1,13 @@
> +/* Fix Bugzilla 8544 -- asm specifier on typedef silently ignored.
> +   { dg-do compile }
> +   { dg-options "-Wignored-asm-name" } */
> +
> +typedef struct
> +{
> +  int 

[patch, libgfortran, committed] Bug 85840 - Memory leak in write.c

2018-05-26 Thread Jerry DeLisle

The following committed as obvious after regression testing.

2018-05-26  Jerry DeLisle  

PR libgfortran/85840
* io/write.c (write_float_0): Use separate local variable for
the float string length.


Author: jvdelisle
Date: Sat May 26 17:30:52 2018
New Revision: 260793

URL: https://gcc.gnu.org/viewcvs?rev=260793=gcc=rev
Log:
2018-05-26  Jerry DeLisle  

PR libgfortran/85840
* io/write.c (write_float_0): Use separate local variable for
the float string length.

Modified:
trunk/libgfortran/io/write.c

--- trunk/libgfortran/io/write.c2018/05/26 11:35:31 260792
+++ trunk/libgfortran/io/write.c2018/05/26 17:30:52 260793
@@ -1566,19 +1566,19 @@
   char buf_stack[BUF_STACK_SZ];
   char str_buf[BUF_STACK_SZ];
   char *buffer, *result;
-  size_t buf_size, res_len;
+  size_t buf_size, res_len, flt_str_len;

   /* Precision for snprintf call.  */
   int precision = get_precision (dtp, f, source, kind);

   /* String buffer to hold final result.  */
   result = select_string (dtp, f, str_buf, _len, kind);
-
+
   buffer = select_buffer (dtp, f, precision, buf_stack, _size, kind);
-
+
   get_float_string (dtp, f, source , kind, 0, buffer,
-   precision, buf_size, result, _len);
-  write_float_string (dtp, result, res_len);
+   precision, buf_size, result, _str_len);
+  write_float_string (dtp, result, flt_str_len);

   if (buf_size > BUF_STACK_SZ)
 free (buffer);


Re: PING^2: [PATCH] Don't mark IFUNC resolver as only called directly

2018-05-26 Thread H.J. Lu
On Thu, May 24, 2018 at 1:47 PM, H.J. Lu  wrote:
> On Wed, May 23, 2018 at 8:35 AM, H.J. Lu  wrote:
>> On Wed, May 23, 2018 at 8:11 AM, Jan Hubicka  wrote:
 On Wed, May 23, 2018 at 2:01 AM, Jan Hubicka  wrote:
 >> On Tue, May 22, 2018 at 9:21 AM, Jan Hubicka  wrote:
 >> >> > >  class ipa_opt_pass_d;
 >> >> > >  typedef ipa_opt_pass_d *ipa_opt_pass;
 >> >> > > @@ -2894,7 +2896,8 @@ 
 >> >> > > cgraph_node::only_called_directly_or_aliased_p (void)
 >> >> > >   && !DECL_STATIC_CONSTRUCTOR (decl)
 >> >> > >   && !DECL_STATIC_DESTRUCTOR (decl)
 >> >> > >   && !used_from_object_file_p ()
 >> >> > > - && !externally_visible);
 >> >> > > + && !externally_visible
 >> >> > > + && !lookup_attribute ("ifunc", DECL_ATTRIBUTES 
 >> >> > > (decl)));
 >> >> >
 >> >> > How's it handled for our own generated resolver functions?  
 >> >> > That is,
 >> >> > isn't there sth cheaper than doing a lookup_attribute here?  I 
 >> >> > see
 >> >> > that make_dispatcher_decl nor 
 >> >> > ix86_get_function_versions_dispatcher
 >> >> > adds the 'ifunc' attribute (though they are TREE_PUBLIC there).
 >> >> 
 >> >>  Is there any drawback of setting force_output flag?
 >> >>  Honza
 >> >> >>>
 >> >> >>> Setting force_output may prevent some optimizations.  Can we add 
 >> >> >>> a bit
 >> >> >>> for IFUNC resolver?
 >> >> >>>
 >> >> >>
 >> >> >> Here is the patch to add ifunc_resolver to cgraph_node. Tested on 
 >> >> >> x86-64
 >> >> >> and i686.  Any comments?
 >> >> >>
 >> >> >
 >> >> > PING:
 >> >> >
 >> >> > https://gcc.gnu.org/ml/gcc-patches/2018-04/msg00647.html
 >> >> >
 >> >>
 >> >> PING.
 >> > OK, but please extend the verifier that ifunc_resolver flag is 
 >> > equivalent to
 >> > lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl))
 >> > so we are sure things stays in sync.
 >> >
 >>
 >> Like this
 >>
 >> diff --git a/gcc/symtab.c b/gcc/symtab.c
 >> index 80f6f910c3b..954920b6dff 100644
 >> --- a/gcc/symtab.c
 >> +++ b/gcc/symtab.c
 >> @@ -998,6 +998,13 @@ symtab_node::verify_base (void)
 >>error ("function symbol is not function");
 >>error_found = true;
 >>}
 >> +  else if ((lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl))
 >> + != NULL)
 >> + != dyn_cast  (this)->ifunc_resolver)
 >> +  {
 >> +  error ("inconsistent `ifunc' attribute");
 >> +  error_found = true;
 >> +  }
 >>  }
 >>else if (is_a  (this))
 >>  {
 >>
 >>
 >> Thanks.
 > Yes, thanks!
 > Honza

 I'd like to also fix it on GCC 8 branch for CET.  Should I backport my
 patch to GCC 8 after a few days or use the simple patch for GCC 8:

 https://gcc.gnu.org/ml/gcc-patches/2018-04/msg00588.html
>>>
>>> I would backport this one so we don't unnecesarily diverge.
>>> Thanks!
>>> Honza
>>
>> This is the backport which I will check into GCC 8 branch next week.
>>
>
> This is the updated backport which I will check into GCC 8 branch next week.
>

This is the updated backport which I will check into GCC 8 branch next week.


-- 
H.J.
From 5ebddef01e810c1684ed0927c0dbb1239cf3c178 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" 
Date: Wed, 11 Apr 2018 12:31:21 -0700
Subject: [PATCH] Don't mark IFUNC resolver as only called directly

Since IFUNC resolver is called indirectly, don't mark IFUNC resolver as
only called directly.  This patch adds ifunc_resolver to cgraph_node,
sets ifunc_resolver for ifunc attribute and checks ifunc_resolver
instead of looking up ifunc attribute.

gcc/

	Backport from mainline
	2018-05-26  H.J. Lu  

	PR target/85900
	PR target/85345
	* varasm.c (assemble_alias): Lookup ifunc attribute on error.

	2018-05-24  H.J. Lu  

	PR target/85900
	PR target/85345
	* varasm.c (assemble_alias): Check ifunc_resolver only on
	FUNCTION_DECL.

	2018-05-22  H.J. Lu  

	PR target/85345
	* cgraph.h (cgraph_node::create): Set ifunc_resolver for ifunc
	attribute.
	(cgraph_node::create_alias): Likewise.
	(cgraph_node::get_availability): Check ifunc_resolver instead
	of looking up ifunc attribute.
	* cgraphunit.c (maybe_diag_incompatible_alias): Likewise.
	* varasm.c (do_assemble_alias): Likewise.
	(assemble_alias): Likewise.
	(default_binds_local_p_3): Likewise.
	* cgraph.h (cgraph_node): Add ifunc_resolver.
	(cgraph_node::only_called_directly_or_aliased_p): Return false
	for IFUNC resolver.
	* lto-cgraph.c (input_node): Set ifunc_resolver for ifunc
	attribute.
	* symtab.c 

Re: [PATCH] Check ifunc_resolver only on FUNCTION_DECL

2018-05-26 Thread H.J. Lu
On Fri, May 25, 2018 at 4:48 AM, H.J. Lu  wrote:
> On Thu, May 24, 2018 at 04:43:25AM -0700, H.J. Lu wrote:
>> Since ifunc_resolver is only valid on FUNCTION_DECL, check ifunc_resolver
>> only on FUNCTION_DECL.
>>
>> Please test it on Darwin.
>>
>>
>> H.J.
>> ---
>>   PR target/85900
>>   PR target/85345
>>   * varasm.c (assemble_alias): Check ifunc_resolver only on
>>   FUNCTION_DECL.
>> ---
>>  gcc/varasm.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/gcc/varasm.c b/gcc/varasm.c
>> index 3bd9cbb69f0..bff43450a91 100644
>> --- a/gcc/varasm.c
>> +++ b/gcc/varasm.c
>> @@ -5917,7 +5917,8 @@ assemble_alias (tree decl, tree target)
>>  # else
>>if (!DECL_WEAK (decl))
>>   {
>> -   if (cgraph_node::get (decl)->ifunc_resolver)
>> +   if (TREE_CODE (decl) == FUNCTION_DECL
>> +   && cgraph_node::get (decl)->ifunc_resolver)
>>   error_at (DECL_SOURCE_LOCATION (decl),
>> "ifunc is not supported in this configuration");
>> else
>> --
>
> Please test it on Darwin.
>
> H.J.
> ---
> Since ifunc_resolver isn't set when an error is detected, we should
> lookup ifunc attribute in this case.
>
> PR target/85900
> PR target/85345
> * varasm.c (assemble_alias): Lookup ifunc attribute on error.
> ---
>  gcc/varasm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/varasm.c b/gcc/varasm.c
> index 6b9f87b203f..4d332f50270 100644
> --- a/gcc/varasm.c
> +++ b/gcc/varasm.c
> @@ -5917,8 +5917,9 @@ assemble_alias (tree decl, tree target)
>  # else
>if (!DECL_WEAK (decl))
> {
> + /* NB: ifunc_resolver isn't set when an error is detected.  */
>   if (TREE_CODE (decl) == FUNCTION_DECL
> - && cgraph_node::get (decl)->ifunc_resolver)
> + && lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl)))
> error_at (DECL_SOURCE_LOCATION (decl),
>   "ifunc is not supported in this configuration");
>   else
> --
> 2.17.0
>

Dominique verified that it fixed all Darwin issues.  I am checking it
in.

-- 
H.J.


Re: [PATCH] Rename ufloat to floatuns and ufix_trunc to fixuns_trunc in a few patterns (PR target/85918)

2018-05-26 Thread Uros Bizjak
On Fri, May 25, 2018 at 11:09 PM, Jakub Jelinek  wrote:
> Hi!
>
> The optab is looking for floatuns2 and
> fixuns_trunc2, but some of the patterns are instead called
> ufloat2 or ufix_trunc2
> and thus are only used from intrinsics.
>
> We can't change all spots, in two spots we have intentionally an
> floatuns2 or fixuns_trunc2 expander that
> uses for AVX512+ a ufloat*/ufix* insn and in other cases something
> different, but for the cases I've changed we just give up before AVX512DQ.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-05-25  Jakub Jelinek  
>
> PR target/85918
> * config/i386/i386.md (fixunssuffix, floatunssuffix): New code
> attributes.
> * config/i386/sse.md
> 
> (float2):
> Rename to ...
> 
> (float2):
> ... this.
> 
> (float2):
> Rename to ...
> 
> (float2):
> ... this.
> (*floatv2div2sf2): Rename to ...
> (*floatv2div2sf2): ... this.
> (floatv2div2sf2_mask): Rename to ...
> (floatv2div2sf2_mask): ... this.
> (*floatv2div2sf2_mask_1): Rename to ...
> (*floatv2div2sf2_mask_1): ... this.
> (fix_truncv8dfv8si2): Rename
> to ...
> (fix_truncv8dfv8si2):
> ... this.
> 
> (fix_trunc2):
> Rename to ...
> 
> (fix_trunc2):
> ... this.
> 
> (fix_trunc2):
> Rename to ...
> 
> (fix_trunc2):
> ... this.
> (fix_truncv2sfv2di2): Rename to ...
> (fix_truncv2sfv2di2): ... this.
> (vec_pack_ufix_trunc_): Use gen_fixuns_truncv8dfv8si2 instead of
> gen_ufix_truncv8dfv8si2.
> * config/i386/i386-builtin.def (__builtin_ia32_cvttpd2uqq256_mask,
> __builtin_ia32_cvttpd2uqq128_mask, __builtin_ia32_cvttps2uqq256_mask,
> __builtin_ia32_cvttps2uqq128_mask, __builtin_ia32_cvtuqq2ps256_mask,
> __builtin_ia32_cvtuqq2ps128_mask, __builtin_ia32_cvtuqq2pd256_mask,
> __builtin_ia32_cvtuqq2pd128_mask, __builtin_ia32_cvttpd2udq512_mask,
> __builtin_ia32_cvtuqq2ps512_mask, __builtin_ia32_cvtuqq2pd512_mask,
> __builtin_ia32_cvttps2uqq512_mask, __builtin_ia32_cvttpd2uqq512_mask):
> Use fixuns instead ufix or floatuns instead ufloat in CODE_FOR_ names.
>
> * gcc.target/i386/avx512dq-pr85918.c: New test.

OK.

Thanks,
Uros.

> --- gcc/config/i386/i386.md.jj  2018-05-25 14:34:52.339390522 +0200
> +++ gcc/config/i386/i386.md 2018-05-25 20:41:43.913430614 +0200
> @@ -981,10 +981,12 @@ (define_code_attr trunsuffix [(ss_trunca
>  ;; Used in signed and unsigned fix.
>  (define_code_iterator any_fix [fix unsigned_fix])
>  (define_code_attr fixsuffix [(fix "") (unsigned_fix "u")])
> +(define_code_attr fixunssuffix [(fix "") (unsigned_fix "uns")])
>
>  ;; Used in signed and unsigned float.
>  (define_code_iterator any_float [float unsigned_float])
>  (define_code_attr floatsuffix [(float "") (unsigned_float "u")])
> +(define_code_attr floatunssuffix [(float "") (unsigned_float "uns")])
>
>  ;; All integer modes.
>  (define_mode_iterator SWI1248x [QI HI SI DI])
> --- gcc/config/i386/sse.md.jj   2018-05-25 14:35:23.122416638 +0200
> +++ gcc/config/i386/sse.md  2018-05-25 20:21:41.939050655 +0200
> @@ -4853,7 +4853,7 @@ (define_insn "float (set_attr "prefix" "maybe_vex")
> (set_attr "mode" "")])
>
> -(define_insn 
> "float2"
> +(define_insn 
> "float2"
>[(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
> (any_float:VF2_AVX512VL
>   (match_operand: 1 "nonimmediate_operand" 
> "")))]
> @@ -4863,7 +4863,7 @@ (define_insn "float (set_attr "prefix" "evex")
> (set_attr "mode" "")])
>
> -;; For float insn patterns
> +;; For float insn patterns
>  (define_mode_attr qq2pssuff
>[(V8SF "") (V4SF "{y}")])
>
> @@ -4877,7 +4877,7 @@ (define_mode_attr sseintvecmode3
>[(V8SF "XI") (V4SF "OI")
> (V8DF "OI") (V4DF "TI")])
>
> -(define_insn 
> "float2"
> +(define_insn 
> "float2"
>[(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
>  (any_float:VF1_128_256VL
>(match_operand: 1 "nonimmediate_operand" 
> "")))]
> @@ -4887,7 +4887,7 @@ (define_insn "float (set_attr "prefix" "evex")
> (set_attr "mode" "")])
>
> -(define_insn "*floatv2div2sf2"
> +(define_insn "*floatv2div2sf2"
>[(set (match_operand:V4SF 0 "register_operand" "=v")
>  (vec_concat:V4SF
> (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" 
> "vm"))
> @@ -4898,7 +4898,7 @@ (define_insn "*floatv2div2s
> (set_attr "prefix" "evex")
> (set_attr "mode" "V4SF")])
>
> -(define_insn "floatv2div2sf2_mask"
> +(define_insn "floatv2div2sf2_mask"
>[(set (match_operand:V4SF 0 "register_operand" "=v")
>  (vec_concat:V4SF
>  (vec_merge:V2SF
> @@ -4914,7 +4914,7 @@ (define_insn "floatv2div2sf
> (set_attr "prefix" "evex")
> (set_attr "mode" 

Re: [PING] [PATCH] Avoid excessive function type casts with splay-trees

2018-05-26 Thread Bernd Edlinger


On 05/17/18 16:37, Bernd Edlinger wrote:
> On 05/17/18 15:39, Richard Biener wrote:
>> On Thu, May 17, 2018 at 3:21 PM Bernd Edlinger 
>> 
>> wrote:
>>
>>> Ping...
>>
>> So this makes all traditional users go through the indirect
>> splay_tree_compare_wrapper
>> and friends (which is also exported for no good reason?).  And all users
>> are traditional
>> at the moment.
>>
> 
> all except gcc/typed-splay-tree.h which only works if VALUE_TYPE is
> compatible with uint_ptr_t but cannot check this requirement.
> This one worried me the most.
> 
> But not having to rewrite omp-low.c for instance where splay_tree_lookup
> and access to n->value are made all the time, made me think it
> will not work to rip out the old interface completely.
> 

Well, I think it will be best to split this patch in two parts:

One that adds just two utility functions for avoiding undefined
function type casts which can be used with the original C interface.
This first part is attached.

And another part that uses a similar approach as the splay-tree in
libgomp, but instead of creating a type-safe C interface it should
translate the complete code from splay-tree.c/.h into a template.
The second part, I plan to do at a later time.


Is this OK for trunk?


Thanks
Bernd.
include:
2018-05-26  Bernd Edlinger  

* splay-tree.h (splay_tree_compare_strings,
splay_tree_delete_pointers): Declare new utility functions.

libiberty:
2018-05-26  Bernd Edlinger  

* splay-tree.c (splay_tree_compare_strings,
splay_tree_delete_pointers): New utility functions.

gcc:
2018-05-26  Bernd Edlinger  

* tree-dump.c (dump_node): Use splay_tree_delete_pointers.

c-family:
2018-05-26  Bernd Edlinger  

* c-lex.c (get_fileinfo): Use splay_tree_compare_strings and
splay_tree_delete_pointers.

cp:
2018-05-26  Bernd Edlinger  

* decl2.c (start_static_storage_duration_function): Use
splay_tree_delete_pointers.
Index: gcc/c-family/c-lex.c
===
--- gcc/c-family/c-lex.c	(revision 260671)
+++ gcc/c-family/c-lex.c	(working copy)
@@ -103,11 +103,9 @@ get_fileinfo (const char *name)
   struct c_fileinfo *fi;
 
   if (!file_info_tree)
-file_info_tree = splay_tree_new ((splay_tree_compare_fn)
- (void (*) (void)) strcmp,
+file_info_tree = splay_tree_new (splay_tree_compare_strings,
  0,
- (splay_tree_delete_value_fn)
- (void (*) (void)) free);
+ splay_tree_delete_pointers);
 
   n = splay_tree_lookup (file_info_tree, (splay_tree_key) name);
   if (n)
Index: gcc/cp/decl2.c
===
--- gcc/cp/decl2.c	(revision 260671)
+++ gcc/cp/decl2.c	(working copy)
@@ -3595,8 +3595,7 @@ start_static_storage_duration_function (unsigned c
   priority_info_map = splay_tree_new (splay_tree_compare_ints,
 	  /*delete_key_fn=*/0,
 	  /*delete_value_fn=*/
-	  (splay_tree_delete_value_fn)
-	  (void (*) (void)) free);
+	  splay_tree_delete_pointers);
 
   /* We always need to generate functions for the
 	 DEFAULT_INIT_PRIORITY so enter it now.  That way when we walk
Index: gcc/tree-dump.c
===
--- gcc/tree-dump.c	(revision 260671)
+++ gcc/tree-dump.c	(working copy)
@@ -736,8 +736,7 @@ dump_node (const_tree t, dump_flags_t flags, FILE
   di.flags = flags;
   di.node = t;
   di.nodes = splay_tree_new (splay_tree_compare_pointers, 0,
-			 (splay_tree_delete_value_fn)
-			 (void (*) (void)) free);
+			 splay_tree_delete_pointers);
 
   /* Queue up the first node.  */
   queue (, t, DUMP_NONE);
Index: include/splay-tree.h
===
--- include/splay-tree.h	(revision 260671)
+++ include/splay-tree.h	(working copy)
@@ -147,7 +147,9 @@ extern splay_tree_node splay_tree_max (splay_tree)
 extern splay_tree_node splay_tree_min (splay_tree);
 extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
 extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
-extern int splay_tree_compare_pointers (splay_tree_key,	splay_tree_key);
+extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
+extern int splay_tree_compare_strings (splay_tree_key, splay_tree_key);
+extern void splay_tree_delete_pointers (splay_tree_value);
 
 #ifdef __cplusplus
 }
Index: libiberty/splay-tree.c
===
--- libiberty/splay-tree.c	(revision 260671)
+++ libiberty/splay-tree.c	(working copy)
@@ -31,6 +31,9 @@ Boston, MA 02110-1301, USA.  */
 #ifdef HAVE_STDLIB_H
 #include 
 #endif
+#ifdef HAVE_STRING_H
+#include 
+#endif
 
 #include 
 
@@ -590,3 +593,19 @@ 

Re: [PATCH] PR target/85358 patch v2: Add target hook to prevent default widening

2018-05-26 Thread Richard Biener
On May 25, 2018 8:49:47 PM GMT+02:00, Michael Meissner  
wrote:
>I redid the patch to make the target hook only apply for scalar float
>points,
>and I removed all of the integer only subcases.
>
>I have checked this on a little endian Power8 system, and verified that
>it
>bootstraps correctly and there are no regressions.  I have just started
>an
>x86_64 build.  Assuming that build has no regressions, can I check this
>into
>GCC 9?  This bug appears in GCC 8, and I would like to back port this
>patch to
>GCC 8 as well before GCC 8.2 goes out.

What happens if you hack genmodes to not claim IFmode has any wider 
relationship with other modes? 

Richard. 

>[gcc]
>2018-05-25  Michael Meissner  
>
>   PR target/85358
>   * target.def (default_fp_widening_p): New target hook to automatic
>   widening betwen two floating point modes.
>   * optabs.c (expand_binop): Do not automatically widen a binary or
>   unary scalar floating point op if the backend says that the
>   widening should not occur.
>   (expand_twoval_unop): Likewise.
>   (expand_twoval_binop): Likewise.
>   (expand_unop): Likewise.
>   * config/rs6000/rs6000.c (TARGET_DEFAULT_FP_WIDENING_P): Define.
>   (rs6000_default_fp_widening_p): New target hook to prevent
>   automatic widening between IEEE 128-bit floating point and IBM
>   extended double floating point.
>   * doc/tm.texi (Target Hooks): Document new target hook
>   default_fp_widening_p.
>   * doc/tm.texi.in (Target Hooks): Likewise.
>
>[gcc/testsuite]
>2018-05-25  Michael Meissner  
>
>   PR target/85358
>   * gcc.target/powerpc/pr85358.c: New test.



Re: [PATCH] Remove useless noinline variable (PR bootstrap/85921)

2018-05-26 Thread Richard Biener
On May 25, 2018 11:03:50 PM GMT+02:00, Jakub Jelinek  wrote:
>Hi!
>
>The following variable only makes the code larger and less readable.
>In addition, with some broken kernel headers that redefine noinline
>it breaks bootstrap.
>
>Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
>for
>trunk?

OK. 

Richard. 

>2018-05-25  Jakub Jelinek  
>
>   PR bootstrap/85921
>   * c-warn.c (diagnose_mismatched_attributes): Remove unnecessary
>   noinline variable to workaround broken kernel headers.
>
>--- gcc/c-family/c-warn.c.jj   2018-05-21 13:15:33.878575581 +0200
>+++ gcc/c-family/c-warn.c  2018-05-25 14:28:12.151050892 +0200
>@@ -2246,18 +2246,16 @@ diagnose_mismatched_attributes (tree old
>  newdecl);
> 
>   /* Diagnose inline __attribute__ ((noinline)) which is silly.  */
>-  const char *noinline = "noinline";
>-
>   if (DECL_DECLARED_INLINE_P (newdecl)
>   && DECL_UNINLINABLE (olddecl)
>-  && lookup_attribute (noinline, DECL_ATTRIBUTES (olddecl)))
>+  && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
>warned |= warning (OPT_Wattributes, "inline declaration of %qD follows
>"
>- "declaration with attribute %qs", newdecl, noinline);
>+ "declaration with attribute %", newdecl);
>   else if (DECL_DECLARED_INLINE_P (olddecl)
>  && DECL_UNINLINABLE (newdecl)
>  && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
>warned |= warning (OPT_Wattributes, "declaration of %q+D with attribute
>"
>- "%qs follows inline declaration", newdecl, noinline);
>+ "% follows inline declaration", newdecl);
> 
>   return warned;
> }
>
>   Jakub