blob: 61ceedadf3b4d5a01f5b121b9870369ed0d88455 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/** Test the 8-bit bitwise operators under register pressure
Meant to trigger use of 16-bit bitwise instructions for 8-bit operations.
*/
#include <testfwk.h>
unsigned char c0, c1, c2, c3;
unsigned char and8(void)
{
unsigned char t0, t1, t2, t3, t4, t5;
t0 = c0 + 1;
t1 = c1 + 1;
t2 = c2 + 1;
t3 = c3 + 1;
t4 = t0 & t1;
t5 = t2 & t3;
return(t4 + t5);
}
unsigned char or8(void)
{
unsigned char t0, t1, t2, t3, t4, t5;
t0 = c0 + 1;
t1 = c1 + 1;
t2 = c2 + 1;
t3 = c3 + 1;
t4 = t0 | t1;
t5 = t2 | t3;
return(t4 + t5);
}
void
test8(void)
{
c0 = 2;
c1 = 2;
c2 = 4;
c3 = 4;
ASSERT(and8() == 8);
ASSERT(or8() == 8);
}
|