POWER __builtin_add_overflow/__builtin_mul_overflow with u64

2023-02-13 Thread Simon Richter

Hi,

I'm looking at the generated code for these builtins on POWER:

add 4,3,4
subfc 3,3,4
subfe 3,3,3
std 4,0(5)
rldicl 3,3,0,63
blr

and

mulld 10,3,4
mulhdu 3,3,4
addic 9,3,-1
std 10,0(5)
subfe 3,9,3
blr

The POWER architecture has variants of these instructions with builtin 
overflow checks (addo/mulldo), but these aren't listed in the .md files, 
and the builtins don't generate them either.


Is this intentional (I've found a few comments that mulldo is microcoded 
on CellBE and should be avoided there)?


   Simon


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH v5 4/5] c++modules: report imported CMI files as dependencies

2023-02-13 Thread Jason Merrill via Gcc

On 1/25/23 13:06, Ben Boeckel wrote:

They affect the build, so report them via `-MF` mechanisms.

gcc/cp/

* module.cc (do_import): Report imported CMI files as
dependencies.


Both this and the mapper dependency patch seem to cause most of the 
modules testcases to crash; please remember to run the regression tests 
(https://gcc.gnu.org/contribute.html#testing)



Signed-off-by: Ben Boeckel 
---
  gcc/cp/module.cc | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index ebd30f63d81..dbd1b721616 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -18966,6 +18966,8 @@ module_state::do_import (cpp_reader *reader, bool 
outermost)
dump () && dump ("CMI is %s", file);
if (note_module_cmi_yes || inform_cmi_p)
inform (loc, "reading CMI %qs", file);
+  /* Add the CMI file to the dependency tracking. */
+  deps_add_dep (cpp_get_deps (reader), file);
fd = open (file, O_RDONLY | O_CLOEXEC | O_BINARY);
e = errno;
  }




Re: GCC -ftime-trace

2023-02-13 Thread NightStrike via Gcc
On Sat, Feb 11, 2023, 14:37 Basile Starynkevitch 
wrote:

> Modifying the pass manager
> https://gcc.gnu.org/onlinedocs/gccint/Pass-manager.html#Pass-manager to
> use clock_gettime system call. See
> https://man7.org/linux/man-pages/man2/clock_gettime.2.html


Since we can now use c++11, std::chrono::high_resolution_clock::now() would
call that without being platform specific.


Re: [PATCH v5 1/5] libcpp: reject codepoints above 0x10FFFF

2023-02-13 Thread Jason Merrill via Gcc

On 1/25/23 13:06, Ben Boeckel wrote:

Unicode does not support such values because they are unrepresentable in
UTF-16.

libcpp/

* charset.cc: Reject encodings of codepoints above 0x10.
UTF-16 does not support such codepoints and therefore all
Unicode rejects such values.


It seems that this causes a bunch of testsuite failures from tests that 
expect this limit to be checked elsewhere with a different diagnostic, 
so I think the easiest thing is to fold this into _cpp_valid_utf8_str 
instead, i.e.:


Make sense?

JasonFrom 296e9d1e16533979d12bd98db2937e396a0796f3 Mon Sep 17 00:00:00 2001
From: Ben Boeckel 
Date: Sat, 10 Dec 2022 17:20:49 -0500
Subject: [PATCH] libcpp: add a function to determine UTF-8 validity of a C
 string
To: gcc-patc...@gcc.gnu.org

This simplifies the interface for other UTF-8 validity detections when a
simple "yes" or "no" answer is sufficient.

libcpp/

	* charset.cc: Add `_cpp_valid_utf8_str` which determines whether
	a C string is valid UTF-8 or not.
	* internal.h: Add prototype for `_cpp_valid_utf8_str`.

Signed-off-by: Ben Boeckel 
---
 libcpp/internal.h |  2 ++
 libcpp/charset.cc | 24 
 2 files changed, 26 insertions(+)

diff --git a/libcpp/internal.h b/libcpp/internal.h
index 9724676a8cd..48520901b2d 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -834,6 +834,8 @@ extern bool _cpp_valid_utf8 (cpp_reader *pfile,
 			 struct normalize_state *nst,
 			 cppchar_t *cp);
 
