diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-08 16:20:49 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-08 16:20:49 -0500 |
commit | a07a863344f8fd1124a4336251bfe2d581abcfdb (patch) | |
tree | 0ad6704ef980826998d94aabe5bd814e1d9b4dc0 | |
parent | cbc0e4652b73931bb379dc71fdb2e8e2948b9811 (diff) |
legalize and, or, xor
-rw-r--r-- | lib/Transforms/NaCl/ExpandI64.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp index d064a508c0..3b74f9a048 100644 --- a/lib/Transforms/NaCl/ExpandI64.cpp +++ b/lib/Transforms/NaCl/ExpandI64.cpp @@ -303,6 +303,22 @@ void ExpandI64::splitInst(Instruction *I, DataLayout& DL) { Split.ToFix.push_back(H); Split.LowHigh.High = H; break; } + case Instruction::And: + case Instruction::Or: + case Instruction::Xor: { + Instruction::BinaryOps Op; + switch (I->getOpcode()) { // XXX why does llvm make us do this? + case Instruction::And: Op = Instruction::And; break; + case Instruction::Or: Op = Instruction::Or; break; + case Instruction::Xor: Op = Instruction::Xor; break; + } + Instruction *L = CopyDebug(BinaryOperator::Create(Op, Zero, Zero, "", I), I); + Instruction *H = CopyDebug(BinaryOperator::Create(Op, Zero, Zero, "", I), I); + SplitInfo &Split = Splits[I]; + Split.ToFix.push_back(L); Split.LowHigh.Low = L; + Split.ToFix.push_back(H); Split.LowHigh.High = H; + break; + } default: { dumpIR(I); assert(0 && "some i64 thing we can't legalize yet"); @@ -412,6 +428,17 @@ void ExpandI64::finalizeInst(Instruction *I) { } break; } + case Instruction::And: + case Instruction::Or: + case Instruction::Xor: { + LowHighPair LeftLH = getLowHigh(I->getOperand(0)); + LowHighPair RightLH = getLowHigh(I->getOperand(1)); + Instruction *L = Split.ToFix[0]; + Instruction *H = Split.ToFix[1]; + L->setOperand(0, LeftLH.Low); L->setOperand(1, RightLH.Low); + H->setOperand(0, LeftLH.High); H->setOperand(1, RightLH.High); + break; + } default: assert(0); } } |