public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285
@ 2023-08-11  8:04 clyon at gcc dot gnu.org
  2023-08-11  8:07 ` [Bug middle-end/110986] [14 Regression] " pinskia at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: clyon at gcc dot gnu.org @ 2023-08-11  8:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

            Bug ID: 110986
           Summary: aarch64 regressions after r14-3110-g7fb65f10285
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: clyon at gcc dot gnu.org
  Target Milestone: ---

After commit r14-3110-g7fb65f10285 (MATCH: [PR110937/PR100798] (a ? ~b : b)
should be optimized to b ^ -(a)), I have noticed regressions on aarch64:

Running gcc:gcc.target/aarch64/aarch64.exp ...
FAIL: gcc.target/aarch64/cond_op_imm_1.c scan-assembler csinv\tw[0-9]*.*
FAIL: gcc.target/aarch64/cond_op_imm_1.c scan-assembler csinv\tx[0-9]*.*

Running gcc:gcc.target/aarch64/sve/aarch64-sve.exp ...
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-not \\tmov\\tz
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-times
\\tneg\\tz[0-9]+\\.b, p[0-7]/m, 3
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-times
\\tneg\\tz[0-9]+\\.h, p[0-7]/m, 2
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-times
\\tneg\\tz[0-9]+\\.s, p[0-7]/m, 1
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-times
\\tnot\\tz[0-9]+\\.b, p[0-7]/m, 3
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-times
\\tnot\\tz[0-9]+\\.h, p[0-7]/m, 2
FAIL: gcc.target/aarch64/sve/cond_unary_5.c scan-assembler-times
\\tnot\\tz[0-9]+\\.s, p[0-7]/m, 1

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 regressions after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
@ 2023-08-11  8:07 ` pinskia at gcc dot gnu.org
  2023-08-11  8:26 ` pinskia at gcc dot gnu.org
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-11  8:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-08-11
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |14.0
          Component|tree-optimization           |middle-end
            Summary|aarch64 regressions after   |[14 Regression] aarch64
                   |r14-3110-g7fb65f10285       |regressions after
                   |                            |r14-3110-g7fb65f10285

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 regressions after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
  2023-08-11  8:07 ` [Bug middle-end/110986] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-08-11  8:26 ` pinskia at gcc dot gnu.org
  2023-08-11  8:27 ` pinskia at gcc dot gnu.org
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-11  8:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
SVE regressions:

One part:
  vect__20.13_45 = .VCOND (vect__5.10_39, { 0, ... }, { -1, ... }, { 0, ... },
114);
  vect__21.14_46 = vect_t_12.7_36 ^ vect__20.13_45;

Should be changed into:
  vect_iftmp.12_52 = ~vect_t_12.8_48;
  vect_iftmp.14_55 = .VCOND (vect__5.11_51, { 0, ... }, vect_iftmp.12_52,
vect_t_12.8_48, 114);


2nd part
For another part:
  vect_patt_10.15_74 = .VCOND (vect__4.10_66, { 0, ... }, { 1, ... }, { 0, ...
}, 114);
  vect_patt_42.16_75 = (vector([8,8]) signed char) vect_patt_10.15_74;
  vect__40.17_76 = -vect_patt_42.16_75;
  vect__41.18_77 = vect_pretmp_25.13_69 ^ vect__40.17_76;

Should be changed into:
  vect_patt_10.15_74 = .VCOND (vect__4.10_66, { 0, ... }, { -1, ... }, { 0, ...
}, 114);
  vect__40.17_76 = (vector([8,8]) signed char) vect_patt_10.15_74;
  vect__41.18_77 = vect_pretmp_25.13_69 ^ vect__40.17_76;

Then into (like the first part):
  t_52 = ~vect_pretmp_25.13_69 ;
  vect__41.18_77 = .VCOND (vect__4.10_66, { 0, ... }, t_52 ,
vect_pretmp_25.13_69, 114);

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 regressions after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
  2023-08-11  8:07 ` [Bug middle-end/110986] [14 Regression] " pinskia at gcc dot gnu.org
  2023-08-11  8:26 ` pinskia at gcc dot gnu.org
