[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"]>;
+
+class SNSWTemplate :
+ Template<["int", "long int", "long long int"],
+ ["_nsw", "l_nsw", "ll_nsw"]>;
+
+class SNXWTemplate :
+ Template<["int", "long int", "long long int"],
+ ["_nuw_nsw", "l_nuw_nsw", "ll_nuw_nsw"]>;
+
+def SAddNUW : Builtin, SNUWTemplate {
+ let Spellings = ["__builtin_sadd"];
+ let Attributes = [NoThrow];
+ let Prototype = "T(T const, T const)";
----------------
philnik777 wrote:
```suggestion
let Prototype = "T(T, T)";
```
These don't do anything anyways, so we might as well drop them.
https://github.com/llvm/llvm-project/pull/130354
More information about the cfe-commits
mailing list