On Wed, Jun 21, 2023 at 9:50 AM Uros Bizjak via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > On Tue, Jun 20, 2023 at 6:11 PM liuhongt via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: > > > > I notice there's some refactor in vectorizable_conversion > > for code_helper,so I've adjusted my patch to that. > > Here's the patch I'm going to commit. > > > > 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. > > > + > > + /* For conversions between float and smaller integer types try > > whether we > > + can use intermediate signed integer types to support the > > + conversion. */ > > I'm trying to enhance testcase coverage with explicit signed/unsigned > types (patch attached), and I have noticed that zero-extension is used > for unsigned types. So, the above comment that mentions only signed > integer types is not entirely correct.
The comment says the intermediate sized vector types are always signed (because float conversions to/from unsigned are always somewhat awkward), but yes, if the original type was unsigned zero-extension is used and if it was signed sign-extension. The testcase adjustments / additions look good to me btw. Thanks, Richard. > > Uros.