Imported Upstream version 2.9.0
[debian/cc1111] / src / regression / pcodeopt.c
1 #include "gpsim_assert.h"
2
3 /*
4  * Test for buggy pCode optimization on
5  *    CLRF reg  ; pc1
6  *    ...
7  *    MOVF reg,W        ; pc2
8  *
9  * Originally, both instructions were removed and pc2 replaced with
10  *    CLRF reg          iff reg was used afterwards, but Z and W were not, or
11  *    MOVLW 0           iff reg and Z were not used afterwards, but W was.
12  * Detection of W being used used to be buggy, though...
13  */
14 signed int x=0;
15 unsigned char y=1;
16
17 void main() {
18     x += y;
19     x += y;
20     if (x != 2) { FAILED(); }
21     if (y != 1) { FAILED(); }
22     //ASSERT(MANGLE(x) == 2);
23     //ASSERT(MANGLE(y) == 1);
24     PASSED();
25 }
26