This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] libitm: add HTM fastpath
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Torvald Riegel <triegel at redhat dot com>, Richard Henderson <rth at redhat dot com>, Aldy Hernandez <aldyh at redhat dot com>
- Date: Tue, 6 Nov 2012 09:55:52 +0100
- Subject: Re: [Patch] libitm: add HTM fastpath
Hello!
> This patch adds support for using strongly-isolated HTMs with
> serial-irrevocable mode as fallback. Such HTMs can execute
> uninstrumented code transactionally, and eventually aborted transactions
> will cause no visible side effects. Data conflicts with
> nontransactional accesses lead to transactions being aborted.
+static inline bool
+htm_available ()
+{
+ const unsigned cpuid_rtm = (1 << 11);
+ if (__get_cpuid_max (0, NULL) >= 7)
+ {
+ unsigned a, b, c, d;
+ __cpuid_count (7, 0, a, b, c, d);
+ if (b & cpuid_rtm)
+ return true;
+ }
+ return false;
You can use bit_RTM from cpuid.h instead of cpuid_rtm here.
Uros.