Blame SOURCES/gcc8-htm-in-asm.patch

ed1ed2
--- libitm/config/x86/target.h.jj	2013-06-23 20:43:50.000000000 +0200
ed1ed2
+++ libitm/config/x86/target.h	2013-08-13 17:14:57.540012109 +0200
ed1ed2
@@ -64,7 +64,7 @@ cpu_relax (void)
ed1ed2
 
ed1ed2
 // Use Intel RTM if supported by the assembler.
ed1ed2
 // See gtm_thread::begin_transaction for how these functions are used.
ed1ed2
-#ifdef HAVE_AS_RTM
ed1ed2
+#if 1 /* def HAVE_AS_RTM */
ed1ed2
 #define USE_HTM_FASTPATH
ed1ed2
 #ifdef __x86_64__
ed1ed2
 // Use the custom fastpath in ITM_beginTransaction.
ed1ed2
@@ -97,7 +97,10 @@ htm_init ()
ed1ed2
 static inline uint32_t
ed1ed2
 htm_begin ()
ed1ed2
 {
ed1ed2
-  return _xbegin();
ed1ed2
+//  return _xbegin();
ed1ed2
+  uint32_t ret;
ed1ed2
+  __asm volatile ("movl $-1, %%eax; .byte 0xc7, 0xf8, 0, 0, 0, 0" : "=a" (ret) : : "memory");
ed1ed2
+  return ret;
ed1ed2
 }
ed1ed2
 
ed1ed2
 static inline bool
ed1ed2
@@ -109,7 +112,8 @@ htm_begin_success (uint32_t begin_ret)
ed1ed2
 static inline void
ed1ed2
 htm_commit ()
ed1ed2
 {
ed1ed2
-  _xend();
ed1ed2
+//  _xend();
ed1ed2
+  __asm volatile (".byte 0x0f, 0x01, 0xd5" : : : "memory");
ed1ed2
 }
ed1ed2
 
ed1ed2
 static inline void
ed1ed2
@@ -117,7 +121,8 @@ htm_abort ()
ed1ed2
 {
ed1ed2
   // ??? According to a yet unpublished ABI rule, 0xff is reserved and
ed1ed2
   // supposed to signal a busy lock.  Source: andi.kleen@intel.com
ed1ed2
-  _xabort(0xff);
ed1ed2
+//  _xabort(0xff);
ed1ed2
+  __asm volatile (".byte 0xc6, 0xf8, 0xff" : : : "memory");
ed1ed2
 }
ed1ed2
 
ed1ed2
 static inline bool
ed1ed2
@@ -130,7 +135,10 @@ htm_abort_should_retry (uint32_t begin_r
ed1ed2
 static inline bool
ed1ed2
 htm_transaction_active ()
ed1ed2
 {
ed1ed2
-  return _xtest() != 0;
ed1ed2
+//  return _xtest() != 0;
ed1ed2
+  bool ret;
ed1ed2
+  __asm volatile (".byte 0x0f, 0x01, 0xd6; setne %%al" : "=a" (ret) : : "memory");
ed1ed2
+  return ret;
ed1ed2
 }
ed1ed2
 #endif
ed1ed2