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-options "-O2 -mthumb -mslow-flash-data" } */
10
11 float sf;
12 double df;
13 long long l;
14 static char *p = "Hello World";
15
16 float
testsf(float * p)17 testsf (float *p)
18 {
19 if (*p > 1.1234f)
20 return 2.1234f;
21 else
22 return 3.1234f;
23 }
24
25 double
testdf(double * p)26 testdf (double *p)
27 {
28 if (*p > 4.1234)
29 return 2.1234;
30 else
31 return 3.1234;
32 }
33
34 long long
testll(long long * p)35 testll (long long *p)
36 {
37 if (*p > 0x123456789ABCDEFll)
38 return 0x111111111ll;
39 else
40 return 0x222222222ll;
41 }
42
43 char *
testchar()44 testchar ()
45 {
46 return p + 4;
47 }
48
49 int
foo(int a,int b)50 foo (int a, int b)
51 {
52 int i;
53 volatile int *labelref = &&label1;
54
55 if (a > b)
56 {
57 while (i < b)
58 {
59 a += *labelref;
60 i += 1;
61 }
62 goto *labelref;
63 }
64 else
65 b = b + 3;
66
67 a = a * b;
68
69 label1:
70 return a + b;
71 }
72
73 /* { dg-final { scan-assembler-not "\\.(float|l\\?double|\d?byte|short|int|long|quad|word)\\s+\[^.\]" } } */
74