diff options
| author | Alon Zakai <alonzakai@gmail.com> | 2013-12-07 18:37:45 -0500 |
|---|---|---|
| committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-07 18:39:01 -0500 |
| commit | 2ff2d17013101b24efbed348aaa59fa36ca4a725 (patch) | |
| tree | 859de248a30a59cce76168f7252a6abfb9d72a47 /lib/Transforms/NaCl/ExpandI64.cpp | |
| parent | 7c445f10aaf611c37e9f6cdf88c27b254f8b6575 (diff) | |
legalize i64 select
Diffstat (limited to 'lib/Transforms/NaCl/ExpandI64.cpp')
| -rw-r--r-- | lib/Transforms/NaCl/ExpandI64.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp index 8b7402a1b3..af20c4c818 100644 --- a/lib/Transforms/NaCl/ExpandI64.cpp +++ b/lib/Transforms/NaCl/ExpandI64.cpp @@ -235,6 +235,18 @@ void ExpandI64::splitInst(Instruction *I, DataLayout& DL) { Split.LowHigh.High = High; break; } + case Instruction::Select: { + Value *Cond = I->getOperand(0); + + Instruction *L = CopyDebug(SelectInst::Create(Cond, Zero, Zero, "", I), I); // will be fixed + Instruction *H = CopyDebug(SelectInst::Create(Cond, Zero, Zero, "", I), I); // will be fixed + SplitInfo &Split = Splits[I]; + Split.ToFix.push_back(L); + Split.ToFix.push_back(H); + Split.LowHigh.Low = L; + Split.LowHigh.High = H; + break; + } default: { dumpIR(I); assert(0 && "some i64 thing we can't legalize yet"); @@ -305,6 +317,16 @@ void ExpandI64::finalizeInst(Instruction *I) { // TODO fix the arguments to the call break; } + case Instruction::Select: { + LowHighPair TrueLH = getLowHigh(I->getOperand(1)); + LowHighPair FalseLH = getLowHigh(I->getOperand(2)); + Instruction *L = Split.ToFix[0]; + Instruction *H = Split.ToFix[1]; + L->setOperand(1, TrueLH.Low); L->setOperand(2, FalseLH.Low); + H->setOperand(1, TrueLH.High); H->setOperand(2, FalseLH.High); + break; + } + default: assert(0); } } |
