OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.dg/] [ext/] [asm1.C] - Diff between revs 301 and 384

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 384
// Check that the 3.1 named operand syntax can be used in template functions.
// Check that the 3.1 named operand syntax can be used in template functions.
struct arg1 {
struct arg1 {
  int value;
  int value;
  static const int info = 99;
  static const int info = 99;
};
};
struct arg2 {
struct arg2 {
  int value;
  int value;
  static const int info = 11;
  static const int info = 11;
};
};
template
template
int foo (void)
int foo (void)
{
{
  int i;
  int i;
  asm ("# foo on %[third] %[second] %[fourth] %[first]"
  asm ("# foo on %[third] %[second] %[fourth] %[first]"
       : [first] "=r" (i)
       : [first] "=r" (i)
       : [second] "i" (j),
       : [second] "i" (j),
         [third] "i" (j + 2),
         [third] "i" (j + 2),
         [fourth] "i" (100));
         [fourth] "i" (100));
  return i;
  return i;
}
}
template
template
TYPE bar (TYPE t)
TYPE bar (TYPE t)
{
{
  asm ("# bar on %[first] %[second] %[third]"
  asm ("# bar on %[first] %[second] %[third]"
       : [first] "=r" (t.value)
       : [first] "=r" (t.value)
       : [second] "i[first]" (t.value),
       : [second] "i[first]" (t.value),
         [third] "i" (t.info));
         [third] "i" (t.info));
  return t;
  return t;
}
}
template
template
struct S {
struct S {
  static void frob (TYPE t)
  static void frob (TYPE t)
  {
  {
    asm ("# frob on %[arg]" :: [arg] "i" (t.info));
    asm ("# frob on %[arg]" :: [arg] "i" (t.info));
  }
  }
};
};
void test ()
void test ()
{
{
  arg1 x;
  arg1 x;
  arg2 y;
  arg2 y;
  foo<42> ();
  foo<42> ();
  bar (x);
  bar (x);
  bar (y);
  bar (y);
  S::frob (x);
  S::frob (x);
}
}
// { dg-final { scan-assembler "foo on" } }
// { dg-final { scan-assembler "foo on" } }
// { dg-final { scan-assembler "bar on" } }
// { dg-final { scan-assembler "bar on" } }
// { dg-final { scan-assembler "frob on" } }
// { 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.