From: Qing Zhao Date: Thu, 30 Aug 2018 14:46:53 +0000 (+0000) Subject: Move strcmpopt_6.c from gcc.dg to gcc.target/aarch64 and gcc.target/i386. X-Git-Tag: basepoints/gcc-10~4454 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21592ebe9d8d1d3486be575d6a64dfa10eba17b1;p=thirdparty%2Fgcc.git Move strcmpopt_6.c from gcc.dg to gcc.target/aarch64 and gcc.target/i386. From-SVN: r263983 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 75e6c6755638..e9e4b5c91b5b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-08-30 Qing Zhao + + PR 86519 + gcc.dg/strcmpopt_6.c: Remove. + gcc.target/aarch64/strcmpopt_6.c: New testcase. + gcc.target/i386/strcmpopt_6.c: Likewise. + 2018-08-30 Richard Biener PR tree-optimization/87147 diff --git a/gcc/testsuite/gcc.dg/strcmpopt_6.c b/gcc/testsuite/gcc.target/aarch64/strcmpopt_6.c similarity index 100% rename from gcc/testsuite/gcc.dg/strcmpopt_6.c rename to gcc/testsuite/gcc.target/aarch64/strcmpopt_6.c diff --git a/gcc/testsuite/gcc.target/i386/strcmpopt_6.c b/gcc/testsuite/gcc.target/i386/strcmpopt_6.c new file mode 100644 index 000000000000..4c6de02824f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/strcmpopt_6.c @@ -0,0 +1,36 @@ +/* When the specified length exceeds one of the arguments of the call to memcmp, + the call to memcmp should NOT be inlined. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wno-stringop-overflow" } */ + +typedef struct { char s[8]; int x; } S; + +__attribute__ ((noinline)) int +f1 (S * s) +{ + int result = 0; + result += __builtin_memcmp (s->s, "a", 3); + return result; +} + +__attribute__ ((noinline)) int +f2 (char *p) +{ + int result = 0; + result += __builtin_memcmp (p, "a", 3); + return result; +} + +int main (void) +{ + S ss = {{'a','b','c'}, 2}; + char *s = "abcd"; + + if (f1 (&ss) < 0 || f2 (s) < 0) + __builtin_abort (); + + return 0; + +} + +/* { dg-final { scan-assembler-times "memcmp" 2 } } */