Chromium Code Reviews| Index: src/IceTargetLoweringMIPS32.cpp |
| diff --git a/src/IceTargetLoweringMIPS32.cpp b/src/IceTargetLoweringMIPS32.cpp |
| index 238b7bb9d8eb52dddae9b0685600022b5c0d1935..2d42d0f9fa09fff54ed367fbbb20aaac81a5f50c 100644 |
| --- a/src/IceTargetLoweringMIPS32.cpp |
| +++ b/src/IceTargetLoweringMIPS32.cpp |
| @@ -956,7 +956,100 @@ void TargetMIPS32::lowerFcmp(const InstFcmp *Instr) { |
| UnimplementedLoweringError(this, Instr); |
| } |
| +void TargetMIPS32::lower64Icmp(const InstIcmp *Instr) { |
| + UnimplementedLoweringError(this, Instr); |
| + return; |
| +} |
| + |
| void TargetMIPS32::lowerIcmp(const InstIcmp *Instr) { |
|
Jim Stichnoth
2016/04/19 16:44:01
This CL is currently lacking tests. There should
sagar.thakur
2016/04/25 09:14:32
Yes, the test for icmp eq could be something like
Jim Stichnoth
2016/04/25 15:26:53
Ah, you're right. It looks like none of the lower
|
| + auto Src0 = Instr->getSrc(0); |
| + auto Src1 = Instr->getSrc(1); |
| + if (Src0->getType() == IceType_i64 || Src1->getType() == IceType_i64) { |
|
Jim Stichnoth
2016/04/19 16:44:01
Typically we just check the type of getDest() or g
sagar.thakur
2016/04/25 09:14:32
Done.
|
| + lower64Icmp(Instr); |
|
Jim Stichnoth
2016/04/19 16:44:02
LLVM coding style uses 2-space indents. If you ru
sagar.thakur
2016/04/25 09:14:32
Done.
|
| + return; |
| + } |
| + Variable *Dest = Instr->getDest(); |
| + if (isVectorType(Dest->getType())) { |
| + UnimplementedLoweringError(this, Instr); |
| + return; |
| + } |
| + InstIcmp::ICond Cond = Instr->getCondition(); |
| + auto Src0R = legalizeToReg(Src0); |
|
Jim Stichnoth
2016/04/19 16:44:02
auto *
for these two
sagar.thakur
2016/04/25 09:14:32
Done.
|
| + auto Src1R = legalizeToReg(Src1); |
| + switch(Cond) { |
| + case InstIcmp::Eq: { |
| + auto DestT = I32Reg(), T = I32Reg(); |
|
Jim Stichnoth
2016/04/19 16:44:01
We usually do variable initializations as separate
sagar.thakur
2016/04/25 09:14:32
Done.
|
| + _xor(T, Src0R, Src1R); |
| + _sltiu(DestT, T, 1); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Ne: { |
| + auto DestT = I32Reg(), T = I32Reg(), Zero = getZero(); |
|
Jim Stichnoth
2016/04/19 16:44:01
The following doesn't need to be addressed in this
sagar.thakur
2016/04/25 09:14:31
I think the third approach would be a good one. Wi
|
| + _xor(T, Src0R, Src1R); |
| + _sltu(DestT, Zero, T); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Ugt: { |
| + auto DestT = I32Reg(); |
| + _sltu(DestT, Src1R, Src0R); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Uge: { |
| + auto DestT = I32Reg(), T = I32Reg(); |
| + _sltu(T, Src0R, Src1R); |
| + _xori(DestT, T, 1); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Ult: { |
| + auto DestT = I32Reg(); |
| + _sltu(DestT, Src0R, Src1R); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Ule:{ |
| + auto DestT = I32Reg(), T = I32Reg(); |
| + _sltu(T, Src1R, Src0R); |
| + _xori(DestT, T, 1); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Sgt: { |
| + auto DestT = I32Reg(); |
| + _slt(DestT, Src1R, Src0R); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Sge: { |
| + auto DestT = I32Reg(), T = I32Reg(); |
| + _slt(T, Src1R, Src0R); |
| + _xori(DestT, T, 1); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Slt: { |
| + auto DestT = I32Reg(); |
| + _slt(DestT, Src0R, Src1R); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + case InstIcmp::Sle:{ |
| + auto DestT = I32Reg(), T = I32Reg(); |
| + _slt(T, Src1R, Src0R); |
| + _xori(DestT, T, 1); |
| + _mov(Dest, DestT); |
| + return; |
| + } |
| + default: |
| + llvm_unreachable("Invalid ICmp operator"); |
| + return; |
| + } |
| + (void)Src0; |
|
Jim Stichnoth
2016/04/19 16:44:02
remove these
sagar.thakur
2016/04/25 09:14:31
Done.
|
| + (void)Src1; |
| + (void)Cond; |
| UnimplementedLoweringError(this, Instr); |
|
Jim Stichnoth
2016/04/19 16:44:01
I think this can be removed, given the return in t
sagar.thakur
2016/04/25 09:14:32
Done.
|
| } |