]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix bug with cmn/adds where C flag was incorrectly set.
authorJim Wilson <jim.wilson@linaro.org>
Sun, 26 Mar 2017 03:32:02 +0000 (20:32 -0700)
committerJim Wilson <jim.wilson@linaro.org>
Sun, 26 Mar 2017 03:32:02 +0000 (20:32 -0700)
sim/aarch64/
* simulator.c (set_flags_for_add32): Cast result to uint32_t in carry
flag check.

sim/testsuite/sim/aarch64/
* adds.s: Add checks for values -2 and 1, where C is not set.

sim/aarch64/ChangeLog
sim/aarch64/simulator.c
sim/testsuite/sim/aarch64/ChangeLog
sim/testsuite/sim/aarch64/adds.s

index 0bf305af1f72a37a5f8d333bef50db7109843dba..1d9729112902c45e932584952048849d6bc37fc2 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-25  Jim Wilson  <jim.wilson@linaro.org>
+
+       * simulator.c (set_flags_for_add32): Cast result to uint32_t in carry
+       flag check.
+
 2017-03-03  Jim Wilson  <jim.wilson@linaro.org>
 
        * simulator.c (mul64hi): Shift carry left by 32.
index 8a8df7a27324cc8f5ccdd664aef3eaaa14485817..f0668ada93c0354ceee4297a979258393b44ea0d 100644 (file)
@@ -1650,7 +1650,7 @@ set_flags_for_add32 (sim_cpu *cpu, int32_t value1, int32_t value2)
   if (result & (1 << 31))
     flags |= N;
 
-  if (uresult != result)
+  if (uresult != (uint32_t)result)
     flags |= C;
 
   if (sresult != result)
index 2fcde5d8823322f3f6f13484ca152dd65efc4353..094144634ae9798e6fe69b8eab7e4fff4ed40dd8 100644 (file)
@@ -1,3 +1,7 @@
+2017-03-25  Jim Wilson  <jim.wilson@linaro.org>
+
+       * adds.s: Add checks for values -2 and 1, where C is not set.
+
 2017-03-03  Jim Wilson  <jim.wilson@linaro.org>
 
        * sumov.s: Correct compare test values.
index 2bc240cd62d4af0bbbd433f60a5962da6ded5265..fdea5a7e19269e21266203f82c20281d234eb4d1 100644 (file)
@@ -3,6 +3,7 @@
 # Check the basic integer compare instructions: adds, adds64, subs, subs64.
 # For add, check value pairs 1 and -1 (Z), -1 and -1 (N), 2 and -1 (C),
 # and MIN_INT and -1 (V), 
+# Also check -2 and 1 (not C).
 # For sub, negate the second value.
 
 .include "testutils.inc"
        mov w1, #-1
        adds w2, w0, w1
        bvc .Lfailure
+       mov w0, #-2
+       mov w1, #1
+       adds w2, w0, w1
+       bcs .Lfailure
 
        mov x0, #1
        mov x1, #-1
        mov x1, #-1
        adds x2, x0, x1
        bvc .Lfailure
+       mov x0, #-2
+       mov x1, #1
+       adds x2, x0, x1
+       bcs .Lfailure
 
        mov w0, #1
        mov w1, #1
        mov w1, #1
        subs w2, w0, w1
        bvc .Lfailure
+       mov w0, #-2
+       mov w1, #-1
+       subs w2, w0, w1
+       bcs .Lfailure
 
        mov x0, #1
        mov x1, #1
        mov x1, #1
        subs x2, x0, x1
        bvc .Lfailure
+       mov x0, #-2
+       mov x1, #-1
+       subs x2, x0, x1
+       bcs .Lfailure
 
        pass
 .Lfailure: