diff mbox

[SH] Add FPUL usage testcase

Message ID 1331766927.1876.112.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo March 14, 2012, 11:15 p.m. UTC
On Thu, 2012-03-15 at 08:12 +0900, Kaz Kojima wrote:
> Oleg Endo <oleg.endo@t-online.de> wrote:
> > I'd like to add an SH target testcase which is supposed to check the
> > usage of the FPUL register when float values are treated as int and vice
> > versa.  Does this make sense?
> > 
> > Tested against rev 185360 with the usual 
> > 
> > make -k check RUNTESTFLAGS="--target_board=sh-sim
> > \{-m2/-ml,-m2/-mb,-m2a-single/-mb,
> > -m4-single/-ml,-m4-single/-mb,
> > -m4a-single/-ml,-m4a-single/-mb}"
> > 
> > and individually with some of the sub-target variations that do not have
> > an FPU (for which the test is skipped).
> 
> ENOPATCH.  Sounds a good idea though.

Argh, sorry .. now there is.

Comments

Kaz Kojima March 14, 2012, 11:49 p.m. UTC | #1
Oleg Endo <oleg.endo@t-online.de> wrote:
>>> I'd like to add an SH target testcase which is supposed to check the
>>> usage of the FPUL register when float values are treated as int and vice
>>> versa.  Does this make sense?
>>> 
>>> Tested against rev 185360 with the usual 
>>> 
>>> make -k check RUNTESTFLAGS="--target_board=sh-sim
>>> \{-m2/-ml,-m2/-mb,-m2a-single/-mb,
>>> -m4-single/-ml,-m4-single/-mb,
>>> -m4a-single/-ml,-m4a-single/-mb}"
>>> 
>>> and individually with some of the sub-target variations that do not have
>>> an FPU (for which the test is skipped).
>> 
>> ENOPATCH.  Sounds a good idea though.
> 
> Argh, sorry .. now there is.

This patch is OK.

Regards,
	kaz
diff mbox

Patch

Index: gcc/testsuite/gcc.target/sh/fpul-usage-1.c
===================================================================
--- gcc/testsuite/gcc.target/sh/fpul-usage-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/fpul-usage-1.c	(revision 0)
@@ -0,0 +1,24 @@ 
+/* Check that the FPUL register is used when reading a float as an int and
+   vice versa, as opposed to pushing and popping the values over the stack.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler "fpul" } } */
+/* { dg-final { scan-assembler-not "r15" } } */
+
+int
+float_as_int (float val)
+{
+  union { float f; int i; } u;
+  u.f = val;
+  return u.i;
+}
+
+float
+int_as_float (int val)
+{
+  union { float f; int i; } u;
+  u.i = val;
+  return u.f;
+}
+