Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-O3 -minline-strcmp" } */
3
4 int
5 __attribute__ ((noipa))
6 foo (const char *s, const char *t)
7 {
8 return __builtin_strcmp (s, t);
9 }
10
11 #define SZ 10
12
13 int
14 main ()
15 {
16 const char *s[SZ]
17 = {"", "asdf", "0", "\0", "!@#$%***m1123fdnmoi43",
18 "a", "z", "1", "9", "12345678901234567889012345678901234567890"};
19
20 const int ref[SZ * SZ]
21 = {0, -97, -48, 0, -33, -97, -122, -49, -57, -49, 97, 0, 49, 97, 64,
22 115, -25, 48, 40, 48, 48, -49, 0, 48, 15, -49, -74, -1, -9, -1,
23 0, -97, -48, 0, -33, -97, -122, -49, -57, -49, 33, -64, -15, 33, 0,
24 -64, -89, -16, -24, -16, 97, -115, 49, 97, 64, 0, -25, 48, 40, 48,
25 122, 25, 74, 122, 89, 25, 0, 73, 65, 73, 49, -48, 1, 49, 16,
26 -48, -73, 0, -8, -50, 57, -40, 9, 57, 24, -40, -65, 8, 0, 8,
27 49, -48, 1, 49, 16, -48, -73, 50, -8, 0};
28
29 for (int i = 0; i < SZ; i++)
30 for (int j = 0; j < SZ; j++)
31 if (foo (s[i], s[j]) != ref [i * SZ + j])
32 __builtin_abort ();
33 }