[PATCH] D134744: [clang][Interp] Implement rem opcode
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 27 08:58:42 PDT 2022
tbaeder added inline comments.
================
Comment at: clang/lib/AST/Interp/Integral.h:213
+ static bool rem(Integral A, Integral B, unsigned OpBits, Integral *R) {
+ *R = Integral(A.V % B.V);
----------------
erichkeane wrote:
> Its a touch weird we return 'bool' in all these places, rather than an `Optional<Integral>`, right? Perhaps a refactor idea for a future patch.
The really weird part is that `false` here suddenly means success, but I get your point. Does using `Optional` introduce any sort of performance penalty if this is being called a lot?
================
Comment at: clang/lib/AST/Interp/Opcodes.td:57
-def AluTypeClass : TypeClass {
+def NumberTypeClass : TypeClass {
let Types = [Sint8, Uint8, Sint16, Uint16, Sint32,
----------------
erichkeane wrote:
> Perhaps `IntegralTypeClass`, unless we expect floats to be here too?
Floats don't have to be in there I guess, but so far I'd say yes, they should be, because they are usable everywhere this class is used, afaik.
================
Comment at: clang/lib/AST/Interp/Opcodes.td:62
+
+def AluTypeClass : TypeClass {
+ let Types = !listconcat(NumberTypeClass.Types, [Bool]);
----------------
erichkeane wrote:
> What does "Alu" mean here?
I didn't introduce the name but I assumed it comes from "arithmetic logical unit".
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134744/new/
https://reviews.llvm.org/D134744
More information about the cfe-commits
mailing list