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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [ext/] [asm1.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// Check that the 3.1 named operand syntax can be used in template functions.
2
 
3
struct arg1 {
4
  int value;
5
  static const int info = 99;
6
};
7
 
8
struct arg2 {
9
  int value;
10
  static const int info = 11;
11
};
12
 
13
template
14
int foo (void)
15
{
16
  int i;
17
  asm ("# foo on %[third] %[second] %[fourth] %[first]"
18
       : [first] "=r" (i)
19
       : [second] "i" (j),
20
         [third] "i" (j + 2),
21
         [fourth] "i" (100));
22
  return i;
23
}
24
 
25
template
26
TYPE bar (TYPE t)
27
{
28
  asm ("# bar on %[first] %[second] %[third]"
29
       : [first] "=r" (t.value)
30
       : [second] "i[first]" (t.value),
31
         [third] "i" (t.info));
32
  return t;
33
}
34
 
35
template
36
struct S {
37
  static void frob (TYPE t)
38
  {
39
    asm ("# frob on %[arg]" :: [arg] "i" (t.info));
40
  }
41
};
42
 
43
void test ()
44
{
45
  arg1 x;
46
  arg2 y;
47
 
48
  foo<42> ();
49
  bar (x);
50
  bar (y);
51
  S::frob (x);
52
}
53
 
54
// { dg-final { scan-assembler "foo on" } }
55
// { dg-final { scan-assembler "bar on" } }
56
// { dg-final { scan-assembler "frob on" } }

powered by: WebSVN 2.1.0

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