diff mbox series

Fix up ix86_expand_adjust_ufix_to_sfix_si ICE (PR target/91931)

Message ID 20190930070105.GC15914@tucnak
State New
Headers show
Series Fix up ix86_expand_adjust_ufix_to_sfix_si ICE (PR target/91931) | expand

Commit Message

Jakub Jelinek Sept. 30, 2019, 7:01 a.m. UTC
Hi!

The recent SUBREG simplification changes aren't as forgiving in the past and
ICE on invalid constants, in this case CONST_VECTOR:V8SI with 8x CONST_INT
0x80000000 element, which is invalid, because for SImode it needs to be sign
extended.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2019-09-30  Jakub Jelinek  <jakub@redhat.com>

	PR target/91931
	* config/i386/i386-expand.c (ix86_expand_adjust_ufix_to_sfix_si): Use
	gen_int_mode instead of GEN_INT.

	* gcc.target/i386/pr91931.c: New test.


	Jakub

Comments

Uros Bizjak Sept. 30, 2019, 7:10 a.m. UTC | #1
On Mon, Sep 30, 2019 at 9:01 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> The recent SUBREG simplification changes aren't as forgiving in the past and
> ICE on invalid constants, in this case CONST_VECTOR:V8SI with 8x CONST_INT
> 0x80000000 element, which is invalid, because for SImode it needs to be sign
> extended.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2019-09-30  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/91931
>         * config/i386/i386-expand.c (ix86_expand_adjust_ufix_to_sfix_si): Use
>         gen_int_mode instead of GEN_INT.
>
>         * gcc.target/i386/pr91931.c: New test.

OK.

Thanks,
Uros.

> --- gcc/config/i386/i386-expand.c.jj    2019-09-10 20:08:44.931792487 +0200
> +++ gcc/config/i386/i386-expand.c       2019-09-29 13:19:47.122382234 +0200
> @@ -1694,7 +1694,7 @@ ix86_expand_adjust_ufix_to_sfix_si (rtx
>                                  OPTAB_DIRECT);
>    else
>      {
> -      rtx two31 = GEN_INT (HOST_WIDE_INT_1U << 31);
> +      rtx two31 = gen_int_mode (HOST_WIDE_INT_1U << 31, SImode);
>        two31 = ix86_build_const_vector (intmode, 1, two31);
>        *xorp = expand_simple_binop (intmode, AND,
>                                    gen_lowpart (intmode, tmp[0]),
> --- gcc/testsuite/gcc.target/i386/pr91931.c.jj  2019-09-29 13:22:58.502510721 +0200
> +++ gcc/testsuite/gcc.target/i386/pr91931.c     2019-09-29 13:23:36.099946605 +0200
> @@ -0,0 +1,5 @@
> +/* PR target/91931 */
> +/* { dg-do compile } */
> +/* { dg-options "-O1 -ftree-loop-vectorize -mavx -mno-avx2" } */
> +
> +#include "../../gcc.dg/vect/pr32216.c"
>
>         Jakub
diff mbox series

Patch

--- gcc/config/i386/i386-expand.c.jj	2019-09-10 20:08:44.931792487 +0200
+++ gcc/config/i386/i386-expand.c	2019-09-29 13:19:47.122382234 +0200
@@ -1694,7 +1694,7 @@  ix86_expand_adjust_ufix_to_sfix_si (rtx
 				 OPTAB_DIRECT);
   else
     {
-      rtx two31 = GEN_INT (HOST_WIDE_INT_1U << 31);
+      rtx two31 = gen_int_mode (HOST_WIDE_INT_1U << 31, SImode);
       two31 = ix86_build_const_vector (intmode, 1, two31);
       *xorp = expand_simple_binop (intmode, AND,
 				   gen_lowpart (intmode, tmp[0]),
--- gcc/testsuite/gcc.target/i386/pr91931.c.jj	2019-09-29 13:22:58.502510721 +0200
+++ gcc/testsuite/gcc.target/i386/pr91931.c	2019-09-29 13:23:36.099946605 +0200
@@ -0,0 +1,5 @@ 
+/* PR target/91931 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-loop-vectorize -mavx -mno-avx2" } */
+
+#include "../../gcc.dg/vect/pr32216.c"