* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
@ 2022-02-15 23:21 ` pinskia at gcc dot gnu.org
2022-02-16 1:52 ` crazylht at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-15 23:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Summary|Wrong code with -O3 for |[12 Regression] Wrong code
|skylake-avx512, |with -O3 for
|icelake-server, and |skylake-avx512,
|sapphirerapids |icelake-server, and
| |sapphirerapids
Target Milestone|--- |12.0
Ever confirmed|0 |1
Last reconfirmed| |2022-02-15
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, single file version:
unsigned int var_11 = 16U;
unsigned int var_178 = 0;
unsigned char arr_492 [128];
[[gnu::noipa]]
void test() {
for (bool a = 0; a < (bool)var_11; a = 2)
for (unsigned b = 0; b < var_11;
b += 1)
var_178 = arr_492[b] ? arr_492[b] : (char) b;
}
int main() {
for (int i = 0; i < 128; ++i)
arr_492 [i] = (unsigned char)128;
test();
__builtin_printf("%u\n", var_178);
if (var_178 != 128)
__builtin_abort();
return 0;
}
----- CUT -----
I increasing the array size to 128 allowed me to merge it, I don't know why
though; maybe because it allowed the code to be vectorize while 16 was not
going to.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
2022-02-15 23:21 ` [Bug tree-optimization/104551] [12 Regression] " pinskia at gcc dot gnu.org
@ 2022-02-16 1:52 ` crazylht at gmail dot com
2022-02-16 2:34 ` crazylht at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2022-02-16 1:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
Hongtao.liu <crazylht at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |crazylht at gmail dot com
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
let me take a look.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
2022-02-15 23:21 ` [Bug tree-optimization/104551] [12 Regression] " pinskia at gcc dot gnu.org
2022-02-16 1:52 ` crazylht at gmail dot com
@ 2022-02-16 2:34 ` crazylht at gmail dot com
2022-02-16 3:57 ` crazylht at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2022-02-16 2:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #2)
> let me take a look.
Start with r12-7216
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
` (2 preceding siblings ...)
2022-02-16 2:34 ` crazylht at gmail dot com
@ 2022-02-16 3:57 ` crazylht at gmail dot com
2022-02-17 11:01 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2022-02-16 3:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #3)
> (In reply to Hongtao.liu from comment #2)
> > let me take a look.
>
> Start with r12-7216
for (bool a = 0; a < (bool)var_11; a = 2)
for (unsigned b = 0; b < var_11;
b += 1)
var_178 = arr_492[b] ? arr_492[b] : (char) b;
arr_492[b] is unsigned char, and (char) b is sign char,
vect_recog_cond_expr_convert_pattern shouldn't hanlde this since it's
zero_extend with sign_extend, it's not equal to
var_178 = arr_492[b] ? (char)arr_492[b] : (char) b;
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
` (3 preceding siblings ...)
2022-02-16 3:57 ` crazylht at gmail dot com
@ 2022-02-17 11:01 ` cvs-commit at gcc dot gnu.org
2022-02-17 11:02 ` crazylht at gmail dot com
2022-02-18 0:37 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-17 11:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:
https://gcc.gnu.org/g:754dce903ca28c4c2f2bc8614a8de5e631655f2e
commit r12-7276-g754dce903ca28c4c2f2bc8614a8de5e631655f2e
Author: liuhongt <hongtao.liu@intel.com>
Date: Wed Feb 16 12:15:18 2022 +0800
Restrict the two sources of vect_recog_cond_expr_convert_pattern to be of
the same type when convert is extension.
It's not equal to transform
(cond (cmp @1 @2) (convert@3 @4) (convert@5 @6))
to
(convert (cmp @1 @2) (convert)@4 @6)
when(convert@3 @4) is extension because it's zero_extend vs sign_extend.
gcc/ChangeLog:
PR tree-optimization/104551
PR tree-optimization/103771
* match.pd (cond_expr_convert_p): Add types_match check when
convert is extension.
* tree-vect-patterns.cc
(gimple_cond_expr_convert_p): Adjust comments.
(vect_recog_cond_expr_convert_pattern): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr104551.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
` (4 preceding siblings ...)
2022-02-17 11:01 ` cvs-commit at gcc dot gnu.org
@ 2022-02-17 11:02 ` crazylht at gmail dot com
2022-02-18 0:37 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2022-02-17 11:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC12.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/104551] [12 Regression] Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids
2022-02-15 18:01 [Bug tree-optimization/104551] New: Wrong code with -O3 for skylake-avx512, icelake-server, and sapphirerapids vsevolod.livinskij at frtk dot ru
` (5 preceding siblings ...)
2022-02-17 11:02 ` crazylht at gmail dot com
@ 2022-02-18 0:37 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-18 0:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104551
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed so closing.
^ permalink raw reply [flat|nested] 8+ messages in thread