[PATCH] D38191: [NVPTX] added match.{any, all}.sync instructions, intrinsics & builtins.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 11:24:42 PDT 2017


jlebar added inline comments.


================
Comment at: clang/include/clang/Basic/BuiltinsNVPTX.def:419
+TARGET_BUILTIN(__nvvm_match_any_sync_i64, "WiUiWi", "", "ptx60")
+// These return a pair {value, predicate} which requires custom lowering.
+TARGET_BUILTIN(__nvvm_match_all_sync_i32p, "UiUiUii*", "", "ptx60")
----------------
Nit, non-restrictive "which" should get a comma.  :)


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9603
+    Value *Pred = Builder.CreateSExt(Builder.CreateExtractValue(ResultPair, 1),
+                                     PredOutPtr.getElementType());
+    Builder.CreateStore(Pred, PredOutPtr);
----------------
Doing sext i1 -> i32 is going to cause us to store 0 or -1 in the pred (right?).  The CUDA docs say

> Predicate pred is set to true if all threads in mask have the same value of value; otherwise the predicate is set to false.

I'd guess that "true" probably means 1 (i.e. uext i1 -> i32) rather than -1, although, I guess we have to check.


https://reviews.llvm.org/D38191





More information about the llvm-commits mailing list