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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [arm/] [long-calls-2.c] - Blame information for rev 826

Details | Compare with Previous | View Log

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