OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [arm/] [long-calls-1.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* Check that long calls to different sections are not optimized to "bl".  */
2
/* { dg-do compile { target { arm32 && nonpic } } } */
3
/* { dg-options "-O2" } */
4
/* This test expects that short calls are the default.  */
5
/* { dg-skip-if "-mlong-calls in use" { "*-*-*" } { "-mlong-calls" } { "" } } */
6
 
7
#define section(S) __attribute__((section(S)))
8
#define weak __attribute__((weak))
9
#define noinline __attribute__((noinline))
10
#define long_call __attribute__((long_call))
11
#define short_call __attribute__((short_call))
12
 
13
#define REMOTE_CALL(ID, TARGET_ATTRS, CALL_ATTRS)                       \
14
  const char *TARGET_ATTRS ID (void);                                   \
15
  const char *CALL_ATTRS call_##ID (void) { return ID () + 1; }
16
 
17
#define EXTERN_CALL(ID, TARGET_ATTRS, CALL_ATTRS)                       \
18
  const char *TARGET_ATTRS noinline ID (void) { return #ID; }           \
19
  const char *CALL_ATTRS call_##ID (void) { return ID () + 1; }         \
20
  const char *CALL_ATTRS sibcall_##ID (void) { return ID (); }
21
 
22
#define STATIC_CALL(ID, TARGET_ATTRS, CALL_ATTRS)                       \
23
  static const char *TARGET_ATTRS noinline ID (void) { return #ID; }    \
24
  const char *CALL_ATTRS call_##ID (void) { return ID () + 1; }         \
25
  const char *CALL_ATTRS sibcall_##ID (void) { return ID (); }
26
 
27
#define DO_TESTS_SECTION(ID, TEST, TARGET_ATTRS)                        \
28
  TEST (ID##1, TARGET_ATTRS, )                                          \
29
  TEST (ID##2, TARGET_ATTRS section (".test.a"), section (".test.b"))   \
30
  TEST (ID##3, TARGET_ATTRS section (".test.c"), section (".test.c"))
31
 
32
#define DO_TESTS_CALL_ATTR(ID, TEST, TARGET_ATTRS)                      \
33
  DO_TESTS_SECTION (ID##n, TEST, TARGET_ATTRS)                          \
34
  DO_TESTS_SECTION (ID##l, TEST, TARGET_ATTRS long_call)                \
35
  DO_TESTS_SECTION (ID##s, TEST, TARGET_ATTRS short_call)
36
 
37
DO_TESTS_CALL_ATTR (remote_, REMOTE_CALL,)
38
DO_TESTS_CALL_ATTR (strong_, EXTERN_CALL,)
39
DO_TESTS_CALL_ATTR (weak_, EXTERN_CALL, weak)
40
DO_TESTS_CALL_ATTR (static_, STATIC_CALL,)
41
 
42
 
43
/* Calls to remote_* should honor the call type attribute,
44
   with "short" being the default.
45
 
46
   In the regular expressions below:
47
 
48
   * We allow both "b" and "bl" in some cases to allow for the
49
     possibility of sibling calls.  As of this writing, GCC does not
50
     use sibling calls in Thumb-2 mode.  */
51
 
52
/* { dg-final { scan-assembler "\tbl\tremote_n1\n" } } */
53
/* { dg-final { scan-assembler "\tbl\tremote_n2\n" } } */
54
/* { dg-final { scan-assembler "\tbl\tremote_n3\n" } } */
55
 
56
/* { dg-final { scan-assembler-not "\tbl\tremote_l1\n" } } */
57
/* { dg-final { scan-assembler-not "\tbl\tremote_l2\n" } } */
58
/* { dg-final { scan-assembler-not "\tbl\tremote_l3\n" } } */
59
 
60
/* { dg-final { scan-assembler "\tbl\tremote_s1\n" } } */
61
/* { dg-final { scan-assembler "\tbl\tremote_s2\n" } } */
62
/* { dg-final { scan-assembler "\tbl\tremote_s3\n" } } */
63
 
64
 
65
/* Calls to strong_*2 calls should honor the call type attribute,
66
   with "short" being the default.  Calls to other strong_* functions
67
   should be short.  */
68
 
69
/* { dg-final { scan-assembler "\tbl\tstrong_n1\n" } } */
70
/* { dg-final { scan-assembler "\tbl?\tstrong_n1\n" } } */
71
/* { dg-final { scan-assembler "\tbl\tstrong_n2\n" } } */
72
/* { dg-final { scan-assembler "\tbl?\tstrong_n2\n" } } */
73
/* { dg-final { scan-assembler "\tbl\tstrong_n3\n" } } */
74
/* { dg-final { scan-assembler "\tbl?\tstrong_n3\n" } } */
75
 
76
/* { dg-final { scan-assembler "\tbl\tstrong_l1\n" } } */
77
/* { dg-final { scan-assembler "\tbl?\tstrong_l1\n" } } */
78
/* { dg-final { scan-assembler-not "\tbl?\tstrong_l2\n" } } */
79
/* { dg-final { scan-assembler "\tbl\tstrong_l3\n" } } */
80
/* { dg-final { scan-assembler "\tbl?\tstrong_l3\n" } } */
81
 
82
/* { dg-final { scan-assembler "\tbl\tstrong_s1\n" } } */
83
/* { dg-final { scan-assembler "\tbl?\tstrong_s1\n" } } */
84
/* { dg-final { scan-assembler "\tbl\tstrong_s2\n" } } */
85
/* { dg-final { scan-assembler "\tbl?\tstrong_s2\n" } } */
86
/* { dg-final { scan-assembler "\tbl\tstrong_s3\n" } } */
87
/* { dg-final { scan-assembler "\tbl?\tstrong_s3\n" } } */
88
 
89
 
90
/* Calls to weak_* should honor the call type attribute,
91
   with "short" being the default.  */
92
 
93
/* { dg-final { scan-assembler "\tbl\tweak_n1\n" } } */
94
/* { dg-final { scan-assembler "\tbl?\tweak_n1\n" } } */
95
/* { dg-final { scan-assembler "\tbl\tweak_n2\n" } } */
96
/* { dg-final { scan-assembler "\tbl?\tweak_n2\n" } } */
97
/* { dg-final { scan-assembler "\tbl\tweak_n3\n" } } */
98
/* { dg-final { scan-assembler "\tbl?\tweak_n3\n" } } */
99
 
100
/* { dg-final { scan-assembler-not "\tbl?\tweak_l1\n" } } */
101
/* { dg-final { scan-assembler-not "\tbl?\tweak_l2\n" } } */
102
/* { dg-final { scan-assembler-not "\tbl?\tweak_l3\n" } } */
103
 
104
/* { dg-final { scan-assembler "\tbl\tweak_s1\n" } } */
105
/* { dg-final { scan-assembler "\tbl?\tweak_s1\n" } } */
106
/* { dg-final { scan-assembler "\tbl\tweak_s2\n" } } */
107
/* { dg-final { scan-assembler "\tbl?\tweak_s2\n" } } */
108
/* { dg-final { scan-assembler "\tbl\tweak_s3\n" } } */
109
/* { dg-final { scan-assembler "\tbl?\tweak_s3\n" } } */
110
 
111
 
112
/* Calls to static_*2 calls should honor the call type attribute,
113
   with "short" being the default.  Calls to other static_* functions
114
   should be short.  */
115
 
116
/* { dg-final { scan-assembler "\tbl\tstatic_n1\n" } } */
117
/* { dg-final { scan-assembler "\tbl?\tstatic_n1\n" } } */
118
/* { dg-final { scan-assembler "\tbl\tstatic_n2\n" } } */
119
/* { dg-final { scan-assembler "\tbl?\tstatic_n2\n" } } */
120
/* { dg-final { scan-assembler "\tbl\tstatic_n3\n" } } */
121
/* { dg-final { scan-assembler "\tbl?\tstatic_n3\n" } } */
122
 
123
/* { dg-final { scan-assembler "\tbl\tstatic_l1\n" } } */
124
/* { dg-final { scan-assembler "\tbl?\tstatic_l1\n" } } */
125
/* { dg-final { scan-assembler-not "\tbl?\tstatic_l2\n" } } */
126
/* { dg-final { scan-assembler "\tbl\tstatic_l3\n" } } */
127
/* { dg-final { scan-assembler "\tbl?\tstatic_l3\n" } } */
128
 
129
/* { dg-final { scan-assembler "\tbl\tstatic_s1\n" } } */
130
/* { dg-final { scan-assembler "\tbl?\tstatic_s1\n" } } */
131
/* { dg-final { scan-assembler "\tbl\tstatic_s2\n" } } */
132
/* { dg-final { scan-assembler "\tbl?\tstatic_s2\n" } } */
133
/* { dg-final { scan-assembler "\tbl\tstatic_s3\n" } } */
134
/* { dg-final { scan-assembler "\tbl?\tstatic_s3\n" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.