1 /* The option -mslow-flash-data is just for performance tuning, it
2 doesn't totally disable the use of literal pools. But for below
3 simple cases, the use of literal pool should be replaced by
4 movw/movt or read-only constant pool. */
5
6 /* { dg-do compile } */
7 /* { dg-require-effective-target arm_cortex_m } */
8 /* { dg-require-effective-target arm_thumb2_ok } */
9 /* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */
10 /* { dg-options "-O2 -mthumb -mslow-flash-data" } */
11
12 float sf;
13 double df;
14 long long l;
15 static char *p = "Hello World";
16
17 float
18 testsf (float *p)
19 {
20 if (*p > 1.1234f)
21 return 2.1234f;
22 else
23 return 3.1234f;
24 }
25
26 double
27 testdf (double *p)
28 {
29 if (*p > 4.1234)
30 return 2.1234;
31 else
32 return 3.1234;
33 }
34
35 long long
36 testll (long long *p)
37 {
38 if (*p > 0x123456789ABCDEFll)
39 return 0x111111111ll;
40 else
41 return 0x222222222ll;
42 }
43
44 char *
45 testchar ()
46 {
47 return p + 4;
48 }
49
50 int
51 foo (int a, int b)
52 {
53 int i;
54 volatile int *labelref = &&label1;
55
56 if (a > b)
57 {
58 while (i < b)
59 {
60 a += *labelref;
61 i += 1;
62 }
63 goto *labelref;
64 }
65 else
66 b = b + 3;
67
68 a = a * b;
69
70 label1:
71 return a + b;
72 }
73
74 /* { dg-final { scan-assembler-not "\\.(float|l\\?double|\d?byte|short|int|long|quad|word)\\s+\[^.\]" } } */