1 /* Copyright (C) 2002, 2005 Free Software Foundation.
3 Test -minline-all-stringops memset with various combinations of pointer
4 alignments and lengths to make sure builtin optimizations are correct.
7 Written by Michael Meissner, March 9, 2002.
8 Target by Roger Sayle, April 25, 2002. */
10 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
11 /* { dg-options "-O2 -minline-all-stringops" } */
13 extern void *memset (void *, int, __SIZE_TYPE__
);
14 extern void abort (void);
15 extern void exit (int);
18 #define MAX_OFFSET (sizeof (long long))
22 #define MAX_COPY (8 * sizeof (long long))
26 #define MAX_EXTRA (sizeof (long long))
29 #define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA)
44 for (off
= 0; off
< MAX_OFFSET
; off
++)
45 for (len
= 1; len
< MAX_COPY
; len
++)
47 for (i
= 0; i
< MAX_LENGTH
; i
++)
50 p
= memset (u
.buf
+ off
, '\0', len
);
55 for (i
= 0; i
< off
; i
++, q
++)
59 for (i
= 0; i
< len
; i
++, q
++)
63 for (i
= 0; i
< MAX_EXTRA
; i
++, q
++)
67 p
= memset (u
.buf
+ off
, A
, len
);
72 for (i
= 0; i
< off
; i
++, q
++)
76 for (i
= 0; i
< len
; i
++, q
++)
80 for (i
= 0; i
< MAX_EXTRA
; i
++, q
++)
84 p
= memset (u
.buf
+ off
, 'B', len
);
89 for (i
= 0; i
< off
; i
++, q
++)
93 for (i
= 0; i
< len
; i
++, q
++)
97 for (i
= 0; i
< MAX_EXTRA
; i
++, q
++)