mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -170,8 +170,6 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
 | 
					Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
 | 
				
			||||||
                                            const Type *DestTy) {
 | 
					                                            const Type *DestTy) {
 | 
				
			||||||
  const Type *SrcTy = V->getType();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (isa<UndefValue>(V)) {
 | 
					  if (isa<UndefValue>(V)) {
 | 
				
			||||||
    // zext(undef) = 0, because the top bits will be zero.
 | 
					    // zext(undef) = 0, because the top bits will be zero.
 | 
				
			||||||
    // sext(undef) = 0, because the top bits will all be the same.
 | 
					    // sext(undef) = 0, because the top bits will all be the same.
 | 
				
			||||||
@@ -257,10 +255,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
 | 
				
			|||||||
    if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
 | 
					    if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
 | 
				
			||||||
      APInt api = CI->getValue();
 | 
					      APInt api = CI->getValue();
 | 
				
			||||||
      const uint64_t zero[] = {0, 0};
 | 
					      const uint64_t zero[] = {0, 0};
 | 
				
			||||||
      uint32_t BitWidth = cast<IntegerType>(SrcTy)->getBitWidth();
 | 
					 | 
				
			||||||
      APFloat apf = APFloat(APInt(DestTy->getPrimitiveSizeInBits(),
 | 
					      APFloat apf = APFloat(APInt(DestTy->getPrimitiveSizeInBits(),
 | 
				
			||||||
                                  2, zero));
 | 
					                                  2, zero));
 | 
				
			||||||
      (void)apf.convertFromZeroExtendedInteger(api.getRawData(), BitWidth, 
 | 
					      (void)apf.convertFromAPInt(api, 
 | 
				
			||||||
                                 opc==Instruction::SIToFP,
 | 
					                                 opc==Instruction::SIToFP,
 | 
				
			||||||
                                 APFloat::rmNearestTiesToEven);
 | 
					                                 APFloat::rmNearestTiesToEven);
 | 
				
			||||||
      return ConstantFP::get(DestTy, apf);
 | 
					      return ConstantFP::get(DestTy, apf);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user