Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-06-24 Thread Cassio Neri via Gcc-patches
Thanks Jonathan. Here are some benchmarks (assembly in [1]): https://quick-bench.com/q/jclBXmi4QLDcRMLuuVpxTUsFmQw Unfortunately, quick-bench times out unless some implementations are commented out. You can copy the code and run it locally (needs google benchmark) to get the full picture. I real

Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-06-23 Thread Jonathan Wakely via Gcc-patches
On 23/06/21 18:51 +0100, Jonathan Wakely wrote: Here's what I've committed. Tested x86_64-linux and powerpc64le-linux. Pushed to trunk. commit b92d12d3fe3f1aa56d190d960e40c62869a6cfbb Author: Cassio Neri Date: Wed Jun 23 15:32:16 2021 libstdc++: More efficient std::chrono::year::leap

Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-06-23 Thread Jonathan Wakely via Gcc-patches
On 23/06/21 14:16 +0100, Jonathan Wakely wrote: On 23/06/21 12:45 +0100, Jonathan Wakely wrote: On 21/05/21 19:44 +0100, Cassio Neri via Libstdc++ wrote: I've checked the generated code and the compiler doesn't figure out the logic. I added a comment to explain. (Revised patch below and attach

Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-06-23 Thread Jonathan Wakely via Gcc-patches
On 23/06/21 12:45 +0100, Jonathan Wakely wrote: On 21/05/21 19:44 +0100, Cassio Neri via Libstdc++ wrote: I've checked the generated code and the compiler doesn't figure out the logic. I added a comment to explain. (Revised patch below and attached.) Best wishes, Cassio. --- Simple change to

Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-06-23 Thread Jonathan Wakely via Gcc-patches
On 21/05/21 19:44 +0100, Cassio Neri via Libstdc++ wrote: I've checked the generated code and the compiler doesn't figure out the logic. I added a comment to explain. (Revised patch below and attached.) Best wishes, Cassio. --- Simple change to std::chrono::year::is_leap. If a year is multipl

Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-05-21 Thread Cassio Neri via Gcc-patches
I've checked the generated code and the compiler doesn't figure out the logic. I added a comment to explain. (Revised patch below and attached.) Best wishes, Cassio. --- Simple change to std::chrono::year::is_leap. If a year is multiple of 100, then it's divisible by 400 if and only if it's div

Re: [PATCH] libstdc++: More efficient std::chrono::year::leap.

2021-05-21 Thread Koning, Paul via Gcc-patches
> On May 21, 2021, at 1:46 PM, Cassio Neri via Gcc-patches > wrote: > > Simple change to std::chrono::year::is_leap. If a year is multiple of 100, > then it's divisible by 400 if and only if it's divisible by 16. The latter > allows for better code generation. I wonder if the optimizer could