blob: e4d8380e2b55a24e5e5f376559ffe008a4d88b2b [file] [log] [blame]
/* APPLE LOCAL file radar 4134510 */
/* { dg-do run { target i?86-*-darwin* } } */
/* { dg-skip-if "" { i?86-*-darwin* } { "-m64" } { "" } } */
/* { dg-options "-save-temps" } */
#include <stdlib.h>
#include <stdio.h>
char *abc31 = "abcdefghijklmnopqrstuvwxyz12345";
char *def31 = "abcdefghijklmnopqrstuvwxyz12345";
char *other_ptr;
void __attribute__ ((noinline))
assign_other (char *str)
{
other_ptr = str;
}
int
main (int argc, char *argv[])
{
/* frighten optimizer */
assign_other (abc31);
assign_other (def31);
/* Length <= 30: use rep|cmpsb */
if (bcmp (abc31, def31, 30))
abort ();
/* Length > 30: call library */
if (bcmp (abc31, def31, 31))
abort ();
/* frighten optimizer */
assign_other (abc31);
assign_other (def31);
if (memcmp (abc31, def31, 30))
abort ();
if (memcmp (abc31, def31, 31))
abort ();
exit (0);
}
/* { dg-final { scan-assembler-times "cmpsb" "2"} } */
/* { dg-final { scan-assembler-times "call\\s*\\w*memcmp" "2"} } */