Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: src/IceTargetLoweringMIPS32.cpp

Issue 1898743002: [Subzero][MIPS] Implement conditional branches and integer comparisons (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/IceTargetLoweringMIPS32.h ('K') | « src/IceTargetLoweringMIPS32.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 } 949 }
950 950
951 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Instr) { 951 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Instr) {
952 UnimplementedLoweringError(this, Instr); 952 UnimplementedLoweringError(this, Instr);
953 } 953 }
954 954
955 void TargetMIPS32::lowerFcmp(const InstFcmp *Instr) { 955 void TargetMIPS32::lowerFcmp(const InstFcmp *Instr) {
956 UnimplementedLoweringError(this, Instr); 956 UnimplementedLoweringError(this, Instr);
957 } 957 }
958 958
959 void TargetMIPS32::lower64Icmp(const InstIcmp *Instr) {
960 UnimplementedLoweringError(this, Instr);
961 return;
962 }
963
959 void TargetMIPS32::lowerIcmp(const InstIcmp *Instr) { 964 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
965 auto Src0 = Instr->getSrc(0);
966 auto Src1 = Instr->getSrc(1);
967 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.
968 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.
969 return;
970 }
971 Variable *Dest = Instr->getDest();
972 if (isVectorType(Dest->getType())) {
973 UnimplementedLoweringError(this, Instr);
974 return;
975 }
976 InstIcmp::ICond Cond = Instr->getCondition();
977 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.
978 auto Src1R = legalizeToReg(Src1);
979 switch(Cond) {
980 case InstIcmp::Eq: {
981 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.
982 _xor(T, Src0R, Src1R);
983 _sltiu(DestT, T, 1);
984 _mov(Dest, DestT);
985 return;
986 }
987 case InstIcmp::Ne: {
988 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
989 _xor(T, Src0R, Src1R);
990 _sltu(DestT, Zero, T);
991 _mov(Dest, DestT);
992 return;
993 }
994 case InstIcmp::Ugt: {
995 auto DestT = I32Reg();
996 _sltu(DestT, Src1R, Src0R);
997 _mov(Dest, DestT);
998 return;
999 }
1000 case InstIcmp::Uge: {
1001 auto DestT = I32Reg(), T = I32Reg();
1002 _sltu(T, Src0R, Src1R);
1003 _xori(DestT, T, 1);
1004 _mov(Dest, DestT);
1005 return;
1006 }
1007 case InstIcmp::Ult: {
1008 auto DestT = I32Reg();
1009 _sltu(DestT, Src0R, Src1R);
1010 _mov(Dest, DestT);
1011 return;
1012 }
1013 case InstIcmp::Ule:{
1014 auto DestT = I32Reg(), T = I32Reg();
1015 _sltu(T, Src1R, Src0R);
1016 _xori(DestT, T, 1);
1017 _mov(Dest, DestT);
1018 return;
1019 }
1020 case InstIcmp::Sgt: {
1021 auto DestT = I32Reg();
1022 _slt(DestT, Src1R, Src0R);
1023 _mov(Dest, DestT);
1024 return;
1025 }
1026 case InstIcmp::Sge: {
1027 auto DestT = I32Reg(), T = I32Reg();
1028 _slt(T, Src1R, Src0R);
1029 _xori(DestT, T, 1);
1030 _mov(Dest, DestT);
1031 return;
1032 }
1033 case InstIcmp::Slt: {
1034 auto DestT = I32Reg();
1035 _slt(DestT, Src0R, Src1R);
1036 _mov(Dest, DestT);
1037 return;
1038 }
1039 case InstIcmp::Sle:{
1040 auto DestT = I32Reg(), T = I32Reg();
1041 _slt(T, Src1R, Src0R);
1042 _xori(DestT, T, 1);
1043 _mov(Dest, DestT);
1044 return;
1045 }
1046 default:
1047 llvm_unreachable("Invalid ICmp operator");
1048 return;
1049 }
1050 (void)Src0;
Jim Stichnoth 2016/04/19 16:44:02 remove these
sagar.thakur 2016/04/25 09:14:31 Done.
1051 (void)Src1;
1052 (void)Cond;
960 UnimplementedLoweringError(this, Instr); 1053 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.
961 } 1054 }
962 1055
963 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Instr) { 1056 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Instr) {
964 UnimplementedLoweringError(this, Instr); 1057 UnimplementedLoweringError(this, Instr);
965 } 1058 }
966 1059
967 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { 1060 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
968 switch (Instr->getIntrinsicInfo().ID) { 1061 switch (Instr->getIntrinsicInfo().ID) {
969 case Intrinsics::AtomicCmpxchg: { 1062 case Intrinsics::AtomicCmpxchg: {
970 UnimplementedLoweringError(this, Instr); 1063 UnimplementedLoweringError(this, Instr);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 Str << "\t.set\t" 1415 Str << "\t.set\t"
1323 << "nomips16\n"; 1416 << "nomips16\n";
1324 } 1417 }
1325 1418
1326 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 1419 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
1327 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 1420 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
1328 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 1421 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
1329 1422
1330 } // end of namespace MIPS32 1423 } // end of namespace MIPS32
1331 } // end of namespace Ice 1424 } // end of namespace Ice
OLDNEW
« src/IceTargetLoweringMIPS32.h ('K') | « src/IceTargetLoweringMIPS32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698