Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-11

-Anasmelf on BeOS bug?

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

BiPolar

While trying to compile an ASM/SSE/3DNow! optimized FFT on BeOS, using FPC 1.0.8, I instructed to ppc386 to use NASM (because BeOS's gas can't handle SSE), but:

ppc386 -Anasmelf FFT.pas

Warning: Assembler output selected "NASMELF" is not compatible with "BeOS for i386"
Warning: "AS" assembler use forced

FPC 1.9.1 doesn't gives the warning, but it force the use of "as" as the assembler too.

The thing is, BeOS use elf objects, (I already used nasm to compile other programs, i.e. Lame), so it seems to me that FPC shouldn't bail out on this (nasmobj doesn't work because then the linker says: hey! that's not a valid elf object! :-).

Also, the SSE portion of that code has a DQWORD (Delphi recognize it) that FPC doesn't know how to handle (undeclared identifier).

Well, that's all. Thanks for your work.

Oscar Lesta. (not on the mail list)

Reply by email

Florian Klaempfl
to BiPolar
BiPolar wrote 13 lines
While trying to compile an ASM/SSE/3DNow! optimized FFT on BeOS, using FPC 1.0.8, I instructed to ppc386 to use NASM (because BeOS's gas can't handle SSE), but: >ppc386 -Anasmelf FFT.pas Warning: Assembler output selected "NASMELF" is not compatible with "BeOS for i386" Warning: "AS" assembler use forced FPC 1.9.1 doesn't gives the warning, but it force the use of "as" as the assembler too.

1.9.1 should allow nasmelf for BeOS now as well.

Show quoted text 8 lines
The thing is, BeOS use elf objects, (I already used nasm to compile other programs, i.e. Lame), so it seems to me that FPC shouldn't bail out on this (nasmobj doesn't work because then the linker says: hey! that's not a valid elf object! :-). Also, the SSE portion of that code has a DQWORD (Delphi recognize it) that FPC doesn't know how to handle (undeclared identifier).

Can you give an example please? I added it but I'am not sure if it works already.

Well, that's all. Thanks for your work. Oscar Lesta. (not on the mail list)

CC added.

Reply by email

BiPolar
to Florian Klaempfl
Florian Klaempfl wrote 9 lines
> Warning: Assembler output selected "NASMELF" is not compatible with > "BeOS for i386" > Warning: "AS" assembler use forced > > FPC 1.9.1 doesn't gives the warning, but it force the use of "as" > as > the assembler too. 1.9.1 should allow nasmelf for BeOS now as well.

Nice! I will try it as soon as I can "make cycle" it again :-)

Show quoted text 7 lines
> Also, the SSE portion of that code has a DQWORD (Delphi recognize > it) > that FPC doesn't know how to handle (undeclared identifier). Can you give an example please? I added it but I'am not sure if it works already.

I'll try. The following is a snipplet from dcdspfilter's FFT code (http://dcdspfilter.corecodec.org)

I put the code of the "CopyFromTo" procedure because it is short and has the original Pascal code to compare (the rest methods that has DQWORD are much larger).

-------------------------------------------------
type
  // FPU Complex Array
  PComplex = ^TComplex;
  TComplex = record
    re,
    im : Single;
  end;
  PComplexArray = ^TComplexArray;
  TComplexArray = array[0..8191] of TComplex;
  // SSE Complex Array
  TComplexSSE = record
    re1,re2,re3,re4,
    im1,im2,im3,im4 : Single;
  end;
  PComplexArraySSE = ^TComplexArraySSE;
  TComplexArraySSE = array[0..255] of TComplexSSE;
--------------------------------------------------
procedure InitSSECosineTable;
{
  procedure CopyFromTo(pFrom : PChar; pTo : PChar);
  begin
    CopyMemory(pTo,pFrom,4);
    CopyMemory(@pTo[4],pFrom,4);
    CopyMemory(@pTo[8],pTo,8);
    CopyMemory(@pTo[16],@pFrom[4],4);
    CopyMemory(@pTo[20],@pFrom[4],4);
    CopyMemory(@pTo[24],@pTo[16],8);
  end;
}
  procedure CopyFromTo(pFrom : PChar; pTo : PChar);
  asm
         movss      xmm1, DWORD PTR [pFrom]
         shufps     xmm1, xmm1, $0
         movaps     DQWORD PTR [pTo], xmm1
         movss      xmm1, DWORD PTR [pFrom+4]
         shufps     xmm1, xmm1, $0
         movaps     DQWORD PTR [pTo+16], xmm1
  end;
var
  i : integer;
begin
  for i := 0 to 6 do CopyFromTo(@d32[i],@d32SSE[i]);
  for i := 0 to 14 do CopyFromTo(@d64[i],@d64SSE[i]);
  for i := 0 to 30 do CopyFromTo(@d128[i],@d128SSE[i]);
  for i := 0 to 62 do CopyFromTo(@d256[i],@d256SSE[i]);
  for i := 0 to 126 do CopyFromTo(@d512[i],@d512SSE[i]);
  for i := 0 to 126 do CopyFromTo(@d1024[i],@d1024SSE[i]);
  for i := 0 to 254 do CopyFromTo(@d2048[i],@d2048SSE[i]);
  for i := 0 to 510 do CopyFromTo(@d4096[i],@d4096SSE[i]);
  for i := 0 to 1022 do CopyFromTo(@d8192[i],@d8192SSE[i]);
end;
-------------------------------------------------
> Oscar Lesta. (not on the mail list) CC added.

Thanks, and sorry for the delay in replying (expensive and inestable dialup down here).

In other subject:

Is it there any Docs/ReadMe/Guide about the structure/layout of the RTL? I mean, from the point of view of someone who wants to create/ modify the RTL specific to certain OS.

I ask this because I understand that the BeOS port has a kinda very-low -prio, and there aren't many BeOS users that also use Pascal so... I just wanted to investigate the posibility of keeping BeOS RTL up-to- date before it becames more difficult.
I already took a look at other OSes RTLs to see what was similar and what different. But I must confess, I get lost in the jungle. That's why I ask if there is any info that an outsider can use. Maybe a diagram to understand how each part interact with each other (OS/RTL/ Compiler)?

I can't promise I will make any valuable contribution, but at least I will try to.

Thanks for reading.

Oscar Lesta.

Reply by email