On Fri, Aug 15, 2014 at 03:45:33PM +0400, Yuri Rumyantsev wrote:
> gcc/ChangeLog
> 2014-08-15  Yuri Rumyantsev  <ysrum...@gmail.com>
> 
> PR target/62011
> * config/i386/i386-protos.h (ix86_avoid_false_dep_for_bm): New function
>  prototype.
> * config/i386/i386.c (ix86_avoid_false_dep_for_bm): New function.
> * config/i386/i386.h (TARGET_AVOID_FALSE_DEP_FOR_BM) New macros.
> * config/i386/i386.md (ctz<mode>2, clz<mode>2_lzcnt, popcount<mode>2,
>  *popcount<mode>2_cmp, *popcountsi2_cmp_zext): Output zeroing
>  destination register for unary bit-manipulation instructions
>  if required.
> * config/i386/x86-tune.def (X86_TUNE_AVOID_FALSE_DEP_FOR_BM): New.

--- config/i386/i386.md (revision 213842)
+++ config/i386/i386.md (working copy)
@@ -12111,7 +12111,13 @@
   ""
 {
   if (TARGET_BMI)
-    return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}";
+    {
+      if (ix86_avoid_false_dep_for_bm (insn, operands))
+       return "xor{<imodesuffix>}\t%0, %0\n\t"
+               "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}";
+      else
+        return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}";
+    }
   else if (optimize_function_for_size_p (cfun))
     ;
   else if (TARGET_GENERIC)

etc., this will make lenght attribute incorrect though.

        Jakub

Reply via email to