[PATCH] [AVX512] Fix ICE: Convert integer mask to vector in ix86_expand_fp_vec_cmp/ix86_expand_int_vec_cmp [PR98537]

Jakub Jelinek jakub@redhat.com
Wed Jan 6 14:39:31 GMT 2021


On Wed, Jan 06, 2021 at 02:49:13PM +0800, Hongtao Liu wrote:
>   ix86_expand_fp_vec_cmp/ix86_expand_int_vec_cmp are used by vec_cmpmn
> for vector comparison to vector mask, but ix86_expand_sse_cmp(which is
> called in upper 2 functions.) may return integer mask whenever integer
> mask is available, so convert integer mask back to vector mask if
> needed.
> 
> gcc/ChangeLog:
> 
>         PR target/98537
>         * config/i386/i386-expand.c (ix86_expand_fp_vec_cmp):
>         When cmp is integer mask, convert it to vector.
>         (ix86_expand_int_vec_cmp): Ditto.
> 
> gcc/testsuite/ChangeLog:
> 
>         PR target/98537
>         * g++.target/i386/avx512bw-pr98537-1.C: New test.
>         * g++.target/i386/avx512vl-pr98537-1.C: New test.
>         * g++.target/i386/avx512vl-pr98537-2.C: New test.

Do we optimize it then to an AVX/AVX2 comparison if possible?

@@ -4024,8 +4025,18 @@ ix86_expand_fp_vec_cmp (rtx operands[])
     cmp = ix86_expand_sse_cmp (operands[0], code, operands[2], operands[3],
 			       operands[1], operands[2]);
 
-  if (operands[0] != cmp)
-    emit_move_insn (operands[0], cmp);
+    if (operands[0] != cmp)
+    {

The indentation of the if above looks wrong.
Otherwise LGTM.

	Jakub



More information about the Gcc-patches mailing list