1
0
mirror of https://github.com/golang/go synced 2024-11-20 09:34:52 -07:00

cmd/5c, cmd/5g, cmd/5l: enable use of R12, F8-F15

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6248070
This commit is contained in:
Shenghou Ma 2012-06-02 12:54:28 -04:00 committed by Russ Cox
parent b7c2ade696
commit d87bc2f0c0
3 changed files with 21 additions and 12 deletions

View File

@ -1150,12 +1150,13 @@ addreg(Adr *a, int rn)
* 1 R1
* ... ...
* 10 R10
* 12 R12
*/
int32
RtoB(int r)
{
if(r < 2 || r >= REGTMP-2) // excluded R9 and R10 for m and g
if(r < 2 || (r >= REGTMP-2 && r != 12)) // excluded R9 and R10 for m and g, but not R12
return 0;
return 1L << r;
}
@ -1163,7 +1164,7 @@ RtoB(int r)
int
BtoR(int32 b)
{
b &= 0x01fcL; // excluded R9 and R10 for m and g
b &= 0x11fcL; // excluded R9 and R10 for m and g, but not R12
if(b == 0)
return 0;
return bitno(b);
@ -1174,7 +1175,7 @@ BtoR(int32 b)
* 18 F2
* 19 F3
* ... ...
* 23 F7
* 31 F15
*/
int32
FtoB(int f)
@ -1189,7 +1190,7 @@ int
BtoF(int32 b)
{
b &= 0xfc0000L;
b &= 0xfffc0000L;
if(b == 0)
return 0;
return bitno(b) - 16;

View File

@ -34,8 +34,8 @@
#include "gg.h"
#include "opt.h"
#define NREGVAR 24
#define REGBITS ((uint32)0xffffff)
#define NREGVAR 32
#define REGBITS ((uint32)0xffffffff)
#define P2R(p) (Reg*)(p->reg)
void addsplits(void);
@ -160,6 +160,14 @@ static char* regname[] = {
".F5",
".F6",
".F7",
".F8",
".F9",
".F10",
".F11",
".F12",
".F13",
".F14",
".F15",
};
void
@ -1486,11 +1494,12 @@ addreg(Adr *a, int rn)
* 1 R1
* ... ...
* 10 R10
* 12 R12
*/
int32
RtoB(int r)
{
if(r >= REGTMP-2) // excluded R9 and R10 for m and g
if(r >= REGTMP-2 && r != 12) // excluded R9 and R10 for m and g, but not R12
return 0;
return 1L << r;
}
@ -1498,7 +1507,7 @@ RtoB(int r)
int
BtoR(int32 b)
{
b &= 0x01fcL; // excluded R9 and R10 for m and g
b &= 0x11fcL; // excluded R9 and R10 for m and g, but not R12
if(b == 0)
return 0;
return bitno(b);
@ -1509,7 +1518,7 @@ BtoR(int32 b)
* 18 F2
* 19 F3
* ... ...
* 23 F7
* 31 F15
*/
int32
FtoB(int f)
@ -1524,7 +1533,7 @@ int
BtoF(int32 b)
{
b &= 0xfc0000L;
b &= 0xfffc0000L;
if(b == 0)
return 0;
return bitno(b) - 16;

View File

@ -49,12 +49,11 @@
#define REGM (REGEXT-1)
/* compiler allocates external registers R10 down */
#define REGTMP 11
#define REGSB 12
#define REGSP 13
#define REGLINK 14
#define REGPC 15
#define NFREG 8
#define NFREG 16
#define FREGRET 0
#define FREGEXT 7
#define FREGTMP 15