struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / patch-466.c
blob4307af06c1cfaf79405594130e40e0ffefa0f771
1 /*
2 patch-466.c - tests for some peephole optimizer rules from patch #466
3 to optimize theuse of MCs-51 bit instructions.
4 */
6 #include <testfwk.h>
8 #include <stdint.h>
9 #include <stdbool.h>
11 uint8_t aaa;
12 uint8_t bbb;
14 uint8_t get_bleh (uint8_t x)
16 bool x0 = x != aaa;
17 bool x1 = x != bbb;
19 return (!x0 | !x1) ? 0xFF : 0x00;
22 void testPatch(void)
24 aaa = 0;
25 bbb = 0;
26 ASSERT (get_bleh (0) == 0xff);
27 ASSERT (get_bleh (1) == 0x00);
29 aaa = 0;
30 bbb = 1;
31 ASSERT (get_bleh (0) == 0xff);
32 ASSERT (get_bleh (1) == 0xff);
34 aaa = 1;
35 bbb = 0;
36 ASSERT (get_bleh (0) == 0xff);
37 ASSERT (get_bleh (1) == 0xff);
39 aaa = 1;
40 bbb = 1;
41 ASSERT (get_bleh (0) == 0x00);
42 ASSERT (get_bleh (1) == 0xff);