1 #include <assert.h>
2 #include <stdint.h>
3 #include "qemu/compiler.h"
4
main(void)5 int main(void)
6 {
7 unsigned int result_wi;
8 vector unsigned char vbc_bi_src = { 0xFF, 0xFF, 0, 0xFF, 0xFF, 0xFF,
9 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0,
10 0, 0xFF, 0xFF};
11 vector unsigned short vbc_hi_src = { 0xFFFF, 0, 0, 0xFFFF,
12 0, 0, 0xFFFF, 0xFFFF};
13 vector unsigned int vbc_wi_src = {0, 0, 0xFFFFFFFF, 0xFFFFFFFF};
14 vector unsigned long long vbc_di_src = {0xFFFFFFFFFFFFFFFF, 0};
15 vector __uint128_t vbc_qi_src;
16
17 asm("vextractbm %0, %1" : "=r" (result_wi) : "v" (vbc_bi_src));
18 #if HOST_BIG_ENDIAN
19 assert(result_wi == 0b1101111111000011);
20 #else
21 assert(result_wi == 0b1100001111111011);
22 #endif
23
24 asm("vextracthm %0, %1" : "=r" (result_wi) : "v" (vbc_hi_src));
25 #if HOST_BIG_ENDIAN
26 assert(result_wi == 0b10010011);
27 #else
28 assert(result_wi == 0b11001001);
29 #endif
30
31 asm("vextractwm %0, %1" : "=r" (result_wi) : "v" (vbc_wi_src));
32 #if HOST_BIG_ENDIAN
33 assert(result_wi == 0b0011);
34 #else
35 assert(result_wi == 0b1100);
36 #endif
37
38 asm("vextractdm %0, %1" : "=r" (result_wi) : "v" (vbc_di_src));
39 #if HOST_BIG_ENDIAN
40 assert(result_wi == 0b10);
41 #else
42 assert(result_wi == 0b01);
43 #endif
44
45 vbc_qi_src[0] = 0x1;
46 vbc_qi_src[0] = vbc_qi_src[0] << 127;
47 asm("vextractqm %0, %1" : "=r" (result_wi) : "v" (vbc_qi_src));
48 assert(result_wi == 0b1);
49
50 return 0;
51 }
52