summaryrefslogtreecommitdiffstats
path: root/qemu/tests/tcg/mips/mips32-dsp/bposge32.c
blob: d25417ea77b2a84a06a2384e242b682b0efd99a4 (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
#include<stdio.h>
#include<assert.h>

int main()
{
    int dsp, sum;
    int result;

    dsp =  0x20;
    sum = 0x01;
    result = 0x02;

    __asm
        ("wrdsp %1\n\t"
         "bposge32 test1\n\t"
         "nop\n\t"
         "addi %0, 0xA2\n\t"
         "nop\n\t"
         "test1:\n\t"
         "addi %0, 0x01\n\t"
         : "+r"(sum)
         : "r"(dsp)
        );
    assert(sum == result);

    dsp =  0x10;
    sum = 0x01;
    result = 0xA4;

    __asm
        ("wrdsp %1\n\t"
         "bposge32 test2\n\t"
         "nop\n\t"
         "addi %0, 0xA2\n\t"
         "nop\n\t"
         "test2:\n\t"
         "addi %0, 0x01\n\t"
         : "+r"(sum)
         : "r"(dsp)
        );
    assert(sum == result);

    return 0;
}