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

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