GCC defines this macro for how many single-precision floating point registers
can be used.
If the -mno-odd-spreg option is given, it will be 16; if either -mno-odd-spreg
nor -modd-spreg are given, we set it to 16 for FPXX.
Differential D157896
Clang: Define macro _MIPS_SPFPSET wzssyqa on Aug 14 2023, 9:21 AM. Authored by
Details
GCC defines this macro for how many single-precision floating point registers If the -mno-odd-spreg option is given, it will be 16; if either -mno-odd-spreg
Diff Detail Event TimelineComment Actions In GCC, -mno-odd-spreg -modd-spreg affects code generation. If we don't implement the behavior, I am not sure we can define _MIPS_SPFPSET. Actually, do we really want to define the macro? CodeSearch context:global _MIPS_SPFPSET -f:gcc|sysdeps/ (regex) gives no result. Comment Actions I am working on libunwind. I'd plan to use this macro to We do implement this behavior. I test with this code float x(float a, float b) { return a*3+b*4; } The objdump result of clang -O2 -mfpxx -mno-odd-spreg -target mipsel-linux-gnu -c xx.c 00000000 <x>: 0: 3c020000 lui v0,0x0 4: 24420000 addiu v0,v0,0 8: 00590821 addu at,v0,t9 c: 8c220000 lw v0,0(at) 10: c4400000 lwc1 $f0,0(v0) 14: 46007002 mul.s $f0,$f14,$f0 18: 8c210000 lw at,0(at) 1c: c4220000 lwc1 $f2,0(at) 20: 46026082 mul.s $f2,$f12,$f2 24: 03e00008 jr ra 28: 46001000 add.s $f0,$f2,$f0 The objdump result of clang -O2 -mfpxx -modd-spreg -target mipsel-linux-gnu -c xx.c 00000000 <x>: 0: 3c020000 lui v0,0x0 4: 24420000 addiu v0,v0,0 8: 00590821 addu at,v0,t9 c: 8c220000 lw v0,0(at) 10: c4400000 lwc1 $f0,0(v0) 14: 46007002 mul.s $f0,$f14,$f0 18: 8c210000 lw at,0(at) 1c: c4210000 lwc1 $f1,0(at) 20: 46016042 mul.s $f1,$f12,$f1 24: 03e00008 jr ra 28: 46000800 add.s $f0,$f1,$f0
I am working on libunwind to support both FP64 (-mfp64), and FPXX (-mfpxx -mno-odd-spreg).
Comment Actions Looks fine to me, though I’ve never seen code using this macro. For a single (not yet implemented) consumer I’m not certain it’s worth putting in the compiler since the same place in the build system that adds the flag directing code generation can also add a -D flag. Comment Actions I add this macro, as I plan to use it for libunwind. |