[clang] 0a2b5b0 - [NVPTX][Fix] Ensure the return value of 'activemask' is unsigned

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 15:33:44 PST 2024


Author: Joseph Huber
Date: 2024-01-29T17:33:38-06:00
New Revision: 0a2b5b03c4084ac1fefd0e62db2ba49f5ac24ab9

URL: https://github.com/llvm/llvm-project/commit/0a2b5b03c4084ac1fefd0e62db2ba49f5ac24ab9
DIFF: https://github.com/llvm/llvm-project/commit/0a2b5b03c4084ac1fefd0e62db2ba49f5ac24ab9.diff

LOG: [NVPTX][Fix] Ensure the return value of 'activemask' is unsigned

Summary:
The previous patch missed the `U` prefix, which caused the mask to be
considered signed. This meant that conversions would incorrectly treat a
full mask as a negative number and break things.

Added: 
    

Modified: 
    clang/include/clang/Basic/BuiltinsNVPTX.def

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def
index 648c013a3002e..7819e71d7fe2a 100644
--- a/clang/include/clang/Basic/BuiltinsNVPTX.def
+++ b/clang/include/clang/Basic/BuiltinsNVPTX.def
@@ -159,7 +159,7 @@ BUILTIN(__nvvm_read_ptx_sreg_pm3, "i", "n")
 
 BUILTIN(__nvvm_prmt, "UiUiUiUi", "")
 BUILTIN(__nvvm_exit, "v", "r")
-TARGET_BUILTIN(__nvvm_nanosleep, "vi", "n", AND(SM_70, PTX63))
+TARGET_BUILTIN(__nvvm_nanosleep, "vUi", "n", AND(SM_70, PTX63))
 
 // Min Max
 
@@ -638,7 +638,7 @@ TARGET_BUILTIN(__nvvm_vote_uni_sync, "bUib", "", PTX60)
 TARGET_BUILTIN(__nvvm_vote_ballot_sync, "UiUib", "", PTX60)
 
 // Mask
-TARGET_BUILTIN(__nvvm_activemask, "i", "n", PTX62)
+TARGET_BUILTIN(__nvvm_activemask, "Ui", "n", PTX62)
 
 // Match
 TARGET_BUILTIN(__nvvm_match_any_sync_i32, "UiUiUi", "", AND(SM_70,PTX60))


        


More information about the cfe-commits mailing list