public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1
@ 2021-03-31 20:24 dushistov at mail dot ru
  2021-04-01  4:42 ` [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dushistov at mail dot ru @ 2021-03-31 20:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99856
           Summary: Alpha Compositing auto vectorization regression: 8.3
                    -> 9.1
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dushistov at mail dot ru
  Target Milestone: ---

Such code vectorized with gcc 8.3, but failed to vectorized with 9.1.
Last version of clang works just fine.

```
#include <stdint.h>
#include <stddef.h>

#define SHIFTFORDIV255(a)\
    ((((a) >> 8) + a) >> 8)

#define DIV255(a)\
    SHIFTFORDIV255(a + 0x80)

void
opSourceOver_premul(uint8_t* restrict Rrgba,
                    const uint8_t* restrict Srgba,
                    const uint8_t* restrict Drgba, size_t len)
{
    size_t i = 0;
    for (; i < len*4; i += 4) {
        uint8_t Sa = Srgba[i + 3];
        Rrgba[i + 0] = DIV255(Srgba[i + 0] * 255 + Drgba[i + 0] * (255 - Sa));
        Rrgba[i + 1] = DIV255(Srgba[i + 1] * 255 + Drgba[i + 1] * (255 - Sa));
        Rrgba[i + 2] = DIV255(Srgba[i + 2] * 255 + Drgba[i + 2] * (255 - Sa));
        Rrgba[i + 3] = DIV255(Srgba[i + 3] * 255 + Drgba[i + 3] * (255 - Sa));
    }
}
```

see https://godbolt.org/z/PW65xzb4h
with assembler output for 8.3 and 9.1

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

* [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression
  2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
@ 2021-04-01  4:42 ` marxin at gcc dot gnu.org
  2021-04-01  7:21 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-01  4:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-04-01
          Component|c                           |tree-optimization
     Ever confirmed|0                           |1
      Known to work|                            |8.4.0
             Status|UNCONFIRMED                 |NEW
            Summary|Alpha Compositing auto      |[9/10/11 Regression] Alpha
                   |vectorization regression:   |Compositing auto
                   |8.3 -> 9.1                  |vectorization regression
      Known to fail|                            |9.3.0
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r9-1590-g370c2ebe8fa20e08.

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

* [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression
  2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
  2021-04-01  4:42 ` [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression marxin at gcc dot gnu.org
@ 2021-04-01  7:21 ` rguenth at gcc dot gnu.org
  2021-04-01  8:23 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-01  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |9.3.0
           Priority|P3                          |P2
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |9.4
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Target|                            |x86_64-*-*

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
t.c:16:14: note:   op template: patt_266 = (<unnamed-unsigned:17>) _8;
t.c:16:14: note:        stmt 0 patt_266 = (<unnamed-unsigned:17>) _8;
t.c:16:14: note:        stmt 1 patt_243 = (<unnamed-unsigned:17>) _28;
t.c:16:14: note:        stmt 2 patt_220 = (<unnamed-unsigned:17>) _46;
t.c:16:14: note:        stmt 3 patt_198 = (<unnamed-unsigned:17>) _60;
t.c:16:14: note:        children 0x38267e0

WTF

t.c:16:14: note:   ==> examining pattern def stmt: patt_266 =
(<unnamed-unsigned:17>) _8;
t.c:16:14: note:   precomputed vectype: vector(8) unsigned int
t.c:16:14: note:   get vectype for smallest scalar type: unsigned char

the dumps do not show who creates this 17 bit precision temporary, but clearly
this causes

t.c:16:14: note:   ==> examining statement: patt_266 = (<unnamed-unsigned:17>)
_8;
t.c:16:14: note:   vect_is_simple_use: operand *_7, type of def: internal
t.c:16:14: missed:   type conversion to/from bit-precision unsupported.
t.c:16:14: missed:   bit-precision arithmetic not supported.
t.c:16:14: note:   vect_is_simple_use: operand *_7, type of def: internal
t.c:11:1: missed:   not vectorized: relevant stmt not supported: patt_266 =
(<unnamed-unsigned:17>) _8;
t.c:16:14: note:   removing SLP instance operations starting from: *_20 = _21;
t.c:16:14: missed:  unsupported SLP instances
t.c:16:14: note:  re-trying with SLP disabled
...
t.c:16:14: note:   ==> examining statement: patt_266 = (<unnamed-unsigned:17>)
_8;
t.c:16:14: note:   vect_is_simple_use: operand *_7, type of def: internal
t.c:16:14: note:   vect_is_simple_use: vectype const vector(32) unsigned char
t.c:16:14: missed:   type conversion to/from bit-precision unsupported.
t.c:16:14: missed:   bit-precision arithmetic not supported.
t.c:16:14: note:   vect_is_simple_use: operand *_7, type of def: internal
t.c:16:14: note:   vect_is_simple_use: vectype const vector(32) unsigned char
t.c:11:1: missed:   not vectorized: relevant stmt not supported: patt_266 =
(<unnamed-unsigned:17>) _8;
t.c:16:14: missed:  bad operation or unsupported loop bound.


Breakpoint 6, build_nonstandard_integer_type (precision=17, unsignedp=1)
    at /home/rguenther/src/gcc3/gcc/tree.c:8090
8090      if (unsignedp)
(gdb) bt
#0  build_nonstandard_integer_type (precision=17, unsignedp=1)
    at /home/rguenther/src/gcc3/gcc/tree.c:8090
#1  0x00000000024461ab in vect_recog_over_widening_pattern (vinfo=0x385bf60, 
    last_stmt_info=0x38d1130, type_out=0x7fffffffc7d0)
    at /home/rguenther/src/gcc3/gcc/tree-vect-patterns.c:1719
