Testcase for PR71785

gcc/testsuite/
	PR rtl-optimization/71785
	* gcc.target/powerpc/pr71785.c: New file.

From-SVN: r242665
This commit is contained in:
Segher Boessenkool 2016-11-21 16:15:21 +01:00 committed by Segher Boessenkool
parent e0e7aa34ab
commit e51482c9c8
2 changed files with 57 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2016-11-21 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/71785
* gcc.target/powerpc/pr71785.c: New file.
2016-11-21 Bin Cheng <bin.cheng@arm.com> 2016-11-21 Bin Cheng <bin.cheng@arm.com>
PR testsuite/78114 PR testsuite/78114

View File

@ -0,0 +1,52 @@
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-not {\mb\M} } } */
/* Check that all computed gotos in this testcase end up unfactored completely.
If some is not there will be a unconditional jump left; if all works fine,
all are gone. */
typedef enum opcode
{
OP_A,
OP_B,
OP_END
} opcode;
typedef struct op
{
opcode opcode;
int arg;
} op;
extern void do_stuff_b(int arg);
extern void do_stuff_c(int arg);
extern int someglobal;
void
eval(op *op)
{
static const void *dispatch_table[] = {
&&CASE_OP_A,
&&CASE_OP_B,
&&CASE_OP_C,
&&CASE_OP_END
};
goto *dispatch_table[op->opcode];
CASE_OP_A:
someglobal++;
op++;
goto *dispatch_table[op->opcode];
CASE_OP_B:
do_stuff_b(op->arg);
op++;
goto *dispatch_table[op->opcode];
CASE_OP_C:
do_stuff_c(op->arg);
op++;
goto *dispatch_table[op->opcode];
CASE_OP_END:
return;
}