aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/fpul-usage-1.c
blob: 5c3bb196de0ffab276f069d0ae263c009f1c98a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 }  */
/* { 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;
}