summaryrefslogtreecommitdiffstats
path: root/qemu/tests/tcg/openrisc/test_movhi.c
blob: 737f75b9fdac52824c6015a6fc2377c6ea438707 (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
#include <stdio.h>

int main(void)
{
    int a;
    int result;

    result = 0x1222;
    __asm
    ("l.movhi r3, 0x1222\n\t"
     "l.srli   %0, r3, 16\n\t"
     : "=r"(a)
    );
    if (a != result) {
        printf("movhi error\n");
        return -1;
    }

    result = 0x1111;
    __asm
    ("l.movhi r8, 0x1111\n\t"
     "l.srli   %0, r8, 16\n\t"
     : "=r"(a)
    );
    if (a != result) {
        printf("movhi error\n");
        return -1;
    }

    return 0;
}