Re: [PATCH] Add vector integer support to double-conversion patterns

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <CAMe9rOrHyQJGp-SLWLq18u_K8H3H02Dp5DmWtXxKyAQimy3ZtQ@mail.gmail.com>
On Thu, Aug 13, 2026 at 8:16 PM Richard Biener <[email protected]> wrote:
>
> The following expands the double-conversion match patterns to also
> cover integer vectors (it already supports float vectors), adding
> required guards for supportability.  I have simplified
> supportable_convert_operation by eliding the useless output code
> argument (it's always the same as the input code).
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
>
>         * match.pd ((convert (convert @0))): Allow integer vector
>         types, unify {inside,intrer,final}_vec, guard patterns that
>         are not correct for vectors and those that are with
>         checks the resulting conversion is supported by the target.
>         * optabs-tree.h (supportable_convert_operation): Remove
>         useless last argument.
>         * optabs-tree.cc (supportable_convert_operation): Likewise.
>         (supportable_half_widening_operation): Adjust.
>         * tree-vect-stmts.cc (vectorizable_conversion): Likewise.
>         (supportable_indirect_convert_operation): Likewise.
>         * tree-vect-generic.cc (expand_vector_conversion): Likewise.
>         * tree-vect-data-refs.cc (vect_gather_scatter_fn_p): Likewise.
>         * tree-ssa-forwprop.cc (simplify_vector_constructor): Likewise.
>
> Co-Authored-By: H.J. Lu <[email protected]>

It missed:

typedef int  v2si __attribute__((vector_size (8)));
typedef long long v2di __attribute__((vector_size (16)));

v2si
func (v2si a)
{
  v2di z = __builtin_convertvector (a, v2di);
  return __builtin_convertvector (z, v2si);
}

It should be compiled to an empty function.  But I got

        movdqa  %xmm0, %xmm1
        psrad   $31, %xmm1
        punpckldq       %xmm1, %xmm0
        shufps  $232, %xmm0, %xmm0


-- 
H.J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.