From 8af24ab9bb16161320bee4d97319cea291435777 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 14 Dec 2013 09:27:34 -0800 Subject: [PATCH] Fixing vrlimi128 --- src/alloy/frontend/ppc/ppc_emit_altivec.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/alloy/frontend/ppc/ppc_emit_altivec.cc b/src/alloy/frontend/ppc/ppc_emit_altivec.cc index 550c1c741..86dab38e2 100644 --- a/src/alloy/frontend/ppc/ppc_emit_altivec.cc +++ b/src/alloy/frontend/ppc/ppc_emit_altivec.cc @@ -1166,8 +1166,9 @@ XEEMITTER(vrlimi128, VX128_4(6, 1808), VX128_4)(PPCFunctionBuilder& f, Inst const uint32_t vb = i.VX128_4.VB128l | (i.VX128_4.VB128h << 5); uint32_t blend_mask_src = i.VX128_4.IMM; uint32_t blend_mask = 0; - for (int n = 0; n < 4; n++) { - blend_mask |= ((blend_mask_src >> n) ? n : (n + 4)) << ((3 - n) * 8); + for (int n = 3; n >= 0; n--) { + blend_mask |= ((blend_mask_src & 0x1) ? n : (4 + n)) << ((3 - n) * 8); + blend_mask_src >>= 1; } uint32_t rotate = i.VX128_4.z; // This is just a fancy permute.