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

Side by Side Diff: src/IceInstX8632.cpp

Issue 413053002: Lower the fcmp instruction for <4 x float> operands. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Improve table formatting and X macro parameter names Created 6 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 | « src/IceInstX8632.h ('k') | src/IceInstX8632.def » ('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 18 matching lines...) Expand all
29 } InstX8632BrAttributes[] = { 29 } InstX8632BrAttributes[] = {
30 #define X(tag, dump, emit) \ 30 #define X(tag, dump, emit) \
31 { dump, emit } \ 31 { dump, emit } \
32 , 32 ,
33 ICEINSTX8632BR_TABLE 33 ICEINSTX8632BR_TABLE
34 #undef X 34 #undef X
35 }; 35 };
36 const size_t InstX8632BrAttributesSize = 36 const size_t InstX8632BrAttributesSize =
37 llvm::array_lengthof(InstX8632BrAttributes); 37 llvm::array_lengthof(InstX8632BrAttributes);
38 38
39 const struct InstX8632CmppsAttributes_ {
40 const char *EmitString;
41 } InstX8632CmppsAttributes[] = {
42 #define X(tag, emit) \
43 { emit } \
44 ,
45 ICEINSTX8632CMPPS_TABLE
46 #undef X
47 };
48 const size_t InstX8632CmppsAttributesSize =
49 llvm::array_lengthof(InstX8632CmppsAttributes);
50
39 const struct TypeX8632Attributes_ { 51 const struct TypeX8632Attributes_ {
40 const char *CvtString; // i (integer), s (single FP), d (double FP) 52 const char *CvtString; // i (integer), s (single FP), d (double FP)
41 const char *SdSsString; // ss, sd, or <blank> 53 const char *SdSsString; // ss, sd, or <blank>
42 const char *PackString; // b, w, d, or <blank> 54 const char *PackString; // b, w, d, or <blank>
43 const char *WidthString; // {byte,word,dword,qword} ptr 55 const char *WidthString; // {byte,word,dword,qword} ptr
44 } TypeX8632Attributes[] = { 56 } TypeX8632Attributes[] = {
45 #define X(tag, elementty, cvt, sdss, pack, width) \ 57 #define X(tag, elementty, cvt, sdss, pack, width) \
46 { cvt, "" sdss, pack, width } \ 58 { cvt, "" sdss, pack, width } \
47 , 59 ,
48 ICETYPEX8632_TABLE 60 ICETYPEX8632_TABLE
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 154
143 InstX8632Cmov::InstX8632Cmov(Cfg *Func, Variable *Dest, Operand *Source, 155 InstX8632Cmov::InstX8632Cmov(Cfg *Func, Variable *Dest, Operand *Source,
144 InstX8632::BrCond Condition) 156 InstX8632::BrCond Condition)
145 : InstX8632(Func, InstX8632::Cmov, 2, Dest), Condition(Condition) { 157 : InstX8632(Func, InstX8632::Cmov, 2, Dest), Condition(Condition) {
146 // The final result is either the original Dest, or Source, so mark 158 // The final result is either the original Dest, or Source, so mark
147 // both as sources. 159 // both as sources.
148 addSource(Dest); 160 addSource(Dest);
149 addSource(Source); 161 addSource(Source);
150 } 162 }
151 163
164 InstX8632Cmpps::InstX8632Cmpps(Cfg *Func, Variable *Dest, Operand *Source,
165 InstX8632Cmpps::CmppsCond Condition)
166 : InstX8632(Func, InstX8632::Cmpps, 2, Dest), Condition(Condition) {
167 addSource(Dest);
168 addSource(Source);
169 }
170
152 InstX8632Cmpxchg::InstX8632Cmpxchg(Cfg *Func, Operand *DestOrAddr, 171 InstX8632Cmpxchg::InstX8632Cmpxchg(Cfg *Func, Operand *DestOrAddr,
153 Variable *Eax, Variable *Desired, 172 Variable *Eax, Variable *Desired,
154 bool Locked) 173 bool Locked)
155 : InstX8632Lockable(Func, InstX8632::Cmpxchg, 3, 174 : InstX8632Lockable(Func, InstX8632::Cmpxchg, 3,
156 llvm::dyn_cast<Variable>(DestOrAddr), Locked) { 175 llvm::dyn_cast<Variable>(DestOrAddr), Locked) {
157 assert(Eax->getRegNum() == TargetX8632::Reg_eax); 176 assert(Eax->getRegNum() == TargetX8632::Reg_eax);
158 addSource(DestOrAddr); 177 addSource(DestOrAddr);
159 addSource(Eax); 178 addSource(Eax);
160 addSource(Desired); 179 addSource(Desired);
161 } 180 }
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 707
689 void InstX8632Cmov::dump(const Cfg *Func) const { 708 void InstX8632Cmov::dump(const Cfg *Func) const {
690 Ostream &Str = Func->getContext()->getStrDump(); 709 Ostream &Str = Func->getContext()->getStrDump();
691 Str << "cmov" << InstX8632BrAttributes[Condition].DisplayString << "."; 710 Str << "cmov" << InstX8632BrAttributes[Condition].DisplayString << ".";
692 Str << getDest()->getType() << " "; 711 Str << getDest()->getType() << " ";
693 dumpDest(Func); 712 dumpDest(Func);
694 Str << ", "; 713 Str << ", ";
695 dumpSources(Func); 714 dumpSources(Func);
696 } 715 }
697 716
717 void InstX8632Cmpps::emit(const Cfg *Func) const {
718 Ostream &Str = Func->getContext()->getStrEmit();
719 assert(getSrcSize() == 2);
720 assert(Condition < InstX8632CmppsAttributesSize);
721 Str << "\t";
722 Str << "cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps"
723 << "\t";
724 getDest()->emit(Func);
725 Str << ", ";
726 getSrc(1)->emit(Func);
727 Str << "\n";
728 }
729
730 void InstX8632Cmpps::dump(const Cfg *Func) const {
731 Ostream &Str = Func->getContext()->getStrDump();
732 assert(Condition < InstX8632CmppsAttributesSize);
733 dumpDest(Func);
734 Str << " = cmp" << InstX8632CmppsAttributes[Condition].EmitString << "ps"
735 << "\t";
736 dumpSources(Func);
737 }
738
698 void InstX8632Cmpxchg::emit(const Cfg *Func) const { 739 void InstX8632Cmpxchg::emit(const Cfg *Func) const {
699 Ostream &Str = Func->getContext()->getStrEmit(); 740 Ostream &Str = Func->getContext()->getStrEmit();
700 assert(getSrcSize() == 3); 741 assert(getSrcSize() == 3);
701 if (Locked) { 742 if (Locked) {
702 Str << "\tlock"; 743 Str << "\tlock";
703 } 744 }
704 Str << "\tcmpxchg\t"; 745 Str << "\tcmpxchg\t";
705 getSrc(0)->emit(Func); 746 getSrc(0)->emit(Func);
706 Str << ", "; 747 Str << ", ";
707 getSrc(2)->emit(Func); 748 getSrc(2)->emit(Func);
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 default: 1408 default:
1368 Str << "???"; 1409 Str << "???";
1369 break; 1410 break;
1370 } 1411 }
1371 Str << "("; 1412 Str << "(";
1372 Var->dump(Func); 1413 Var->dump(Func);
1373 Str << ")"; 1414 Str << ")";
1374 } 1415 }
1375 1416
1376 } // end of namespace Ice 1417 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceInstX8632.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698