summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--target-sparc/op_helper.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index f8f94ac39a..3cc4f501cc 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -234,7 +234,10 @@ void helper_faligndata(void)
     uint64_t tmp;
 
     tmp = (*((uint64_t *)&DT0)) << ((env->gsr & 7) * 8);
-    tmp |= (*((uint64_t *)&DT1)) >> (64 - (env->gsr & 7) * 8);
+    /* on many architectures a shift of 64 does nothing */
+    if ((env->gsr & 7) != 0) {
+        tmp |= (*((uint64_t *)&DT1)) >> (64 - (env->gsr & 7) * 8);
+    }
     *((uint64_t *)&DT0) = tmp;
 }