[committed] i386: Emit mfence_sse2 for -Os [PR95750]

Uros Bizjak ubizjak@gmail.com
Fri Jul 24 14:03:26 GMT 2020


2020-07-24  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
    PR target/95750
    * config/i386/sync.md (mmem_thread_fence): Emit mfence_sse2 for -Os.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Uros.
-------------- next part --------------
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md
index c88750d3664..ed17bb00205 100644
--- a/gcc/config/i386/sync.md
+++ b/gcc/config/i386/sync.md
@@ -123,7 +123,8 @@
       rtx mem;
 
       if ((TARGET_64BIT || TARGET_SSE2)
-	  && !TARGET_AVOID_MFENCE)
+	  && (optimize_function_for_size_p (cfun)
+	      || !TARGET_AVOID_MFENCE))
 	mfence_insn = gen_mfence_sse2;
       else
 	mfence_insn = gen_mfence_nosse;


More information about the Gcc-patches mailing list