From 0e73ec770c2d784e4c933adf0a4885d209c7b9db Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 19 Aug 2009 17:04:28 +0000 Subject: [PATCH] * pmacros.scm (.sll, .srl, .sra): Fix thinko. * testsuite/pmacros-1.test: Ditto. Add better tests. --- ChangeLog | 3 +++ pmacros.scm | 12 +++--------- testsuite/pmacros-1.test | 8 ++++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f5b690..ba86478 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-08-19 Doug Evans + * pmacros.scm (.sll, .srl, .sra): Fix thinko. + * testsuite/pmacros-1.test: Ditto. Add better tests. + * doc/rtl.texi (Instructions): Improve docs of when ${...} is needed in assembler syntax. diff --git a/pmacros.scm b/pmacros.scm index 9d3158d..b8ec407 100644 --- a/pmacros.scm +++ b/pmacros.scm @@ -1179,9 +1179,7 @@ (define (-pmacro-builtin-sll x n) (-pmacro-verify-integer ".sll" x) (-pmacro-verify-non-negative-integer ".sll" n) - (if (= n 0) - x - (* x n 2)) + (ash x n) ) ; (.srl x n) - shift right logical @@ -1192,9 +1190,7 @@ (define (-pmacro-builtin-srl x n) (-pmacro-verify-non-negative-integer ".srl" x) (-pmacro-verify-non-negative-integer ".srl" n) - (if (= n 0) - x - (quotient x (* n 2))) + (ash x (- n)) ) ; (.sra x n) - shift right arithmetic @@ -1202,9 +1198,7 @@ (define (-pmacro-builtin-sra x n) (-pmacro-verify-integer ".sra" x) (-pmacro-verify-non-negative-integer ".sra" n) - (cond ((= n 0) x) - ((= x -1) -1) - (else (quotient x (* n 2)))) + (ash x (- n)) ) ; (.and x y) - bitwise and diff --git a/testsuite/pmacros-1.test b/testsuite/pmacros-1.test index 76ba0ba..12f4569 100644 --- a/testsuite/pmacros-1.test +++ b/testsuite/pmacros-1.test @@ -244,14 +244,14 @@ cat > ${cpu_file} < ${cpu_file} <