[clang] [clang] Add builtins for `add` with `nuw` and/or `nsw` (PR #130354)
Nikolas Klauser via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 8 01:26:24 PST 2025
================
@@ -5037,6 +5037,66 @@ def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> {
let Prototype = "void(...)";
}
+class SNUWTemplate :
+ Template<["int", "long int", "long long int"],
+ ["_nuw", "l_nuw", "ll_nuw"]>;
----------------
philnik777 wrote:
I'm not a huge fan of `nuw` and `nsw`, since they don't tell me anything without having to look up what they stand for. It's also not clear to me how signed vs. unsigned wrapping is relevant when you only have either signed or unsigned types, but never a combination.
I'd be much happier with a `__buitin_non_wrapping_add` or something like that.
https://github.com/llvm/llvm-project/pull/130354
More information about the cfe-commits
mailing list