virtio-iommu: Fix the partial copy of probe request
[qemu.git] / tests / tcg / s390x / vxeh2_vs.c
blobb7ef419d79a032f6546bacd426edf7653990c470
1 /*
2 * vxeh2_vs: vector-enhancements facility 2 vector shift
3 */
4 #include <stdint.h>
5 #include "vx.h"
7 #define vtst(v1, v2) \
8 if (v1.d[0] != v2.d[0] || v1.d[1] != v2.d[1]) { \
9 return 1; \
12 static inline void vsl(S390Vector *v1, S390Vector *v2, S390Vector *v3)
14 asm volatile("vsl %[v1], %[v2], %[v3]\n"
15 : [v1] "=v" (v1->v)
16 : [v2] "v" (v2->v)
17 , [v3] "v" (v3->v));
20 static inline void vsra(S390Vector *v1, S390Vector *v2, S390Vector *v3)
22 asm volatile("vsra %[v1], %[v2], %[v3]\n"
23 : [v1] "=v" (v1->v)
24 : [v2] "v" (v2->v)
25 , [v3] "v" (v3->v));
28 static inline void vsrl(S390Vector *v1, S390Vector *v2, S390Vector *v3)
30 asm volatile("vsrl %[v1], %[v2], %[v3]\n"
31 : [v1] "=v" (v1->v)
32 : [v2] "v" (v2->v)
33 , [v3] "v" (v3->v));
36 static inline void vsld(S390Vector *v1, S390Vector *v2,
37 S390Vector *v3, const uint8_t I)
39 asm volatile("vsld %[v1], %[v2], %[v3], %[I]\n"
40 : [v1] "=v" (v1->v)
41 : [v2] "v" (v2->v)
42 , [v3] "v" (v3->v)
43 , [I] "i" (I & 7));
46 static inline void vsrd(S390Vector *v1, S390Vector *v2,
47 S390Vector *v3, const uint8_t I)
49 asm volatile("vsrd %[v1], %[v2], %[v3], %[I]\n"
50 : [v1] "=v" (v1->v)
51 : [v2] "v" (v2->v)
52 , [v3] "v" (v3->v)
53 , [I] "i" (I & 7));
56 int main(int argc, char *argv[])
58 const S390Vector vt_vsl = { .d[0] = 0x7FEDBB32D5AA311Dull,
59 .d[1] = 0xBB65AA10912220C0ull };
60 const S390Vector vt_vsra = { .d[0] = 0xF1FE6E7399AA5466ull,
61 .d[1] = 0x0E762A5188221044ull };
62 const S390Vector vt_vsrl = { .d[0] = 0x11FE6E7399AA5466ull,
63 .d[1] = 0x0E762A5188221044ull };
64 const S390Vector vt_vsld = { .d[0] = 0x7F76EE65DD54CC43ull,
65 .d[1] = 0xBB32AA2199108838ull };
66 const S390Vector vt_vsrd = { .d[0] = 0x0E060802040E000Aull,
67 .d[1] = 0x0C060802040E000Aull };
68 S390Vector vs = { .d[0] = 0x8FEEDDCCBBAA9988ull,
69 .d[1] = 0x7766554433221107ull };
70 S390Vector vd = { .d[0] = 0, .d[1] = 0 };
71 S390Vector vsi = { .d[0] = 0, .d[1] = 0 };
73 for (int ix = 0; ix < 16; ix++) {
74 vsi.b[ix] = (1 + (5 ^ ~ix)) & 7;
77 vsl(&vd, &vs, &vsi);
78 vtst(vd, vt_vsl);
80 vsra(&vd, &vs, &vsi);
81 vtst(vd, vt_vsra);
83 vsrl(&vd, &vs, &vsi);
84 vtst(vd, vt_vsrl);
86 vsld(&vd, &vs, &vsi, 3);
87 vtst(vd, vt_vsld);
89 vsrd(&vd, &vs, &vsi, 15);
90 vtst(vd, vt_vsrd);
92 return 0;