summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/noreorder.c
blob: 7d40a2958a4afe8213705c3eb1ed81f3dbb6e570 (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
/* { dg-do compile } */
/* { dg-options "-O2" } */

/* The function order in this file is opposite from what the cgraph
   topological sort would output. So we can check the order is preserved. */

extern void f2(int);
static int func2(void);

#ifndef NOREORDER
#define NOREORDER __attribute__((no_reorder))
#endif

asm("firstasm");

NOREORDER __attribute__((noinline)) int bozo(void)
{
  f2(3);
  func2();
}

asm("jukjuk");

NOREORDER __attribute__((noinline)) static int func1(void)
{
  f2(1);
}

asm("barbar");

NOREORDER __attribute__((noinline)) static int func2(void)
{
  func1();
}

asm("lastasm");

/* { dg-final { scan-assembler "firstasm.*bozo.*jukjuk.*func1.*barbar.*func2.*lastasm" } } */