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]: Rewrite float patterns


Hello!

Attached patch rewrites float patterns. When disabled by
X87_ENABLE_FLOAT macro, generic expanders are able to correctly use
wider FPmode patterns and float truncation sequence, so there is no
need to do the same functionality manually in the expander.

The patch also re-enables floatdi<X87MODEF:mode>2_i387_with_xmm
pattern, so we are able to avoid partial register stalls when
compiling DImode float conversion on 32bit targets, e.g.:

double test (long long x) { return x + 1; }

-O2 -m32 -msse2 -mtune=intel -mfpmath=387 produces following code:

        addl    $1, %eax
        movd    %eax, %xmm0
        adcl    $0, %edx
        movd    %edx, %xmm1
        punpckldq       %xmm1, %xmm0
        movq    %xmm0, (%esp)
        fildq   (%esp)

2018-09-07  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.md (float<SWI48x:mode><MODEF:mode>2) Enable
    DImode for x87 on 32bit targets.  Conditionally disable x87 modes
    with X87_ENABLE_FLOAT.  Remove preparation code.
    (*float<SWI48:mode><MODEF:mode>2): Rename from
    *float<SWI48:mode><MODEF:mode>2_mixed.  Handle x87, SSE and mixed
    math using "enabled" attribute.
    (*floatdi<MODEF:mode>2_i387): Rename from
    *float<SWI48x:mode><MODEF:mode>2_i387.  Handle only DImode and
    enable for 32bit targets only.
    (floatdi<X87MODEF:mode>2_i387_with_xmm pre-reload splitter): New
    splitter.
    (floatdi<X87MODEF:mode>2_i387_with_xmm): Use register_operand
    as operand 1 predicate.  Rewrite as define_insn_and_split.
    (floatdi<X87MODEF:mode>2_i387_with_xmm memory input splitter): Remove.

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]