comparison gen/tollvm.cpp @ 661:99f32e967746

Simplify fp80 handling in DtoConstFP
author Christian Kamm <kamm incasoftware de>
date Mon, 06 Oct 2008 21:27:29 +0200
parents 5812d6fac0f0
children 06576ece1a1b
comparison
equal deleted inserted replaced
660:d6b71647b622 661:99f32e967746
533 if(llty == LLType::FloatTy || llty == LLType::DoubleTy) 533 if(llty == LLType::FloatTy || llty == LLType::DoubleTy)
534 return LLConstantFP::get(llty, value); 534 return LLConstantFP::get(llty, value);
535 else if(llty == LLType::X86_FP80Ty) { 535 else if(llty == LLType::X86_FP80Ty) {
536 uint64_t bits[] = {0, 0}; 536 uint64_t bits[] = {0, 0};
537 bits[1] = *(uint16_t*)&value; 537 bits[1] = *(uint16_t*)&value;
538 bits[0] = *((uint16_t*)&value + 4); 538 bits[0] = *(uint64_t*)((uint16_t*)&value + 1);
539 bits[0] <<= 16;
540 bits[0] += *((uint16_t*)&value + 3);
541 bits[0] <<= 16;
542 bits[0] += *((uint16_t*)&value + 2);
543 bits[0] <<= 16;
544 bits[0] += *((uint16_t*)&value + 1);
545 return LLConstantFP::get(APFloat(APInt(80, 2, bits))); 539 return LLConstantFP::get(APFloat(APInt(80, 2, bits)));
546 } else { 540 } else {
547 assert(0 && "Unknown floating point type encountered"); 541 assert(0 && "Unknown floating point type encountered");
548 } 542 }
549 } 543 }