Hello!

Attached patch fixes oversight in standard_x87sse_constant_load
splitter and its float-extend counterpart, where a FP reg-reg move
insn RTX can be tagged with REG_EQUIV or REG_EQUAL const_double RTX.

find_constant_src and ix86_standard_x87sse_constant_load_p predicate
are able to handle this situation, and patched splitters emit direct
constant load instead of a reg-reg move. This also lowers regstack
register pressure, as evident from the testcase:

--- pr79593.s_  2017-02-21 19:41:36.615740647 +0100
+++ pr79593.s   2017-02-21 19:41:47.251622966 +0100
@@ -15,21 +15,16 @@
        fldz
 .L2:
        fld1
-       fld     %st(0)
-       fcomp   %st(2)
+       fcomp   %st(1)
        fnstsw  %ax
        sahf
-       jnb     .L5
-       fstp    %st(1)
-       jmp     .L3
-       .p2align 4,,10
-       .p2align 3
-.L5:
+       jnb     .L3
        fstp    %st(0)
+       fld1
 .L3:
        rep ret
        .cfi_endproc
 .LFE2:
        .size   bar, .-bar
-       .ident  "GCC: (GNU) 7.0.0 20170117 (experimental) [trunk
revision 244540]"
+       .ident  "GCC: (GNU) 7.0.1 20170221 (experimental) [trunk
revision 245630]"
        .section        .note.GNU-stack,"",@progbits

Patched compiler also removed a jump to a BB where only compensating
regstack pop was emitted.

2017-02-21  Uros Bizjak  <ubiz...@gmail.com>

    PR target/79593
    * config/i386/i386.md (standard_x87sse_constant_load splitter):
    Use nonimmediate_operand instead of memory_operand for operand 1.
    (float-extend standard_x87sse_constant_load splitter): Ditto.

testsuite/ChangeLog:

2017-02-21  Uros Bizjak  <ubiz...@gmail.com>

    PR target/79593
    * gcc.target/i386/pr79593.c: New test.

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

Committed to mainline SVN.

Uros.

Reply via email to