This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH:[darwin] fix load of a misaligned double word

Alan Modra wrote:

>Consider the following instruction from Brad's large testcase.
>(insn 3173 3172 3175 181 (set (mem:DF (plus:SI (reg/f:SI 1177)
>                (const_int 3 [0x3])) [0 S8 A64])
>        (reg/v:DF 133 [ ___F64V3 ])) 318 {*movdf_hardfloat64} (insn_list
3163 (insn_list 3172 (nil)))
>Note that the address in the instruction is valid for reg 133 as a
>pseudo or fpr, but not after reg 133 is assigned a gpr.  Thus, in the
>early stage of reload's processing of this instruction, the
>strict_memory_address_p check in find_reloads_address fails to detect
>any addressing problem.  I believe this is what Ulrich was referring to

Actually, this is not what I was referring to.  In this particular case,
what should happen is that the insn alternative that allows a gpr as
source argument should enforce a correct destination memory address
via the constraint used for the destination operand.

You didn't mention which alternative reload chose; assuming it was in
fact the 'r' -> 'Y' one, then the 'Y' constraint should be evaluated
later in the find_reloads loop (note that find_reloads_address does
*not* handle this), and cause the address to be reloaded into a register.
Note that secondary reloads should not be involved *here* at all.

If this doesn't happen, then either the 'r'->'Y' alternative isn't
chosen after all, or else your SECONDARY_RELOAD_ macros incorrectly
force a secondary reload in this case.

Secondary reloads come into play for insns reload *itself* generates.
Say, for example, if in your insn above reg 133 were not assigned a
hard reg at all, but would be found in memory at some equivalent-
memory slot with a non-aligned address, and reload chose to use the
'r' -> 'Y' alternative, using gpr0 as temporary and generating a
input reload to move from the equivalent-memory slot to gpr0.
In *this* case, a secondary reload is required to ensure that this
input reload itself gets its address reloaded into a base register.

Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]