Skip to content

Commit d87bc2f

Browse files
minuxrsc
authored andcommitted
cmd/5c, cmd/5g, cmd/5l: enable use of R12, F8-F15
R=dave, rsc CC=golang-dev https://golang.org/cl/6248070
1 parent b7c2ade commit d87bc2f

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

src/cmd/5c/reg.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,20 +1150,21 @@ addreg(Adr *a, int rn)
11501150
* 1 R1
11511151
* ... ...
11521152
* 10 R10
1153+
* 12 R12
11531154
*/
11541155
int32
11551156
RtoB(int r)
11561157
{
11571158

1158-
if(r < 2 || r >= REGTMP-2) // excluded R9 and R10 for m and g
1159+
if(r < 2 || (r >= REGTMP-2 && r != 12)) // excluded R9 and R10 for m and g, but not R12
11591160
return 0;
11601161
return 1L << r;
11611162
}
11621163

11631164
int
11641165
BtoR(int32 b)
11651166
{
1166-
b &= 0x01fcL; // excluded R9 and R10 for m and g
1167+
b &= 0x11fcL; // excluded R9 and R10 for m and g, but not R12
11671168
if(b == 0)
11681169
return 0;
11691170
return bitno(b);
@@ -1174,7 +1175,7 @@ BtoR(int32 b)
11741175
* 18 F2
11751176
* 19 F3
11761177
* ... ...
1177-
* 23 F7
1178+
* 31 F15
11781179
*/
11791180
int32
11801181
FtoB(int f)
@@ -1189,7 +1190,7 @@ int
11891190
BtoF(int32 b)
11901191
{
11911192

1192-
b &= 0xfc0000L;
1193+
b &= 0xfffc0000L;
11931194
if(b == 0)
11941195
return 0;
11951196
return bitno(b) - 16;

src/cmd/5g/reg.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#include "gg.h"
3535
#include "opt.h"
3636

37-
#define NREGVAR 24
38-
#define REGBITS ((uint32)0xffffff)
37+
#define NREGVAR 32
38+
#define REGBITS ((uint32)0xffffffff)
3939
#define P2R(p) (Reg*)(p->reg)
4040

4141
void addsplits(void);
@@ -160,6 +160,14 @@ static char* regname[] = {
160160
".F5",
161161
".F6",
162162
".F7",
163+
".F8",
164+
".F9",
165+
".F10",
166+
".F11",
167+
".F12",
168+
".F13",
169+
".F14",
170+
".F15",
163171
};
164172

165173
void
@@ -1486,19 +1494,20 @@ addreg(Adr *a, int rn)
14861494
* 1 R1
14871495
* ... ...
14881496
* 10 R10
1497+
* 12 R12
14891498
*/
14901499
int32
14911500
RtoB(int r)
14921501
{
1493-
if(r >= REGTMP-2) // excluded R9 and R10 for m and g
1502+
if(r >= REGTMP-2 && r != 12) // excluded R9 and R10 for m and g, but not R12
14941503
return 0;
14951504
return 1L << r;
14961505
}
14971506

14981507
int
14991508
BtoR(int32 b)
15001509
{
1501-
b &= 0x01fcL; // excluded R9 and R10 for m and g
1510+
b &= 0x11fcL; // excluded R9 and R10 for m and g, but not R12
15021511
if(b == 0)
15031512
return 0;
15041513
return bitno(b);
@@ -1509,7 +1518,7 @@ BtoR(int32 b)
15091518
* 18 F2
15101519
* 19 F3
15111520
* ... ...
1512-
* 23 F7
1521+
* 31 F15
15131522
*/
15141523
int32
15151524
FtoB(int f)
@@ -1524,7 +1533,7 @@ int
15241533
BtoF(int32 b)
15251534
{
15261535

1527-
b &= 0xfc0000L;
1536+
b &= 0xfffc0000L;
15281537
if(b == 0)
15291538
return 0;
15301539
return bitno(b) - 16;

src/cmd/5l/5.out.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@
4949
#define REGM (REGEXT-1)
5050
/* compiler allocates external registers R10 down */
5151
#define REGTMP 11
52-
#define REGSB 12
5352
#define REGSP 13
5453
#define REGLINK 14
5554
#define REGPC 15
5655

57-
#define NFREG 8
56+
#define NFREG 16
5857
#define FREGRET 0
5958
#define FREGEXT 7
6059
#define FREGTMP 15

0 commit comments

Comments
 (0)