Recent

Author Topic: [SOLVED] what to do if my target MIPS cpu has no FPU  (Read 2634 times)

Key-Real

  • Sr. Member
  • ****
  • Posts: 372
[SOLVED] what to do if my target MIPS cpu has no FPU
« on: April 18, 2024, 02:02:29 pm »
-Cfnone

spits:

Compiling ./rtl/ps1/system.pp
compproc.inc(838,47) Error: Identifier not found "double"
compproc.inc(839,47) Error: Identifier not found "double"
softfpu.pp(134,19) Error: Identifier not found "double"
softfpu.pp(134,25) Error: Error in type definition
softfpu.pp(144,19) Error: Identifier not found "extended"
softfpu.pp(144,27) Error: Error in type definition
system.pp(35,1) Fatal: There were 6 errors compiling module, stopping


-Cfsoft
generates assembler FPU code


some advises?
« Last Edit: July 17, 2024, 09:53:24 am by Key-Real »

Thaddy

  • Hero Member
  • *****
  • Posts: 16143
  • Censorship about opinions does not belong here.
Re: what to do if my target MIPS cpu has no FPU
« Reply #1 on: April 18, 2024, 02:34:25 pm »
You scale integers....
If I smell bad code it usually is bad code and that includes my own code.

Key-Real

  • Sr. Member
  • ****
  • Posts: 372
Re: what to do if my target MIPS cpu has no FPU
« Reply #2 on: April 18, 2024, 02:35:34 pm »
yes, but is there not allready a .inc file in the rtl for thouse types

Laksen

  • Hero Member
  • *****
  • Posts: 785
    • J-Software
Re: what to do if my target MIPS cpu has no FPU
« Reply #3 on: April 18, 2024, 04:14:52 pm »
Check how the embedded target does it. Most of those don't have FPU support

But beware that it's not just a one liner. It likely requires lots of code to get completely right

Thaddy

  • Hero Member
  • *****
  • Posts: 16143
  • Censorship about opinions does not belong here.
Re: what to do if my target MIPS cpu has no FPU
« Reply #4 on: April 18, 2024, 06:39:12 pm »
Scaling integers is a junior job and not very complex as long as the required precision is known.
For embedded:
define your precision... is usually enough.
« Last Edit: April 18, 2024, 06:42:17 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Laksen

  • Hero Member
  • *****
  • Posts: 785
    • J-Software
Re: what to do if my target MIPS cpu has no FPU
« Reply #5 on: April 18, 2024, 07:04:34 pm »
Thaddy, please keep on topic. This is clearly about softfpu development for the RTL

Thaddy

  • Hero Member
  • *****
  • Posts: 16143
  • Censorship about opinions does not belong here.
Re: what to do if my target MIPS cpu has no FPU
« Reply #6 on: April 18, 2024, 07:54:39 pm »
But I am on topic.
If I smell bad code it usually is bad code and that includes my own code.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: what to do if my target MIPS cpu has no FPU
« Reply #7 on: April 18, 2024, 09:36:59 pm »
some advises?

You might need to add

Code: Pascal  [Select][+][-]
  1. {$define cpufpemu}

to the MIPS related defines in compiler/fpcdefs.inc. I have not tested however whether that is enough.

But I am on topic.

You are absolutely offtopic, because as usual you did not read and understand the original post to grasp what this topic is about: It is about using/enabling the software floating point support provided by the compiler for a specific target, not about using fixed comma arithmetic.

Key-Real

  • Sr. Member
  • ****
  • Posts: 372
Re: what to do if my target MIPS cpu has no FPU
« Reply #8 on: April 18, 2024, 10:16:29 pm »
I added the
{$define cpufpemu}

now can't compile anymore


/run/media/key-real/E3AF-F107/code/source/compiler/ppc -Ur -Xs -O2 -n -Fumipsel -Fusystems -Fu/run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux -Fimipsel -FEmipsel/bin/x86_64-linux -FUmipsel/units/x86_64-linux -Cg -Fl/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1 -dRELEASE -DD2024/04/18 -dmipsel -dGDB -Fumips -Sew -o/run/media/key-real/E3AF-F107/code/source/compiler/ppcrossmipsel pp.pas
nld.pas(844,54) Error: Identifier not found "fpu_libgcc"
nld.pas(1623) Fatal: There were 1 errors compiling module, stopping

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: what to do if my target MIPS cpu has no FPU
« Reply #9 on: April 18, 2024, 10:27:56 pm »
nld.pas(844,54) Error: Identifier not found "fpu_libgcc"

Either add fpc_libgcc to tfputype in compiler/mips/cpuinfo.pas or protect it using {$if declared(fpc_libgcc)}.

Key-Real

  • Sr. Member
  • ****
  • Posts: 372
Re: what to do if my target MIPS cpu has no FPU
« Reply #10 on: April 18, 2024, 10:48:29 pm »
I added fpu_libgcc to tfputype
and 'libgcc' to fputypestr

now i do

$./compiler/ppcrossmipsel ./rtl/ps1/system.pp -Tps1 -Fi./rtl/mipsel -Fi./rtl/inc -Fi./rtl/ps1 -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -Cfsoft


Warning: Source OS Redefined!
Free Pascal Compiler version 3.3.1 [2024/04/18] for mipsel
Copyright (c) 1993-2024 by Florian Klaempfl and others
Target OS: PlayStation 1 for MIPSEL
Compiling ./rtl/ps1/system.pp
mips.inc(187,4) Note: "assembler" not yet supported inside inline procedure/function
generic.inc(88,40) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
generic.inc(347,12) Warning: Comparison might be always true due to range of constant and expression
generic.inc(544,19) Note: Local variable "pendpart" not used
system.inc(482,5) Fatal: Internal error 2007042702
Fatal: Compilation aborted

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: what to do if my target MIPS cpu has no FPU
« Reply #11 on: April 18, 2024, 11:44:18 pm »
Seems like there are some locations that don't handle software floating point correctly for the MIPS CPU. Best look for fpu_soft inside the other code generator backends and try to adjust locations in the MIPS backend in similar ways.

Laksen

  • Hero Member
  • *****
  • Posts: 785
    • J-Software
Re: what to do if my target MIPS cpu has no FPU
« Reply #12 on: April 19, 2024, 12:49:12 am »
Anything involving fpu_libgcc is the wrong path to look for, pretty sure it's just leftovers from long ago. fpu_soft is the right fputype for softfloat stuff.
Same with CPUFPEMU, as far as I remember it's only relevant for cases where you have mixed support or ancient cpus

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: what to do if my target MIPS cpu has no FPU
« Reply #13 on: April 21, 2024, 09:23:55 pm »
Anything involving fpu_libgcc is the wrong path to look for, pretty sure it's just leftovers from long ago. fpu_soft is the right fputype for softfloat stuff.
Same with CPUFPEMU, as far as I remember it's only relevant for cases where you have mixed support or ancient cpus

Doesn't change that fpu_libgcc seems to be required for compilation currently.

Laksen

  • Hero Member
  • *****
  • Posts: 785
    • J-Software
Re: what to do if my target MIPS cpu has no FPU
« Reply #14 on: April 21, 2024, 10:36:10 pm »
True, it might have some deep roots but I think it's safe just to define it whenever required like other targets and then just ignoring anything about it

 

TinyPortal © 2005-2018