comparison gen/llvmhelpers.cpp @ 1004:45ed9e125a00

Remove initialization of padding of reals, ireals and creals. According to the spec and C ABIs, the contents of padding is undefined. This was breaking dstress creal_01,02,03,07,08,09 and 20 on x86-64. The code was apparently added to fix creal_13,14 and 15, which explicitly compare padding and assert if it's different. I'd argue those tests are broken. (Also, on x86-64 they *also* fail) The tests this fixes, on the other hand, are basic arithmetic.
author Frits van Bommel <fvbommel wxs.nl>
date Fri, 27 Feb 2009 19:41:25 +0100
parents 18ad5601dff7
children 8c73ff5f69e0
comparison
equal deleted inserted replaced
1003:de97188378bc 1004:45ed9e125a00
1376 return 0; 1376 return 0;
1377 else if (ExpInitializer* ex = init->isExpInitializer()) 1377 else if (ExpInitializer* ex = init->isExpInitializer())
1378 { 1378 {
1379 Logger::println("expression initializer"); 1379 Logger::println("expression initializer");
1380 assert(ex->exp); 1380 assert(ex->exp);
1381 DValue* res = ex->exp->toElem(gIR); 1381 return ex->exp->toElem(gIR);
1382
1383 assert(llvm::isa<llvm::PointerType>(target->getType()) && "init target must be ptr");
1384 const LLType* targetty = target->getType()->getContainedType(0);
1385 if(targetty == LLType::X86_FP80Ty)
1386 {
1387 Logger::println("setting fp80 padding to zero");
1388
1389 LLValue* castv = DtoBitCast(target, getPtrToType(LLType::Int16Ty));
1390 LLValue* padding = DtoGEPi1(castv, 5);
1391 DtoStore(llvm::Constant::getNullValue(LLType::Int16Ty), padding);
1392 }
1393 else if(targetty == DtoComplexType(Type::tcomplex80))
1394 {
1395 Logger::println("setting complex fp80 padding to zero");
1396
1397 LLValue* castv = DtoBitCast(target, getPtrToType(LLType::Int16Ty));
1398 LLValue* padding = DtoGEPi1(castv, 5);
1399 DtoStore(llvm::Constant::getNullValue(LLType::Int16Ty), padding);
1400 padding = DtoGEPi1(castv, 11);
1401 DtoStore(llvm::Constant::getNullValue(LLType::Int16Ty), padding);
1402 }
1403
1404 return res;
1405 } 1382 }
1406 else if (init->isVoidInitializer()) 1383 else if (init->isVoidInitializer())
1407 { 1384 {
1408 // do nothing 1385 // do nothing
1409 } 1386 }