aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOleg Endo <olegendo@gcc.gnu.org>2015-09-21 01:43:50 +0000
committerOleg Endo <olegendo@gcc.gnu.org>2015-09-21 01:43:50 +0000
commit1383eae791fc8ac120e0e79d878713fcdd4af653 (patch)
tree83fe794c22d0b23417ef95001c0d6de8c17c0e7e /gcc
parent0a775f1a4b4f95182b801969178c2dea7aeac3bf (diff)
downloadgcc-1383eae791fc8ac120e0e79d878713fcdd4af653.zip
gcc-1383eae791fc8ac120e0e79d878713fcdd4af653.tar.gz
gcc-1383eae791fc8ac120e0e79d878713fcdd4af653.tar.bz2
re PR tree-optimization/59478 (Optimize variable access via byte copy)
gcc/testsuite/ PR target/59478 * gcc.target/sh/pr59478.c: New. From-SVN: r227958
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/sh/pr59478.c49
2 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 752bac6..5abe438 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2015-09-21 Oleg Endo <olegendo@gcc.gnu.org>
+ PR target/59478
+ * gcc.target/sh/pr59478.c: New.
+
+2015-09-21 Oleg Endo <olegendo@gcc.gnu.org>
+
PR target/67126
* gcc.target/sh/pr51244-12.c: Adjust testcase.
* gcc.target/sh/pr54236-2.c: Likewise.
diff --git a/gcc/testsuite/gcc.target/sh/pr59478.c b/gcc/testsuite/gcc.target/sh/pr59478.c
new file mode 100644
index 0000000..f2de9e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr59478.c
@@ -0,0 +1,49 @@
+/* Verify that the fmac insn is used for the standard fmaf function. */
+/* { dg-do compile { target { any_fpu } } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "fpul" 8 } } */
+/* { dg-final { scan-assembler-times "\tflds\tfr" 2 } } */
+/* { dg-final { scan-assembler-times "\tsts\tfpul" 2 } } */
+/* { dg-final { scan-assembler-times "\tlds\tr" 2 } } */
+/* { dg-final { scan-assembler-times "\tfsts\tfpul" 2 } } */
+/* { dg-final { scan-assembler-not "mov" } } */
+
+int
+test_00 (float val)
+{
+ char valbytes[sizeof (float)];
+ __builtin_memcpy (valbytes, &val, sizeof (float));
+
+ int result;
+ __builtin_memcpy (&result, valbytes, sizeof (int));
+
+ return result;
+}
+
+float
+test_01 (int val)
+{
+ char valbytes[sizeof (int)];
+ __builtin_memcpy (valbytes, &val, sizeof (int));
+
+ float result;
+ __builtin_memcpy (&result, valbytes, sizeof (float));
+
+ return result;
+}
+
+int
+test_02 (float val)
+{
+ union { int i; float f; } tmp;
+ tmp.f = val;
+ return tmp.i;
+}
+
+float
+test_03 (int val)
+{
+ union { int i; float f; } tmp;
+ tmp.i = val;
+ return tmp.f;
+}