target-ppc: fix evmergelo and evmergelohi
authorNathan Froyd <froydnj@codesourcery.com>
Thu, 4 Jun 2009 20:46:41 +0000 (13:46 -0700)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 12 Jul 2009 21:36:21 +0000 (23:36 +0200)
commitdf41a58ec22643a1b4f7c6cfec371dfae69bc9ee
tree1b3d467066ab7e5aa2db1ef31a956f269a8d1d75
parent83df18b35fa1a88fcc3b1240fb5a4cf71a3a10e7
target-ppc: fix evmergelo and evmergelohi

For 32-bit PPC targets, we translated:

evmergelo rX, rX, rY

as:

rX-lo = rY-lo
rX-hi = rX-lo

which is wrong, because we should be transferring rX-lo first.  This
problem is fixed by swapping the order in which we write the parts of
rX.

Similarly, we translated:

evmergelohi rX, rX, rY

as:

rX-lo = rY-hi
rX-hi = rX-lo

In this case, we can't swap the assignment statements, because that
would just cause problems for:

evmergelohi rX, rY, rX

Instead, we detect the first case and save rX-lo in a temporary
variable:

tmp = rX-lo
rX-lo = rY-hi
rX-hi = tmp

These problems don't occur on PPC64 targets because we don't split the
SPE registers into hi/lo parts for such targets.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-ppc/translate.c