@ 2023-08-11  8:27 ` pinskia at gcc dot gnu.org
  2023-08-11  8:31 ` [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) " pinskia at gcc dot gnu.org
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-11  8:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The scalar part needs some changes in isel I think; will get to them later.
Will try to implement the fixes for the vectors early next week.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-08-11  8:27 ` pinskia at gcc dot gnu.org
@ 2023-08-11  8:31 ` pinskia at gcc dot gnu.org
  2023-08-11  8:32 ` pinskia at gcc dot gnu.org
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-11  8:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For x86_64, we need to convert:
  mask__9.14_51 = vect__4.10_46 != { 0, 0, 0, 0, 0, 0, 0, 0 };
  vect__40.16_55 = VIEW_CONVERT_EXPR<vector(8) signed short>(mask__9.14_51);
  vect__41.17_56 = vect_pretmp_25.13_49 ^ vect__40.16_55;

back into
  vect_iftmp.14_48 = ~vect_pretmp_25.13_47;
  vect_iftmp.16_51 = .VCOND (vect__4.10_44, { 0, 0, 0, 0, 0, 0, 0, 0 },
vect_iftmp.14_48, vect_pretmp_25.13_47, 114);


I find it a bit odd there was no testcase on the x86_64 side for the code
generation here.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-08-11  8:31 ` [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) " pinskia at gcc dot gnu.org
@ 2023-08-11  8:32 ` pinskia at gcc dot gnu.org
  2023-08-12  0:17 ` pinskia at gcc dot gnu.org
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-11  8:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55719
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55719&action=edit
testcase for easier access

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-08-11  8:32 ` pinskia at gcc dot gnu.org
@ 2023-08-12  0:17 ` pinskia at gcc dot gnu.org
  2023-08-12  0:33 ` pinskia at gcc dot gnu.org
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  0:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh and:
  vect_patt_10.16_58 = .VCOND (vect__4.10_47, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 1,
1, 1, 1, 1, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, 114);
  vect_patt_10.16_59 = .VCOND (vect__4.11_49, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 1,
1, 1, 1, 1, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, 114);
  vect_patt_42.17_60 = VEC_PACK_TRUNC_EXPR <vect_patt_10.16_58,
vect_patt_10.16_59>;
  vect__40.18_61 = -vect_patt_42.17_60;

needs to change just into:
  mask__9.16_54 = vect__4.10_46 != { 0, 0, 0, 0, 0, 0, 0, 0 };
  mask__9.16_55 = vect__4.11_48 != { 0, 0, 0, 0, 0, 0, 0, 0 };
  mask_patt_40.17_56 = VEC_PACK_TRUNC_EXPR <mask__9.16_54, mask__9.16_55>;

That is push the negative back if it is a VCOND I think ...

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh and:
  vect_patt_12.16_57 = .VCOND (vect__3.10_47, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 114);
  vect_patt_42.17_58 = [vec_unpack_lo_expr] vect_patt_12.16_57;
  vect_patt_42.17_59 = [vec_unpack_hi_expr] vect_patt_12.16_57;
  vect__40.18_60 = -vect_patt_42.17_58;
  vect__40.18_61 = -vect_patt_42.17_59;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-08-12  0:17 ` pinskia at gcc dot gnu.org
@ 2023-08-12  0:33 ` pinskia at gcc dot gnu.org
  2023-08-12  1:15 ` pinskia at gcc dot gnu.org
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  0:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=93183

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the SVE issue here is related to the old PR 93183 .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-08-12  0:33 ` pinskia at gcc dot gnu.org
@ 2023-08-12  1:15 ` pinskia at gcc dot gnu.org
  2023-08-12  1:18 ` pinskia at gcc dot gnu.org
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  1:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55728
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55728&action=edit
Fixes part of this

This patch does 2 things which I will split out.
First is it creates COND_NOT like COND_NEG to allow better code generation
earlier on.

Next it simplifies:
vector `(a ? -1 : 0) ^ b` -> `a ? ~b : b` as there might be a conditional not.

That fixes the case where the types are the same. Still need to fix up the case
where the types are different.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-08-12  1:15 ` pinskia at gcc dot gnu.org
@ 2023-08-12  1:18 ` pinskia at gcc dot gnu.org
  2023-08-12  1:50 ` pinskia at gcc dot gnu.org
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  1:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> Created attachment 55728 [details]
> Fixes part of this
> 
> This patch does 2 things which I will split out.
> First is it creates COND_NOT like COND_NEG to allow better code generation
> earlier on.
> 
> Next it simplifies:
> vector `(a ? -1 : 0) ^ b` -> `a ? ~b : b` as there might be a conditional
> not.
> 
> That fixes the case where the types are the same. Still need to fix up the
> case where the types are different.

