[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-10-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #25 from Andrew Pinski  ---
Fixed.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-10-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #24 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:bcc5054b36626459ddb04c779f0b201fba6001d1

commit r14-4831-gbcc5054b36626459ddb04c779f0b201fba6001d1
Author: Andrew Pinski 
Date:   Wed Oct 18 16:39:12 2023 -0700

aarch64: Emit csinv again for `a ? ~b : b` [PR110986]

After r14-3110-g7fb65f10285, the canonical form for
`a ? ~b : b` changed to be `-(a) ^ b` that means
for aarch64 we need to add a few new insn patterns
to be able to catch this and change it to be
what is the canonical form for the aarch64 backend.
A secondary pattern was needed to support a zero_extended
form too; this adds a testcase for all 3 cases.

Bootstrapped and tested on aarch64-linux-gnu with no regressions.

PR target/110986

gcc/ChangeLog:

* config/aarch64/aarch64.md (*cmov_insn_insv): New pattern.
(*cmov_uxtw_insn_insv): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/cond_op-1.c: New test.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-10-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #23 from Andrew Pinski  ---
Final patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633517.html

The Canonicalization between the 2 forms or doing it in isel will wait until
next I think.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-10-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski  changed:

   What|Removed |Added

  Attachment #56134|0   |1
is obsolete||

--- Comment #22 from Andrew Pinski  ---
Created attachment 56146
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56146=edit
patch under test

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-10-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #21 from Andrew Pinski  ---
Created attachment 56134
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56134=edit
the scalar patterns

This adds the scalar patterns which I had talked about before.
I have not tested this patch yet except to see if we get the code which we were
expecting (again).
Even for:
```
long long f(unsigned a, unsigned b)
{
  return a ? ~b : b;
}
```

Which I don't think there was a testcase before. Will add one tomorrow for this
and fully test it too.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-10-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Richard Biener  changed:

   What|Removed |Added

   Keywords||testsuite-fail
   Priority|P3  |P1

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-08-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #20 from Andrew Pinski  ---
Only the scalar testcase remains failing now. I will come up with a solution
next week.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-08-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #19 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:70c50c87273d940918225d5c6b03f1ccfb6f978e

commit r14-3337-g70c50c87273d940918225d5c6b03f1ccfb6f978e
Author: Andrew Pinski 
Date:   Mon Aug 14 18:35:53 2023 -0700

MATCH: Sink convert for vec_cond

Convert be sinked into a vec_cond if both sides
fold. Unlike other unary operations, we need to check that we still can
handle
this vec_cond's first operand is the same as the new truth type.

I tried a few different versions of this patch:
view_convert to the new truth_type but that does not work as we always
support all vec_cond
afterwards.
using expand_vec_cond_expr_p; but that would allow too much.

I also tried to see if view_convert can be handled here but we end up with:
  _3 = VEC_COND_EXPR <_2, {  Nan(-1),  Nan(-1),  Nan(-1),  Nan(-1) }, {
0.0, 0.0, 0.0, 0.0 }>;
Which isel does not know how to handle as just being a view_convert from
`vector(4) `
to `vector(4) float` and causes a regression with
`g++.target/i386/pr88152.C`

Note, in the case of the SVE testcase, we will sink negate after the
convert and be able
to remove a few extra instructions in the end.
Also with this change gcc.target/aarch64/sve/cond_unary_5.c will now pass.

Committed as approved after a bootstrapped and tested on x86_64-linux-gnu
and aarch64-linux-gnu.

gcc/ChangeLog:

PR tree-optimization/111006
PR tree-optimization/110986
* match.pd: (op(vec_cond(a,b,c))): Handle convert for op.

gcc/testsuite/ChangeLog:

PR tree-optimization/111006
* gcc.target/aarch64/sve/cond_convert_7.c: New test.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-08-16 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #18 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:a32de58c9e6394e4e6aef0ac95b52d1c774ac8bc

commit r14-3257-ga32de58c9e6394e4e6aef0ac95b52d1c774ac8bc
Author: Andrew Pinski 
Date:   Fri Aug 11 18:19:01 2023 -0700

Add support for vector conitional not

Like the support conditional neg (r12-4470-g20dcda98ed376cb61c74b2c71),
this just adds conditional not too.
Also we should be able to turn `(a ? -1 : 0) ^ b` into a conditional
not.

OK? Bootstrapped and tested on x86_64-linux-gnu and aarch64-linux-gnu.

gcc/ChangeLog:

* internal-fn.def (COND_NOT): New internal function.
* match.pd (UNCOND_UNARY, COND_UNARY): Add bit_not/not
to the lists.
(`vec (a ? -1 : 0) ^ b`): New pattern to convert
into conditional not.
* optabs.def (cond_one_cmpl): New optab.
(cond_len_one_cmpl): Likewise.

gcc/testsuite/ChangeLog:

PR target/110986
* gcc.target/aarch64/sve/cond_unary_9.c: New test.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-08-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #17 from Andrew Pinski  ---
For the scalar version we could match:
(set (reg:SI 106)
(xor:SI (neg:SI (ne:SI (reg:CC 66 cc)
(const_int 0 [0])))
(reg:SI 107 [ MEM[(int *)a_14(D) + ivtmp.14_9 * 1] ])))

In the backend to do the csinv but it might not catch all of them because
combine does not match everything.

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-08-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=111005,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=111006

--- Comment #16 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #15)
> Note the main issue with the 2 different type is a different issue (even
> though my patches improve the situtation, other issues shows up).  Will file
> a few testcase for that ...

PR 111005 and PR 111006  .

[Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285

2023-08-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #15 from Andrew Pinski  ---
Note the main issue with the 2 different type is a different issue (even though
my patches improve the situtation, other issues shows up).  Will file a few
testcase for that ...