Commit d87bc2f0 authored by Shenghou Ma's avatar Shenghou Ma Committed by Russ Cox

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

R=dave, rsc
CC=golang-dev
https://golang.org/cl/6248070
parent b7c2ade6
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment