[llvm] ce88ca9 - [TableGen] Sign extend constants based on size for EmitIntegerMatcher. (#104550)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 08:43:58 PDT 2024
Author: Craig Topper
Date: 2024-08-16T08:43:54-07:00
New Revision: ce88ca928a29748f5fd179a3ab7f7039b3a311c4
URL: https://github.com/llvm/llvm-project/commit/ce88ca928a29748f5fd179a3ab7f7039b3a311c4
DIFF: https://github.com/llvm/llvm-project/commit/ce88ca928a29748f5fd179a3ab7f7039b3a311c4.diff
LOG: [TableGen] Sign extend constants based on size for EmitIntegerMatcher. (#104550)
I'm planning to add a getSignedConstant to SelectionDAG and use it for
EmitInteger in SelectionDAGISel which already uses int64_t.
getSignedConstant will assert that the constant has the correct number
of significant bits for the VT.
This patch ensures that tablegen emits constants in this form.
Added:
Modified:
llvm/utils/TableGen/Common/DAGISelMatcher.h
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/Common/DAGISelMatcher.h b/llvm/utils/TableGen/Common/DAGISelMatcher.h
index f4ababcd4be68a..81a5e3e050f272 100644
--- a/llvm/utils/TableGen/Common/DAGISelMatcher.h
+++ b/llvm/utils/TableGen/Common/DAGISelMatcher.h
@@ -836,7 +836,8 @@ class EmitIntegerMatcher : public Matcher {
public:
EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt)
- : Matcher(EmitInteger), Val(val), VT(vt) {}
+ : Matcher(EmitInteger), Val(SignExtend64(val, MVT(vt).getSizeInBits())),
+ VT(vt) {}
int64_t getValue() const { return Val; }
MVT::SimpleValueType getVT() const { return VT; }
More information about the llvm-commits
mailing list