llvm-6502/lib/Target/Mips
Daniel Sanders ea28aafa83 Fix illegal DAG produced by SelectionDAG::getConstant() for v2i64 type
Summary:
When getConstant() is called for an expanded vector type, it is split into
multiple scalar constants which are then combined using appropriate build_vector
and bitcast operations.

In addition to the usual big/little endian differences, the case where the
element-order of the vector does not have the same endianness as the elements
themselves is also accounted for.  For example, for v4i32 on big-endian MIPS,
the byte-order of the vector is <3210,7654,BA98,FEDC>. For little-endian, it is
<0123,4567,89AB,CDEF>.
Handling this case turns out to be a nop since getConstant() returns a splatted
vector (so reversing the element order doesn't change the value)

This fixes a number of cases in MIPS MSA where calling getConstant() during
operation legalization introduces illegal types (e.g. to legalize v2i64 UNDEF
into a v2i64 BUILD_VECTOR of illegal i64 zeros). It should also handle bigger
differences between illegal and legal types such as legalizing v2i64 into v8i16.

lowerMSASplatImm() in the MIPS backend no longer needs to avoid calling
getConstant() so this function has been updated in the same patch.

For the sake of transparency, the steps I've taken since the review are:
* Added 'virtual' to isVectorEltOrderLittleEndian() as requested. This revealed
  that the MIPS tests were falsely passing because a polymorphic function was
  not actually polymorphic in the reviewed patch.
* Fixed the tests that were now failing. This involved deleting the code to
  handle the MIPS MSA element-order (which was previously doing an byte-order
  swap instead of an element-order swap). This left
  isVectorEltOrderLittleEndian() unused and it was deleted.
* Fixed build failures caused by rebasing beyond r194467-r194472. These build
  failures involved the bset, bneg, and bclr instructions added in these commits
  using lowerMSASplatImm() in a way that was no longer valid after this patch.
  Some of these were fixed by calling SelectionDAG::getConstant() instead,
  others were fixed by a new function getBuildVectorSplat() that provided the
  removed functionality of lowerMSASplatImm() in a more sensible way.

Reviewers: bkramer

Reviewed By: bkramer

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1973

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194811 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 12:56:49 +00:00
..
AsmParser Fix bug in .gpword directive parsing. 2013-11-13 13:18:04 +00:00
Disassembler Support for microMIPS branch instructions. 2013-11-04 14:53:22 +00:00
InstPrinter [mips][msa] Added support for matching splati from normal IR (i.e. not intrinsics) 2013-09-27 11:48:57 +00:00
MCTargetDesc Support for microMIPS branch instructions. 2013-11-04 14:53:22 +00:00
TargetInfo
CMakeLists.txt Turn MipsOptimizeMathLibCalls into a target-independent scalar transform 2013-08-23 10:27:02 +00:00
LLVMBuild.txt
Makefile
MicroMipsInstrFormats.td Use instr mapping for microMIPS in llvm-mc. 2013-11-15 08:07:34 +00:00
MicroMipsInstrInfo.td Support for microMIPS trap instruction with immediate operands. 2013-11-13 13:15:03 +00:00
Mips16FrameLowering.cpp Add the saving of S2. This is needed for some of the floating point 2013-08-04 23:56:53 +00:00
Mips16FrameLowering.h [mips] Align the stack to 16-bytes for mfp64. 2013-10-29 19:29:03 +00:00
Mips16HardFloat.cpp Add fabsf to the list of inlined functions; otherwise 2013-10-08 19:55:01 +00:00
Mips16HardFloat.h Checkin in of first of several patches to finish implementation of 2013-05-10 22:25:39 +00:00
Mips16InstrFormats.td Create a pattern for the "trap" instruction. 2013-08-07 04:00:26 +00:00
Mips16InstrInfo.cpp Make all the conditional Mips 16 branches get initially set for the 2013-11-15 02:21:52 +00:00
Mips16InstrInfo.h Allow the code which returns the length for inline assembler to know 2013-11-13 04:37:52 +00:00
Mips16InstrInfo.td Make all the conditional Mips 16 branches get initially set for the 2013-11-15 02:21:52 +00:00
Mips16ISelDAGToDAG.cpp Fix two issues regarding Got pointer (GP) setup. 2013-09-18 22:46:09 +00:00
Mips16ISelDAGToDAG.h Track IR ordering of SelectionDAG nodes 2/4. 2013-05-25 02:42:55 +00:00
Mips16ISelLowering.cpp Make all the conditional Mips 16 branches get initially set for the 2013-11-15 02:21:52 +00:00
Mips16ISelLowering.h Mips: Remove global set. 2013-06-13 19:06:52 +00:00
Mips16RegisterInfo.cpp Clean up code for Mips16 large frame handling. 2013-08-04 01:13:25 +00:00
Mips16RegisterInfo.h Don't cache the instruction and register info from the TargetMachine, because 2013-06-07 07:04:14 +00:00
Mips64InstrInfo.td Support for microMIPS branch instructions. 2013-11-04 14:53:22 +00:00
Mips.h Turn MipsOptimizeMathLibCalls into a target-independent scalar transform 2013-08-23 10:27:02 +00:00
Mips.td [mips] Compute stack alignment on the fly. 2013-10-30 02:29:43 +00:00
MipsAnalyzeImmediate.cpp Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros. 2013-05-24 22:23:49 +00:00
MipsAnalyzeImmediate.h Even more spelling fixes for "instruction". 2013-09-28 13:42:22 +00:00
MipsAsmPrinter.cpp [mips][msa] Enable inlinse assembly for MSA. 2013-11-12 12:56:01 +00:00
MipsAsmPrinter.h [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00
MipsCallingConv.td [mips] Add support for calling convention CC_MipsO32_FP64, which is used when the 2013-08-20 23:38:40 +00:00
MipsCodeEmitter.cpp Support for microMIPS branch instructions. 2013-11-04 14:53:22 +00:00
MipsCondMov.td [mips] Set instruction itineraries of loads, stores and conditional moves. 2013-09-06 23:28:24 +00:00
MipsConstantIslandPass.cpp Take care of long short branch immediate instructions for mips16 in 2013-11-13 23:52:18 +00:00
MipsDelaySlotFiller.cpp [mips] Coding style clean up. 2013-10-07 19:33:02 +00:00
MipsDSPInstrFormats.td [mips] DSP-ASE move from HI/LO register instructions. 2013-04-18 00:52:44 +00:00
MipsDSPInstrInfo.td [mips] Define a pseudo instruction which writes to both the lower and higher 2013-10-15 01:48:30 +00:00
MipsFrameLowering.cpp
MipsFrameLowering.h [mips] Add parameter Alignment to MipsFrameLowering's constructor. 2013-03-29 01:51:04 +00:00
MipsInstrFormats.td Support for microMIPS trap instruction with immediate operands. 2013-11-13 13:15:03 +00:00
MipsInstrFPU.td This patch implements Mips load/store instructions from/to coprocessor 2. Test cases are added. 2013-09-16 10:29:42 +00:00
MipsInstrInfo.cpp Make first substantial checkin of my port of ARM constant islands code to Mips. 2013-10-27 21:57:36 +00:00
MipsInstrInfo.h DebugInfo: remove target-specific Frame Index handling for DBG_VALUE MachineInstrs 2013-06-16 20:34:27 +00:00
MipsInstrInfo.td Use instr mapping for microMIPS in llvm-mc. 2013-11-15 08:07:34 +00:00
MipsISelDAGToDAG.cpp [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00
MipsISelDAGToDAG.h [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00
MipsISelLowering.cpp [mips] Fix a bug in function CC_MipsO32_FP64. The second double precision 2013-11-12 22:16:18 +00:00
MipsISelLowering.h [mips] Rename isel nodes. 2013-10-15 01:12:50 +00:00
MipsJITInfo.cpp [test commit] Minor comment change. 2013-07-24 13:02:35 +00:00
MipsJITInfo.h
MipsLongBranch.cpp [mips] Simplify and optimize code. 2013-10-08 18:13:24 +00:00
MipsMachineFunction.cpp [mips] Simplify and optimize code. 2013-10-08 18:13:24 +00:00
MipsMachineFunction.h [mips] Define a derived class of PseudoSourceValue that represents a GOT entry 2013-09-27 22:30:36 +00:00
MipsMCInstLower.cpp Add a helper getSymbol to AsmPrinter. 2013-10-29 17:07:16 +00:00
MipsMCInstLower.h The asm printer has a mangler. Use it. 2013-10-29 16:24:21 +00:00
MipsModuleISelDAGToDAG.cpp This patch enables llvm to switch between compiling for mips32/mips64 2013-04-09 19:46:01 +00:00
MipsModuleISelDAGToDAG.h This patch enables llvm to switch between compiling for mips32/mips64 2013-04-09 19:46:01 +00:00
MipsMSAInstrFormats.td [mips][msa] Direct Object Emission support for the LSA instruction. 2013-10-23 13:20:07 +00:00
MipsMSAInstrInfo.td [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00
MipsOs16.cpp Make nomips16 mask not repeat if it ends with a '.'. 2013-09-23 22:36:11 +00:00
MipsOs16.h This is for an experimental option -mips-os16. The idea is to compile all 2013-04-10 16:58:04 +00:00
MipsRegisterInfo.cpp Remove getEHExceptionRegister and getEHHandlerRegister. 2013-10-07 13:39:22 +00:00
MipsRegisterInfo.h Remove getEHExceptionRegister and getEHHandlerRegister. 2013-10-07 13:39:22 +00:00
MipsRegisterInfo.td [mips][msa] Direct Object Emission support for CTCMSA and CFCMSA. 2013-10-21 12:26:50 +00:00
MipsRelocations.h
MipsSchedule.td [mips] Define instruction itineraries IIArith and IILogic. 2013-07-31 00:55:34 +00:00
MipsSEFrameLowering.cpp [mips] Fix definition of mfhi and mflo instructions to read from the whole 2013-10-07 18:49:46 +00:00
MipsSEFrameLowering.h [mips] Align the stack to 16-bytes for mfp64. 2013-10-29 19:29:03 +00:00
MipsSEInstrInfo.cpp [mips] Define a pseudo instruction which writes to both the lower and higher 2013-10-15 01:48:30 +00:00
MipsSEInstrInfo.h [mips] Define a pseudo instruction which writes to both the lower and higher 2013-10-15 01:48:30 +00:00
MipsSEISelDAGToDAG.cpp [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00
MipsSEISelDAGToDAG.h [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00
MipsSEISelLowering.cpp Fix illegal DAG produced by SelectionDAG::getConstant() for v2i64 type 2013-11-15 12:56:49 +00:00
MipsSEISelLowering.h [mips][msa] Added support for matching fexp2 from normal IR (i.e. not intrinsics) 2013-10-23 10:36:52 +00:00
MipsSelectionDAGInfo.cpp
MipsSelectionDAGInfo.h
MipsSERegisterInfo.cpp [mips] Rename register classes CPURegs and CPU64Regs. 2013-08-06 23:08:38 +00:00
MipsSERegisterInfo.h Don't cache the instruction and register info from the TargetMachine, because 2013-06-07 07:04:14 +00:00
MipsSubtarget.cpp [mips] Compute stack alignment on the fly. 2013-10-30 02:29:43 +00:00
MipsSubtarget.h [mips] Partially revert r193641. Stack alignment should not be determined by 2013-11-11 21:49:03 +00:00
MipsTargetMachine.cpp [mips] Disable tail merging when long branch pass is enabled. 2013-10-07 19:13:53 +00:00
MipsTargetMachine.h [mips] Implement MipsTargetMachine::getInstrItineraryData(). 2013-07-12 23:33:22 +00:00
MipsTargetObjectFile.cpp
MipsTargetObjectFile.h
MipsTargetStreamer.h Add a MCTargetStreamer interface. 2013-10-08 13:08:17 +00:00
MSA.txt [mips][msa] Added support for matching bclr, and bclri from normal IR (i.e. not intrinsics) 2013-11-12 10:45:18 +00:00