mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-16 23:19:37 +00:00
There is no need to emit a shift if the size is constant, which is common
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11420 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8ff9a8639a
commit
0712283e43
@ -1198,21 +1198,29 @@ void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
}
|
||||
|
||||
// Turn the byte code into # iterations
|
||||
unsigned ByteReg = getReg(CI.getOperand(3));
|
||||
unsigned ByteReg;
|
||||
unsigned CountReg;
|
||||
|
||||
switch (Align & 3) {
|
||||
case 2: // WORD aligned
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(1);
|
||||
if (ConstantInt *I = dyn_cast<ConstantInt>(CI.getOperand(3))) {
|
||||
CountReg = getReg(ConstantUInt::get(Type::UIntTy, I->getRawValue()/2));
|
||||
} else {
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(1);
|
||||
}
|
||||
break;
|
||||
case 0: // DWORD aligned
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(2);
|
||||
if (ConstantInt *I = dyn_cast<ConstantInt>(CI.getOperand(3))) {
|
||||
CountReg = getReg(ConstantUInt::get(Type::UIntTy, I->getRawValue()/4));
|
||||
} else {
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(2);
|
||||
}
|
||||
break;
|
||||
case 1: // BYTE aligned
|
||||
case 3: // BYTE aligned
|
||||
CountReg = ByteReg;
|
||||
CountReg = getReg(CI.getOperand(3));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1224,7 +1232,6 @@ void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
BuildMI(BB, X86::MOVrr32, 1, X86::EDI).addReg(TmpReg1);
|
||||
BuildMI(BB, X86::MOVrr32, 1, X86::ESI).addReg(TmpReg2);
|
||||
|
||||
unsigned Bytes = getReg(CI.getOperand(3));
|
||||
switch (Align & 3) {
|
||||
case 1: // BYTE aligned
|
||||
case 3: // BYTE aligned
|
||||
|
@ -1198,21 +1198,29 @@ void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
}
|
||||
|
||||
// Turn the byte code into # iterations
|
||||
unsigned ByteReg = getReg(CI.getOperand(3));
|
||||
unsigned ByteReg;
|
||||
unsigned CountReg;
|
||||
|
||||
switch (Align & 3) {
|
||||
case 2: // WORD aligned
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(1);
|
||||
if (ConstantInt *I = dyn_cast<ConstantInt>(CI.getOperand(3))) {
|
||||
CountReg = getReg(ConstantUInt::get(Type::UIntTy, I->getRawValue()/2));
|
||||
} else {
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(1);
|
||||
}
|
||||
break;
|
||||
case 0: // DWORD aligned
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(2);
|
||||
if (ConstantInt *I = dyn_cast<ConstantInt>(CI.getOperand(3))) {
|
||||
CountReg = getReg(ConstantUInt::get(Type::UIntTy, I->getRawValue()/4));
|
||||
} else {
|
||||
CountReg = makeAnotherReg(Type::IntTy);
|
||||
BuildMI(BB, X86::SHRir32, 2, CountReg).addReg(ByteReg).addZImm(2);
|
||||
}
|
||||
break;
|
||||
case 1: // BYTE aligned
|
||||
case 3: // BYTE aligned
|
||||
CountReg = ByteReg;
|
||||
CountReg = getReg(CI.getOperand(3));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1224,7 +1232,6 @@ void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
BuildMI(BB, X86::MOVrr32, 1, X86::EDI).addReg(TmpReg1);
|
||||
BuildMI(BB, X86::MOVrr32, 1, X86::ESI).addReg(TmpReg2);
|
||||
|
||||
unsigned Bytes = getReg(CI.getOperand(3));
|
||||
switch (Align & 3) {
|
||||
case 1: // BYTE aligned
|
||||
case 3: // BYTE aligned
|
||||
|
Loading…
x
Reference in New Issue
Block a user