The second part is really enough to fix that. The COND_NOT just improves the
situtation ...

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-08-12  1:18 ` pinskia at gcc dot gnu.org
@ 2023-08-12  1:50 ` pinskia at gcc dot gnu.org
  2023-08-12  2:30 ` pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  1:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So actually for x86_64, The trunk actually produces better code (figures)

.L2:
        movdqu  (%rdx,%rax), %xmm0
        movdqu  (%rsi,%rax), %xmm2
        movdqu  (%rsi,%rax), %xmm1
        pcmpeqw %xmm3, %xmm0
        pxor    %xmm4, %xmm2
        pand    %xmm0, %xmm1
        pandn   %xmm2, %xmm0
        por     %xmm1, %xmm0
        movups  %xmm0, (%rdi,%rax)
        addq    $16, %rax
        cmpq    $256, %rax
        jne     .L2

.L2:
        movdqu  (%rdx,%rax), %xmm0
        movdqu  (%rsi,%rax), %xmm2
        pcmpeqw %xmm1, %xmm0
        pcmpeqw %xmm1, %xmm0
        pxor    %xmm2, %xmm0
        movups  %xmm0, (%rdi,%rax)
        addq    $16, %rax
        cmpq    $256, %rax
        jne     .L2

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2023-08-12  1:50 ` pinskia at gcc dot gnu.org
@ 2023-08-12  2:30 ` pinskia at gcc dot gnu.org
  2023-08-12  2:54 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  2:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It turns out we should only turn `(a ? -1 : 0) ^ b` into a conditional not if
that exists.

Even on armv8-a without SVE we get on the trunk:
        cmtst   v31.8h, v31.8h, v31.8h
        eor     v31.16b, v31.16b, v30.16b

vs GCC 13:
        not     v1.16b, v2.16b
        cmeq    v0.8h, v0.8h, #0
        bsl     v0.16b, v2.16b, v1.16b

Anyways still have a patch for the same type case. But it now depends on
getting conditional not in place.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2023-08-12  2:30 ` pinskia at gcc dot gnu.org
@ 2023-08-12  2:54 ` pinskia at gcc dot gnu.org
  2023-08-12  9:00 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  2:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #55728|0                           |1
        is obsolete|                            |

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55729
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55729&action=edit
First patch

First part to fix sve/cond_unary_5.c .
Testing it right now and will submit it tomorrow.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2023-08-12  2:54 ` pinskia at gcc dot gnu.org
@ 2023-08-12  9:00 ` pinskia at gcc dot gnu.org
  2023-08-12 19:50 ` [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) " pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  9:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The next and final part for cond_unary_5.c:

(for unpack (vec_unpack_lo vec_unpack_hi)
 (simplify
  (negate (unpack (vec_cond @0 uniform_integer_cst_p@1
uniform_integer_cst_p@2)))
  (with {
   tree outer_mask_type = truth_type_for (type);
   tree allones = build_minus_one_cst (type);
   tree zeros = build_zero_cst (type);
  }
  (if (integer_onep (@1) && integer_zerop (@2))
   (vec_cond (unpack:outer_mask_type @0) { allones; } { zeros; } )
   (if (integer_onep (@2) && integer_zerop (@1))
    (vec_cond (unpack:outer_mask_type @0) { zeros; } { allones; } ))))))

(simplify
 (negate
  (vec_pack_trunc
   (vec_cond @0 uniform_integer_cst_p@1 uniform_integer_cst_p@2)
   (vec_cond @3 @1 @2)))
  (with {
   tree outer_mask_type = truth_type_for (type);
   tree allones = build_minus_one_cst (type);
   tree zeros = build_zero_cst (type);
  }
  (if (integer_onep (@1) && integer_zerop (@2))
   (vec_cond (vec_pack_trunc:outer_mask_type @0 @3) { allones; } { zeros; } )
   (if (integer_onep (@2) && integer_zerop (@1))
    (vec_cond (vec_pack_trunc:outer_mask_type @0 @3) { zeros; } { allones; }
)))))

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2023-08-12  9:00 ` pinskia at gcc dot gnu.org
@ 2023-08-12 19:50 ` pinskia at gcc dot gnu.org
  2023-08-12 20:11 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12 19:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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 ...

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2023-08-12 19:50 ` [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) " pinskia at gcc dot gnu.org
@ 2023-08-12 20:11 ` pinskia at gcc dot gnu.org
  2023-08-15  0:14 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12 20:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> ---
(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  .

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2023-08-12 20:11 ` pinskia at gcc dot gnu.org
@ 2023-08-15  0:14 ` pinskia at gcc dot gnu.org
  2023-08-17  1:37 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-15  0:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2023-08-15  0:14 ` pinskia at gcc dot gnu.org
@ 2023-08-17  1:37 ` cvs-commit at gcc dot gnu.org
  2023-08-20  7:27 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-17  1:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r14-3257-ga32de58c9e6394e4e6aef0ac95b52d1c774ac8bc
Author: Andrew Pinski <apinski@marvell.com>
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.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2023-08-17  1:37 ` cvs-commit at gcc dot gnu.org
@ 2023-08-20  7:27 ` cvs-commit at gcc dot gnu.org
  2023-08-20  7:29 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-20  7:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r14-3337-g70c50c87273d940918225d5c6b03f1ccfb6f978e
Author: Andrew Pinski <apinski@marvell.com>
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) <signed-boolean:32>`
    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.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2023-08-20  7:27 ` cvs-commit at gcc dot gnu.org
