Fix for 32-bit mode, as per comment.


git-svn-id: svn://svn.valgrind.org/vex/trunk@1610 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/host-ppc/hdefs.c b/priv/host-ppc/hdefs.c
index 801997a..5498a7b 100644
--- a/priv/host-ppc/hdefs.c
+++ b/priv/host-ppc/hdefs.c
@@ -2468,6 +2468,16 @@
 {
    vassert(r_dst < 0x20);
 
+   if (!mode64) {
+      /* In 32-bit mode, make sure the top 32 bits of imm are a sign
+         extension of the bottom 32 bits, so that the range tests
+         below work correctly. */
+      UInt u32 = (UInt)imm;
+      Int  s32 = (Int)u32;
+      Long s64 = (Long)s32;
+      imm = (ULong)s64;
+   }
+
    if (imm >= 0xFFFFFFFFFFFF8000ULL || imm < 0x8000) {
       // sign-extendable from 16 bits