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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 407093014: Fix legalization of source operand to bsr and bsf. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | tests_lit/llvm2ice_tests/nacl-other-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 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 // Similar for 64-bit, but start w/ speculating that the upper 32 bits 3007 // Similar for 64-bit, but start w/ speculating that the upper 32 bits
3008 // are all zero, and compute the result for that case (checking the lower 3008 // are all zero, and compute the result for that case (checking the lower
3009 // 32 bits). Then actually compute the result for the upper bits and 3009 // 32 bits). Then actually compute the result for the upper bits and
3010 // cmov in the result from the lower computation if the earlier speculation 3010 // cmov in the result from the lower computation if the earlier speculation
3011 // was correct. 3011 // was correct.
3012 // 3012 //
3013 // Cttz, is similar, but uses bsf instead, and doesn't require the xor 3013 // Cttz, is similar, but uses bsf instead, and doesn't require the xor
3014 // bit position conversion, and the speculation is reversed. 3014 // bit position conversion, and the speculation is reversed.
3015 assert(Ty == IceType_i32 || Ty == IceType_i64); 3015 assert(Ty == IceType_i32 || Ty == IceType_i64);
3016 Variable *T = makeReg(IceType_i32); 3016 Variable *T = makeReg(IceType_i32);
3017 Operand *FirstValRM = legalize(FirstVal, Legal_Mem | Legal_Reg);
3017 if (Cttz) { 3018 if (Cttz) {
3018 _bsf(T, FirstVal); 3019 _bsf(T, FirstValRM);
3019 } else { 3020 } else {
3020 _bsr(T, FirstVal); 3021 _bsr(T, FirstValRM);
3021 } 3022 }
3022 Variable *T_Dest = makeReg(IceType_i32); 3023 Variable *T_Dest = makeReg(IceType_i32);
3023 Constant *ThirtyTwo = Ctx->getConstantInt(IceType_i32, 32); 3024 Constant *ThirtyTwo = Ctx->getConstantInt(IceType_i32, 32);
3024 Constant *ThirtyOne = Ctx->getConstantInt(IceType_i32, 31); 3025 Constant *ThirtyOne = Ctx->getConstantInt(IceType_i32, 31);
3025 if (Cttz) { 3026 if (Cttz) {
3026 _mov(T_Dest, ThirtyTwo); 3027 _mov(T_Dest, ThirtyTwo);
3027 } else { 3028 } else {
3028 Constant *SixtyThree = Ctx->getConstantInt(IceType_i32, 63); 3029 Constant *SixtyThree = Ctx->getConstantInt(IceType_i32, 63);
3029 _mov(T_Dest, SixtyThree); 3030 _mov(T_Dest, SixtyThree);
3030 } 3031 }
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
3751 for (SizeT i = 0; i < Size; ++i) { 3752 for (SizeT i = 0; i < Size; ++i) {
3752 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; 3753 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n";
3753 } 3754 }
3754 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; 3755 Str << "\t.size\t" << MangledName << ", " << Size << "\n";
3755 } 3756 }
3756 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName 3757 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName
3757 << "\n"; 3758 << "\n";
3758 } 3759 }
3759 3760
3760 } // end of namespace Ice 3761 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698