summaryrefslogtreecommitdiffstats
path: root/qemu/tests/tcg/mips/mips64-dsp/addq_ph.c
blob: 22a36d9805146d46b9b4d63ff1a29553f783bb32 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "io.h"

int main(void)
{
    long long rd, rs, rt;
    long long dsp;
    long long result;

    rs     = 0xFFFFFFFF;
    rt     = 0x10101010;
    result = 0x100F100F;
    __asm
        ("addq.ph   %0, %1, %2\n\t"
         : "=r"(rd)
         : "r"(rs), "r"(rt)
        );
    if (rd != result) {
        printf("1 addq.ph wrong\n");

        return -1;
    }

    rs     = 0x3712847D;
    rt     = 0x0031AF2D;
    result = 0x374333AA;
    __asm
        ("addq.ph   %0, %1, %2\n\t"
         : "=r"(rd)
         : "r"(rs), "r"(rt)
        );
    if (rd != result) {
        printf("2 addq.ph wrong\n");

        return -1;
    }

    rs     = 0x7fff847D;
    rt     = 0x0031AF2D;
    result = 0xffffffff803033AA;
    __asm
        ("addq.ph   %0, %1, %2\n\t"
         : "=r"(rd)
         : "r"(rs), "r"(rt)
        );

    __asm("rddsp %0\n\t"
          : "=r"(dsp)
         );

    if (rd != result || (((dsp >> 20) & 0x01) != 1)) {
        printf("3 addq.ph wrong\n");

        return -1;
    }

    return 0;
}