mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	constant fold sign_extend_inreg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -1335,6 +1335,14 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, | |||||||
|   ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.Val); |   ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1.Val); | ||||||
|   ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2.Val); |   ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2.Val); | ||||||
|   if (N1C) { |   if (N1C) { | ||||||
|  |     if (Opcode == ISD::SIGN_EXTEND_INREG) { | ||||||
|  |       int64_t Val = N1C->getValue(); | ||||||
|  |       unsigned FromBits = MVT::getSizeInBits(cast<VTSDNode>(N2)->getVT()); | ||||||
|  |       Val <<= 64-FromBits; | ||||||
|  |       Val >>= 64-FromBits; | ||||||
|  |       return getConstant(Val, VT); | ||||||
|  |     } | ||||||
|  |      | ||||||
|     if (N2C) { |     if (N2C) { | ||||||
|       uint64_t C1 = N1C->getValue(), C2 = N2C->getValue(); |       uint64_t C1 = N1C->getValue(), C2 = N2C->getValue(); | ||||||
|       switch (Opcode) { |       switch (Opcode) { | ||||||
| @@ -1441,7 +1449,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|    |    | ||||||
|   // Fold a bunch of operators that  |   // Fold a bunch of operators when the RHS is undef.  | ||||||
|   if (N2.getOpcode() == ISD::UNDEF) { |   if (N2.getOpcode() == ISD::UNDEF) { | ||||||
|     switch (Opcode) { |     switch (Opcode) { | ||||||
|     case ISD::ADD: |     case ISD::ADD: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user