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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/IceInstMIPS32.cpp ('k') | tests_lit/assembler/mips32/encoding_intrinsics.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // 1 //
2 // The Subzero Code Generator 2 // The Subzero Code Generator
3 // 3 //
4 // This file is distributed under the University of Illinois Open Source 4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details. 5 // License. See LICENSE.TXT for details.
6 // 6 //
7 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
8 /// 8 ///
9 /// \file 9 /// \file
10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost 10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost
(...skipping 2849 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 case IceType_i64: { 2860 case IceType_i64: {
2861 UnimplementedLoweringError(this, Instr); 2861 UnimplementedLoweringError(this, Instr);
2862 break; 2862 break;
2863 } 2863 }
2864 default: 2864 default:
2865 llvm::report_fatal_error("Control flow should never have reached here."); 2865 llvm::report_fatal_error("Control flow should never have reached here.");
2866 } 2866 }
2867 break; 2867 break;
2868 } 2868 }
2869 case Intrinsics::Cttz: { 2869 case Intrinsics::Cttz: {
2870 UnimplementedLoweringError(this, Instr); 2870 auto *Src = Instr->getArg(0);
2871 const Type SrcTy = Src->getType();
2872 assert(SrcTy == IceType_i32 || SrcTy == IceType_i64);
2873 switch (SrcTy) {
2874 case IceType_i32: {
2875 auto *T1 = I32Reg();
2876 auto *T2 = I32Reg();
2877 auto *T3 = I32Reg();
2878 auto *T4 = I32Reg();
2879 auto *T5 = I32Reg();
2880 auto *T6 = I32Reg();
2881 auto *SrcR = legalizeToReg(Src);
2882 _addiu(T1, SrcR, -1);
2883 _not(T2, SrcR);
2884 _and(T3, T2, T1);
2885 _clz(T4, T3);
2886 _addiu(T5, getZero(), 32);
2887 _subu(T6, T5, T4);
2888 _mov(Dest, T6);
2889 break;
2890 }
2891 case IceType_i64: {
2892 UnimplementedLoweringError(this, Instr);
2893 break;
2894 }
2895 default:
2896 llvm::report_fatal_error("Control flow should never have reached here.");
2897 }
2871 return; 2898 return;
2872 } 2899 }
2873 case Intrinsics::Fabs: { 2900 case Intrinsics::Fabs: {
2874 if (isScalarFloatingType(DestTy)) { 2901 if (isScalarFloatingType(DestTy)) {
2875 Variable *T = makeReg(DestTy); 2902 Variable *T = makeReg(DestTy);
2876 if (DestTy == IceType_f32) { 2903 if (DestTy == IceType_f32) {
2877 _abs_s(T, legalizeToReg(Instr->getArg(0))); 2904 _abs_s(T, legalizeToReg(Instr->getArg(0)));
2878 } else { 2905 } else {
2879 _abs_d(T, legalizeToReg(Instr->getArg(0))); 2906 _abs_d(T, legalizeToReg(Instr->getArg(0)));
2880 } 2907 }
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
3360 // since loOperand() and hiOperand() don't expect Undef input. 3387 // since loOperand() and hiOperand() don't expect Undef input.
3361 void TargetMIPS32::prelowerPhis() { 3388 void TargetMIPS32::prelowerPhis() {
3362 PhiLowering::prelowerPhis32Bit<TargetMIPS32>(this, Context.getNode(), Func); 3389 PhiLowering::prelowerPhis32Bit<TargetMIPS32>(this, Context.getNode(), Func);
3363 } 3390 }
3364 3391
3365 void TargetMIPS32::postLower() { 3392 void TargetMIPS32::postLower() {
3366 if (Func->getOptLevel() == Opt_m1) 3393 if (Func->getOptLevel() == Opt_m1)
3367 return; 3394 return;
3368 // TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0, 3395 // TODO(rkotler): Find two-address non-SSA instructions where Dest==Src0,
3369 // and set the IsDestRedefined flag to keep liveness analysis consistent. 3396 // and set the IsDestRedefined flag to keep liveness analysis consistent.
3370 UnimplementedError(getFlags()); 3397 markRedefinitions();
3398 Context.availabilityUpdate();
3371 } 3399 }
3372 3400
3373 void TargetMIPS32::makeRandomRegisterPermutation( 3401 void TargetMIPS32::makeRandomRegisterPermutation(
3374 llvm::SmallVectorImpl<RegNumT> &Permutation, 3402 llvm::SmallVectorImpl<RegNumT> &Permutation,
3375 const SmallBitVector &ExcludeRegisters, uint64_t Salt) const { 3403 const SmallBitVector &ExcludeRegisters, uint64_t Salt) const {
3376 (void)Permutation; 3404 (void)Permutation;
3377 (void)ExcludeRegisters; 3405 (void)ExcludeRegisters;
3378 (void)Salt; 3406 (void)Salt;
3379 UnimplementedError(getFlags()); 3407 UnimplementedError(getFlags());
3380 } 3408 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3758 Str << "\t.set\t" 3786 Str << "\t.set\t"
3759 << "nomips16\n"; 3787 << "nomips16\n";
3760 } 3788 }
3761 3789
3762 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 3790 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
3763 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 3791 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
3764 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 3792 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
3765 3793
3766 } // end of namespace MIPS32 3794 } // end of namespace MIPS32
3767 } // end of namespace Ice 3795 } // end of namespace Ice
OLDNEW
« 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