4 #define VECTOR __attribute__ ((vector_size (16)))
6 typedef char VECTOR char_v
;
9 static const char *hex_digit
= "0123456789abcdefGHIJKLMNOPQRSTUV";
11 static char_v
to_char_vec(const char *str
)
15 int len
= strlen(str
);
17 memcpy(buf
, str
, (len
&& str
[len
- 1] == '~') ? len
- 1 : len
+ 1);
22 #define GENERATE_TEST(mnem) \
23 static void test_ ## mnem ## _char(const char *str, const char *match, \
24 int expect_res, int expect_cc) \
28 char_v v2 = to_char_vec(str); \
29 char_v v3 = to_char_vec(match); \
32 "cr 0,0\n\t" /* Clear CC */ \
33 #mnem " %[v1],%[v2],%[v3],0,3\n\t" \
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); \
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);