This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch hjl/iamcu/improve in repository gcc.
commit 15a4eafd9170f50607ce3fa85015f7a73d577ea6 Author: H.J. Lu hjl.tools@gmail.com Date: Thu Jul 9 12:06:40 2015 -0700
Allow software FP SFmode in FP splitter
ix86_split_long_move can optimize floating point constant move, which can be used to optimize SFmode move with software floating point.
gcc/
PR target/66824 * config/i386/i386.c (ix86_split_to_parts): Allow SFmode move without 387, MMX nor SSE. (ix86_split_long_move): Support single move. * config/i386/i386.md (FP splitter): Allow SFmode without 387, MMX nor SSE.
gcc/testsuite/
PR target/66824 * gcc.target/i386/pr66824.c: New test. --- gcc/config/i386/i386.c | 18 +++++++++++++++++- gcc/config/i386/i386.md | 6 +++++- gcc/testsuite/gcc.target/i386/pr66824.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 785990a..57b8acc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -22745,7 +22745,13 @@ ix86_split_to_parts (rtx operand, rtx *parts, machine_mode mode) size = (GET_MODE_SIZE (mode) + 4) / 8;
gcc_assert (!REG_P (operand) || !MMX_REGNO_P (REGNO (operand))); - gcc_assert (size >= 2 && size <= 4); + /* For software floating point, we also optimize SFmode move. */ + gcc_assert ((size >= 2 + || (mode == SFmode + && !TARGET_80387 + && !TARGET_MMX + && !TARGET_SSE)) + && size <= 4);
/* Optimize constant pool reference to immediates. This is used by fp moves, that force all constants to memory to allow combining. */ @@ -22823,10 +22829,14 @@ ix86_split_to_parts (rtx operand, rtx *parts, machine_mode mode) case DFmode: REAL_VALUE_TO_TARGET_DOUBLE (r, l); break; + case SFmode: + REAL_VALUE_TO_TARGET_SINGLE (r, l[0]); + goto part0; default: gcc_unreachable (); } parts[1] = gen_int_mode (l[1], SImode); +part0: parts[0] = gen_int_mode (l[0], SImode); } else @@ -22933,6 +22943,12 @@ ix86_split_long_move (rtx operands[]) nparts = ix86_split_to_parts (operands[1], part[1], GET_MODE (operands[0])); ix86_split_to_parts (operands[0], part[0], GET_MODE (operands[0]));
+ if (nparts == 1) + { + emit_move_insn (part[0][0], part[1][0]); + return; + } + /* When emitting push, take care for source operands on the stack. */ if (push && MEM_P (operands[1]) && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1])) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index bc98389..0351c36 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -3507,7 +3507,11 @@ "reload_completed && (GET_MODE (operands[0]) == TFmode || GET_MODE (operands[0]) == XFmode - || GET_MODE (operands[0]) == DFmode) + || GET_MODE (operands[0]) == DFmode + || (GET_MODE (operands[0]) == SFmode + && !TARGET_80387 + && !TARGET_MMX + && !TARGET_SSE)) && !(ANY_FP_REG_P (operands[0]) || ANY_FP_REG_P (operands[1]))" [(const_int 0)] "ix86_split_long_move (operands); DONE;") diff --git a/gcc/testsuite/gcc.target/i386/pr66824.c b/gcc/testsuite/gcc.target/i38 [...] new file mode 100644 index 0000000..3511e4c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66824.c @@ -0,0 +1,29 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-sse -mno-mmx -mno-80387" } */ +/* { dg-final { scan-assembler-not ".LC[0-9]" } } */ + +double foo (float); + +double +f1 (void) +{ + return foo (1.0); +} + +double +f2 (void) +{ + return foo (0.0); +} + +void +f3 (float *x, float t) +{ + *x = 0.0 + t; +} + +float +f4 (void) +{ + return 1.0; +}