Chromium Code Reviews| Index: src/IceTargetLoweringX8632.cpp |
| diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
| index 81973d06cd027df3c652d75c789e6d380ff6e352..c646fd0c4f950b3037b8c8a864406b3edcf8c317 100644 |
| --- a/src/IceTargetLoweringX8632.cpp |
| +++ b/src/IceTargetLoweringX8632.cpp |
| @@ -1764,6 +1764,82 @@ void TargetX8632::lowerIcmp(const InstIcmp *Inst) { |
| Context.insert(Label); |
| } |
| +void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { |
| + switch (Instr->getIntrinsicInfo().ID) { |
| + case AtomicCmpxchg: |
| + case AtomicFence: |
| + case AtomicFenceAll: |
| + case AtomicIsLockFree: |
| + case AtomicLoad: |
| + case AtomicRMW: |
| + case AtomicStore: |
| + case Bswap: |
| + case Ctlz: |
| + case Ctpop: |
| + case Cttz: |
| + Func->setError("Unhandled intrinsic"); |
| + return; |
| + case Longjmp: { |
| + InstCall *Call = makeHelperCall("longjmp", NULL, 2); |
| + Call->addArg(Instr->getSrc(1)); |
|
Jim Stichnoth
2014/06/10 22:58:28
Change all the Instr->getSrc(N) calls to Instr->ge
jvoung (off chromium)
2014/06/12 05:48:30
Done.
Also adding a crosstest runnable test. Curr
|
| + Call->addArg(Instr->getSrc(2)); |
| + lowerCall(Call); |
| + break; |
| + } |
| + case Memcpy: { |
| + // In the future, we could potentially emit an inline memcpy/memset, etc. |
| + // for intrinsic calls w/ a known length. |
| + InstCall *Call = makeHelperCall("memcpy", NULL, 3); |
| + Call->addArg(Instr->getSrc(1)); |
| + Call->addArg(Instr->getSrc(2)); |
| + Call->addArg(Instr->getSrc(3)); |
| + lowerCall(Call); |
| + break; |
| + } |
| + case Memmove: { |
| + InstCall *Call = makeHelperCall("memmove", NULL, 3); |
| + Call->addArg(Instr->getSrc(1)); |
| + Call->addArg(Instr->getSrc(2)); |
| + Call->addArg(Instr->getSrc(3)); |
| + lowerCall(Call); |
| + break; |
| + } |
| + case Memset: { |
| + InstCall *Call = makeHelperCall("memset", NULL, 3); |
| + Call->addArg(Instr->getSrc(1)); |
| + Call->addArg(Instr->getSrc(2)); |
| + Call->addArg(Instr->getSrc(3)); |
| + lowerCall(Call); |
| + break; |
| + } |
| + case NaClReadTP: { |
| + Constant *Zero = Ctx->getConstantInt(IceType_i32, 0); |
| + Operand *Src = OperandX8632MemOffSeg::create(Func, IceType_i32, |
| + Zero, Reg_GS); |
| + Variable *Dest = Instr->getDest(); |
| + // Src is already a memory operand, so we need Dest to be a register. |
| + Dest->setWeightInfinite(); |
|
Jim Stichnoth
2014/06/10 22:58:28
This will force Dest to have a register for the en
jvoung (off chromium)
2014/06/12 05:48:30
Oops yeah otherwise it could potentially have a pr
|
| + _mov(Dest, Src); |
| + break; |
| + } |
| + case Setjmp: { |
| + InstCall *Call = makeHelperCall("setjmp", Instr->getDest(), 1); |
| + Call->addArg(Instr->getSrc(1)); |
| + lowerCall(Call); |
| + break; |
| + } |
| + case Sqrt: |
| + case Stacksave: |
| + case Stackrestore: |
| + Func->setError("Unhandled intrinsic"); |
| + return; |
| + case Trap: |
| + _ud2(); |
| + break; |
| + } |
| + return; |
| +} |
| + |
| namespace { |
| bool isAdd(const Inst *Inst) { |