mirror of
https://github.com/golang/go
synced 2024-11-21 17:54:39 -07:00
runtime: arm: abort if VFPv3 support missing
Fixes #3456. This proposal is a reformulation of CL 5987063. This CL resets the default GOARM value to 6 and allows the use of the VFPv3 optimisation if GOARM=7. Binaries built with this CL in place will abort if GOARM=7 was used and the target host does not support VFPv3. R=minux.ma, rsc, ajstarks CC=golang-dev https://golang.org/cl/6501099
This commit is contained in:
parent
5e1864fbe5
commit
55ca5ab0be
@ -2213,7 +2213,8 @@ omvl(Prog *p, Adr *a, int dr)
|
||||
int
|
||||
chipzero(Ieee *e)
|
||||
{
|
||||
if(e->l != 0 || e->h != 0)
|
||||
// We use GOARM=7 to gate the use of VFPv3 vmov (imm) instructions.
|
||||
if(goarm < 7 || e->l != 0 || e->h != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@ -2224,6 +2225,10 @@ chipfloat(Ieee *e)
|
||||
int n;
|
||||
ulong h;
|
||||
|
||||
// We use GOARM=7 to gate the use of VFPv3 vmov (imm) instructions.
|
||||
if(goarm < 7)
|
||||
goto no;
|
||||
|
||||
if(e->l != 0 || (e->h&0xffff) != 0)
|
||||
goto no;
|
||||
h = e->h & 0x7fc00000;
|
||||
|
@ -316,6 +316,8 @@ void addpool(Prog*, Adr*);
|
||||
EXTERN Prog* blitrl;
|
||||
EXTERN Prog* elitrl;
|
||||
|
||||
EXTERN int goarm;
|
||||
|
||||
void initdiv(void);
|
||||
EXTERN Prog* prog_div;
|
||||
EXTERN Prog* prog_divu;
|
||||
|
@ -93,7 +93,7 @@ main(int argc, char *argv[])
|
||||
if(p != nil)
|
||||
goarm = atoi(p);
|
||||
else
|
||||
goarm = 7;
|
||||
goarm = 6;
|
||||
if(goarm == 5)
|
||||
debug['F'] = 1;
|
||||
|
||||
|
@ -147,7 +147,8 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
|
||||
#define AT_PLATFORM 15 // introduced in at least 2.6.11
|
||||
#define AT_HWCAP 16 // introduced in at least 2.6.11
|
||||
#define AT_RANDOM 25 // introduced in 2.6.29
|
||||
#define HWCAP_VFP (1 << 6)
|
||||
#define HWCAP_VFP (1 << 6) // introduced in at least 2.6.11
|
||||
#define HWCAP_VFPv3 (1 << 13) // introduced in 2.6.30
|
||||
static uint32 runtime·randomNumber;
|
||||
uint8 runtime·armArch = 6; // we default to ARMv6
|
||||
uint32 runtime·hwcap; // set by setup_auxv
|
||||
@ -161,6 +162,11 @@ runtime·checkgoarm(void)
|
||||
runtime·printf("this GOARM=%d binary. Recompile using GOARM=5.\n", runtime·goarm);
|
||||
runtime·exit(1);
|
||||
}
|
||||
if(runtime·goarm > 6 && !(runtime·hwcap & HWCAP_VFPv3)) {
|
||||
runtime·printf("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n");
|
||||
runtime·printf("this GOARM=%d binary. Recompile using GOARM=6.\n", runtime·goarm);
|
||||
runtime·exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma textflag 7
|
||||
|
Loading…
Reference in New Issue
Block a user