This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] rtlanal: Fix nonzero_bits for non-load paradoxical subregs (PR85925)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Sandiford <richard dot sandiford at linaro dot org>
- Date: Mon, 04 Jun 2018 22:57:05 +0200
- Subject: Re: [PATCH] rtlanal: Fix nonzero_bits for non-load paradoxical subregs (PR85925)
- References: <94c0a64d9f0f94439db4e445507ddbb86dd3455e.1528115574.git.segher@kernel.crashing.org>
> In the PR we have insns:
>
> Trying 23 -> 24:
> 23: r123:SI=zero_extend(r122:HI)
> REG_DEAD r122:HI
> 24: [r115:SI]=r123:SI
> REG_DEAD r123:SI
>
> which should be combined to
>
> (set (mem:SI (reg/f:SI 115 [ pretmp_19 ]) [1 *pretmp_19+0 S4 A32])
> (and:SI (subreg:SI (reg:HI 122) 0)
> (const_int 32767 [0x7fff])))
>
> But nonzero_bits of reg:HI 122 is 0x7fff, and nonzero_bits1 thinks it
> then also has that same nonzero_bits for the subreg. This is not
> correct: the bit outside of HImode are undefined. load_extend_op
> applies to loads from memory only, not anything else. Which means the
> whole AND is optimised away.
No, this is done on purpose for WORD_REGISTER_OPERATIONS targets and your
patch will pessimize them. I'm going to have a look at the PR then.
--
Eric Botcazou