Skip to content

Commit

Permalink
mips: use MIPS32 (instead of MIPS32R2) as the instruction set
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aykevl authored and deadprogram committed Sep 5, 2024
1 parent e39358d commit 25abfff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compileopts/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
spec.Features = "+fp-armv8,+neon,-fmv,-outline-atomics"
}
case "mips", "mipsle":
spec.CPU = "mips32r2"
spec.CPU = "mips32"
spec.CFlags = append(spec.CFlags, "-fno-pic")
if options.GOARCH == "mips" {
llvmarch = "mips" // big endian
Expand All @@ -345,10 +345,10 @@ func defaultTarget(options *Options) (*TargetSpec, error) {
}
switch options.GOMIPS {
case "hardfloat":
spec.Features = "+fpxx,+mips32r2,+nooddspreg,-noabicalls"
spec.Features = "+fpxx,+mips32,+nooddspreg,-noabicalls"
case "softfloat":
spec.SoftFloat = true
spec.Features = "+mips32r2,+soft-float,-noabicalls"
spec.Features = "+mips32,+soft-float,-noabicalls"
spec.CFlags = append(spec.CFlags, "-msoft-float")
default:
return nil, fmt.Errorf("invalid GOMIPS=%s: must be hardfloat or softfloat", options.GOMIPS)
Expand Down

0 comments on commit 25abfff

Please sign in to comment.