aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/sh')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c29
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c29
5 files changed, 91 insertions, 8 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c
index f2cd2de04..3208f932a 100644
--- a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c
+++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c
@@ -3,12 +3,12 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */
-/* { dg-final { scan-assembler-times "tst" 5 } } */
-/* { dg-final { scan-assembler-times "movt" 0 } } */
+/* { dg-final { scan-assembler-times "tst" 6 } } */
+/* { dg-final { scan-assembler-times "movt" 1 } } */
/* { dg-final { scan-assembler-times "nott" 1 } } */
/* { dg-final { scan-assembler-times "cmp/eq" 2 } } */
/* { dg-final { scan-assembler-times "cmp/hi" 4 } } */
/* { dg-final { scan-assembler-times "cmp/gt" 3 } } */
-/* { dg-final { scan-assembler-times "not\t" 1 } } */
+/* { dg-final { scan-assembler-not "not\t" } } */
#include "pr51244-20.c"
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c
index a9ded4635..aad6a2fd3 100644
--- a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c
+++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c
@@ -1,15 +1,15 @@
/* Check that the SH specific sh_treg_combine RTL optimization pass works as
expected. On SH2A the expected insns are slightly different, see
- pr51244-21.c. */
+ pr51244-20-sh2a.c. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */
-/* { dg-final { scan-assembler-times "tst" 6 } } */
-/* { dg-final { scan-assembler-times "movt" 1 } } */
+/* { dg-final { scan-assembler-times "tst" 7 } } */
+/* { dg-final { scan-assembler-times "movt" 2 } } */
/* { dg-final { scan-assembler-times "cmp/eq" 2 } } */
/* { dg-final { scan-assembler-times "cmp/hi" 4 } } */
/* { dg-final { scan-assembler-times "cmp/gt" 2 } } */
-/* { dg-final { scan-assembler-times "not\t" 1 } } */
+/* { dg-final { scan-assembler-not "not\t" } } */
/* non-SH2A: 2x tst, 1x movt, 2x cmp/eq, 1x cmp/hi
@@ -81,7 +81,7 @@ get_request_2 (int* q, int rw)
}
-/* 2x tst, 1x cmp/hi, 1x not */
+/* 3x tst, 1x movt, 1x cmp/hi, 1x not */
static inline int
blk_oversized_queue_5 (int* q)
{
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c
new file mode 100644
index 000000000..d3d93849b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c
@@ -0,0 +1,25 @@
+/* Check that the __builtin_strnlen returns 0 with with
+ non-constant 0 length. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern int snprintf(char *, int, const char *, ...);
+extern void abort (void);
+
+int main()
+ {
+ int i;
+ int cmp = 0;
+ char buffer[1024];
+ const char* s = "the string";
+
+ snprintf(buffer, 4, "%s", s);
+
+ for (i = 1; i < 4; i++)
+ cmp += __builtin_strncmp(buffer, s, i - 1);
+
+ if (cmp)
+ abort();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c
new file mode 100644
index 000000000..f18beadd9
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-additional-options "-std=c99" } */
+
+#include <assert.h>
+
+int decision_result;
+int val;
+int truecount = 0;
+
+static void __attribute__((noinline))
+buggy (int flag)
+{
+ int condition;
+ if(flag == 0)
+ condition = val != 0;
+ else
+ condition = !decision_result;
+ if (condition)
+ truecount++;
+}
+
+int
+main (void)
+{
+ decision_result = 1;
+ buggy(1);
+ assert (truecount == 0);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c
new file mode 100644
index 000000000..c0bc9116c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-additional-options "-std=c99" } */
+
+#include <assert.h>
+
+long long decision_result;
+long long val;
+int truecount = 0;
+
+static void __attribute__((noinline))
+buggy (int flag)
+{
+ int condition;
+ if(flag == 0)
+ condition = val != 0;
+ else
+ condition = !decision_result;
+ if (condition)
+ truecount++;
+}
+
+int
+main (void)
+{
+ decision_result = 1;
+ buggy(1);
+ assert (truecount == 0);
+ return 0;
+}