aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-05-09 15:03:09 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-05-09 15:03:09 +0000
commit7010a0c9019a68999ca6e43b4eec8b28d0907cbc (patch)
treec9dde5c32eda8f0e2f3d2cb8738c42b765694ab4 /sim/ppc
parent55ba0940d96a0da92a3ab3234a5fb7ae0b445b5f (diff)
downloadfsf-binutils-gdb-7010a0c9019a68999ca6e43b4eec8b28d0907cbc.zip
fsf-binutils-gdb-7010a0c9019a68999ca6e43b4eec8b28d0907cbc.tar.gz
fsf-binutils-gdb-7010a0c9019a68999ca6e43b4eec8b28d0907cbc.tar.bz2
* ppc/altivec.igen (vperm): Latch inputs into temporaries.
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/altivec.igen9
1 files changed, 7 insertions, 2 deletions
diff --git a/sim/ppc/altivec.igen b/sim/ppc/altivec.igen
index d933f56..3a224cc 100644
--- a/sim/ppc/altivec.igen
+++ b/sim/ppc/altivec.igen
@@ -1634,12 +1634,17 @@ unsigned32::model-function::altivec_unsigned_saturate_32:signed64 val, int *sat
0.4,6.VS,11.VA,16.VB,21.VC,26.43:VX:av:vperm %VD, %VA, %VB, %VC:Vector Permute
int i, who;
+ /* The permutation vector might have us read into the source vectors
+ back at positions before the iteration index, so we must latch the
+ sources to prevent early-clobbering in case the destination vector
+ is the same as one of them. */
+ vreg myvA = (*vA), myvB = (*vB);
for (i = 0; i < 16; i++) {
who = (*vC).b[AV_BINDEX(i)] & 0x1f;
if (who & 0x10)
- (*vS).b[AV_BINDEX(i)] = (*vB).b[AV_BINDEX(who & 0xf)];
+ (*vS).b[AV_BINDEX(i)] = myvB.b[AV_BINDEX(who & 0xf)];
else
- (*vS).b[AV_BINDEX(i)] = (*vA).b[AV_BINDEX(who & 0xf)];
+ (*vS).b[AV_BINDEX(i)] = myvA.b[AV_BINDEX(who & 0xf)];
}
PPC_INSN_VR(VS_BITMASK, VA_BITMASK | VB_BITMASK | VC_BITMASK);