Hi!

On Tue, Feb 25, 2020 at 10:10:08AM +0100, Jakub Jelinek wrote:
> git is miscompiled on s390x-linux with -O2 -march=zEC12 -mtune=z13.
> I've managed to reduce it into the following testcase.  The problem is that
> during combine we see the s->k = -1; bitfield store and change the SET_SRC
> from a pseudo into a constant:
> (set (zero_extract:DI (mem/j:HI (plus:DI (reg/v/f:DI 60 [ s ])
>                 (const_int 10 [0xa])) [0 +0 S2 A16])
>         (const_int 2 [0x2])
>         (const_int 7 [0x7]))
>     (const_int -1 [0xffffffffffffffff]))

Extracts on the LHS are a monstrosity.

> The following patch fixes it by masking src with mask, this way already
> the src == mask test will DTRT, and as the code for or_mask uses
> gen_int_mode, if the most significant bit is set after shifting it left by
> pos, it will be properly sign-extended.

Yup.  Did you see anything else nearby forgetting to do this as well?

> Bootstrapped/regtested on {x86_64,i686,s390x}-linux, ok for trunk and
> release branches?

Okay everywhere (8 and 9 immediately, if your schedule requires).
Thanks!

> 2020-02-25  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR rtl-optimization/93908
>       * combine.c (find_split_point): For store into ZERO_EXTRACT, and src
>       with mask.
> 
>       * gcc.c-torture/execute/pr93908.c: New test.

> --- gcc/testsuite/gcc.target/s390/pr93908.c.jj        2020-02-24 
> 18:39:26.767378641 +0100
> +++ gcc/testsuite/gcc.target/s390/pr93908.c   2020-02-24 18:39:18.928495337 
> +0100
> @@ -0,0 +1,5 @@
> +/* PR rtl-optimization/93908 */
> +/* { dg-do run { target s390_zEC12_hw } } */
> +/* { dg-options "-O2 -march=zEC12 -mtune=z13" } */
> +
> +#include "../../gcc.c-torture/execute/pr93908.c"

This file isn't in the changelog, please fix that?


Segher

Reply via email to