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

Side by Side Diff: src/IceInstX8632.cpp

Issue 550723002: Subzero: Use cvttss2si and similar instead of cvtss2si for fp->int casts. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use truncating conversion instruction for fp to int conversions Created 6 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/IceInstX8632.h ('k') | src/IceTargetLoweringX8632.h » ('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/IceInstX8632.cpp - X86-32 instruction implementation ---===// 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===//
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 InstX8632 and OperandX8632 classes, 10 // This file implements the InstX8632 and OperandX8632 classes,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 assert(Eax->getRegNum() == TargetX8632::Reg_eax); 175 assert(Eax->getRegNum() == TargetX8632::Reg_eax);
176 assert(Ecx->getRegNum() == TargetX8632::Reg_ecx); 176 assert(Ecx->getRegNum() == TargetX8632::Reg_ecx);
177 assert(Ebx->getRegNum() == TargetX8632::Reg_ebx); 177 assert(Ebx->getRegNum() == TargetX8632::Reg_ebx);
178 addSource(Addr); 178 addSource(Addr);
179 addSource(Edx); 179 addSource(Edx);
180 addSource(Eax); 180 addSource(Eax);
181 addSource(Ecx); 181 addSource(Ecx);
182 addSource(Ebx); 182 addSource(Ebx);
183 } 183 }
184 184
185 InstX8632Cvt::InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source) 185 InstX8632Cvt::InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source,
186 : InstX8632(Func, InstX8632::Cvt, 1, Dest) { 186 bool Trunc)
187 : InstX8632(Func, InstX8632::Cvt, 1, Dest), Trunc(Trunc) {
187 addSource(Source); 188 addSource(Source);
188 } 189 }
189 190
190 InstX8632Icmp::InstX8632Icmp(Cfg *Func, Operand *Src0, Operand *Src1) 191 InstX8632Icmp::InstX8632Icmp(Cfg *Func, Operand *Src0, Operand *Src1)
191 : InstX8632(Func, InstX8632::Icmp, 2, NULL) { 192 : InstX8632(Func, InstX8632::Icmp, 2, NULL) {
192 addSource(Src0); 193 addSource(Src0);
193 addSource(Src1); 194 addSource(Src1);
194 } 195 }
195 196
196 InstX8632Ucomiss::InstX8632Ucomiss(Cfg *Func, Operand *Src0, Operand *Src1) 197 InstX8632Ucomiss::InstX8632Ucomiss(Cfg *Func, Operand *Src0, Operand *Src1)
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 if (Locked) { 792 if (Locked) {
792 Str << "lock "; 793 Str << "lock ";
793 } 794 }
794 Str << "cmpxchg8b "; 795 Str << "cmpxchg8b ";
795 dumpSources(Func); 796 dumpSources(Func);
796 } 797 }
797 798
798 void InstX8632Cvt::emit(const Cfg *Func) const { 799 void InstX8632Cvt::emit(const Cfg *Func) const {
799 Ostream &Str = Func->getContext()->getStrEmit(); 800 Ostream &Str = Func->getContext()->getStrEmit();
800 assert(getSrcSize() == 1); 801 assert(getSrcSize() == 1);
801 Str << "\tcvt" << TypeX8632Attributes[getSrc(0)->getType()].CvtString << "2" 802 Str << "\tcvt";
803 if (Trunc)
804 Str << "t";
805 Str << TypeX8632Attributes[getSrc(0)->getType()].CvtString << "2"
802 << TypeX8632Attributes[getDest()->getType()].CvtString << "\t"; 806 << TypeX8632Attributes[getDest()->getType()].CvtString << "\t";
803 getDest()->emit(Func); 807 getDest()->emit(Func);
804 Str << ", "; 808 Str << ", ";
805 getSrc(0)->emit(Func); 809 getSrc(0)->emit(Func);
806 Str << "\n"; 810 Str << "\n";
807 } 811 }
808 812
809 void InstX8632Cvt::dump(const Cfg *Func) const { 813 void InstX8632Cvt::dump(const Cfg *Func) const {
810 Ostream &Str = Func->getContext()->getStrDump(); 814 Ostream &Str = Func->getContext()->getStrDump();
811 dumpDest(Func); 815 dumpDest(Func);
812 Str << " = cvt" << TypeX8632Attributes[getSrc(0)->getType()].CvtString 816 Str << " = cvt";
813 << "2" << TypeX8632Attributes[getDest()->getType()].CvtString << " "; 817 if (Trunc)
818 Str << "t";
819 Str << TypeX8632Attributes[getSrc(0)->getType()].CvtString << "2"
820 << TypeX8632Attributes[getDest()->getType()].CvtString << " ";
814 dumpSources(Func); 821 dumpSources(Func);
815 } 822 }
816 823
817 void InstX8632Icmp::emit(const Cfg *Func) const { 824 void InstX8632Icmp::emit(const Cfg *Func) const {
818 Ostream &Str = Func->getContext()->getStrEmit(); 825 Ostream &Str = Func->getContext()->getStrEmit();
819 assert(getSrcSize() == 2); 826 assert(getSrcSize() == 2);
820 Str << "\tcmp\t"; 827 Str << "\tcmp\t";
821 getSrc(0)->emit(Func); 828 getSrc(0)->emit(Func);
822 Str << ", "; 829 Str << ", ";
823 getSrc(1)->emit(Func); 830 getSrc(1)->emit(Func);
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 default: 1480 default:
1474 Str << "???"; 1481 Str << "???";
1475 break; 1482 break;
1476 } 1483 }
1477 Str << "("; 1484 Str << "(";
1478 Var->dump(Func); 1485 Var->dump(Func);
1479 Str << ")"; 1486 Str << ")";
1480 } 1487 }
1481 1488
1482 } // end of namespace Ice 1489 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698