mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-08 18:30:04 +00:00
Support vector bitcasts in the AsmPrinter. PR11495.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146001 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e3d3572e28
commit
f91abd22be
@ -1642,6 +1642,28 @@ static void EmitGlobalConstantVector(const ConstantVector *CV,
|
|||||||
AP.OutStreamer.EmitZeros(Padding, AddrSpace);
|
AP.OutStreamer.EmitZeros(Padding, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LowerVectorConstant(const Constant *CV, unsigned AddrSpace,
|
||||||
|
AsmPrinter &AP) {
|
||||||
|
// Look through bitcasts
|
||||||
|
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV))
|
||||||
|
if (CE->getOpcode() == Instruction::BitCast)
|
||||||
|
CV = CE->getOperand(0);
|
||||||
|
|
||||||
|
if (const ConstantVector *V = dyn_cast<ConstantVector>(CV))
|
||||||
|
return EmitGlobalConstantVector(V, AddrSpace, AP);
|
||||||
|
|
||||||
|
// If we get here, we're stuck; report the problem to the user.
|
||||||
|
// FIXME: Are there any other useful tricks for vectors?
|
||||||
|
{
|
||||||
|
std::string S;
|
||||||
|
raw_string_ostream OS(S);
|
||||||
|
OS << "Unsupported vector expression in static initializer: ";
|
||||||
|
WriteAsOperand(OS, CV, /*PrintType=*/false,
|
||||||
|
!AP.MF ? 0 : AP.MF->getFunction()->getParent());
|
||||||
|
report_fatal_error(OS.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
||||||
unsigned AddrSpace, AsmPrinter &AP) {
|
unsigned AddrSpace, AsmPrinter &AP) {
|
||||||
// Print the fields in successive locations. Pad to align if needed!
|
// Print the fields in successive locations. Pad to align if needed!
|
||||||
@ -1796,8 +1818,8 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const ConstantVector *V = dyn_cast<ConstantVector>(CV))
|
if (CV->getType()->isVectorTy())
|
||||||
return EmitGlobalConstantVector(V, AddrSpace, AP);
|
return LowerVectorConstant(CV, AddrSpace, AP);
|
||||||
|
|
||||||
// Otherwise, it must be a ConstantExpr. Lower it to an MCExpr, then emit it
|
// Otherwise, it must be a ConstantExpr. Lower it to an MCExpr, then emit it
|
||||||
// thread the streamer with EmitValue.
|
// thread the streamer with EmitValue.
|
||||||
|
5
test/CodeGen/X86/2011-12-06-BitcastVectorGlobal.ll
Normal file
5
test/CodeGen/X86/2011-12-06-BitcastVectorGlobal.ll
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
; RUN: llc < %s -march=x86-64 | FileCheck %s
|
||||||
|
; PR11495
|
||||||
|
|
||||||
|
; CHECK: 1311768467463790320
|
||||||
|
@v = global <2 x float> bitcast (<1 x i64> <i64 1311768467463790320> to <2 x float>), align 8
|
Loading…
Reference in New Issue
Block a user