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

Side by Side Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1262003003: Subzero: Fix x86 lowering for shift-by-relocatable-constant. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 4 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/arith.ll » ('j') | tests_lit/llvm2ice_tests/arith.ll » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==//
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 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 _mov(T, Src0, Traits::RegisterSet::Reg_eax); 1828 _mov(T, Src0, Traits::RegisterSet::Reg_eax);
1829 Src1 = legalize(Src1, Legal_Reg | Legal_Mem); 1829 Src1 = legalize(Src1, Legal_Reg | Legal_Mem);
1830 } else { 1830 } else {
1831 _mov(T, Src0); 1831 _mov(T, Src0);
1832 } 1832 }
1833 _imul(T, Src1); 1833 _imul(T, Src1);
1834 _mov(Dest, T); 1834 _mov(Dest, T);
1835 break; 1835 break;
1836 case InstArithmetic::Shl: 1836 case InstArithmetic::Shl:
1837 _mov(T, Src0); 1837 _mov(T, Src0);
1838 if (!llvm::isa<Constant>(Src1)) 1838 if (!llvm::isa<ConstantInteger32>(Src1))
1839 Src1 = legalizeToReg(Src1, Traits::RegisterSet::Reg_ecx); 1839 Src1 = legalizeToReg(Src1, Traits::RegisterSet::Reg_ecx);
1840 _shl(T, Src1); 1840 _shl(T, Src1);
1841 _mov(Dest, T); 1841 _mov(Dest, T);
1842 break; 1842 break;
1843 case InstArithmetic::Lshr: 1843 case InstArithmetic::Lshr:
1844 _mov(T, Src0); 1844 _mov(T, Src0);
1845 if (!llvm::isa<Constant>(Src1)) 1845 if (!llvm::isa<ConstantInteger32>(Src1))
1846 Src1 = legalizeToReg(Src1, Traits::RegisterSet::Reg_ecx); 1846 Src1 = legalizeToReg(Src1, Traits::RegisterSet::Reg_ecx);
1847 _shr(T, Src1); 1847 _shr(T, Src1);
1848 _mov(Dest, T); 1848 _mov(Dest, T);
1849 break; 1849 break;
1850 case InstArithmetic::Ashr: 1850 case InstArithmetic::Ashr:
1851 _mov(T, Src0); 1851 _mov(T, Src0);
1852 if (!llvm::isa<Constant>(Src1)) 1852 if (!llvm::isa<ConstantInteger32>(Src1))
1853 Src1 = legalizeToReg(Src1, Traits::RegisterSet::Reg_ecx); 1853 Src1 = legalizeToReg(Src1, Traits::RegisterSet::Reg_ecx);
1854 _sar(T, Src1); 1854 _sar(T, Src1);
1855 _mov(Dest, T); 1855 _mov(Dest, T);
1856 break; 1856 break;
1857 case InstArithmetic::Udiv: 1857 case InstArithmetic::Udiv:
1858 // div and idiv are the few arithmetic operators that do not allow 1858 // div and idiv are the few arithmetic operators that do not allow
1859 // immediates as the operand. 1859 // immediates as the operand.
1860 Src1 = legalize(Src1, Legal_Reg | Legal_Mem); 1860 Src1 = legalize(Src1, Legal_Reg | Legal_Mem);
1861 if (isByteSizedArithType(Dest->getType())) { 1861 if (isByteSizedArithType(Dest->getType())) {
1862 // For 8-bit unsigned division we need to zero-extend al into ah. A mov 1862 // For 8-bit unsigned division we need to zero-extend al into ah. A mov
(...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after
5472 } 5472 }
5473 // the offset is not eligible for blinding or pooling, return the original 5473 // the offset is not eligible for blinding or pooling, return the original
5474 // mem operand 5474 // mem operand
5475 return MemOperand; 5475 return MemOperand;
5476 } 5476 }
5477 5477
5478 } // end of namespace X86Internal 5478 } // end of namespace X86Internal
5479 } // end of namespace Ice 5479 } // end of namespace Ice
5480 5480
5481 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 5481 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/arith.ll » ('j') | tests_lit/llvm2ice_tests/arith.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698