Add missing zstd.h to coregrind Makefile.am noinst_HEADERS
[valgrind.git] / memcheck / tests / s390x / vfae.c
blob68781e7fb738c636d363d3534f7391b54d6e02bf
1 #include <stdio.h>
2 #include <string.h>
4 #define VECTOR __attribute__ ((vector_size (16)))
6 typedef char VECTOR char_v;
8 volatile char tmp;
9 static const char *hex_digit = "0123456789abcdefGHIJKLMNOPQRSTUV";
11 static char_v to_char_vec(const char *str)
13 char_v v;
14 char buf[17];
15 int len = strlen(str);
17 memcpy(buf, str, (len && str[len - 1] == '~') ? len - 1 : len + 1);
18 v = *(char_v *) buf;
19 return v;
22 #define GENERATE_TEST(mnem) \
23 static void test_ ## mnem ## _char(const char *str, const char *match, \
24 int expect_res, int expect_cc) \
25 { \
26 int cc; \
27 char_v v1; \
28 char_v v2 = to_char_vec(str); \
29 char_v v3 = to_char_vec(match); \
31 __asm__( \
32 "cr 0,0\n\t" /* Clear CC */ \
33 #mnem " %[v1],%[v2],%[v3],0,3\n\t" \
34 "ipm %[cc]\n\t" \
35 "srl %[cc],28" \
36 : [v1] "=v" (v1), \
37 [cc] "=d" (cc) \
38 : [v2] "v" (v2), \
39 [v3] "v" (v3) \
40 : "cc"); \
42 tmp = hex_digit[v1[7] & 0x1f]; \
43 if (expect_res >= 0 && v1[7] != expect_res) \
44 printf("result %u != %d\n", v1[7], expect_res); \
46 tmp = hex_digit[cc & 0xf]; \
47 if (expect_cc >= 0 && cc != expect_cc) \
48 printf("CC %d != %d\n", cc, expect_cc); \
51 GENERATE_TEST(vfae)
53 GENERATE_TEST(vfee)
55 GENERATE_TEST(vfene)
57 int main()
59 test_vfae_char("not found", "................", 9, 0);
60 test_vfae_char("xy", "zzzzzzzzyyyyyyyy", 1, 2);
61 test_vfae_char("incomplete~", "xxxxxxxxxxxxxxxx", -1, -1);
63 test_vfee_char("same char here", "..........here", 10, 2);
64 test_vfee_char("and here too ...", "_________t~", 9, 1);
65 test_vfee_char("equality!~", "========!!~", 8, -1);
67 test_vfene_char("strings equal", "strings equal", 13, 0);
68 test_vfene_char(hex_digit, hex_digit, 16, 3);
69 test_vfene_char("undef~", "undefined", -1, -1);
70 test_vfene_char("active~", "actually ok", 3, 1);
71 return 0;