* [SH][committed] Add some test cases for PR 59478
@ 2015-09-21 4:52 Oleg Endo
0 siblings, 0 replies; only message in thread
From: Oleg Endo @ 2015-09-21 4:52 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
Hi,
This adds some known-to-work test cases from the PR.
Tested on sh-elf with
make -k check-gcc RUNTESTFLAGS="sh.exp=pr59478.c --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r227958.
Cheers,
Oleg
gcc/testsuite/ChangeLog:
PR target/59478
* gcc.target/sh/pr59478.c: New.
[-- Attachment #2: sh_pr59478_test.patch --]
[-- Type: text/x-patch, Size: 1367 bytes --]
Index: gcc/testsuite/gcc.target/sh/pr59478.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr59478.c (revision 0)
+++ gcc/testsuite/gcc.target/sh/pr59478.c (working copy)
@@ -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;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-21 1:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-21 4:52 [SH][committed] Add some test cases for PR 59478 Oleg Endo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).