1*9e3eb3b2SThomas Huth /*
2*9e3eb3b2SThomas Huth * Test the VECTOR ISOLATE STRING (vistr) instruction
3*9e3eb3b2SThomas Huth */
4*9e3eb3b2SThomas Huth #include <stdint.h>
5*9e3eb3b2SThomas Huth #include <stdio.h>
6*9e3eb3b2SThomas Huth #include "vx.h"
7*9e3eb3b2SThomas Huth
vistr(S390Vector * v1,S390Vector * v2,const uint8_t m3,const uint8_t m5)8*9e3eb3b2SThomas Huth static inline void vistr(S390Vector *v1, S390Vector *v2,
9*9e3eb3b2SThomas Huth const uint8_t m3, const uint8_t m5)
10*9e3eb3b2SThomas Huth {
11*9e3eb3b2SThomas Huth asm volatile("vistr %[v1], %[v2], %[m3], %[m5]\n"
12*9e3eb3b2SThomas Huth : [v1] "=v" (v1->v)
13*9e3eb3b2SThomas Huth : [v2] "v" (v2->v)
14*9e3eb3b2SThomas Huth , [m3] "i" (m3)
15*9e3eb3b2SThomas Huth , [m5] "i" (m5)
16*9e3eb3b2SThomas Huth : "cc");
17*9e3eb3b2SThomas Huth }
18*9e3eb3b2SThomas Huth
main(int argc,char * argv[])19*9e3eb3b2SThomas Huth int main(int argc, char *argv[])
20*9e3eb3b2SThomas Huth {
21*9e3eb3b2SThomas Huth S390Vector vd = {};
22*9e3eb3b2SThomas Huth S390Vector vs16 = {
23*9e3eb3b2SThomas Huth .h[0] = 0x1234, .h[1] = 0x0056, .h[2] = 0x7800, .h[3] = 0x0000,
24*9e3eb3b2SThomas Huth .h[4] = 0x0078, .h[5] = 0x0000, .h[6] = 0x6543, .h[7] = 0x2100
25*9e3eb3b2SThomas Huth };
26*9e3eb3b2SThomas Huth S390Vector vs32 = {
27*9e3eb3b2SThomas Huth .w[0] = 0x12340000, .w[1] = 0x78654300,
28*9e3eb3b2SThomas Huth .w[2] = 0x0, .w[3] = 0x12,
29*9e3eb3b2SThomas Huth };
30*9e3eb3b2SThomas Huth
31*9e3eb3b2SThomas Huth vistr(&vd, &vs16, 1, 0);
32*9e3eb3b2SThomas Huth if (vd.h[0] != 0x1234 || vd.h[1] != 0x0056 || vd.h[2] != 0x7800 ||
33*9e3eb3b2SThomas Huth vd.h[3] || vd.h[4] || vd.h[5] || vd.h[6] || vd.h[7]) {
34*9e3eb3b2SThomas Huth puts("ERROR: vitrh failed!");
35*9e3eb3b2SThomas Huth return 1;
36*9e3eb3b2SThomas Huth }
37*9e3eb3b2SThomas Huth
38*9e3eb3b2SThomas Huth vistr(&vd, &vs32, 2, 0);
39*9e3eb3b2SThomas Huth if (vd.w[0] != 0x12340000 || vd.w[1] != 0x78654300 || vd.w[2] || vd.w[3]) {
40*9e3eb3b2SThomas Huth puts("ERROR: vitrf failed!");
41*9e3eb3b2SThomas Huth return 1;
42*9e3eb3b2SThomas Huth }
43*9e3eb3b2SThomas Huth
44*9e3eb3b2SThomas Huth return 0;
45*9e3eb3b2SThomas Huth }
46