[Support] Add LLVM_IS_UNALIGNED_ACCESS_FAST.
[oota-llvm.git] / include / llvm / Support / Compiler.h
index 36539f6d346daad159d8e0249c43c16fce41a523..6ca86bdd50263817f89af67258d3ce6c02ac5642 100644 (file)
 # define LLVM_MEMORY_SANITIZER_BUILD 0
 #endif
 
+/// \macro LLVM_IS_UNALIGNED_ACCESS_FAST
+/// \brief Is unaligned memory access fast on the host machine.
+///
+/// Don't specialize on alignment for platforms where unaligned memory accesses
+/// generates the same code as aligned memory accesses for common types.
+#if defined(_M_AMD64) || defined(_M_IX86) || defined(__amd64) || \
+    defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || \
+    defined(_X86_) || defined(__i386) || defined(__i386__)
+# define LLVM_IS_UNALIGNED_ACCESS_FAST 1
+#else
+# define LLVM_IS_UNALIGNED_ACCESS_FAST 0
+#endif
+
 #endif