diff mbox

[PR,target/69890] Remove "string.h" dependency for string functions optimization tests

Message ID 20160401102810.GE309@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich April 1, 2016, 10:28 a.m. UTC
Hi,

This patch replaces "string.h" with "strlenopt.h" in all tests
checking string function optimizations with CHKP.  I added memmove
definition to strlenopt.h for that.

Regtested on x86_64-pc-linux-gnu and checked PR69890 is resolved
on Darwin by Dominique d'Humieres.  Is strlenopt.h extension and
re-usage OK for trunk and gcc-5-branch?

Thanks,
Ilya
--
gcc/testsuite/

2016-04-01  Ilya Enkovich  <enkovich.gnu@gmail.com>

	PR target/69890
	* gcc.dg/strlenopt.h (memmove): New.
	* gcc.target/i386/chkp-strlen-1.c: Include "../../gcc.dg/strlenopt.h"
	instead of "string.h".
	* gcc.target/i386/chkp-strlen-2.c: Likewise.
	* gcc.target/i386/chkp-strlen-3.c: Likewise.
	* gcc.target/i386/chkp-strlen-4.c: Likewise.
	* gcc.target/i386/chkp-strlen-5.c: Likewise.
	* gcc.target/i386/chkp-stropt-1.c: Likewise.
	* gcc.target/i386/chkp-stropt-10.c: Likewise.
	* gcc.target/i386/chkp-stropt-11.c: Likewise.
	* gcc.target/i386/chkp-stropt-12.c: Likewise.
	* gcc.target/i386/chkp-stropt-13.c: Likewise.
	* gcc.target/i386/chkp-stropt-14.c: Likewise.
	* gcc.target/i386/chkp-stropt-15.c: Likewise.
	* gcc.target/i386/chkp-stropt-16.c: Likewise.
	* gcc.target/i386/chkp-stropt-2.c: Likewise.
	* gcc.target/i386/chkp-stropt-3.c: Likewise.
	* gcc.target/i386/chkp-stropt-4.c: Likewise.
	* gcc.target/i386/chkp-stropt-5.c: Likewise.
	* gcc.target/i386/chkp-stropt-6.c: Likewise.
	* gcc.target/i386/chkp-stropt-7.c: Likewise.
	* gcc.target/i386/chkp-stropt-8.c: Likewise.
	* gcc.target/i386/chkp-stropt-9.c: Likewise.

Comments

Jakub Jelinek April 1, 2016, 10:37 a.m. UTC | #1
On Fri, Apr 01, 2016 at 01:28:10PM +0300, Ilya Enkovich wrote:
> This patch replaces "string.h" with "strlenopt.h" in all tests
> checking string function optimizations with CHKP.  I added memmove
> definition to strlenopt.h for that.
> 
> Regtested on x86_64-pc-linux-gnu and checked PR69890 is resolved
> on Darwin by Dominique d'Humieres.  Is strlenopt.h extension and
> re-usage OK for trunk and gcc-5-branch?

Ok, thanks.

	Jakub
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/strlenopt.h b/gcc/testsuite/gcc.dg/strlenopt.h
index ef47e5a..8f69940 100644
--- a/gcc/testsuite/gcc.dg/strlenopt.h
+++ b/gcc/testsuite/gcc.dg/strlenopt.h
@@ -10,6 +10,7 @@  void free (void *);
 char *strdup (const char *);
 size_t strlen (const char *);
 void *memcpy (void *__restrict, const void *__restrict, size_t);
+void *memmove (void *, const void *, size_t);
 char *strcpy (char *__restrict, const char *__restrict);
 char *strcat (char *__restrict, const char *__restrict);
 char *strchr (const char *, int);
@@ -31,6 +32,12 @@  memcpy (void *__restrict dest, const void *__restrict src, size_t len)
   return __builtin___memcpy_chk (dest, src, len, bos0 (dest));
 }
 
+extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
+memmove (void *dest, const void *src, size_t len)
+{
+  return __builtin___memmove_chk (dest, src, len, bos0 (dest));
+}
+
 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
 strcpy (char *__restrict dest, const char *__restrict src)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c
index de6279f..38d5390 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
 /* { dg-final { scan-tree-dump "memcpy.chkp" "strlen" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 char *test (char *str1, char *str2)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
index 470ac47..789ebc1 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c
@@ -3,8 +3,8 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
 /* { dg-final { scan-tree-dump-not "strlen" "strlen" } } */
 
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
 
 char *test (char *str1, char *str2)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c
index 311c9a0..276f412 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
 /* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 size_t test (char *str1, char *str2)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
index dbf568b..51ff960 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c
@@ -3,8 +3,8 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
 /* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */
 
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
 
 char * test (char *str1, char *str2)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c
index e44096c..bbafecc 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c
@@ -3,7 +3,7 @@ 
 /* { dg-final { scan-tree-dump-times "strlen" 2 "strlen" } } */
 /* { dg-final { scan-tree-dump "memcpy" "strlen" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 size_t test (char *str1, char *str2)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c
index 18aa281..d6148a8 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
 /* { dg-final { scan-tree-dump "memcpy_nochk" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c
index 26e9f13..18cff73 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump-not "memset_nobnd" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (void *buf1, int c, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c
index e84963f..c53db6a 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump-not "memmove_nobnd" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (void *buf1, void *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
index 638810b8..a076d17 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c
@@ -3,8 +3,8 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump-not "mempcpy_nobnd" "chkpopt" } } */
 
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
 
 void test (void *buf1, void *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c
index 3b926b1..279cae3 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "memcpy_nobnd_nochk" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c
index a8d000b..b810c68 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "memset_nobnd_nochk" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int c, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c
index 7c606565..a9a79c1 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "memmove_nobnd_nochk" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
index b0f43a6..6ce170c 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c
@@ -3,8 +3,8 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "mempcpy_nobnd_nochk" "chkpopt" } } */
 
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c
index cac0fea..6a0c24e 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
 /* { dg-final { scan-tree-dump "memset_nochk" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int c, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c
index 72ff386..310dec7 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
 /* { dg-final { scan-tree-dump "memmove_nochk" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
index 216ed52..7a30d17 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c
@@ -3,8 +3,8 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */
 /* { dg-final { scan-tree-dump "mempcpy_nochk" "chkpopt" } } */
 
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c
index 02ad9cc..39850d6 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "memcpy_nobnd" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c
index 6db5d83..06dcbfb 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "memset_nobnd" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int c, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c
index 761e626..40ded06 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "memmove_nobnd" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
index afde3c9..7e575bb 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c
@@ -3,8 +3,8 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump "mempcpy_nobnd" "chkpopt" } } */
 
-#define _GNU_SOURCE
-#include "string.h"
+#define USE_GNU
+#include "../../gcc.dg/strlenopt.h"
 
 void test (int *buf1, int *buf2, size_t len)
 {
diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c
index b79d096..bf26874 100644
--- a/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c
+++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c
@@ -2,7 +2,7 @@ 
 /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */
 /* { dg-final { scan-tree-dump-not "memcpy_nobnd" "chkpopt" } } */
 
-#include "string.h"
+#include "../../gcc.dg/strlenopt.h"
 
 void test (void *buf1, void *buf2, size_t len)
 {