Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / none / tests / s390x / clst.c
blobfc7d96e47a3a4f64731653040f46d6818bffbfb9
1 #include <stdio.h>
2 #include <ctype.h>
3 #include "test.h"
5 #define LOOPBACK "jo 0b \n\t"
7 typedef struct {
8 const char *str1;
9 const char *str2;
10 int cc;
11 } clst_t;
13 static clst_t
14 do_clst(const char *__string1, const char *__string2, char __end)
16 register char end asm ("0") = __end;
17 register const char *string1 asm ("2") = __string1;
18 register const char *string2 asm ("4") = __string2;
20 asm volatile( "0: clst 2,4\n\t"
21 LOOPBACK
22 :"+d" (string1), "+d" (string2) :"d" (end): "cc");
24 return (clst_t) { .str1 = string1, .str2 = string2, .cc = get_cc() };
27 void
28 clst(const char *str1, const char *str2, int sentinel)
30 clst_t res;
32 printf("comparing: %s with %s sentinel = %d", str1, str2, sentinel);
33 if (isprint(sentinel))
34 printf(" (%c)", sentinel);
35 printf("\n");
36 res = do_clst(str1, str2, sentinel);
37 printf("str1 = %s\nstr2 = %s\ncc = %d\n", res.str1, res.str2, res.cc);
38 printf("\n");
41 int main(void)
43 clst("lower123", "lowerabc", '\0');
44 clst("higher234", "higher123", '\0');
45 clst("equal", "equal", '\0');
47 clst("equal", "equallong", '\0');
48 clst("equallong", "equal", '\0');
50 clst("lower1", "lower2", 'w'); // will compare equal
52 return 0;