From 21da84bd5e7c0b1f2bdfa28429b066a098307f44 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 14 Sep 2007 21:24:26 +0200 Subject: [PATCH] re PR target/33438 (ICE in cselib_record_set, at cselib.c:1515 on x86) PR target/33438 * config/i386/i386.md (fmodxf3): Copy operands[2] to temporary register when operands[2] equals operands[1]. (remainderxf3): Ditto. testsuite/ChangeLog: PR target/33438 * gcc.target/i386/pr33438.c: New test. From-SVN: r128502 --- gcc/ChangeLog | 10 +++++++-- gcc/config/i386/i386.md | 28 +++++++++++++++++++------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr33483.c | 12 +++++++++++ 4 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr33483.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c51ce01730e..728309eda9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-09-14 Uros Bizjak + + PR target/33438 + * config/i386/i386.md (fmodxf3): Copy operands[2] to temporary register + when operands[2] equals operands[1]. + (remainderxf3): Ditto. + 2007-09-14 Sandra Loosemore Nigel Stephens @@ -1191,8 +1198,7 @@ (lshr3): Ditto. (ashl3): Ditto. (vec_shl_): Use const_0_to_255_mul_8_operand predicate for op2. - (vec_shr_): Use const_0_to_255_mul_8_operand predicate for op2. - + (vec_shr_): Ditto. * gcc/config/i386/i386.c (ix86_expand_builtin) [IX86_BUILTIN_PSLL?128, IX86_BUILTIN_PSRA*?128, IX86_BUILTIN_PSRL?128]: Convert op1 to SImode. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a0e0c821705..622686beeaf 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -16691,10 +16691,18 @@ { rtx label = gen_label_rtx (); - emit_label (label); + rtx op2; - emit_insn (gen_fpremxf4_i387 (operands[1], operands[2], - operands[1], operands[2])); + if (rtx_equal_p (operands[1], operands[2])) + { + op2 = gen_reg_rtx (XFmode); + emit_move_insn (op2, operands[2]); + } + else + op2 = operands[2]; + + emit_label (label); + emit_insn (gen_fpremxf4_i387 (operands[1], op2, operands[1], op2)); ix86_emit_fp_unordered_jump (label); LABEL_NUSES (label) = 1; @@ -16755,10 +16763,18 @@ { rtx label = gen_label_rtx (); - emit_label (label); + rtx op2; - emit_insn (gen_fprem1xf4_i387 (operands[1], operands[2], - operands[1], operands[2])); + if (rtx_equal_p (operands[1], operands[2])) + { + op2 = gen_reg_rtx (XFmode); + emit_move_insn (op2, operands[2]); + } + else + op2 = operands[2]; + + emit_label (label); + emit_insn (gen_fprem1xf4_i387 (operands[1], op2, operands[1], op2)); ix86_emit_fp_unordered_jump (label); LABEL_NUSES (label) = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9c18500cc7c..884f3f93984 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-09-14 Uros Bizjak + + PR target/33438 + * gcc.target/i386/pr33438.c: New test. + 2007-09-14 Francois-Xavier Coudert * gfortran.dg/nint_2.f90: Revert previous commit. diff --git a/gcc/testsuite/gcc.target/i386/pr33483.c b/gcc/testsuite/gcc.target/i386/pr33483.c new file mode 100644 index 00000000000..8fe2a946bba --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr33483.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +long double f1 (long double x) +{ + return __builtin_fmodl (x, x); +} + +long double f2 (long double x) +{ + return __builtin_remainderl (x, x); +}