| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-mips16 -mcode-readable=yes" } */ |
| 3 |
|
| 4 |
/* PR tree-optimization/51513 verification variant for MIPS16, #1. */ |
| 5 |
|
| 6 |
int __attribute__ ((weak)) |
| 7 |
frob (int i) |
| 8 |
{ |
| 9 |
switch (i) |
| 10 |
{ |
| 11 |
case -5: |
| 12 |
return -2; |
| 13 |
case -3: |
| 14 |
return -1; |
| 15 |
case 0: |
| 16 |
return 0; |
| 17 |
case 3: |
| 18 |
return 1; |
| 19 |
case 5: |
| 20 |
break; |
| 21 |
default: |
| 22 |
__builtin_unreachable (); |
| 23 |
} |
| 24 |
return i; |
| 25 |
} |
| 26 |
|
| 27 |
/* Without the fix for PR tree-optimization/51513 truncated code |
| 28 |
would be emitted for `frob', like: |
| 29 |
|
| 30 |
.text |
| 31 |
.align 2 |
| 32 |
.weak frob |
| 33 |
.set mips16 |
| 34 |
.set nomicromips |
| 35 |
.ent frob |
| 36 |
.type frob, @function |
| 37 |
frob: |
| 38 |
.frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 |
| 39 |
.mask 0x00000000,0 |
| 40 |
.fmask 0x00000000,0 |
| 41 |
addiu $2,$4,5 |
| 42 |
.end frob |
| 43 |
.size frob, .-frob |
| 44 |
|
| 45 |
meaning `frob' will have no chance to return, let alone produce |
| 46 |
the result expected. */ |
| 47 |
|
| 48 |
/* { dg-final { scan-assembler "\tjrc?\t\\\$31\n" } } */ |