This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: [Bug] subword handling for DI modes
Ben Elliston writes:
> I wrote:
>
> Here is a minimal test case that reproduces the problem. Does anyone
> have any ideas? Thanks,
>
> (set reg (subword SI reg 0))
>
> FYI, I was able to work around this by using:
>
> (subword SI (reg h-reg) 0)
>
> So it seems something is amiss in the determination of the operand's mode.
Here is my tentative proposed patch.
The bug happens when "compiling" the semantics of the insn.
semantic-compile will call rtx-traverse which will use the mode
of the result as the default mode for operand0. subword is not a
normal rtx; the mode of operand0 is its own mode, not the mode of
the result of the rtx.
2000-10-26 Doug Evans <dje@casey.transmeta.com>
* rtx-funcs.scm (subword): Change mode spec of operand0 from OP0
to ANY.
*** rtx-funcs.scm.~1~ Thu Jul 27 21:11:52 2000
--- rtx-funcs.scm Thu Oct 26 21:49:11 2000
***************
*** 426,439 ****
; GCC's subreg.
; Called subword 'cus it's not exactly subreg.
! ; Word numbering is from most signficant (word 0) to least (word N-1).
; ??? May also want an endian dependent word ordering. That can be
; implemented on top of or beside this.
; ??? GCC plans to switch to SUBREG_BYTE. Keep an eye out for the switch
; (which is extensive so probably won't happen anytime soon).
(drn (subword &options &mode value word-num)
! (OPTIONS NUMMODE RTX RTX) (NA NA OP0 INT)
ARG
#f
)
--- 426,444 ----
; GCC's subreg.
; Called subword 'cus it's not exactly subreg.
! ; Word numbering is from most significant (word 0) to least (word N-1).
; ??? May also want an endian dependent word ordering. That can be
; implemented on top of or beside this.
; ??? GCC plans to switch to SUBREG_BYTE. Keep an eye out for the switch
; (which is extensive so probably won't happen anytime soon).
+ ;
+ ; The mode spec of operand0 use to be OP0, but subword is not a normal rtx.
+ ; The mode of operand0 is not necessarily the same as the mode of the result,
+ ; and code which analyzes it would otherwise use the result mode (specified by
+ ; `&mode') for the mode of operand0.
(drn (subword &options &mode value word-num)
! (OPTIONS NUMMODE RTX RTX) (NA NA ANY INT)
ARG
#f
)