From 268a53de823a6750d6256ee1fb1e7707b4b45740 Mon Sep 17 00:00:00 2001 From: Xavier ASUS Date: Fri, 18 Oct 2019 00:31:54 +0200 Subject: sdcc-3.9.0 fork implementing GNU assembler syntax This fork aims to provide better support for stm8-binutils --- src/regression/pcodeopt.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/regression/pcodeopt.c (limited to 'src/regression/pcodeopt.c') 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(); +} + -- cgit v1.2.3