summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-11-25 21:15:39 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-02 18:13:31 -0500
commit0aeaa8f35025d49bbb85c867a86baf23330d17a1 (patch)
treeb644820cb5971c6eff333136cc4102b73282258e /testsuite
parentebaf7333b83b8838de138105337962623c0c6239 (diff)
downloadhaskell-0aeaa8f35025d49bbb85c867a86baf23330d17a1.tar.gz
CmmToC: Always cast arguments as unsigned
As noted in Note [When in doubt, cast arguments as unsigned], we must ensure that arguments have the correct signedness since some operations (e.g. `%`) have different semantics depending upon signedness.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/cmm/should_run/machops/MachOps1.cmm3
-rw-r--r--testsuite/tests/cmm/should_run/machops/MachOps1.stdout1
-rw-r--r--testsuite/tests/cmm/should_run/machops/all.T1
3 files changed, 5 insertions, 0 deletions
diff --git a/testsuite/tests/cmm/should_run/machops/MachOps1.cmm b/testsuite/tests/cmm/should_run/machops/MachOps1.cmm
new file mode 100644
index 0000000000..e5d33ef285
--- /dev/null
+++ b/testsuite/tests/cmm/should_run/machops/MachOps1.cmm
@@ -0,0 +1,3 @@
+test(bits64 buffer) {
+ return (%modu(%sx64((72 :: bits32)), %modu((-43 :: bits64), (-0x443c70fa3e465120 :: bits64))));
+}
diff --git a/testsuite/tests/cmm/should_run/machops/MachOps1.stdout b/testsuite/tests/cmm/should_run/machops/MachOps1.stdout
new file mode 100644
index 0000000000..ea70ce0134
--- /dev/null
+++ b/testsuite/tests/cmm/should_run/machops/MachOps1.stdout
@@ -0,0 +1 @@
+72
diff --git a/testsuite/tests/cmm/should_run/machops/all.T b/testsuite/tests/cmm/should_run/machops/all.T
index faad54a2ce..d705f331dd 100644
--- a/testsuite/tests/cmm/should_run/machops/all.T
+++ b/testsuite/tests/cmm/should_run/machops/all.T
@@ -8,3 +8,4 @@ cmm_test('T20626a')
cmm_test('T20626b')
cmm_test('T20638')
cmm_test('T20634')
+cmm_test('MachOps1')