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

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: Addressed review comments Created 4 years, 7 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
« no previous file with comments | « 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) {
960 UnimplementedLoweringError(this, Instr); 965 auto *Src0 = Instr->getSrc(0);
966 auto *Src1 = Instr->getSrc(1);
967 if (Src0->getType() == IceType_i64) {
968 lower64Icmp(Instr);
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);
978 auto *Src1R = legalizeToReg(Src1);
979 switch (Cond) {
980 case InstIcmp::Eq: {
981 auto *DestT = I32Reg();
982 auto *T = I32Reg();
983 _xor(T, Src0R, Src1R);
984 _sltiu(DestT, T, 1);
985 _mov(Dest, DestT);
986 return;
987 }
988 case InstIcmp::Ne: {
989 auto *DestT = I32Reg();
990 auto *T = I32Reg();
991 auto *Zero = getZero();
992 _xor(T, Src0R, Src1R);
993 _sltu(DestT, Zero, T);
994 _mov(Dest, DestT);
995 return;
996 }
997 case InstIcmp::Ugt: {
998 auto *DestT = I32Reg();
999 _sltu(DestT, Src1R, Src0R);
1000 _mov(Dest, DestT);
1001 return;
1002 }
1003 case InstIcmp::Uge: {
1004 auto *DestT = I32Reg();
1005 auto *T = I32Reg();
1006 _sltu(T, Src0R, Src1R);
1007 _xori(DestT, T, 1);
1008 _mov(Dest, DestT);
1009 return;
1010 }
1011 case InstIcmp::Ult: {
1012 auto *DestT = I32Reg();
1013 _sltu(DestT, Src0R, Src1R);
1014 _mov(Dest, DestT);
1015 return;
1016 }
1017 case InstIcmp::Ule: {
1018 auto *DestT = I32Reg();
1019 auto *T = I32Reg();
1020 _sltu(T, Src1R, Src0R);
1021 _xori(DestT, T, 1);
1022 _mov(Dest, DestT);
1023 return;
1024 }
1025 case InstIcmp::Sgt: {
1026 auto *DestT = I32Reg();
1027 _slt(DestT, Src1R, Src0R);
1028 _mov(Dest, DestT);
1029 return;
1030 }
1031 case InstIcmp::Sge: {
1032 auto *DestT = I32Reg();
1033 auto *T = I32Reg();
1034 _slt(T, Src1R, Src0R);
1035 _xori(DestT, T, 1);
1036 _mov(Dest, DestT);
1037 return;
1038 }
1039 case InstIcmp::Slt: {
1040 auto *DestT = I32Reg();
1041 _slt(DestT, Src0R, Src1R);
1042 _mov(Dest, DestT);
1043 return;
1044 }
1045 case InstIcmp::Sle: {
1046 auto *DestT = I32Reg();
1047 auto *T = I32Reg();
1048 _slt(T, Src1R, Src0R);
1049 _xori(DestT, T, 1);
1050 _mov(Dest, DestT);
1051 return;
1052 }
1053 default:
1054 llvm_unreachable("Invalid ICmp operator");
1055 return;
1056 }
961 } 1057 }
962 1058
963 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Instr) { 1059 void TargetMIPS32::lowerInsertElement(const InstInsertElement *Instr) {
964 UnimplementedLoweringError(this, Instr); 1060 UnimplementedLoweringError(this, Instr);
965 } 1061 }
966 1062
967 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) { 1063 void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
968 switch (Instr->getIntrinsicInfo().ID) { 1064 switch (Instr->getIntrinsicInfo().ID) {
969 case Intrinsics::AtomicCmpxchg: { 1065 case Intrinsics::AtomicCmpxchg: {
970 UnimplementedLoweringError(this, Instr); 1066 UnimplementedLoweringError(this, Instr);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 Str << "\t.set\t" 1418 Str << "\t.set\t"
1323 << "nomips16\n"; 1419 << "nomips16\n";
1324 } 1420 }
1325 1421
1326 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 1422 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
1327 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 1423 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
1328 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 1424 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
1329 1425
1330 } // end of namespace MIPS32 1426 } // end of namespace MIPS32
1331 } // end of namespace Ice 1427 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698