#2  0x0000000002453c10 in vect_pattern_recog_1 (vinfo=0x385bf60, 
    recog_func=0x359bf80 <vect_vect_recog_func_ptrs>, stmt_info=0x38d1130)
    at /home/rguenther/src/gcc3/gcc/tree-vect-patterns.c:5463
#3  0x0000000002453fee in vect_pattern_recog (vinfo=0x385bf60)
    at /home/rguenther/src/gcc3/gcc/tree-vect-patterns.c:5603

where

(gdb) p last_stmt_info->min_output_precision
$9 = 17
(gdb) p last_stmt_info->operation_precision
$10 = 8

and the min_output_precision is determined from the defs uses
min_input_precision.

I didn't trace further where we arrive at '17', but

diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index b575b456301..803de3fc287 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1705,6 +1705,7 @@ vect_recog_over_widening_pattern (vec_info *vinfo,
   /* Apply the minimum efficient precision we just calculated.  */
   if (new_precision < min_precision)
     new_precision = min_precision;
+  new_precision = vect_element_precision (new_precision);
   if (new_precision >= TYPE_PRECISION (type))
     return NULL;

restores vectorization.

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

* [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression
  2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
  2021-04-01  4:42 ` [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression marxin at gcc dot gnu.org
  2021-04-01  7:21 ` rguenth at gcc dot gnu.org
@ 2021-04-01  8:23 ` cvs-commit at gcc dot gnu.org
  2021-04-01  9:14 ` [Bug tree-optimization/99856] [9/10 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-01  8:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r11-7945-gb75c4e1384c021ca94fc8e8db8e517e802b820f3
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 1 09:29:14 2021 +0200

    tree-optimization/99856 - fix overwideing pattern creation

    This fixes an omission of promoting a bit-precision required precision
    to a vector element precision.

    2021-04-01  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/99856
            * tree-vect-patterns.c (vect_recog_over_widening_pattern): Promote
            precision to vector element precision.

            * gcc.dg/vect/pr99856.c: New testcase.

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

* [Bug tree-optimization/99856] [9/10 Regression] Alpha Compositing auto vectorization regression
  2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
                   ` (2 preceding siblings ...)
  2021-04-01  8:23 ` cvs-commit at gcc dot gnu.org
@ 2021-04-01  9:14 ` cvs-commit at gcc dot gnu.org
  2021-04-01  9:42 ` [Bug tree-optimization/99856] [9 " cvs-commit at gcc dot gnu.org
  2021-04-01  9:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-01  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:1cfe48d35e31e905632e37ae6a9cb37d35f9a228

commit r10-9649-g1cfe48d35e31e905632e37ae6a9cb37d35f9a228
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 1 09:29:14 2021 +0200

    tree-optimization/99856 - fix overwideing pattern creation

    This fixes an omission of promoting a bit-precision required precision
    to a vector element precision.

    2021-04-01  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/99856
            * tree-vect-patterns.c (vect_recog_over_widening_pattern): Promote
            precision to vector element precision.

            * gcc.dg/vect/pr99856.c: New testcase.

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

* [Bug tree-optimization/99856] [9 Regression] Alpha Compositing auto vectorization regression
  2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
                   ` (3 preceding siblings ...)
  2021-04-01  9:14 ` [Bug tree-optimization/99856] [9/10 " cvs-commit at gcc dot gnu.org
@ 2021-04-01  9:42 ` cvs-commit at gcc dot gnu.org
  2021-04-01  9:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-01  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:3d705c86c08985af73823b71af21c2ffe2c23758

commit r9-9317-g3d705c86c08985af73823b71af21c2ffe2c23758
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 1 09:29:14 2021 +0200

    tree-optimization/99856 - fix overwideing pattern creation

    This fixes an omission of promoting a bit-precision required precision
    to a vector element precision.

    2021-04-01  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/99856
            * tree-vect-patterns.c (vect_recog_over_widening_pattern): Promote
            precision to vector element precision.

            * gcc.dg/vect/pr99856.c: New testcase.

    (cherry picked from commit 1cfe48d35e31e905632e37ae6a9cb37d35f9a228)

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

* [Bug tree-optimization/99856] [9 Regression] Alpha Compositing auto vectorization regression
  2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
                   ` (4 preceding siblings ...)
  2021-04-01  9:42 ` [Bug tree-optimization/99856] [9 " cvs-commit at gcc dot gnu.org
@ 2021-04-01  9:43 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-01  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-04-01  9:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 20:24 [Bug c/99856] New: Alpha Compositing auto vectorization regression: 8.3 -> 9.1 dushistov at mail dot ru
2021-04-01  4:42 ` [Bug tree-optimization/99856] [9/10/11 Regression] Alpha Compositing auto vectorization regression marxin at gcc dot gnu.org
2021-04-01  7:21 ` rguenth at gcc dot gnu.org
2021-04-01  8:23 ` cvs-commit at gcc dot gnu.org
2021-04-01  9:14 ` [Bug tree-optimization/99856] [9/10 " cvs-commit at gcc dot gnu.org
2021-04-01  9:42 ` [Bug tree-optimization/99856] [9 " cvs-commit at gcc dot gnu.org
2021-04-01  9:43 ` rguenth 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).