[fpc-devel] Code generation oddity on SPARC Linux

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Aug 26 23:16:05 CEST 2011


On 26 Aug 2011, at 22:42, Mark Morgan Lloyd wrote:

> Using 2.4.4 with -a -al -s this compiles to a .s which looks like this:
> 
> .Ll34:
> # [439] IF z < 2299161.0 THEN
>        ld      [%i6-32],%o0
>        ld      [%i6-28],%o1
>        call    fpc_int64_to_double
>        nop
>        sethi   %hi(_$MOONPHASE$_Ld8),%o0
>        ld      [%lo(_$MOONPHASE$_Ld8)+%o0],%f1
>        fcmpd   %f0,%f1
>        nop
>        fbl     .Lj87
>        nop
>        ba      .Lj88
>        nop
> .Lj87:
>        .stabn 68,0,441,.Ll35 - MOONPHASE_JYEAR$DOUBLE$INT64$INT64$DOUBLE
> .Ll35:
> # [441] a:= z
> 
> This appears to be the only place in the program where  fcmpd %f0,%f1 is generated, although the same opcode is generated with other registers as opeands. Assembling with as (2.17 or 2.18), I get this error:
> 
> moonphase.s:629: Error: Illegal operands

The sparc only has single precision floating point registers. Double precision values are stored in two consecutive single precision registers, and hence arguments to double precision opcodes must always be even registers. The above demonstrates a bug in the register allocator. Please file a bug report.


Jonas


More information about the fpc-devel mailing list