2

I am currently trying to porting GCC-9.2.0 compiler for new architecture "SPIM" which is similar to MIPS architecture, using floating point arithmetic operation by GCC internal: 4.2 Routines for floating point emulation ([https://reurl.cc/Q3Y1jM]) and running at QtSpim simulator.

Since I want to build with soft floating point, I had added/modified some files under [gcc/config.gcc libgcc/config.host libgcc/config/spim/] and had built GCC with configure option --with-float=soft.

I use the following code as the test case:

void main(){
    float a = 10.1111;
    float b = 20.1111;
    float c = a + b;
}

In normal, it should call "__addsf3" for "float c = a + b;". But an internal compiler error occured when I compiled:

0x91dcc1 emit_library_call_value_1(int, rtx_def*, rtx_def*, libcall_type, machine_mode, int, std::pair<rtx_def*, machine_mode>*)
         ../../gcc-9.2.0/gcc/calls.c:4966

And the assembly code of this case is not completed:

.file   "float-add.c"
        .text
        .globl __addsf3

For my knowledge, GCC will do pattern match for RTL instructions. When matching, it will output the assembly code for that pattern line by line.

I guess I might not provide enough patterns for RTL instructions in some particular modes. There was someone else suggesting me to provide property patterns for RTL instruction in some particular modes. Which means I need to provide it in machine description file (e.g. target.md). And I should emit libcalls for each of them in the callgen. But I have no idea of how to use the soft floating point library and how to generate the patterns for RTL instructions to emit libcalls for codegen. If there is anyone can give me some advices? I will be really grateful for that. Thanks. Sorry if I am not clear, I will elaborate if this is still unclear.

Lino Peng
  • 21
  • 3
  • Do you mean [SPIM the MIPS emulator/simulator](http://spimsimulator.sourceforge.net/) with toy system-calls? MARS simulates a MIPS with floating-point; does SPIM not? Anyway, it doesn't take much to get GCC to make asm that can run on MARS/SPIM, except for I/O stuff: [Is there a way to use gcc to convert C to MIPS?](https://stackoverflow.com/a/63386888) – Peter Cordes Oct 16 '20 at 07:55
  • Hi @PeterCordes thanks for reply. I use QtSpim, the simulator, to run SPIM. I want to use soft floating point library to generate assembly code (e.g. __addsf3) in GCC back-end RTL pass. My problem is the assembly code that I got from GCC is not completed, because there is an internal compiler error occurred during the compile process. Do you have any suggestion? – Lino Peng Oct 19 '20 at 05:35
  • Oh I see, you want MIPS with soft-float, for some other reason, and you just happen to be using QtSpim. So you don't care that SPIM supports MIPS hardware FP instructions. No, I don't have any suggestions. – Peter Cordes Oct 19 '20 at 05:41
  • @PeterCordes thanks for your reply. If you have any new thought, please let me know. I will appreciate that. Thank you. – Lino Peng Oct 19 '20 at 07:52

0 Answers0