public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
@ 2023-05-29 2:35 crazylht at gmail dot com
2023-05-29 3:28 ` [Bug middle-end/110018] " pinskia at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-05-29 2:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
Bug ID: 110018
Summary: Missing vectorizable_conversion(unsigned char ->
double) for BB vectorizer
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: crazylht at gmail dot com
Target Milestone: ---
When Looking at PR109812, I noticed there's missing vectorizable_conversion for
BB vectorizer when target doesn't support direct optab for unsigned char to
double. But actually it can be vectorized via unsigned char -> short/int/long
long -> double when vectorizable_conversion is ok for any of the immediate
type.
Currently, when modifier is NONE, vectorizable_conversion doesn't try any
immediate type, it can be extended similar like WIDEN.
5158 case NONE:
5159 if (code != FIX_TRUNC_EXPR
5160 && code != FLOAT_EXPR
5161 && !CONVERT_EXPR_CODE_P (code))
5162 return false;
5163 if (supportable_convert_operation (code, vectype_out, vectype_in,
&code1))
5164 break;
5165 /* FALLTHRU */
void
foo (double* __restrict a, unsigned char* b)
{
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
a[3] = b[3];
a[4] = b[4];
a[5] = b[5];
a[6] = b[6];
a[7] = b[7];
}
missed: conversion not supported by target.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
@ 2023-05-29 3:28 ` pinskia at gcc dot gnu.org
2023-05-29 5:53 ` crazylht at gmail dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-29 3:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-05-29
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
2023-05-29 3:28 ` [Bug middle-end/110018] " pinskia at gcc dot gnu.org
@ 2023-05-29 5:53 ` crazylht at gmail dot com
2023-05-29 6:14 ` crazylht at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-05-29 5:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
> Currently, when modifier is NONE, vectorizable_conversion doesn't try any
> immediate type, it can be extended similar like WIDEN.
>
After gdb the testcase, the modifier is not NONE, it's widen from V8QI to V4DF,
and failed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
2023-05-29 3:28 ` [Bug middle-end/110018] " pinskia at gcc dot gnu.org
2023-05-29 5:53 ` crazylht at gmail dot com
@ 2023-05-29 6:14 ` crazylht at gmail dot com
2023-05-30 7:57 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-05-29 6:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
Even we have direct optab for unsigned char to long long, BB vectorizer failer
to optimize
void
foo1 (long long* __restrict a, unsigned char* b)
{
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
a[3] = b[3];
a[4] = b[4];
a[5] = b[5];
a[6] = b[6];
a[7] = b[7];
}
since we have vectype_out as V4DImode, but vectype_in as V8QImode as *vectype =
SLP_TREE_VECTYPE (child);
If manually change the testcase to
void
foo1 (long long* __restrict a, unsigned char* b)
{
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
a[3] = b[3];
}
Then BB vectorizer can do vectorization, but still failed for
void
foo1 (double* __restrict a, unsigned char* b)
{
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
a[3] = b[3];
}
So it looks there're 2 separate issue
1. As mentioned in the PR, we can use intermediate type for vectorizable
unsigned char to double.
2. There's mismatch between vectype_out and vectype_in as SLP_TREE_VECTYPE
(child);
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (2 preceding siblings ...)
2023-05-29 6:14 ` crazylht at gmail dot com
@ 2023-05-30 7:57 ` rguenth at gcc dot gnu.org
2023-05-30 9:50 ` crazylht at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-30 7:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |x86_64-*-*
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the easiest would be to handle this in pattern recog and piggy-back
on the existing multi-step conversion support for the integral promotion
whilst not relying on such for int<->float conversions.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (3 preceding siblings ...)
2023-05-30 7:57 ` rguenth at gcc dot gnu.org
@ 2023-05-30 9:50 ` crazylht at gmail dot com
2023-06-21 2:33 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-05-30 9:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
Do we know if the stmt belongs to any slp_node in pattern recog? slp_node use
SLP_TREE_LANES for vectype which is different from vinfo->vector_mode.
Different optabs should be checked according to both vectype_in and
vectype_out, for non-slp case, assuming vec_pack/unpack are always used when
lhs has different size from rhs, for slp case, sometimes vec_pack/unpack is
used, somethings direct conversion is used.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (4 preceding siblings ...)
2023-05-30 9:50 ` crazylht at gmail dot com
@ 2023-06-21 2:33 ` cvs-commit at gcc dot gnu.org
2023-06-21 2:38 ` crazylht at gmail dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-21 2:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #6 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:6f19cf7526168f840fd22f6af3f0cb67efb90dc8
commit r14-2007-g6f19cf7526168f840fd22f6af3f0cb67efb90dc8
Author: liuhongt <hongtao.liu@intel.com>
Date: Wed May 31 11:20:46 2023 +0800
Use intermiediate integer type for float_expr/fix_trunc_expr when direct
optab is not existed.
We have already use intermidate type in case WIDEN, but not for NONE,
this patch extended that.
gcc/ChangeLog:
PR target/110018
* tree-vect-stmts.cc (vectorizable_conversion): Use
intermiediate integer type for float_expr/fix_trunc_expr when
direct optab is not existed.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr110018-1.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (5 preceding siblings ...)
2023-06-21 2:33 ` cvs-commit at gcc dot gnu.org
@ 2023-06-21 2:38 ` crazylht at gmail dot com
2023-06-21 14:35 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-06-21 2:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
Hongtao.liu <crazylht at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #7 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed for GCC14.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (6 preceding siblings ...)
2023-06-21 2:38 ` crazylht at gmail dot com
@ 2023-06-21 14:35 ` cvs-commit at gcc dot gnu.org
2023-06-26 7:30 ` cvs-commit at gcc dot gnu.org
2023-06-26 7:49 ` cvs-commit at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-21 14:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:
https://gcc.gnu.org/g:b9401c3a323c59705eca177bf72c13c0d2f462b6
commit r14-2020-gb9401c3a323c59705eca177bf72c13c0d2f462b6
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Wed Jun 21 16:34:39 2023 +0200
vect: Add testcases for unsigned conversions [PR110018]
Also test convresions with unsigned types.
PR target/110018
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr110018-1.c: Use explicit signed types.
* gcc.target/i386/pr110018-2.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (7 preceding siblings ...)
2023-06-21 14:35 ` cvs-commit at gcc dot gnu.org
@ 2023-06-26 7:30 ` cvs-commit at gcc dot gnu.org
2023-06-26 7:49 ` cvs-commit at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-26 7:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #9 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:77a50c772771f681085922b493922516c3c03e9a
commit r14-2085-g77a50c772771f681085922b493922516c3c03e9a
Author: liuhongt <hongtao.liu@intel.com>
Date: Sun Jun 25 11:35:09 2023 +0800
Don't use intermiediate type for FIX_TRUNC_EXPR when ftrapping-math.
> > Hmm, good question. GENERIC has a direct truncation to unsigned char
> > for example, the C standard generally says if the integral part cannot
> > be represented then the behavior is undefined. So I think we should be
> > safe here (0x1.0p32 doesn't fit an int).
>
> We should be following Annex F (unspecified value plus "invalid"
exception
> for out-of-range floating-to-integer conversions rather than undefined
> behavior). But we don't achieve that very well at present (see bug 93806
> comments 27-29 for examples of how such conversions produce wobbly
> values).
That would mean guarding this with !flag_trapping_math would be the
appropriate
thing to do.
gcc/ChangeLog:
PR tree-optimization/110371
PR tree-optimization/110018
* tree-vect-stmts.cc (vectorizable_conversion): Don't use
intermiediate type for FIX_TRUNC_EXPR when ftrapping-math.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr110018-1.c: Add -fno-trapping-math to
dg-options.
* gcc.target/i386/pr110018-2.c: Ditto.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
` (8 preceding siblings ...)
2023-06-26 7:30 ` cvs-commit at gcc dot gnu.org
@ 2023-06-26 7:49 ` cvs-commit at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-26 7:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110018
--- Comment #10 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:1bfe7e5352d1f4ac525317454aca45aa80a517ba
commit r14-2086-g1bfe7e5352d1f4ac525317454aca45aa80a517ba
Author: liuhongt <hongtao.liu@intel.com>
Date: Sun Jun 25 11:12:29 2023 +0800
Use cvt_op to save intermediate type operand instead of "subtle" vec_dest.
When there're multiple operands in vec_oprnds0, vec_dest will be
overwrited to vectype_out, but in multi_step_cvt case, cvt_type is
expected. It caused an ICE when verify_gimple_in_cfg.
gcc/ChangeLog:
PR tree-optimization/110371
PR tree-optimization/110018
* tree-vect-stmts.cc (vectorizable_conversion): Use cvt_op to
save intermediate type operand instead of "subtle" vec_dest
for case NONE.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/pr110371.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-06-26 7:49 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29 2:35 [Bug middle-end/110018] New: Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer crazylht at gmail dot com
2023-05-29 3:28 ` [Bug middle-end/110018] " pinskia at gcc dot gnu.org
2023-05-29 5:53 ` crazylht at gmail dot com
2023-05-29 6:14 ` crazylht at gmail dot com
2023-05-30 7:57 ` rguenth at gcc dot gnu.org
2023-05-30 9:50 ` crazylht at gmail dot com
2023-06-21 2:33 ` cvs-commit at gcc dot gnu.org
2023-06-21 2:38 ` crazylht at gmail dot com
2023-06-21 14:35 ` cvs-commit at gcc dot gnu.org
2023-06-26 7:30 ` cvs-commit at gcc dot gnu.org
2023-06-26 7:49 ` cvs-commit 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).