aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Sparc
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-11-23 08:14:09 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-11-23 08:14:09 +0000
commitfbe558c9937110109bc1eadc268c198511a841af (patch)
tree4b2cba7c629621fc7ac51e58e044cf747a42b8a1 /lib/Target/Sparc
parent7598bbac664097768aa0841dc54aabd8753269eb (diff)
downloadexternal_llvm-fbe558c9937110109bc1eadc268c198511a841af.zip
external_llvm-fbe558c9937110109bc1eadc268c198511a841af.tar.gz
external_llvm-fbe558c9937110109bc1eadc268c198511a841af.tar.bz2
pseudocode for 64-bit lshr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r--lib/Target/Sparc/SparcV8ISelSimple.cpp53
1 files changed, 52 insertions, 1 deletions
diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp
index 2144be6..840c7a3 100644
--- a/lib/Target/Sparc/SparcV8ISelSimple.cpp
+++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp
@@ -1114,12 +1114,63 @@ void V8ISel::emitOp64LibraryCall (MachineBasicBlock *MBB,
void V8ISel::emitShift64 (MachineBasicBlock *MBB,
MachineBasicBlock::iterator IP, Instruction &I,
- unsigned DestReg, unsigned Op0Reg, unsigned Op1Reg) {
+ unsigned DestReg, unsigned SrcReg,
+ unsigned ShiftAmtReg) {
bool isSigned = I.getType()->isSigned();
switch (I.getOpcode ()) {
case Instruction::Shl:
case Instruction::Shr:
+ if (!isSigned) {
+ unsigned CarryReg = makeAnotherReg (Type::IntTy),
+ ThirtyTwo = makeAnotherReg (Type::IntTy),
+ HalfShiftReg = makeAnotherReg (Type::IntTy),
+ NegHalfShiftReg = makeAnotherReg (Type::IntTy),
+ TempReg = makeAnotherReg (Type::IntTy);
+ unsigned OneShiftOutReg = makeAnotherReg (Type::ULongTy),
+ TwoShiftsOutReg = makeAnotherReg (Type::ULongTy);
+
+ /*
+ .lshr_begin:
+ ...
+ // Check whether the shift amount is zero:
+ V8::G0 = V8::SUBCCrr V8::G0, ShiftAmountReg
+ V8::BE .lshr_continue
+ V8::BA .lshr_shift
+
+ .lshr_shift: // [preds: begin]
+ // Calculate 32 - shamt:
+ ThirtyTwo = V8::ORri V8::G0, 32
+ HalfShiftReg = V8::SUBCCrr ThirtyTwo, ShiftAmountReg
+ // See whether it was greater than 0:
+ V8::BG .lshr_two_shifts
+ V8::BA .lshr_one_shift
+
+ .lshr_two_shifts: // [preds: shift]
+ CarryReg = V8::SLLrr SrcReg, HalfShiftReg
+ TwoShiftsOutReg = V8::SRLrr SrcReg, ShiftAmountReg
+ TempReg = V8::SRLrr SrcReg+1, ShiftAmountReg
+ TwoShiftsOutReg+1 = V8::ORrr TempReg, CarryReg
+ V8::BA .lshr_continue
+
+ .lshr_one_shift: // [preds: shift]
+ OneShiftOutReg = V8::ORrr V8::G0, V8::G0
+ NegHalfShiftReg = V8::SUBrr V8::G0, HalfShiftReg
+ OneShiftOutReg+1 = V8::SRLrr SrcReg, NegHalfShiftReg
+ V8::BA .lshr_continue
+
+ .lshr_continue: // [preds: begin, do_one_shift, do_two_shifts]
+ DestReg = V8::PHI (SrcReg, begin), (TwoShiftsOutReg, two_shifts),
+ (OneShiftOutReg, one_shift)
+ DestReg+1 = V8::PHI (SrcReg+1, begin), (TwoShiftsOutReg+1, two_shifts),
+ (OneShiftOutReg+1, one_shift)
+ ...
+ */
+
+ std::cerr << "Sorry, 64-bit lshr is not yet supported:\n" << I;
+ abort ();
+ return;
+ }
default:
std::cerr << "Sorry, 64-bit shifts are not yet supported:\n" << I;
abort ();