aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-06-01 03:38:26 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-07-23 01:40:10 +0200
commitbfe532a4f10f480085aac3a5785de3cca90e7ee5 (patch)
tree53619edf41f73e5cc5d26b90e0e85f57cc96dc71 /validation
parent6915fbc000970323afb2e7757226f3ad0f17be09 (diff)
downloadsparse-dev-bfe532a4f10f480085aac3a5785de3cca90e7ee5.tar.gz
big-shift: do not simplify over-sized OP_ASR to zero
Currently, arithmetic right shifts with a shift count bigger than the operand size are simplified to zero. While this makes a lot of sense for LSR and SHL, for ASR it's much less so. Remove the simplification and let the back-end generate the code for a non-immediate count (which is what GCC do). Note: Some other options would be: - reduce the shift count modulo the operand size, like it was done previously at expansion time and which correspond to the run-time behaviour of several CPUs families (x86[-64], arm64, mips, ...) but not all of them (arm, ppc, ...). - truncate the count to N-1 Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/shift-undef.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/validation/shift-undef.c b/validation/shift-undef.c
index e15847a8..df1ac89e 100644
--- a/validation/shift-undef.c
+++ b/validation/shift-undef.c
@@ -98,6 +98,7 @@ shift-undef.c:18:30: warning: shift too big (4294967289) for type int
shift-undef.c:19:30: warning: shift too big (4294967288) for type unsigned int
shift-undef.c:20:30: warning: shift too big (4294967287) for type unsigned int
shift-undef.c:21:29: warning: right shift by bigger than source value
+shift-undef.c:24:29: warning: right shift by bigger than source value
shift-undef.c:32:11: warning: shift too big (100) for type int
shift-undef.c:33:11: warning: shift too big (101) for type unsigned int
shift-undef.c:34:11: warning: shift too big (102) for type unsigned int
@@ -117,5 +118,6 @@ shift-undef.c:47:30: warning: shift too big (4294967289) for type int
shift-undef.c:48:30: warning: shift too big (4294967288) for type unsigned int
shift-undef.c:49:30: warning: shift too big (4294967287) for type unsigned int
shift-undef.c:50:26: warning: right shift by bigger than source value
+shift-undef.c:53:26: warning: right shift by bigger than source value
* check-error-end
*/