comparison gcc/testsuite/gcc.c-torture/compile/pr27528.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Check that constant constraints like "i", "n" and "s" can be used in
2 cases where the operand is an initializer constant. */
3 /* { dg-require-effective-target nonpic } */
4
5 int x[2] = { 1, 2 };
6
7 #ifdef __OPTIMIZE__
8 static inline void __attribute__((__always_inline__))
9 insn1 (int x)
10 {
11 asm volatile ("" :: "n" (x), "i" (x));
12 }
13
14 static inline void __attribute__((__always_inline__))
15 insn2 (const void *x)
16 {
17 asm volatile ("" :: "s" (x), "i" (x));
18 }
19 #endif
20
21 void
22 foo (void)
23 {
24 #ifdef __OPTIMIZE__
25 insn1 (2);
26 insn1 (2);
27 insn1 (400);
28 insn1 (__LINE__);
29 insn2 (x);
30 insn2 (x);
31 insn2 (&x[1]);
32 insn2 ("string");
33 #endif
34 asm volatile ("" :: "s" (x), "i" (x));
35 /* At the time of writing, &x[1] is decomposed before reaching expand
36 when compiling with -O0. */
37 asm volatile ("" :: "s" ("string"), "i" ("string"));
38 asm volatile ("" :: "s" (__FILE__), "i" (__FILE__));
39 asm volatile ("" :: "s" (__FUNCTION__), "i" (__FUNCTION__));
40 }