[PATCH] D31736: Implement _interlockedbittestandset as a builtin

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 5 17:47:43 PDT 2017


rnk added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:570
+        llvm::AtomicOrdering::SequentiallyConsistent);
+    llvm::Value *Shifted = Builder.CreateLShr(RMWI, Bit);
+    llvm::Value *Truncated =
----------------
Can you comment that this shifts the relevant bit into the low bit, truncates to i8, and then tests the low bit? At first I was thinking "of course, we just do AND %old, $constant to test the bit".

Do we successfully pattern match this idiom to `lock bts`? Is there a pattern match we should target?


https://reviews.llvm.org/D31736





More information about the cfe-commits mailing list