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

Unified Diff: src/IceTargetLoweringMIPS32.cpp

Issue 2358393004: Subzero, MIPS32: Intrinsic call Cttz for i32 (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changes as advised Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInstMIPS32.cpp ('k') | tests_lit/assembler/mips32/encoding_intrinsics.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringMIPS32.cpp
diff --git a/src/IceTargetLoweringMIPS32.cpp b/src/IceTargetLoweringMIPS32.cpp
index f61ba8a862993c3098ebd14d8e0e8447e8a9432c..2c90a7c415f7ee4749d1b24031a75daa918ae703 100644
--- a/src/IceTargetLoweringMIPS32.cpp
+++ b/src/IceTargetLoweringMIPS32.cpp
@@ -2867,7 +2867,34 @@ void TargetMIPS32::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
break;
}
case Intrinsics::Cttz: {
- UnimplementedLoweringError(this, Instr);
+ auto *Src = Instr->getArg(0);
+ const Type SrcTy = Src->getType();
+ assert(SrcTy == IceType_i32 || SrcTy == IceType_i64);
+ switch (SrcTy) {
+ case IceType_i32: {
+ auto *T1 = I32Reg();
+ auto *T2 = I32Reg();
+ auto *T3 = I32Reg();
+ auto *T4 = I32Reg();
+ auto *T5 = I32Reg();
+ auto *T6 = I32Reg();
+ auto *SrcR = legalizeToReg(Src);
+ _addiu(T1, SrcR, -1);
+ _not(T2, SrcR);
+ _and(T3, T2, T1);
+ _clz(T4, T3);
+ _addiu(T5, getZero(), 32);
+ _subu(T6, T5, T4);
+ _mov(Dest, T6);
+ break;
+ }
+ case IceType_i64: {
+ UnimplementedLoweringError(this, Instr);
+ break;
+ }
+ default:
+ llvm::report_fatal_error("Control flow should never have reached here.");
+ }
return;
}
case Intrinsics::Fabs: {
@@ -3367,7 +3394,8 @@ void TargetMIPS32::postLower() {
return;
// TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0,
// and set the IsDestRedefined flag to keep liveness analysis consistent.
- UnimplementedError(getFlags());
+ markRedefinitions();
+ Context.availabilityUpdate();
}
void TargetMIPS32::makeRandomRegisterPermutation(
« no previous file with comments | « src/IceInstMIPS32.cpp ('k') | tests_lit/assembler/mips32/encoding_intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698