From 12640219e6e3a4c8e3bcd7410b628d3197cf37bb Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sat, 14 Mar 2009 14:34:44 -0600 Subject: [PATCH] handle b == dst case in andC --- src/powerpc.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/powerpc.cpp b/src/powerpc.cpp index d0255b4b0d..01f5a3e862 100644 --- a/src/powerpc.cpp +++ b/src/powerpc.cpp @@ -1091,8 +1091,18 @@ andC(Context* c, unsigned size, Assembler::Constant* a, } else if ((v32 & 0xFFFF) == 0) { issue(c, andis(dst->low, b->low, v32 >> 16)); } else { - moveCR(c, 4, a, 4, dst); - andR(c, 4, b, dst, dst); + bool useTemporary = b->low == dst->low; + Assembler::Register tmp(dst->low); + if (useTemporary) { + tmp.low = c->client->acquireTemporary(); + } + + moveCR(c, 4, a, 4, &tmp); + andR(c, 4, b, &tmp, dst); + + if (useTemporary) { + c->client->releaseTemporary(tmp.low); + } } return; }