1 /* PR tree-optimization/56094 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -g -fdump-tree-optimized-lineno" } */
4 
5 _Bool cond;
6 
7 int
8 fn0 (unsigned char, unsigned long long, unsigned char,
9      unsigned char, signed short, unsigned int,
10      unsigned char *);
11 
12 extern void fn3 (unsigned char, unsigned char, unsigned char, unsigned char,
13 		 unsigned char, unsigned char, unsigned char, unsigned short);
14 extern void fn7 (int);
15 extern void fn8 (int);
16 
17 static __inline__ __attribute__ ((always_inline)) void
fn1(unsigned char arg0,unsigned char arg1,unsigned char arg2,unsigned char arg3,unsigned char arg4,unsigned char arg5,unsigned short arg6)18 fn1 (unsigned char arg0, unsigned char arg1, unsigned char arg2,
19      unsigned char arg3, unsigned char arg4, unsigned char arg5,
20      unsigned short arg6)
21 {
22   asm volatile ("" :: "g" ((unsigned long long) arg0), "g" (arg1),
23 		      "g" (arg2), "g" (arg3), "g" (arg4), "g" (arg5),
24 		      "g" (arg6));
25   if (cond)
26     {
27       unsigned char loc0 = 0;
28       fn3 (loc0, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
29     }
30 }
31 
32 static __inline__ __attribute__ ((always_inline)) void
fn4(unsigned int arg0,unsigned long long arg1)33 fn4 (unsigned int arg0, unsigned long long arg1)
34 {
35   asm volatile ("" :: "g" (arg0), "g" (arg1));
36 }
37 
38 static __inline__ __attribute__ ((always_inline)) void
fn5(unsigned int arg0,unsigned char arg1,unsigned int arg2,unsigned char arg3)39 fn5 (unsigned int arg0, unsigned char arg1, unsigned int arg2,
40      unsigned char arg3)
41 {
42   asm volatile ("" :: "g" (arg0), "g" (arg1),
43 		      "g" ((unsigned long long) arg2), "g" (arg3));
44 }
45 
46 static __inline__ __attribute__ ((always_inline)) void
fn6(unsigned long long arg0,unsigned char arg1,unsigned char arg2,signed short arg3,unsigned int arg4,unsigned char * arg5)47 fn6 (unsigned long long arg0, unsigned char arg1,
48      unsigned char arg2, signed short arg3,
49      unsigned int arg4, unsigned char * arg5)
50 {
51   asm volatile ("" :: "g" (arg0), "g" ((unsigned long long) arg1),
52 		      "g" ((unsigned long long) arg2), "g" (arg3),
53 		      "g" (arg4), "g" (arg5));
54   if (cond)
55     {
56       unsigned char loc0 = 0;
57       fn0 (loc0, arg0, arg1, arg2, arg3, arg4, arg5);
58     }
59 }
60 
61 unsigned char b[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa };
62 unsigned int q = sizeof (b) / sizeof (b[0]);
63 
64 void
foo()65 foo ()
66 {
67   int i;
68   for (i = 1; i <= 50; i++)
69     {
70       fn6 (i + 0x1234, i + 1, i + 0xa, i + 0x1234, q, b);
71       fn5 (i + 0xabcd, i << 1, i + 0x1234, i << 2);
72       fn7 (i + 0xdead);
73       fn8 (i + 0xdead);
74       fn1 (i, i + 1, i + 2, i + 3, i + 4, i + 5, i << 10);
75       fn4 (i + 0xfeed, i);
76     }
77 }
78 
79 /* Verify no statements get the location of the foo () decl.  */
80 /* { dg-final { scan-tree-dump-not " : 65:1\\\]" "optimized" } } */
81 /* { dg-final { cleanup-tree-dump "optimized" } } */
82