aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data.c
blob: 9852ea5d0bdeae79010ddf02e68a3769f4915036 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* The option -mslow-flash-data is just for performance tuning, it
   doesn't totally disable the use of literal pools.  But for below
   simple cases, the use of literal pool should be replaced by
   movw/movt or read-only constant pool.  */

/* { dg-do compile } */
/* { dg-require-effective-target arm_cortex_m } */
/* { dg-require-effective-target arm_thumb2_ok } */
/* { dg-options "-O2 -mthumb -mslow-flash-data" } */

float sf;
double df;
long long l;
static char *p = "Hello World";

float
testsf (float *p)
{
  if (*p > 1.1234f)
    return 2.1234f;
  else
    return 3.1234f;
}

double
testdf (double *p)
{
  if (*p > 4.1234)
    return 2.1234;
  else
    return 3.1234;
}

long long
testll (long long *p)
{
  if (*p > 0x123456789ABCDEFll)
    return 0x111111111ll;
  else
    return 0x222222222ll;
}

char *
testchar ()
{
  return p + 4;
}

int
foo (int a, int b)
{
  int i;
  volatile *labelref = &&label1;

  if (a > b)
    {
      while (i < b)
	{
	  a += *labelref;
	  i += 1;
	}
      goto *labelref;
    }
  else
    b = b + 3;

  a = a * b;

label1:
  return a + b;
}

/* { dg-final { scan-assembler-times "movt" 13 } } */
/* { dg-final { scan-assembler-times "movt.*LC0\\+4" 1 } } */