From e3d59c5e7359daaaafcffed4e1c39d5558bca5a4 Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Mon, 1 Sep 2014 22:25:09 +0000 Subject: [PATCH] re PR target/62312 ([SH] Invalid operands for opcode div0s) gcc/ PR target/62312 * config/sh/sh.md (*cmp_div0s_0): Add missing constraints. gcc/testsuite/ PR target/62312 * gcc.c-torture/compile/pr62312.c: New. From-SVN: r214804 --- gcc/ChangeLog | 5 ++++ gcc/config/sh/sh.md | 4 ++-- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.c-torture/compile/pr62312.c | 23 +++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr62312.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce0f3bbec94..f8aa0f36424 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-01 Oleg Endo + + PR target/62312 + * config/sh/sh.md (*cmp_div0s_0): Add missing constraints. + 2014-09-01 Andi Kleen * file-find.c (add_prefix_begin): Add. diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 3f92737b85b..a7155308377 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -869,9 +869,9 @@ (define_insn "*cmp_div0s_0" [(set (reg:SI T_REG) - (eq:SI (lshiftrt:SI (match_operand:SI 0 "arith_reg_operand") + (eq:SI (lshiftrt:SI (match_operand:SI 0 "arith_reg_operand" "%r") (const_int 31)) - (ge:SI (match_operand:SI 1 "arith_reg_operand") + (ge:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0))))] "TARGET_SH1" "div0s %0,%1" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 936bfacf97d..7dcb6e7421f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-01 Oleg Endo + + PR target/62312 + * gcc.c-torture/compile/pr62312.c: New. + 2014-09-01 Maciej W. Rozycki * gcc.dg/tree-ssa/loop-19.c: Exclude classic FPU Power targets. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr62312.c b/gcc/testsuite/gcc.c-torture/compile/pr62312.c new file mode 100644 index 00000000000..2e87bb9bd93 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr62312.c @@ -0,0 +1,23 @@ +/* PR target/62312 */ + +typedef struct { unsigned int arg[100]; } *FunctionCallInfo; +typedef struct { int day; int month; } Interval; +void* palloc (unsigned int); +int bar (void); +void baz (void); + +void +interval_pl (FunctionCallInfo fcinfo) +{ + Interval *span1 = ((Interval *) ((char *) ((fcinfo->arg[0])))); + Interval *span2 = ((Interval *) ((char *) ((fcinfo->arg[1])))); + Interval *result = (Interval *) palloc (sizeof (Interval)); + + if ((((span1->month) < 0) == ((span2->month) < 0)) + && !(((result->month) < 0) == ((span1->month) < 0))) + do { + if (bar ()) + baz (); + } while(0); + result->day = span1->day + span2->day; +} -- 2.30.2