Skip to content

Commit 95e5152

Browse files
committed
mips: use MIPS32 (instead of MIPS32R2) as the instruction set
This should widen compatibility a bit, so that older CPUs can also execute programs built by TinyGo. The performance may be lower, if that's an issue we can look into implementing the proposal here: golang/go#60072 This still wouldn't make programs usable on MIPS II CPUs, I suppose we can lower compatiblity down to that CPU if needed. I tried setting the -cpu flag in the QEMU command line to be able to test this, but it looks like there are no QEMU CPU models that are mips32r1 and have a FPU. So it's difficult to test this.
1 parent 83c98a2 commit 95e5152

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compileopts/target.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
336336
spec.Features = "+fp-armv8,+neon,-fmv,-outline-atomics"
337337
}
338338
case "mips", "mipsle":
339-
spec.CPU = "mips32r2"
339+
spec.CPU = "mips32"
340340
spec.CFlags = append(spec.CFlags, "-fno-pic")
341341
if options.GOOS == "mips" {
342342
llvmarch = "mips" // big endian
@@ -345,10 +345,10 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
345345
}
346346
switch options.GOMIPS {
347347
case "hardfloat":
348-
spec.Features = "+fpxx,+mips32r2,+nooddspreg,-noabicalls"
348+
spec.Features = "+fpxx,+mips32,+nooddspreg,-noabicalls"
349349
case "softfloat":
350350
spec.SoftFloat = true
351-
spec.Features = "+mips32r2,+soft-float,-noabicalls"
351+
spec.Features = "+mips32,+soft-float,-noabicalls"
352352
spec.CFlags = append(spec.CFlags, "-msoft-float")
353353
default:
354354
return nil, fmt.Errorf("invalid GOMIPS=%s: must be hardfloat or softfloat", options.GOMIPS)

0 commit comments

Comments
 (0)