~ubuntu-branches/ubuntu/vivid/qemu-linaro/vivid

« back to all changes in this revision

Viewing changes to tests/tcg/openrisc/test_div.c

  • Committer: Ricardo Salveti de Araujo
  • Date: 2012-09-20 18:39:31 UTC
  • mfrom: (12922.1.2 qemu-linaro)
  • Revision ID: ricardo.salveti@linaro.org-20120920183931-sp3cg6kpdl8dmwo9
* New upstream release.
  - support emulated systems with more than 2G of memory. (LP: #1030588)
* Drop powerpc-missing-include.patch - merged upstream.
* Update debian/control:
  - drop perl build dependency.
  - add libfdt-dev build dependency.
* Update debian/qemu-keymaps.install file.
* Update debian/rules:
  - update QEMU_CPU for ARM architecture: armv4l -> armv7l.
  - update conf_audio_drv: default to PulseAudio since PA is the default on
    Ubuntu.
  - enable KVM on ARM architecture.
  - enable flat device tree support (--enable-fdt). (LP: #1030594)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
 
 
3
int main(void)
 
4
{
 
5
    int a, b, c;
 
6
    int result;
 
7
 
 
8
    b = 0x120;
 
9
    c = 0x4;
 
10
    result = 0x48;
 
11
    __asm
 
12
    ("l.div  %0, %1, %2\n\t"
 
13
     : "=r"(a)
 
14
     : "r"(b), "r"(c)
 
15
    );
 
16
    if (a != result) {
 
17
        printf("div error\n");
 
18
        return -1;
 
19
    }
 
20
 
 
21
    result = 0x4;
 
22
    __asm
 
23
    ("l.div %0, %1, %0\n\t"
 
24
     : "+r"(a)
 
25
     : "r"(b)
 
26
    );
 
27
    if (a != result) {
 
28
        printf("div error\n");
 
29
        return -1;
 
30
    }
 
31
 
 
32
    b = 0xffffffff;
 
33
    c = 0x80000000;
 
34
    result = 0;
 
35
    __asm
 
36
    ("l.div %0, %1, %2\n\t"
 
37
     : "=r"(a)
 
38
     : "r"(b), "r"(c)
 
39
    );
 
40
    if (a != result) {
 
41
        printf("div error\n");
 
42
        return -1;
 
43
    }
 
44
 
 
45
    b = 0x80000000;
 
46
    c = 0xffffffff;
 
47
    __asm
 
48
    ("l.div %0, %1, %2\n\t"
 
49
     : "=r"(a)
 
50
     : "r"(b), "r"(c)
 
51
    );
 
52
 
 
53
    return 0;
 
54
}