aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/mips/mips32-dsp/addq_s_w.c
blob: 1e13acf68fb9c77d8859b8422a6dfba655c5874e (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 rd, rs, rt;
    int result;

    rt     = 0x10017EFD;
    rs     = 0x11111111;
    result = 0x2112900e;

    __asm
        ("addq_s.w %0, %1, %2\n\t"
         : "=r"(rd)
         : "r"(rs), "r"(rt)
        );
    assert(rd == result);

    rt     = 0x80017EFD;
    rs     = 0x81111111;
    result = 0x80000000;

    __asm
        ("addq_s.w %0, %1, %2\n\t"
         : "=r"(rd)
         : "r"(rs), "r"(rt)
        );
    assert(rd == result);

    rt     = 0x7fffffff;
    rs     = 0x01111111;
    result = 0x7fffffff;

    __asm
        ("addq_s.w %0, %1, %2\n\t"
         : "=r"(rd)
         : "r"(rs), "r"(rt)
        );
    assert(rd == result);

    return 0;
}