| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mips16 -mcode-readable=yes" } */ |
| 3 |
/* { dg-skip-if "MIPS16 `casesi' loses at -Os" { *-*-* } { "-Os"} { "" } } */ |
| 4 |
|
| 5 |
int |
| 6 |
frob (int i) |
| 7 |
{ |
| 8 |
switch (i) |
| 9 |
{ |
| 10 |
case -5: |
| 11 |
return -2; |
| 12 |
case -3: |
| 13 |
return -1; |
| 14 |
case 0: |
| 15 |
return 0; |
| 16 |
case 3: |
| 17 |
return 1; |
| 18 |
case 5: |
| 19 |
break; |
| 20 |
default: |
| 21 |
__builtin_unreachable (); |
| 22 |
} |
| 23 |
return i; |
| 24 |
} |
| 25 |
|
| 26 |
/* Expect assembly like: |
| 27 |
|
| 28 |
la $2,$L4 |
| 29 |
# Anything goes here. |
| 30 |
.type __jump_frob_4, @object # Symbol # must match label. |
| 31 |
__jump_frob_4: # The symbol must match. |
| 32 |
$L4: # The label must match. |
| 33 |
.half $L3-$L4 # Or `.word'. The subtrahend |
| 34 |
.half $L2-$L4 # label must match thoughout |
| 35 |
.half $L9-$L4 # (repeated 11 times). |
| 36 |
.half $L2-$L4 # . |
| 37 |
.half $L2-$L4 # . |
| 38 |
.half $L8-$L4 # . |
| 39 |
.half $L2-$L4 # . |
| 40 |
.half $L2-$L4 # . |
| 41 |
.half $L7-$L4 # . |
| 42 |
.half $L2-$L4 # . |
| 43 |
.half $L8-$L4 # . |
| 44 |
.type __jend_frob_4, @function # Symbol # must match label. |
| 45 |
__jend_frob_4: # The symbol must match. |
| 46 |
.insn |
| 47 |
|
| 48 |
that is `__jump_*'/`__jend_*' symbols inserted around a jump table. */ |
| 49 |
|
| 50 |
/* { dg-final { scan-assembler "\tla\t\\\$\[0-9\]+,(.L(\[0-9\]+))\n.*\t\\.type\t(__jump_frob_\\2), @object\n\\3:\n\\1:\n(?:\t\\.(?:half|word)\t.L\[0-9\]+-\\1\n)\{11\}\t\\.type\t(__jend_frob_\\2), @function\n\\4:\n\t\\.insn\n" } } */ |