struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bitwise8reg.c
blob61ceedadf3b4d5a01f5b121b9870369ed0d88455
1 /** Test the 8-bit bitwise operators under register pressure
2 Meant to trigger use of 16-bit bitwise instructions for 8-bit operations.
4 */
6 #include <testfwk.h>
8 unsigned char c0, c1, c2, c3;
10 unsigned char and8(void)
12 unsigned char t0, t1, t2, t3, t4, t5;
14 t0 = c0 + 1;
15 t1 = c1 + 1;
16 t2 = c2 + 1;
17 t3 = c3 + 1;
19 t4 = t0 & t1;
20 t5 = t2 & t3;
22 return(t4 + t5);
25 unsigned char or8(void)
27 unsigned char t0, t1, t2, t3, t4, t5;
29 t0 = c0 + 1;
30 t1 = c1 + 1;
31 t2 = c2 + 1;
32 t3 = c3 + 1;
34 t4 = t0 | t1;
35 t5 = t2 | t3;
37 return(t4 + t5);
40 void
41 test8(void)
43 c0 = 2;
44 c1 = 2;
45 c2 = 4;
46 c3 = 4;
48 ASSERT(and8() == 8);
49 ASSERT(or8() == 8);