diff mbox

[i386] : Slightly disparage DFmode moves involving stack registers on x86_64

Message ID CAFULd4bhX7MgKBoHKoz6SxfLWiQ-iRUr5s=MRUW7J9bGVK42jg@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Jan. 23, 2013, 7:08 p.m. UTC
Hello!

All things equal, we would like to avoid x87 registers to move DFmode
immediates to a memory.

Following testcase:

--cut here--
volatile double y;

void
test ()
{
  int z;

  for (z = 0; z < 1000; z++)
    {
      y = 1.33;
    }
}
-- cut here--

compiled with -O3 to:

        movl    $1000, %eax
.L3:
        fldl    .LC0(%rip)
        subl    $1, %eax
        fstpl   y(%rip)
        jne     .L3
        rep; ret

With attached patch, it compiles to:

        movsd   .LC0(%rip), %xmm0
        movl    $1000, %eax
.L3:
        subl    $1, %eax
        movsd   %xmm0, y(%rip)
        jne     .L3
        rep; ret

2013-01-23  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (*movdf_internal_rex64): Disparage alternatives
	involving stack registers slightly.

Tested on x86_64-pc-linux-gnu, committed to mainline, will ba commited
also to 4.7 branch.

Uros.
diff mbox

Patch

Index: i386.md
===================================================================
--- i386.md	(revision 195407)
+++ i386.md	(working copy)
@@ -2934,9 +2934,9 @@ 
 
 (define_insn "*movdf_internal_rex64"
   [(set (match_operand:DF 0 "nonimmediate_operand"
-		"=f,m,f,?r,?m,?r,x,x,x,m,Yi,r ")
+		"=?f,?m,?f,?r,?m,?r,x,x,x,m,Yi,r ")
 	(match_operand:DF 1 "general_operand"
-		"fm,f,G,rm,r ,F ,C,x,m,x,r ,Yi"))]
+		"fm ,f ,G ,rm,r ,F ,C,x,m,x,r ,Yi"))]
   "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))
    && (!can_create_pseudo_p ()
        || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE)