Browse Source
If the value to be shifted has the sign bit set, the sign bit would get copied into bits 32..63 of the temporary. Those would then be right shifted into the final value giving an incorrect final result. This was observed with upcoming GCC improvements which eliminate unnecessary extensions.binutils-2_42-branch
3 changed files with 55 additions and 2 deletions
@ -0,0 +1,28 @@ |
|||
# check that lsr works correctly |
|||
# mach: mcore |
|||
|
|||
.include "testutils.inc" |
|||
|
|||
start |
|||
# Construct -1 |
|||
bmaski r2, 32 |
|||
|
|||
# Construct 24 |
|||
movi r3, 24 |
|||
|
|||
# logical shift right by r3 (24) |
|||
lsr r2, r3 |
|||
|
|||
# Construct 255 |
|||
bmaski r1, 8 |
|||
|
|||
# Compare them, they should be equal |
|||
cmpne r2,r1 |
|||
jbt .L1 |
|||
pass |
|||
.L1: |
|||
fail |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,25 @@ |
|||
# check that lsri works correctly |
|||
# mach: mcore |
|||
|
|||
.include "testutils.inc" |
|||
|
|||
start |
|||
# Construct -1 |
|||
bmaski r2, 32 |
|||
|
|||
# logical shift right by 24 |
|||
lsri r2, 24 |
|||
|
|||
# Construct 255 |
|||
bmaski r1, 8 |
|||
|
|||
# Compare them, they should be equal |
|||
cmpne r2,r1 |
|||
jbt .L1 |
|||
pass |
|||
.L1: |
|||
fail |
|||
|
|||
|
|||
|
|||
|
|||
Loading…
Reference in new issue