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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [ppc-switch-1.c] - Rev 691

Compare with Previous | Blame | View Log

/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-options "-O2 --param case-values-threshold=2" } */
/* { dg-final { scan-assembler "mtctr" } } */
/* { dg-final { scan-assembler "bctr" } } */
 
/* Force using a dispatch table even though by default we would generate
   ifs.  */
 
extern long call (long);
 
long
test_switch (long a, long b)
{
  long c;
 
  switch (a)
    {
    case 0:  c = -b;	break;
    case 1:  c = ~b;	break;
    case 2:  c = b+1;	break;
    default: c = b & 9;	break;
    }
 
  return call (c) + 1;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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