This patch adds a simplification to match.pd that was discussed on the
thread for pr106243. It simplifies the pattern, abs(x) & 1, to x & 1.
There are also tests for the simplification in this patch. I couldn't
figure out how to get abs to work with vectors. If a test for that is
necessary, could
This patch adds a new optimization to match.pd. The pattern, -x & 1,
now gets simplified to x & 1, reducing the number of instructions
produced.
This patch also adds tests for the optimization rule.
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
PR tree-optimization/106243
Here is the patch that I pushed. Thanks for the feedback.
Thanks
-Sam
On Thu, Jul 28, 2022 at 3:03 AM Richard Biener
wrote:
> On Wed, Jul 27, 2022 at 9:57 PM Sam Feifer wrote:
> >
> >
> >> _Complex int are strange beasts, I'd simply avoid the transform for
> them.
> >>
> >
> > I added to the m
> _Complex int are strange beasts, I'd simply avoid the transform for them.
>
>
I added to the match.pd rule to not simplify if the operands are complex.
There is now a test case for complex types to make sure they do not
simplify. I had to move the "dg-do run" test to g++.dg to accommodate the
com
>
> int f(_Complex int x, _Complex int y)
> {
> return x == x / y * y;
> }
>
After some research about mod with complex types, I found that the binary
mod operation does not work with complex types. If so, the complex test
case should not be simplified. Is this correct?
I should also note that
> I suspect for eq and mult you might want to add :c to them even though
> in your testcase you don't need them, you might be able to get it via
> using different statements and looking at the forwprop gimple dump.
> Also, did you send the wrong patch as it looks like the function call
> to build_z
This patch fixes a missed optimization in match.pd. It takes the pattern, x / y
* y == x, and optimizes it to x % y == 0. This produces fewer instructions.
There are also tests for the optimizations to be added to the test suite.
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
This patch is intended to fix a missed optimization in match.pd. It optimizes
(x >= 0 ? x : 0) + (x <= 0 ? -x : 0) to just abs(x). Additionally, the pattern
(x <= 0 ? -x : 0) now gets optimized to max(-x, 0), which helps with the other
simplification rule.
Tests are also included to be added to
ChangeLog:
* MAINTAINERS (Write After Approval): Add myself.
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index e2db0cfe18b..46c9e48a497 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -398,6 +398,7 @@ Chris Fairles
Attached is a patch file with those changes.
Thanks
-Sam
On Tue, Jul 19, 2022 at 2:36 AM Richard Biener
wrote:
> On Mon, Jul 18, 2022 at 7:31 PM Sam Feifer via Gcc-patches
> wrote:
> >
> > Just realized I had mixed up the 9 and the 2 when labelling the patch.
> This
>
u, Jul 14, 2022 at 7:09 AM Sam Feifer wrote:
>> >> >
>> >> >
>> >> > On Wed, Jul 13, 2022 at 3:36 PM Andrew Pinski
>> wrote:
>> >> >>
>> >> >> On Wed, Jul 13, 2022 at 12:26 PM Sam Feifer via Gcc-patches
>>
On Thu, Jul 14, 2022 at 7:09 AM Sam Feifer wrote:
> >> >
> >> >
> >> > On Wed, Jul 13, 2022 at 3:36 PM Andrew Pinski
> wrote:
> >> >>
> >> >> On Wed, Jul 13, 2022 at 12:26 PM Sam Feifer via Gcc-patches
> >> >> wrote:
&
On Thu, Jul 14, 2022 at 1:24 PM Andrew Pinski wrote:
> On Thu, Jul 14, 2022 at 7:09 AM Sam Feifer wrote:
> >
> >
> > On Wed, Jul 13, 2022 at 3:36 PM Andrew Pinski wrote:
> >>
> >> On Wed, Jul 13, 2022 at 12:26 PM Sam Feifer via Gcc-patches
> >>
On Wed, Jul 13, 2022 at 3:36 PM Andrew Pinski wrote:
> On Wed, Jul 13, 2022 at 12:26 PM Sam Feifer via Gcc-patches
> wrote:
> >
> > This patch is intended to fix a missed optimization in match.pd. It
> optimizes (x >= 0 ? x : 0) + (x <= 0 ? -x : 0) to just abs(x)
This patch is intended to fix a missed optimization in match.pd. It optimizes
(x >= 0 ? x : 0) + (x <= 0 ? -x : 0) to just abs(x). I had to write a second
simplification in match.pd to handle the commutative property as the match was
not ocurring otherwise. Additionally, the pattern (x <= 0 ? -x
Hi!
This patch is meant to solve a missed optimization in match.pd. It optimizes
the following expression: n - (((n > 63) ? n : 63) & -64) where the constant
being negated (in this case -64) is a power of 2 and the sum of the two
constants is -1. For the signed case, this gets optimized to (n <
16 matches
Mail list logo