diff options
author | Momchil Velikov <momchil.velikov@arm.com> | 2024-06-26 19:37:02 +0100 |
---|---|---|
committer | Momchil Velikov <momchil.velikov@arm.com> | 2024-06-26 20:00:22 +0100 |
commit | d058b51604eeb73bfc236bfe84e1ade90229950f (patch) | |
tree | 8d5717494df49a78acb4c55a49e8ae7ad9f626a1 /llvm/lib | |
parent | d29fdfbc4e3b42e9ee0295049493ba7b1471772f (diff) | |
download | llvm-d058b51604eeb73bfc236bfe84e1ade90229950f.zip llvm-d058b51604eeb73bfc236bfe84e1ade90229950f.tar.gz llvm-d058b51604eeb73bfc236bfe84e1ade90229950f.tar.bz2 |
Revert "[AArch64] Lower extending sitofp using tbl (#92528)"
This reverts commit d1a4f0c9fb559eb4c2fb56112e56343bcd333edc.
There are reports about test failures with Eigen and JAX.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 37 |
2 files changed, 3 insertions, 37 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 900c33b5..550b532 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -8331,8 +8331,7 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) { if (OptimizeNoopCopyExpression(CI, *TLI, *DL)) return true; - if ((isa<UIToFPInst>(I) || isa<SIToFPInst>(I) || isa<FPToUIInst>(I) || - isa<TruncInst>(I)) && + if ((isa<UIToFPInst>(I) || isa<FPToUIInst>(I) || isa<TruncInst>(I)) && TLI->optimizeExtendOrTruncateConversion( I, LI->getLoopFor(I->getParent()), *TTI)) return true; diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index b32e67a..8113257 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -15965,24 +15965,6 @@ static Value *createTblShuffleForZExt(IRBuilderBase &Builder, Value *Op, return Result; } -static Value *createTblShuffleForSExt(IRBuilderBase &Builder, Value *Op, - FixedVectorType *DstTy, - bool IsLittleEndian) { - auto *SrcTy = cast<FixedVectorType>(Op->getType()); - auto SrcWidth = cast<IntegerType>(SrcTy->getElementType())->getBitWidth(); - auto DstWidth = cast<IntegerType>(DstTy->getElementType())->getBitWidth(); - - SmallVector<int> Mask; - if (!createTblShuffleMask(SrcWidth, DstWidth, SrcTy->getNumElements(), - !IsLittleEndian, Mask)) - return nullptr; - - auto *FirstEltZero = Builder.CreateInsertElement( - PoisonValue::get(SrcTy), Builder.getInt8(0), uint64_t(0)); - - return Builder.CreateShuffleVector(Op, FirstEltZero, Mask); -} - static void createTblForTrunc(TruncInst *TI, bool IsLittleEndian) { IRBuilder<> Builder(TI); SmallVector<Value *> Parts; @@ -16163,29 +16145,14 @@ bool AArch64TargetLowering::optimizeExtendOrTruncateConversion( Value *ZExt = createTblShuffleForZExt( Builder, I->getOperand(0), FixedVectorType::getInteger(DstTy), FixedVectorType::getInteger(DstTy), Subtarget->isLittleEndian()); - assert(ZExt && "Cannot fail for the i8 to float conversion"); + if (!ZExt) + return false; auto *UI = Builder.CreateUIToFP(ZExt, DstTy); I->replaceAllUsesWith(UI); I->eraseFromParent(); return true; } - auto *SIToFP = dyn_cast<SIToFPInst>(I); - if (SIToFP && SrcTy->getElementType()->isIntegerTy(8) && - DstTy->getElementType()->isFloatTy()) { - IRBuilder<> Builder(I); - auto *Shuffle = createTblShuffleForSExt(Builder, I->getOperand(0), - FixedVectorType::getInteger(DstTy), - Subtarget->isLittleEndian()); - assert(Shuffle && "Cannot fail for the i8 to float conversion"); - auto *Cast = Builder.CreateBitCast(Shuffle, VectorType::getInteger(DstTy)); - auto *AShr = Builder.CreateAShr(Cast, 24, "", true); - auto *SI = Builder.CreateSIToFP(AShr, DstTy); - I->replaceAllUsesWith(SI); - I->eraseFromParent(); - return true; - } - // Convert 'fptoui <(8|16) x float> to <(8|16) x i8>' to a wide fptoui // followed by a truncate lowered to using tbl.4. auto *FPToUI = dyn_cast<FPToUIInst>(I); |