[PATCH, alpha]: Fix all struct-layout-1 failures

Uros Bizjak ubizjak@gmail.com
Sun Jan 11 10:39:00 GMT 2009


Hello!

So, the problem here was not with missing -mieee flag in the testcases, 
but with the way alpha compiler handles HIGH/LO_SUM combos when loading 
immediates that are bigger than word_size.

An example from failed tests is when TFmode long double 128bit immediate 
is loaded via:

    ldah $1,$LC611($29)        !gprelhigh
    ldq $2,$LC611+8($1)        !gprellow
    ldq $1,$LC611($1)        !gprellow

The problem is with +8 explicit reloc, when relocation is exactly 32760 
bytes away. Linker then creates:

0x0000000120028da4 <test2141+1768>:     ldah    t0,-3(gp)
0x0000000120028da8 <test2141+1772>:     ldq     t1,-32768(t0)
0x0000000120028dac <test2141+1776>:     ldq     t0,32760(t0)

As can be seen from this example, lo_sum offset of $LABEL+8 folds around 
to a negative offset.

Disabling explicit relocs for immediates wider than word_mode fixes this 
problem:

    ldah $1,$LC0($29)        !gprelhigh
    lda $1,$LC0($1)        !gprellow
    ldq $9,0($1)
    ldq $10,8($1)

2009-01-10  Uros Bizjak  <ubizjak@gmail.com>

    * config/alpha/alpha.c (alpha_legitimate_address_p): Explicit
    relocations of local symbols  wider than UNITS_PER_WORD are not valid.
    (alpha_legitimize_address): Do not split local symbols wider than
    UNITS_PER_WORD into HIGH/LO_SUM parts.

testsuite/ChangeLog:

2009-01-10  Uros Bizjak  <ubizjak@gmail.com>

    Revert:
    2009-01-05  Uros Bizjak  <ubizjak@gmail.com>

    * gcc.dg/compat/struct-layout-1_generate.c (dg-options): Add -mieee
    for alpha*-*-* targets.
    * g++.dg/compat/struct-layout-1_generate.c (dg-options): Ditto.

Attached patch was bootstrapped and regression tested on 
alphaev56-pc-linux-gnu, -mlong-double-128 -mexplicit-reloc target. This 
patch fixes all struct-layout-1 failures.

OK for mainline?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: a.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090111/7d5a6460/attachment.txt>


More information about the Gcc-patches mailing list