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-2.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do compile { target { powerpc*-*-* } } } */
2
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3
/* { dg-options "-O2 --param case-values-threshold=20" } */
4
/* { dg-final { scan-assembler-not "mtctr" } } */
5
/* { dg-final { scan-assembler-not "bctr" } } */
6
 
7
/* Force using if tests, instead of a dispatch table.  */
8
 
9
extern long call (long);
10
 
11
long
12
test_switch (long a, long b)
13
{
14
  long c;
15
 
16
  switch (a)
17
    {
18
    case 0:  c = -b;     break;
19
    case 1:  c = ~b;    break;
20
    case 2:  c = b+1;   break;
21
    case 3:  c = b-2;   break;
22
    case 4:  c = b*3;   break;
23
    case 5:  c = b/4;   break;
24
    case 6:  c = b<<5;  break;
25
    case 7:  c = b>>6;  break;
26
    case 8:  c = b|7;   break;
27
    case 9:  c = b^8;   break;
28
    default: c = b&9;   break;
29
    }
30
 
31
  return call (c) + 1;
32
}

powered by: WebSVN 2.1.0

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