Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: lib/Target/ARM/ARMISelLowering.cpp

Issue 183273009: Prep for merging 3.4: Undo changes from 3.3 branch (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/MC/MCStreamer.cpp ('k') | lib/Target/NVPTX/CMakeLists.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- ARMISelLowering.cpp - ARM DAG Lowering Implementation -------------===// 1 //===-- ARMISelLowering.cpp - ARM DAG Lowering Implementation -------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines the interfaces that ARM uses to lower LLVM code into a 10 // This file defines the interfaces that ARM uses to lower LLVM code into a
(...skipping 5403 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 /// isZeroExtended - Check if a node is a vector value that is zero-extended 5414 /// isZeroExtended - Check if a node is a vector value that is zero-extended
5415 /// or a constant BUILD_VECTOR with zero-extended elements. 5415 /// or a constant BUILD_VECTOR with zero-extended elements.
5416 static bool isZeroExtended(SDNode *N, SelectionDAG &DAG) { 5416 static bool isZeroExtended(SDNode *N, SelectionDAG &DAG) {
5417 if (N->getOpcode() == ISD::ZERO_EXTEND || ISD::isZEXTLoad(N)) 5417 if (N->getOpcode() == ISD::ZERO_EXTEND || ISD::isZEXTLoad(N))
5418 return true; 5418 return true;
5419 if (isExtendedBUILD_VECTOR(N, DAG, false)) 5419 if (isExtendedBUILD_VECTOR(N, DAG, false))
5420 return true; 5420 return true;
5421 return false; 5421 return false;
5422 } 5422 }
5423 5423
5424 static EVT getExtensionTo64Bits(const EVT &OrigVT) {
5425 if (OrigVT.getSizeInBits() >= 64)
5426 return OrigVT;
5427
5428 assert(OrigVT.isSimple() && "Expecting a simple value type");
5429
5430 MVT::SimpleValueType OrigSimpleTy = OrigVT.getSimpleVT().SimpleTy;
5431 switch (OrigSimpleTy) {
5432 default: llvm_unreachable("Unexpected Vector Type");
5433 case MVT::v2i8:
5434 case MVT::v2i16:
5435 return MVT::v2i32;
5436 case MVT::v4i8:
5437 return MVT::v4i16;
5438 }
5439 }
5440
5441 /// AddRequiredExtensionForVMULL - Add a sign/zero extension to extend the total 5424 /// AddRequiredExtensionForVMULL - Add a sign/zero extension to extend the total
5442 /// value size to 64 bits. We need a 64-bit D register as an operand to VMULL. 5425 /// value size to 64 bits. We need a 64-bit D register as an operand to VMULL.
5443 /// We insert the required extension here to get the vector to fill a D register . 5426 /// We insert the required extension here to get the vector to fill a D register .
5444 static SDValue AddRequiredExtensionForVMULL(SDValue N, SelectionDAG &DAG, 5427 static SDValue AddRequiredExtensionForVMULL(SDValue N, SelectionDAG &DAG,
5445 const EVT &OrigTy, 5428 const EVT &OrigTy,
5446 const EVT &ExtTy, 5429 const EVT &ExtTy,
5447 unsigned ExtOpcode) { 5430 unsigned ExtOpcode) {
5448 // The vector originally had a size of OrigTy. It was then extended to ExtTy. 5431 // The vector originally had a size of OrigTy. It was then extended to ExtTy.
5449 // We expect the ExtTy to be 128-bits total. If the OrigTy is less than 5432 // We expect the ExtTy to be 128-bits total. If the OrigTy is less than
5450 // 64-bits we need to insert a new extension so that it will be 64-bits. 5433 // 64-bits we need to insert a new extension so that it will be 64-bits.
5451 assert(ExtTy.is128BitVector() && "Unexpected extension size"); 5434 assert(ExtTy.is128BitVector() && "Unexpected extension size");
5452 if (OrigTy.getSizeInBits() >= 64) 5435 if (OrigTy.getSizeInBits() >= 64)
5453 return N; 5436 return N;
5454 5437
5455 // Must extend size to at least 64 bits to be used as an operand for VMULL. 5438 // Must extend size to at least 64 bits to be used as an operand for VMULL.
5456 EVT NewVT = getExtensionTo64Bits(OrigTy); 5439 MVT::SimpleValueType OrigSimpleTy = OrigTy.getSimpleVT().SimpleTy;
5457 5440 EVT NewVT;
5441 switch (OrigSimpleTy) {
5442 default: llvm_unreachable("Unexpected Orig Vector Type");
5443 case MVT::v2i8:
5444 case MVT::v2i16:
5445 NewVT = MVT::v2i32;
5446 break;
5447 case MVT::v4i8:
5448 NewVT = MVT::v4i16;
5449 break;
5450 }
5458 return DAG.getNode(ExtOpcode, N->getDebugLoc(), NewVT, N); 5451 return DAG.getNode(ExtOpcode, N->getDebugLoc(), NewVT, N);
5459 } 5452 }
5460 5453
5461 /// SkipLoadExtensionForVMULL - return a load of the original vector size that 5454 /// SkipLoadExtensionForVMULL - return a load of the original vector size that
5462 /// does not do any sign/zero extension. If the original vector is less 5455 /// does not do any sign/zero extension. If the original vector is less
5463 /// than 64 bits, an appropriate extension will be added after the load to 5456 /// than 64 bits, an appropriate extension will be added after the load to
5464 /// reach a total size of 64 bits. We have to add the extension separately 5457 /// reach a total size of 64 bits. We have to add the extension separately
5465 /// because ARM does not have a sign/zero extending load for vectors. 5458 /// because ARM does not have a sign/zero extending load for vectors.
5466 static SDValue SkipLoadExtensionForVMULL(LoadSDNode *LD, SelectionDAG& DAG) { 5459 static SDValue SkipLoadExtensionForVMULL(LoadSDNode *LD, SelectionDAG& DAG) {
5467 EVT ExtendedTy = getExtensionTo64Bits(LD->getMemoryVT()); 5460 SDValue NonExtendingLoad =
5468 5461 DAG.getLoad(LD->getMemoryVT(), LD->getDebugLoc(), LD->getChain(),
5469 // The load already has the right type.
5470 if (ExtendedTy == LD->getMemoryVT())
5471 return DAG.getLoad(LD->getMemoryVT(), LD->getDebugLoc(), LD->getChain(),
5472 LD->getBasePtr(), LD->getPointerInfo(), LD->isVolatile(), 5462 LD->getBasePtr(), LD->getPointerInfo(), LD->isVolatile(),
5473 LD->isNonTemporal(), LD->isInvariant(), 5463 LD->isNonTemporal(), LD->isInvariant(),
5474 LD->getAlignment()); 5464 LD->getAlignment());
5475 5465 unsigned ExtOp = 0;
5476 // We need to create a zextload/sextload. We cannot just create a load 5466 switch (LD->getExtensionType()) {
5477 // followed by a zext/zext node because LowerMUL is also run during normal 5467 default: llvm_unreachable("Unexpected LoadExtType");
5478 // operation legalization where we can't create illegal types. 5468 case ISD::EXTLOAD:
5479 return DAG.getExtLoad(LD->getExtensionType(), LD->getDebugLoc(), ExtendedTy, 5469 case ISD::SEXTLOAD: ExtOp = ISD::SIGN_EXTEND; break;
5480 LD->getChain(), LD->getBasePtr(), LD->getPointerInfo(), 5470 case ISD::ZEXTLOAD: ExtOp = ISD::ZERO_EXTEND; break;
5481 LD->getMemoryVT(), LD->isVolatile(), 5471 }
5482 LD->isNonTemporal(), LD->getAlignment()); 5472 MVT::SimpleValueType MemType = LD->getMemoryVT().getSimpleVT().SimpleTy;
5473 MVT::SimpleValueType ExtType = LD->getValueType(0).getSimpleVT().SimpleTy;
5474 return AddRequiredExtensionForVMULL(NonExtendingLoad, DAG,
5475 MemType, ExtType, ExtOp);
5483 } 5476 }
5484 5477
5485 /// SkipExtensionForVMULL - For a node that is a SIGN_EXTEND, ZERO_EXTEND, 5478 /// SkipExtensionForVMULL - For a node that is a SIGN_EXTEND, ZERO_EXTEND,
5486 /// extending load, or BUILD_VECTOR with extended elements, return the 5479 /// extending load, or BUILD_VECTOR with extended elements, return the
5487 /// unextended value. The unextended vector should be 64 bits so that it can 5480 /// unextended value. The unextended vector should be 64 bits so that it can
5488 /// be used as an operand to a VMULL instruction. If the original vector size 5481 /// be used as an operand to a VMULL instruction. If the original vector size
5489 /// before extension is less than 64 bits we add a an extension to resize 5482 /// before extension is less than 64 bits we add a an extension to resize
5490 /// the vector to 64 bits. 5483 /// the vector to 64 bits.
5491 static SDValue SkipExtensionForVMULL(SDNode *N, SelectionDAG &DAG) { 5484 static SDValue SkipExtensionForVMULL(SDNode *N, SelectionDAG &DAG) {
5492 if (N->getOpcode() == ISD::SIGN_EXTEND || N->getOpcode() == ISD::ZERO_EXTEND) 5485 if (N->getOpcode() == ISD::SIGN_EXTEND || N->getOpcode() == ISD::ZERO_EXTEND)
(...skipping 5271 matching lines...) Expand 10 before | Expand all | Expand 10 after
10764 Info.readMem = true; 10757 Info.readMem = true;
10765 Info.writeMem = false; 10758 Info.writeMem = false;
10766 return true; 10759 return true;
10767 } 10760 }
10768 default: 10761 default:
10769 break; 10762 break;
10770 } 10763 }
10771 10764
10772 return false; 10765 return false;
10773 } 10766 }
OLDNEW
« no previous file with comments | « lib/MC/MCStreamer.cpp ('k') | lib/Target/NVPTX/CMakeLists.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698