[Bug target/59379] [4.9 Regression] gomp_init_num_threads is compiled into an infinite loop with --with-arch=corei7 --with-cpu=slm

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jan 19 09:51:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59379

--- Comment #18 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to H.J. Lu from comment #17)

> > I prefer first patch. It splits all LEAs, where ix86_avoid_lea_for_addr is
> > true.
> 
> Then we should avoid the extra
> 
> (set (reg:DI) (zero_extend:DI (reg:SI)))

ree pass, located just after post-reload split, should handle this extra
zero-extend insn. Based on this fact, we can just slap a zero-extend insn at
the end of sequence with:

--cut here--
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 206753)
+++ config/i386/i386.md (working copy)
@@ -5428,12 +5428,17 @@
   operands[0] = SET_DEST (pat);
   operands[1] = SET_SRC (pat);

-  /* Emit all operations in SImode for zero-extended addresses.  Recall
-     that x86_64 inheretly zero-extends SImode operations to DImode.  */
+  /* Emit all operations in SImode for zero-extended addresses.  */
   if (SImode_address_operand (operands[1], VOIDmode))
     mode = SImode;

   ix86_split_lea_for_addr (curr_insn, operands, mode);
+
+  /* Zero-extend return register to DImode for zero-extended addresses.  */
+  if (mode != <MODE>mode)
+    emit_insn (gen_zero_extendsidi2
+              (operands[0], gen_lowpart ((mode), operands[0])));
+
   DONE;
 }
   [(set_attr "type" "lea")
--cut here--

I have checked that this patch with the testcase from Comment #9, using "-O
-march=corei7 -mtune=slm" compile options. The resulting binary worked OK.


More information about the Gcc-bugs mailing list