This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Do not emit x87 FP reg-stack compensation pops from output_fp_compare


Hello!

Currently, x87 FP stack compensation pops for FTST and FCOMIP
instructions are emitted from output_fp_compare function as an
assembly code. Attached patch moves detection of these two
instructions to reg-stack.c and handles compensation pops during
reg-stack processing. This change further allows for a massive cleanup
in output_fp_compare.

2017-10-17  Uros Bizjak  <ubizjak@gmail.com>

    * reg-stack.c (compare_for_stack_reg): Add bool argument.
    Detect FTST instruction and handle its register pops.  Only pop
    second operand if can_pop_second_op is true.
    (subst_stack_regs_pat) <case COMPARE>: Detect FCOMI instruction to
    set can_pop_second_op to false in the compare_for_stack_reg call.

    * config/i386/i386.md (*cmpi<FPCMP:unord><MODEF:mode>): Only call
    output_fp_compare for stack register operands.
    * config/i386/i386.c (output_fp_compare): Do not output SSE compare
    instructions here.  Do not emit stack register pops here.  Assert
    that FCOMPP pops next to top stack register.  Rewrite function.

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]