mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-25 00:29:20 +00:00
Have fast-isel understand llvm.objectsize. Update testcase for slightly
different codegen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6220754525
commit
f27805b5c5
@ -1166,6 +1166,30 @@ bool X86FastISel::X86VisitIntrinsicCall(IntrinsicInst &I) {
|
|||||||
// FIXME: Handle more intrinsics.
|
// FIXME: Handle more intrinsics.
|
||||||
switch (I.getIntrinsicID()) {
|
switch (I.getIntrinsicID()) {
|
||||||
default: return false;
|
default: return false;
|
||||||
|
case Intrinsic::objectsize: {
|
||||||
|
ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(2));
|
||||||
|
const Type *Ty = I.getCalledFunction()->getReturnType();
|
||||||
|
|
||||||
|
assert(CI && "Non-constant type in Intrinsic::objectsize?");
|
||||||
|
|
||||||
|
EVT VT;
|
||||||
|
if (!isTypeLegal(Ty, VT))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned OpC = 0;
|
||||||
|
if (VT == MVT::i32)
|
||||||
|
OpC = X86::MOV32ri;
|
||||||
|
else if (VT == MVT::i64)
|
||||||
|
OpC = X86::MOV64ri;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned ResultReg = createResultReg(TLI.getRegClassFor(VT));
|
||||||
|
BuildMI(MBB, DL, TII.get(OpC), ResultReg).
|
||||||
|
addImm(CI->getZExtValue() == 0 ? -1ULL : 0);
|
||||||
|
UpdateValueMap(&I, ResultReg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
case Intrinsic::dbg_declare: {
|
case Intrinsic::dbg_declare: {
|
||||||
DbgDeclareInst *DI = cast<DbgDeclareInst>(&I);
|
DbgDeclareInst *DI = cast<DbgDeclareInst>(&I);
|
||||||
X86AddressMode AM;
|
X86AddressMode AM;
|
||||||
|
@ -12,7 +12,7 @@ entry:
|
|||||||
%tmp = load i8** @p ; <i8*> [#uses=1]
|
%tmp = load i8** @p ; <i8*> [#uses=1]
|
||||||
%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i1 0) ; <i64> [#uses=1]
|
%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i1 0) ; <i64> [#uses=1]
|
||||||
%cmp = icmp ne i64 %0, -1 ; <i1> [#uses=1]
|
%cmp = icmp ne i64 %0, -1 ; <i1> [#uses=1]
|
||||||
; X64: movq $-1, %rax
|
; X64: movabsq $-1, %rax
|
||||||
; X64: cmpq $-1, %rax
|
; X64: cmpq $-1, %rax
|
||||||
br i1 %cmp, label %cond.true, label %cond.false
|
br i1 %cmp, label %cond.true, label %cond.false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user