summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c')
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
index a996218ce7..24be65bff9 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_ppc_spe.c
@@ -316,7 +316,9 @@ void spe_init_func(struct spe_function *p, unsigned code_size)
void spe_release_func(struct spe_function *p)
{
- align_free(p->store);
+ if (p->store != NULL) {
+ align_free(p->store);
+ }
p->store = NULL;
p->csr = NULL;
}
@@ -326,8 +328,8 @@ int spe_allocate_available_register(struct spe_function *p)
{
unsigned i;
for (i = 0; i < 128; i++) {
- const uint64_t mask = (1ULL << (i % 128));
- const unsigned idx = i / 128;
+ const uint64_t mask = (1ULL << (i % 64));
+ const unsigned idx = i / 64;
if ((p->regs[idx] & mask) != 0) {
p->regs[idx] &= ~mask;
@@ -341,8 +343,8 @@ int spe_allocate_available_register(struct spe_function *p)
int spe_allocate_register(struct spe_function *p, int reg)
{
- const unsigned idx = reg / 128;
- const unsigned bit = reg % 128;
+ const unsigned idx = reg / 64;
+ const unsigned bit = reg % 64;
assert((p->regs[idx] & (1ULL << bit)) != 0);
@@ -353,8 +355,8 @@ int spe_allocate_register(struct spe_function *p, int reg)
void spe_release_register(struct spe_function *p, int reg)
{
- const unsigned idx = reg / 128;
- const unsigned bit = reg % 128;
+ const unsigned idx = reg / 64;
+ const unsigned bit = reg % 64;
assert((p->regs[idx] & (1ULL << bit)) == 0);