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. */
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)
45 for (off
= 0; off
< MAX_OFFSET
; off
++)
46 for (len
= 1; len
< MAX_COPY
; len
++)
48 for (i
= 0; i
< MAX_LENGTH
; i
++)
51 p
= memset (u
.buf
+ off
, '\0', len
);
56 for (i
= 0; i
< off
; i
++, q
++)
60 for (i
= 0; i
< len
; i
++, q
++)
64 for (i
= 0; i
< MAX_EXTRA
; i
++, q
++)
68 p
= memset (u
.buf
+ off
, A
, len
);
73 for (i
= 0; i
< off
; i
++, q
++)
77 for (i
= 0; i
< len
; i
++, q
++)
81 for (i
= 0; i
< MAX_EXTRA
; i
++, q
++)
85 p
= memset (u
.buf
+ off
, 'B', len
);
90 for (i
= 0; i
< off
; i
++, q
++)
94 for (i
= 0; i
< len
; i
++, q
++)
98 for (i
= 0; i
< MAX_EXTRA
; i
++, q
++)