summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorKevin Buhr <buhr@asaurus.net>2019-05-01 17:13:33 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-05-08 15:35:13 -0400
commitd9bdff607e79a605197a13203ca9421153e8dd37 (patch)
tree64b7b42f69f00311793dff046c4e4328eaf706a9 /includes
parented5f858b8484a207e28baf9cbec4c60de1c86187 (diff)
downloadhaskell-d9bdff607e79a605197a13203ca9421153e8dd37.tar.gz
stg_floatToWord32zh: zero-extend the Word32 (#16617)
The primop stgFloatToWord32 was sign-extending the 32-bit word, resulting in weird negative Word32s. Zero-extend them instead. Closes #16617.
Diffstat (limited to 'includes')
-rw-r--r--includes/Cmm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index ba84328a73..99f5233ab5 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -159,14 +159,19 @@
#define BYTES_TO_WDS(n) ((n) / SIZEOF_W)
#define ROUNDUP_BYTES_TO_WDS(n) (((n) + SIZEOF_W - 1) / SIZEOF_W)
-/* TO_W_(n) converts n to W_ type from a smaller type */
+/*
+ * TO_W_(n) and TO_ZXW_(n) convert n to W_ type from a smaller type,
+ * with and without sign extension respectively
+ */
#if SIZEOF_W == 4
#define TO_I64(x) %sx64(x)
#define TO_W_(x) %sx32(x)
+#define TO_ZXW_(x) %zx32(x)
#define HALF_W_(x) %lobits16(x)
#elif SIZEOF_W == 8
#define TO_I64(x) (x)
#define TO_W_(x) %sx64(x)
+#define TO_ZXW_(x) %zx64(x)
#define HALF_W_(x) %lobits32(x)
#endif