@ 2023-08-20  7:29 ` pinskia at gcc dot gnu.org
  2023-10-17 12:24 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-20  7:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #20 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Only the scalar testcase remains failing now. I will come up with a solution
next week.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2023-08-20  7:29 ` pinskia at gcc dot gnu.org
@ 2023-10-17 12:24 ` rguenth at gcc dot gnu.org
  2023-10-18  0:52 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17 12:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |testsuite-fail
           Priority|P3                          |P1

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2023-10-17 12:24 ` rguenth at gcc dot gnu.org
@ 2023-10-18  0:52 ` pinskia at gcc dot gnu.org
  2023-10-18 23:45 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-18  0:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56134
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56134&action=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.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (20 preceding siblings ...)
  2023-10-18  0:52 ` pinskia at gcc dot gnu.org
@ 2023-10-18 23:45 ` pinskia at gcc dot gnu.org
  2023-10-19  4:07 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-18 23:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #56134|0                           |1
        is obsolete|                            |

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (21 preceding siblings ...)
  2023-10-18 23:45 ` pinskia at gcc dot gnu.org
@ 2023-10-19  4:07 ` pinskia at gcc dot gnu.org
  2023-10-22 22:33 ` cvs-commit at gcc dot gnu.org
  2023-10-22 22:34 ` pinskia at gcc dot gnu.org
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-19  4:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #23 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (22 preceding siblings ...)
  2023-10-19  4:07 ` pinskia at gcc dot gnu.org
@ 2023-10-22 22:33 ` cvs-commit at gcc dot gnu.org
  2023-10-22 22:34 ` pinskia at gcc dot gnu.org
  24 siblings, 0 replies; 26+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-22 22:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

--- Comment #24 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

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

commit r14-4831-gbcc5054b36626459ddb04c779f0b201fba6001d1
Author: Andrew Pinski <pinskia@gmail.com>
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<mode>_insn_insv): New pattern.
            (*cmov_uxtw_insn_insv): Likewise.

    gcc/testsuite/ChangeLog:

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) after r14-3110-g7fb65f10285
  2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
                   ` (23 preceding siblings ...)
  2023-10-22 22:33 ` cvs-commit at gcc dot gnu.org
@ 2023-10-22 22:34 ` pinskia at gcc dot gnu.org
  24 siblings, 0 replies; 26+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 22:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110986

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #25 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-10-22 22:34 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11  8:04 [Bug tree-optimization/110986] New: aarch64 regressions after r14-3110-g7fb65f10285 clyon at gcc dot gnu.org
2023-08-11  8:07 ` [Bug middle-end/110986] [14 Regression] " pinskia at gcc dot gnu.org
2023-08-11  8:26 ` pinskia at gcc dot gnu.org
2023-08-11  8:27 ` pinskia at gcc dot gnu.org
2023-08-11  8:31 ` [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectors can do conditional not still) " pinskia at gcc dot gnu.org
2023-08-11  8:32 ` pinskia at gcc dot gnu.org
2023-08-12  0:17 ` pinskia at gcc dot gnu.org
2023-08-12  0:33 ` pinskia at gcc dot gnu.org
2023-08-12  1:15 ` pinskia at gcc dot gnu.org
2023-08-12  1:18 ` pinskia at gcc dot gnu.org
2023-08-12  1:50 ` pinskia at gcc dot gnu.org
2023-08-12  2:30 ` pinskia at gcc dot gnu.org
2023-08-12  2:54 ` pinskia at gcc dot gnu.org
2023-08-12  9:00 ` pinskia at gcc dot gnu.org
2023-08-12 19:50 ` [Bug middle-end/110986] [14 Regression] aarch64 has support for conditional not (and vectorized conditional not ) " pinskia at gcc dot gnu.org
2023-08-12 20:11 ` pinskia at gcc dot gnu.org
2023-08-15  0:14 ` pinskia at gcc dot gnu.org
2023-08-17  1:37 ` cvs-commit at gcc dot gnu.org
2023-08-20  7:27 ` cvs-commit at gcc dot gnu.org
2023-08-20  7:29 ` pinskia at gcc dot gnu.org
2023-10-17 12:24 ` rguenth at gcc dot gnu.org
2023-10-18  0:52 ` pinskia at gcc dot gnu.org
2023-10-18 23:45 ` pinskia at gcc dot gnu.org
2023-10-19  4:07 ` pinskia at gcc dot gnu.org
2023-10-22 22:33 ` cvs-commit at gcc dot gnu.org
2023-10-22 22:34 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).