Don't clear destination if it is used in source
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 19 Aug 2014 16:26:35 +0000 (16:26 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 19 Aug 2014 16:26:35 +0000 (09:26 -0700)
* config/i386/i386.md (*ctz<mode>2_falsedep_1): Don't clear
destination if it is used in source.
(*clz<mode>2_lzcnt_falsedep_1): Likewise.
(*popcount<mode>2_falsedep_1): Likewise.

From-SVN: r214169

gcc/ChangeLog
gcc/config/i386/i386.md

index 0751681..01597a4 100644 (file)
@@ -1,5 +1,12 @@
 2014-08-19  H.J. Lu  <hongjiu.lu@intel.com>
 
+       * config/i386/i386.md (*ctz<mode>2_falsedep_1): Don't clear
+       destination if it is used in source.
+       (*clz<mode>2_lzcnt_falsedep_1): Likewise.
+       (*popcount<mode>2_falsedep_1): Likewise.
+
+2014-08-19  H.J. Lu  <hongjiu.lu@intel.com>
+
        PR other/62168
        * configure.ac: Set install_gold_as_default to no first.
         * configure: Regenerated.
index 4749b74..8e74eab 100644 (file)
            (match_operand:SWI248 1 "nonimmediate_operand")))
      (clobber (reg:CC FLAGS_REG))])])
 
+; False dependency happens when destination is only updated by tzcnt,
+; lzcnt or popcnt.  There is no false dependency when destination is
+; also used in source.
 (define_insn_and_split "*ctz<mode>2_falsedep_1"
-  [(set (match_operand:SWI48 0 "register_operand" "=&r")
+  [(set (match_operand:SWI48 0 "register_operand" "=r")
        (ctz:SWI48
          (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
    (clobber (reg:CC FLAGS_REG))]
          (ctz:SWI48 (match_dup 1)))
      (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)
      (clobber (reg:CC FLAGS_REG))])]
-  "ix86_expand_clear (operands[0]);")
+{
+  if (!reg_mentioned_p (operands[0], operands[1]))
+    ix86_expand_clear (operands[0]);
+})
 
 (define_insn "*ctz<mode>2_falsedep"
   [(set (match_operand:SWI48 0 "register_operand" "=r")
   "TARGET_LZCNT")
 
 (define_insn_and_split "*clz<mode>2_lzcnt_falsedep_1"
-  [(set (match_operand:SWI48 0 "register_operand" "=&r")
+  [(set (match_operand:SWI48 0 "register_operand" "=r")
        (clz:SWI48
          (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
    (clobber (reg:CC FLAGS_REG))]
          (clz:SWI48 (match_dup 1)))
      (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)
      (clobber (reg:CC FLAGS_REG))])]
-  "ix86_expand_clear (operands[0]);")
+{
+  if (!reg_mentioned_p (operands[0], operands[1]))
+    ix86_expand_clear (operands[0]);
+})
 
 (define_insn "*clz<mode>2_lzcnt_falsedep"
   [(set (match_operand:SWI48 0 "register_operand" "=r")
   "TARGET_POPCNT")
 
 (define_insn_and_split "*popcount<mode>2_falsedep_1"
-  [(set (match_operand:SWI48 0 "register_operand" "=&r")
+  [(set (match_operand:SWI48 0 "register_operand" "=r")
        (popcount:SWI48
          (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
    (clobber (reg:CC FLAGS_REG))]
          (popcount:SWI48 (match_dup 1)))
      (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)
      (clobber (reg:CC FLAGS_REG))])]
-  "ix86_expand_clear (operands[0]);")
+{
+  if (!reg_mentioned_p (operands[0], operands[1]))
+    ix86_expand_clear (operands[0]);
+})
 
 (define_insn "*popcount<mode>2_falsedep"
   [(set (match_operand:SWI48 0 "register_operand" "=r")