+extern bool _cpp_valid_utf8_str (const char *str);
+
 extern void _cpp_destroy_iconv (cpp_reader *);
 extern unsigned char *_cpp_convert_input (cpp_reader *, const char *,
 	  unsigned char *, size_t, size_t,
diff --git a/libcpp/charset.cc b/libcpp/charset.cc
index 3c47d4f868b..42a1b596c06 100644
--- a/libcpp/charset.cc
+++ b/libcpp/charset.cc
@@ -1864,6 +1864,30 @@ _cpp_valid_utf8 (cpp_reader *pfile,
   return true;
 }
 
+/*  Detect whether a C-string is a valid UTF-8-encoded set of bytes. Returns
+`false` if any contained byte sequence encodes an invalid Unicode codepoint
+or is not a valid UTF-8 sequence. Returns `true` otherwise. */
+
+extern bool
+_cpp_valid_utf8_str (const char *name)
+{
+  const uchar* in = (const uchar*)name;
+  size_t len = strlen (name);
+  cppchar_t cp;
+
+  while (*in)
+{
+  if (one_utf8_to_cppchar (&in, &len, &cp))
+	return false;
+
+  /* one_utf8_to_cppchar doesn't check this limit.  */
+  if (cp > UCS_LIMIT)
+	return false;
+}
+
+  return true;
+}
+
 /* Subroutine of convert_hex and convert_oct.  N is the representation
in the execution character set of a numeric escape; write it into the
string buffer TBUF and update the end-of-string pointer therein.  WIDE
-- 
2.31.1



Re: Gcc Digest, Vol 35, Issue 13

2023-02-13 Thread Miguel Laredo via Gcc
Bb g. Hg hh. Hggjg ggjh jh j cb23"€* ca*
-- Mensaje original --
> De: gcc-requ...@gcc.gnu.org
> A: gcc@gcc.gnu.org
> Asunto: Gcc Digest, Vol 35, Issue 13
> Fecha: 11/01/2023 03:30:13 Europe/Paris
> 
> Send Gcc mailing list submissions to
>   gcc@gcc.gnu.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   https://gcc.gnu.org/mailman/listinfo/gcc
> or, via email, send a message with subject or body 'help' to
>   gcc-requ...@gcc.gnu.org
> 
> You can reach the person managing the list at
>   gcc-ow...@gcc.gnu.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Gcc digest..."
> 
> Today's Topics:
> 
>1. Re: urgent - Google Cloud public subnet blacklisted by
>   gcc.org (Frank Ch. Eigler)
>2. struct vs. class in GCC source (Paul Koning)
>3. Re: Widening multiplication, but no narrowing division
>   [i386/AMD64] (Paul Koning)
>4. GCC GSoC 2023: Call for project ideas and mentors (Martin Jambor)
>5. Re: struct vs. class in GCC source (Jason Merrill)
>6. LRA produces RTL not meeting constraint (Paul Koning)
>7. Re: testsuitexxddwdxwSd sax dddx  d under wine (Jacob 
> Bachmeyer)
> 
> From: Frank Ch. Eigl 
> To: Federico Iezzi 
> Cc: gcc@gcc.gnu.org
> Subject: Re: urgent - Google Cloud public subnet blacklisted by
>   gcc.org
> Date: Tue, 10 Jan 2023 15:42:13 +0100 (CET)
> 
> Federico Iezzi via Gcc  writes:
> 
> > [...]
> > It seems like the GCC frontend/WAF have blacklisted the entire subnet
> > used by Google Cloud for Internet access.
> > [...]
> > $ curl ifconfig.me
> > 35.234.162.99
> 
> This has been unblocked add ZsszXcfsf d sdcs fcddsc.  We sometimes must block 
> large subnets when
> abusive traffic comes from there.
> 
> - FChE
> 
> 
> 
> From: Paul Koning 
> To: GCC Development 
> Subject: struct vs. class in GCC source
> Date: Tue, 10 Jan 2023 15:50:24 +0100 (CET)
> 
> Building on Mac with Clang I get warnings like this:
> 
> ../../../gcc/gcc/cgraph.h:2629:28: warning: struct 'cgraph_edge' was 
> previously declared as a class; this is valid, but may result in linker 
> errors under the Microsoft C++ ABI [-Wmismatched-tags]
> 
> It seems to be talking about a MS bug (since C++ says struct and class mean 
> the same thing other than the default access).  Still, I wonder if it would 
> be worth changing the code to use just one of "struct" or "class" for any 
> given type.  (And then the convention would presumably be that a POD type is 
> called "struct" and other types are "class".)
> 
>   paul
> 
> 
> 
> From: Paul Koning 
> To: Stefan Kanthak 
> Cc: g...@gnu.org
> Subject: Re: Widening multiplication, but no narrowing division
>   [i386/AMD64]
> Date: Tue, 10 Jan 2023 17:49:03 +0100 (CET)
> 
> 
> 
> > On Jan 9, 2023, at 11:27 AM, Stefan Kanthak  
> wrote:
> > 
> > "Paul Koning"  wrote:
> > 
> >>> ...
> > 
> >> Yes, I was thinking the same.  But I spent a while on that pattern -- I
> >> wanted to support div/mod as a single operation because the machine has
> >> that primitive.  And I'm pretty sure I saw it work before I committed
> >> that change.  That's why I'm wondering if something changed.
> > 
> > I can't tell from the past how GCC once worked, but today it can't
> > (or doesn't) use such patterns, at least not on i386/AMD64 processors.
> 
> It turns out I was confused by the RTL generated by my pattern.  That 
> pattern is for divmodhi, so it works as desired given same-size inputs.  
> 
> I'm wondering if the case of longer dividend -- which is a common thing for 
> several machines -- could be handled by a define_peephole2 that matches the 
> sign-extend of the divisor followed by the (longer) divide.  I made a stab 
> at that but what I wrote wasn't valid.
> 
> So, question to the list:  suppose I want to write RTL that matches what 
> Stefan is talking about, with a div or mod or divmod that has si results and 
> a di dividend (or hi results and an si dividend), how would you do that?  
> Can a define_peephole2 do it, and if so, what would it look like?
> 
>   paul
> 
> 
> 
> 
> From: Martin Jambor 
> To: GCC Mailing List ,
>  Gfortran mailing list ,
>  libstd...@gcc.gnu.org,
>  gcc-r...@gcc.gnu.org
> Subject: GCC GSoC 2023: Call for project ideas and mentors
> Date: Tue, 10 Jan 2023 19:25:06 +0100 (CET)
> 
> Hello,
> 
> another year has passed and Google has announced there will be again
> Google Summer of Code (GsoC) in 2023 and the deadline for organizations
> to apply is already approaching (February 7th).  I'd like to volunteer
> to be the main Org Admin for GCC again so let me know if you think I
> shouldn't or that someone else should or if you want to do it instead,
> but otherwise I'll assume that I will.
> 
>  The most important bit: 
> 
> I would like to ask all (moderately) seasoned GCC contributors to
> consider mentoring a student this year and ideally also come up with a
> project that they wo

GSOC 2023 Contribution Request

2023-02-13 Thread Kritika Rag via Gcc
Hello Sir/Mam,



I’m Kritika Rag, a Computer Science pre-final year undergraduate student
from India. I’m quite passionate about web development and competitive
programming and now I’m looking forward to contributing to open-source
projects. I believe that GSOC 2023 would provide me with the best way to
start my open-source contribution journey.



Since I’m a competitive programmer, I have excellent command over Data
Structures & Algorithms and my primary language is C++, so C++ and GCC are
something that I use daily, therefore I would love to make my contributions
to GCC projects. After going through all the projects listed on GCC Wiki
, these are the
projects(any one of them) to which I would like to contribute:

   1. Bug Patrol and primarily Analyze Failing Test Cases – Whether I'm
   practicing algorithms on Leetcode, GFG, etc., or giving CP contests on
   CodeChef, Codeforces, etc., Test case failures are something I encounter
   daily. Working on the project would be an interesting dig for me to learn
   about the inner workings of something that I see daily and make
   improvements to it.
   2.  Library Infrastructure - As quoted *"These tasks are about improving
   the utility routine library used by GCC. If you like data structures, these
   may be for you", *and being a data structures enthusiast I do believe
   that I'll be able to put my best knowledge to use in this project.

Lastly, thank you so much for providing these opportunities, I would be
grateful if you would provide me the opportunity to work with your
organization. Looking forward to hearing from you soon.

Thanks and Regards,
Kritika Rag



Sent from Mail  for Windows


Re: GCC -ftime-trace

2023-02-13 Thread Richard Biener via Gcc
On Sat, Feb 11, 2023 at 8:37 PM Basile Starynkevitch
 wrote:
>
> Hello all,
>
> Shivansh Khare wrote:
>
>
> > I have looked into the different starter projects that are offered in the
> > [Wiki GSoC page](https://gcc.gnu.org/wiki/SummerOfCode) and I was
> > particularly interested in the `-ftime-trace` project. The following is
> > what is given as a short description about the problematic:
> > "Implement something similar to Clang's -ftime-trace feature which
> > generates performance reports that show where the compiler spends compile
> > time. For more information, please check the following blog post.
>
> Are you aware of the existing -ftime-report option to GCC 12 or later?

It looks like -ftime-trace can be implemented ontop of the existing time
tracking that's reported with -ftime-report and -ftime-report-details, possibly
a first step would be to make the raw data more accessible.  We've now
not alternate output for various auxiliary data for example in JSON format,
so implementing -ftime-report=json plus an external visualization tool/script
might be a good start for the project.

Richard.

> On Linux (and probably many other POSIX) systems, at least in straight
> (non-cross) x86-64 GCC compilers, implementing that should be not very
> difficult. Here are some insights.
>
> Read carefully https://man7.org/linux/man-pages/man7/time.7.html
>
> First, you could experiment by writing a GCC plugin doing that timing
> (in some experimental way).
> https://gcc.gnu.org/onlinedocs/gccint/Plugins.html
>
> Maybe consider later providing such a "standard" GCC plugin to do the
> timing.
>
> Modifying the pass manager
> https://gcc.gnu.org/onlinedocs/gccint/Pass-manager.html#Pass-manager to
> use clock_gettime system call. See
> https://man7.org/linux/man-pages/man2/clock_gettime.2.html
>
> It is related to plugin gate functions...
>
>
> Regards.
>
>
> BTW, my pet open source project is http://refpersys.org/ (symbolic
> inference engine, work in progress).
>
>
> --
> Basile Starynkevitch  
> (only mine opinions / les opinions sont miennes uniquement)
> 92340 Bourg-la-Reine, France
> web page: starynkevitch.net/Basile/
>