summaryrefslogtreecommitdiff
path: root/src/regression/pcodeopt.c
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
commit268a53de823a6750d6256ee1fb1e7707b4b45740 (patch)
tree42c1799a9a82b2f7d9790ee9fe181d72a7274751 /src/regression/pcodeopt.c
downloadsdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'src/regression/pcodeopt.c')
-rw-r--r--src/regression/pcodeopt.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/regression/pcodeopt.c b/src/regression/pcodeopt.c
new file mode 100644
index 0000000..8be5a2a
--- /dev/null
+++ b/src/regression/pcodeopt.c
@@ -0,0 +1,26 @@
+#include "gpsim_assert.h"
+
+/*
+ * Test for buggy pCode optimization on
+ * CLRF reg ; pc1
+ * ...
+ * MOVF reg,W ; pc2
+ *
+ * Originally, both instructions were removed and pc2 replaced with
+ * CLRF reg iff reg was used afterwards, but Z and W were not, or
+ * MOVLW 0 iff reg and Z were not used afterwards, but W was.
+ * Detection of W being used used to be buggy, though...
+ */
+signed int x=0;
+unsigned char y=1;
+
+void main() {
+ x += y;
+ x += y;
+ if (x != 2) { FAILED(); }
+ if (y != 1) { FAILED(); }
+ //ASSERT(MANGLE(x) == 2);
+ //ASSERT(MANGLE(y) == 1);
+ PASSED();
+}
+