xref: /openbmc/qemu/tests/tcg/s390x/vcksm.c (revision 2b74dd91)
1 /*
2  * Test the VCKSM instruction.
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  */
6 #include <assert.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include "vx.h"
10 
11 int main(void)
12 {
13     S390Vector v1;
14     S390Vector v2 = {
15         .d[0] = 0xb2261c8140edce49ULL,
16         .d[1] = 0x387bf5a433af39d1ULL,
17     };
18     S390Vector v3 = {
19         .d[0] = 0x73b03d2c7f9e654eULL,
20         .d[1] = 0x23d74e51fb479877ULL,
21     };
22     S390Vector exp = {.d[0] = 0xdedd7f8eULL, .d[1] = 0ULL};
23 
24     asm volatile("vcksm %[v1],%[v2],%[v3]"
25                  : [v1] "=v" (v1.v)
26                  : [v2] "v" (v2.v)
27                  , [v3] "v" (v3.v));
28     assert(memcmp(&v1, &exp, sizeof(v1)) == 0);
29 
30     return EXIT_SUCCESS;
31 }
32