aboutsummaryrefslogtreecommitdiff
path: root/AstSemantics.md
diff options
context:
space:
mode:
authorDan Gohman <sunfish@mozilla.com>2015-11-09 12:10:01 -0800
committerDan Gohman <sunfish@mozilla.com>2015-11-09 12:14:27 -0800
commitc2bb26a4ab5281aad6bd3c7aab4ea730ec7cba4e (patch)
tree005d2224bf2837f8c7c5e28f10df7017e43c494d /AstSemantics.md
parent6158f356f0be4577ea5c226e279d7be4dbeaac88 (diff)
downloadnanowasm-design-c2bb26a4ab5281aad6bd3c7aab4ea730ec7cba4e.tar.gz
Change shift count overflow to be masking.
Diffstat (limited to 'AstSemantics.md')
-rw-r--r--AstSemantics.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/AstSemantics.md b/AstSemantics.md
index 7cd58ee..9aabf87 100644
--- a/AstSemantics.md
+++ b/AstSemantics.md
@@ -383,10 +383,10 @@ results into the result type.
* `i32.ctz`: sign-agnostic count trailing zero bits (All zero bits are considered trailing if the value is zero)
* `i32.popcnt`: sign-agnostic count number of one bits
-Shifts interpret their shift count operand as an unsigned value. When the shift
-count is at least the bitwidth of the shift, `shl` and `shr_u` produce `0`, and
-`shr_s` produces `0` if the value being shifted is non-negative, and `-1`
-otherwise.
+Shifts counts are wrapped to be less than the log-base-2 of the number of bits
+in the value to be shifted, as an unsigned quantity. For example, in a 32-bit
+shift, only the least 5 significant bits of the count affect the result. In a
+64-bit shift, only the least 6 significant bits of the count affect the result.
All comparison operators yield 32-bit integer results with `1` representing
`true` and `0` representing `false`.