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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [pr27528.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* 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
}

powered by: WebSVN 2.1.0

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