[PATCH] D91753: [GlobalISel] Add an isExtendedTrueVal helper.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 30 15:59:19 PDT 2021


arsenm requested changes to this revision.
arsenm added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/Utils.h:264-265
+/// \p IsSignExtended is true if the extension should be signed.
+bool isExtendedTrueVal(const TargetLowering &TLI, int64_t Val, const LLT &ExtTy,
+                       const LLT &OrigTy, bool IsFP, bool IsSignExtended);
+
----------------
Should pass LLT by value


================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:746
+  if (ExtTy == S1)
+    return Val == 1;
+  switch (TLI.getBooleanContents(ExtTy.isVector(), IsFP)) {
----------------
aemerson wrote:
> paquette wrote:
> > aemerson wrote:
> > > Not saying this is wrong, but what's the rationale here for Val needing to be exactly 1 for s1? If The type is s1 then isn't either -1 or 1 equivalently true?
> > I think that's very philosophical, but I guess I'm fine either way?
> > 
> > I could believe that there's no meaningful distinction between 1 and -1 in 1-bit world.
> I guess it depends on what the contract is for this function when the type size is < 64 bits. I know that if you get the constant value from a G_CONSTANT i1 true then it ends up as a -1 int64_t, so passing to this function would return false. Maybe we should mask off the upper bits on entry?
i1 true constants are treated as -1 everywhere else


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91753/new/

https://reviews.llvm.org/D91753



More information about the llvm-commits mailing list