~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to tests/cris/check_moveq.c

  • Committer: j_mayer
  • Date: 2007-09-29 12:18:20 UTC
  • Revision ID: git-v1:f93732914e0b06539170e84f046f01ebe99980f3
make cpu_abort dump cpu state in logfile, which is useful for debugging.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3260 c046a42c-6fe2-441c-8c8c-71466251a162

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
 
#define cris_moveq(dst, src) \
8
 
               asm volatile ("moveq %1, %0\n" : "=r" (dst) : "i" (src));
9
 
 
10
 
 
11
 
 
12
 
int main(void)
13
 
{
14
 
        int t;
15
 
 
16
 
        cris_tst_cc_init();
17
 
        asm volatile ("setf\tzvnc\n");
18
 
        cris_moveq(t, 10);
19
 
        cris_tst_cc(1, 1, 1, 1);
20
 
        if (t != 10)
21
 
                err();
22
 
 
23
 
        /* make sure moveq doesnt clobber the zflag.  */
24
 
        cris_tst_cc_init();
25
 
        asm volatile ("setf vnc\n");
26
 
        asm volatile ("clearf z\n");
27
 
        cris_moveq(t, 0);
28
 
        cris_tst_cc(1, 0, 1, 1);
29
 
        if (t != 0)
30
 
                err();
31
 
 
32
 
        /* make sure moveq doesnt clobber the nflag.
33
 
           Also check large immediates  */
34
 
        cris_tst_cc_init();
35
 
        asm volatile ("setf zvc\n");
36
 
        asm volatile ("clearf n\n");
37
 
        cris_moveq(t, -31);
38
 
        cris_tst_cc(0, 1, 1, 1);
39
 
        if (t != -31)
40
 
                err();
41
 
 
42
 
        cris_tst_cc_init();
43
 
        asm volatile ("setf nzvc\n");
44
 
        cris_moveq(t, 31);
45
 
        cris_tst_cc(1, 1, 1, 1);
46
 
        if (t != 31)
47
 
                err();
48
 
 
49
 
        pass();
50
 
        return 0;
51
 
}