[PATCH] D25438: [mips] Fix Mips MSA instrinsics

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 04:40:16 PDT 2016


vkalintiris added a comment.

Why shouldn't we "crash" when we pass invalid/bad constant immediates to our intrinsics? Do you have a case in mind that causes us problems if we do so?



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1108
    EltVT = TLI->getTypeToTransformTo(*getContext(), EltVT);
-   APInt NewVal = Elt->getValue().zext(EltVT.getSizeInBits());
+   APInt NewVal = Elt->getValue().zextOrTrunc(EltVT.getSizeInBits());
    Elt = ConstantInt::get(*getContext(), NewVal);
----------------
I don't think that we need this because the type will be always promoted based on the check above. Do you have any example/test case that hits this?


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1134
       EltParts.push_back(getConstant(NewVal.lshr(i * ViaEltSizeInBits)
-                                           .trunc(ViaEltSizeInBits), DL,
+                                           .zextOrTrunc(ViaEltSizeInBits), DL,
                                      ViaEltVT, isT, isO));
----------------
Similarly, given that the element type has been expanded, I don't think that we need to cover zero-extensions.


Repository:
  rL LLVM

https://reviews.llvm.org/D25438





More information about the llvm-commits mailing list