Add memmove to value profiling.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / val-prof-7.c
blobbb9dd210eece22c38dd72b24ea1526eb8cb33038
1 /* { dg-options "-O2 -fdump-ipa-profile -mtune=core2" } */
2 /* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } } */
4 char *buffer1;
5 char *buffer2;
7 /* Bzero is not tested because it gets transformed into memset. */
9 #define DEFINE_TEST(N) \
10 __attribute__((noinline)) \
11 void memcpy_test_ ## N (int len) \
12 { \
13 __builtin_memcpy (buffer1, buffer2, len); \
14 } \
16 __attribute__((noinline)) \
17 void mempcpy_test_ ## N (int len) \
18 { \
19 __builtin_mempcpy (buffer1, buffer2, len); \
20 } \
22 __attribute__((noinline)) \
23 void memset_test_ ## N (int len) \
24 { \
25 __builtin_memset (buffer1, 'c', len); \
26 } \
27 __attribute__((noinline)) \
28 void memmove_test_ ## N (int len) \
29 { \
30 __builtin_memmove (buffer1, buffer2, len); \
31 } \
33 void test_stringops_ ## N(int len) \
34 { \
35 memcpy_test_## N (len); \
36 mempcpy_test_ ## N (len); \
37 memset_test_ ## N (len); \
38 memmove_test_ ## N (len); \
39 } \
41 void test_stringops_with_values_ ## N (int common, int not_common) \
42 { \
43 int i; \
44 for (i = 0; i < 1000; i++) \
45 { \
46 if (i > 990) \
47 test_stringops_ ## N (not_common); \
48 else \
49 test_stringops_ ## N (common); \
50 } \
53 DEFINE_TEST(0);
54 DEFINE_TEST(1);
55 DEFINE_TEST(2);
57 int main() {
58 buffer1 = __builtin_malloc (1000);
59 buffer2 = __builtin_malloc (1000);
61 test_stringops_with_values_0 (8, 55);
62 test_stringops_with_values_1 (55, 55);
63 test_stringops_with_values_2 (257, 55);
65 return 0;
68 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on __builtin_memcpy" "profile" } } */
69 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 55 stringop transformation on __builtin_memcpy" "profile" } } */
70 /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Single value 32 stringop transformation on __builtin_memcpy" 0 "profile" } } */
72 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on __builtin_mempcpy" "profile" } } */
73 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 55 stringop transformation on __builtin_mempcpy" "profile" } } */
74 /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Single value 32 stringop transformation on __builtin_mempcpy" 0 "profile" } } */
76 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on __builtin_memset" "profile" } } */
77 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 55 stringop transformation on __builtin_memset" "profile" } } */
78 /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Single value 32 stringop transformation on __builtin_memset" 0 "profile" } } */
80 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on __builtin_memmove" "profile" } } */
81 /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 55 stringop transformation on __builtin_memmove" "profile" } } */
82 /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Single value 32 stringop transformation on __builtin_memmove" 0 "profile" } } */