root / tests / tcg / cris / check_int64.c @ c09015dd
History | View | Annotate | Download (584 Bytes)
1 |
#include <stdio.h> |
---|---|
2 |
#include <stdlib.h> |
3 |
#include <stdint.h> |
4 |
#include "sys.h" |
5 |
#include "crisutils.h" |
6 |
|
7 |
|
8 |
static inline int64_t add64(const int64_t a, const int64_t b) |
9 |
{ |
10 |
return a + b;
|
11 |
} |
12 |
|
13 |
static inline int64_t sub64(const int64_t a, const int64_t b) |
14 |
{ |
15 |
return a - b;
|
16 |
} |
17 |
|
18 |
int main(void) |
19 |
{ |
20 |
int64_t a = 1;
|
21 |
int64_t b = 2;
|
22 |
|
23 |
/* FIXME: add some tests. */
|
24 |
a = add64(a, b); |
25 |
if (a != 3) |
26 |
err(); |
27 |
|
28 |
a = sub64(a, b); |
29 |
if (a != 1) |
30 |
err(); |
31 |
|
32 |
a = add64(a, -4);
|
33 |
if (a != -3) |
34 |
err(); |
35 |
|
36 |
a = add64(a, 3);
|
37 |
if (a != 0) |
38 |
err(); |
39 |
|
40 |
a = 0;
|
41 |
a = sub64(a, 1);
|
42 |
if (a != -1) |
43 |
err(); |
44 |
|
45 |
pass(); |
46 |
return 0; |
47 |
} |