~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to tests/cris/check_addc.c

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2008-08-25 04:38:35 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080825043835-8e3tftavy8bujdch
Tags: 0.9.1-6
[ Aurelien Jarno ]
* debian/control: 
  - Update list of supported targets (Closes: bug#488339).
* debian/qemu-make-debian-root:
  - Use mktemp instead of $$ to create temporary directories (Closes: 
    bug#496394).
* debian/links:
  - Add missing links to manpages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <stdint.h>
 
4
#include "sys.h"
 
5
#include "crisutils.h"
 
6
 
 
7
extern inline int cris_addc(int a, const int b) {
 
8
        asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b));
 
9
        return a;
 
10
}
 
11
 
 
12
#define verify_addc(a, b, res, n, z, v, c)  \
 
13
{                                           \
 
14
        int r;                              \
 
15
        r = cris_addc((a), (b));            \
 
16
        cris_tst_cc((n), (z), (v), (c));    \
 
17
        if (r != (res))                     \
 
18
                err();                      \
 
19
}
 
20
 
 
21
int main(void)
 
22
{
 
23
        cris_tst_cc_init();
 
24
        asm volatile ("clearf cz");
 
25
        verify_addc(0, 0, 0, 0, 0, 0, 0);
 
26
 
 
27
        cris_tst_cc_init();
 
28
        asm volatile ("setf z");
 
29
        verify_addc(0, 0, 0, 0, 1, 0, 0);
 
30
 
 
31
        cris_tst_cc_init();
 
32
        asm volatile ("setf cz");
 
33
        verify_addc(0, 0, 1, 0, 0, 0, 0);
 
34
        cris_tst_cc_init();
 
35
        asm volatile ("clearf c");
 
36
        verify_addc(-1, 2, 1, 0, 0, 0, 1);
 
37
 
 
38
        cris_tst_cc_init();
 
39
        asm volatile ("clearf nzv");
 
40
        asm volatile ("setf c");
 
41
        verify_addc(-1, 2, 2, 0, 0, 0, 1);
 
42
 
 
43
        cris_tst_cc_init();
 
44
        asm volatile ("setf c");
 
45
        verify_addc(0xffff, 0xffff, 0x1ffff, 0, 0, 0, 0);
 
46
 
 
47
        cris_tst_cc_init();
 
48
        asm volatile ("clearf nzvc");
 
49
        verify_addc(-1, -1, 0xfffffffe, 1, 0, 0, 1);
 
50
 
 
51
        cris_tst_cc_init();
 
52
        asm volatile ("setf c");
 
53
        verify_addc(0x78134452, 0x5432f789, 0xcc463bdc, 1, 0, 1, 0);
 
54
 
 
55
        pass();
 
56
        return 0;
 
57
}