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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1568933002: Add VDIVS and VDIVD instructions to the integrated ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add test case. Created 4 years, 11 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/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('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/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 // cccc11100D11nnnndddd101sN0M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn, 2064 // cccc11100D11nnnndddd101sN0M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn,
2065 // and Mmmmm=Rm. 2065 // and Mmmmm=Rm.
2066 constexpr const char *Vaddd = "vaddd"; 2066 constexpr const char *Vaddd = "vaddd";
2067 IValueT Dd = encodeDRegister(OpDd, "Dd", Vaddd); 2067 IValueT Dd = encodeDRegister(OpDd, "Dd", Vaddd);
2068 IValueT Dn = encodeDRegister(OpDn, "Dn", Vaddd); 2068 IValueT Dn = encodeDRegister(OpDn, "Dn", Vaddd);
2069 IValueT Dm = encodeDRegister(OpDm, "Dm", Vaddd); 2069 IValueT Dm = encodeDRegister(OpDm, "Dm", Vaddd);
2070 constexpr IValueT VadddOpcode = B21 | B20; 2070 constexpr IValueT VadddOpcode = B21 | B20;
2071 emitVFPddd(Cond, VadddOpcode, Dd, Dn, Dm); 2071 emitVFPddd(Cond, VadddOpcode, Dd, Dn, Dm);
2072 } 2072 }
2073 2073
2074 void AssemblerARM32::vdivs(const Operand *OpSd, const Operand *OpSn,
2075 const Operand *OpSm, CondARM32::Cond Cond) {
2076 // VDIV (floating-point) - ARM section A8.8.283, encoding A2:
2077 // vdiv<c>.f32 <Sd>, <Sn>, <Sm>
2078 //
2079 // cccc11101D00nnnndddd101sN0M0mmmm where cccc=Cond, s=0, ddddD=Rd, nnnnN=Rn,
2080 // and mmmmM=Rm.
2081 constexpr const char *Vdivs = "vdivs";
2082 IValueT Sd = encodeSRegister(OpSd, "Sd", Vdivs);
2083 IValueT Sn = encodeSRegister(OpSn, "Sn", Vdivs);
2084 IValueT Sm = encodeSRegister(OpSm, "Sm", Vdivs);
2085 constexpr IValueT VdivsOpcode = B23;
2086 emitVFPsss(Cond, VdivsOpcode, Sd, Sn, Sm);
2087 }
2088
2089 void AssemblerARM32::vdivd(const Operand *OpDd, const Operand *OpDn,
2090 const Operand *OpDm, CondARM32::Cond Cond) {
2091 // VDIV (floating-point) - ARM section A8.8.283, encoding A2:
2092 // vdiv<c>.f64 <Dd>, <Dn>, <Dm>
2093 //
2094 // cccc11101D00nnnndddd101sN0M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn,
2095 // and Mmmmm=Rm.
2096 constexpr const char *Vdivd = "vdivd";
2097 IValueT Dd = encodeDRegister(OpDd, "Dd", Vdivd);
2098 IValueT Dn = encodeDRegister(OpDn, "Dn", Vdivd);
2099 IValueT Dm = encodeDRegister(OpDm, "Dm", Vdivd);
2100 constexpr IValueT VdivdOpcode = B23;
2101 emitVFPddd(Cond, VdivdOpcode, Dd, Dn, Dm);
2102 }
2103
2074 void AssemblerARM32::vsubs(const Operand *OpSd, const Operand *OpSn, 2104 void AssemblerARM32::vsubs(const Operand *OpSd, const Operand *OpSn,
2075 const Operand *OpSm, CondARM32::Cond Cond) { 2105 const Operand *OpSm, CondARM32::Cond Cond) {
2076 // VSUB (floating-point) - ARM section A8.8.415, encoding A2: 2106 // VSUB (floating-point) - ARM section A8.8.415, encoding A2:
2077 // vsub<c>.f32 <Sd>, <Sn>, <Sm> 2107 // vsub<c>.f32 <Sd>, <Sn>, <Sm>
2078 // 2108 //
2079 // cccc11100D11nnnndddd101sN1M0mmmm where cccc=Cond, s=0, ddddD=Rd, nnnnN=Rn, 2109 // cccc11100D11nnnndddd101sN1M0mmmm where cccc=Cond, s=0, ddddD=Rd, nnnnN=Rn,
Jim Stichnoth 2016/01/07 20:50:31 Why the extra space character here?
Karl 2016/01/07 21:37:59 Slow stutter I guess. Removed.
2080 // and mmmmM=Rm. 2110 // and mmmmM=Rm.
2081 constexpr const char *Vadds = "vsubs"; 2111 constexpr const char *Vsubs = "vsubs";
2082 IValueT Sd = encodeSRegister(OpSd, "Sd", Vadds); 2112 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsubs);
2083 IValueT Sn = encodeSRegister(OpSn, "Sn", Vadds); 2113 IValueT Sn = encodeSRegister(OpSn, "Sn", Vsubs);
2084 IValueT Sm = encodeSRegister(OpSm, "Sm", Vadds); 2114 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsubs);
2085 constexpr IValueT VaddsOpcode = B21 | B20 | B6; 2115 constexpr IValueT VsubsOpcode = B21 | B20 | B6;
2086 emitVFPsss(Cond, VaddsOpcode, Sd, Sn, Sm); 2116 emitVFPsss(Cond, VsubsOpcode, Sd, Sn, Sm);
2087 } 2117 }
2088 2118
2089 void AssemblerARM32::vsubd(const Operand *OpDd, const Operand *OpDn, 2119 void AssemblerARM32::vsubd(const Operand *OpDd, const Operand *OpDn,
2090 const Operand *OpDm, CondARM32::Cond Cond) { 2120 const Operand *OpDm, CondARM32::Cond Cond) {
2091 // VSUB (floating-point) - ARM section A8.8.415, encoding A2: 2121 // VSUB (floating-point) - ARM section A8.8.415, encoding A2:
2092 // vadd<c>.f64 <Dd>, <Dn>, <Dm> 2122 // vsub<c>.f64 <Dd>, <Dn>, <Dm>
2093 // 2123 //
2094 // cccc11100D11nnnndddd101sN1M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn, 2124 // cccc11100D11nnnndddd101sN1M0mmmm where cccc=Cond, s=1, Ddddd=Rd, Nnnnn=Rn,
2095 // and Mmmmm=Rm. 2125 // and Mmmmm=Rm.
2096 constexpr const char *Vaddd = "vsubd"; 2126 constexpr const char *Vsubd = "vsubd";
2097 IValueT Dd = encodeDRegister(OpDd, "Dd", Vaddd); 2127 IValueT Dd = encodeDRegister(OpDd, "Dd", Vsubd);
2098 IValueT Dn = encodeDRegister(OpDn, "Dn", Vaddd); 2128 IValueT Dn = encodeDRegister(OpDn, "Dn", Vsubd);
2099 IValueT Dm = encodeDRegister(OpDm, "Dm", Vaddd); 2129 IValueT Dm = encodeDRegister(OpDm, "Dm", Vsubd);
2100 constexpr IValueT VadddOpcode = B21 | B20 | B6; 2130 constexpr IValueT VsubdOpcode = B21 | B20 | B6;
2101 emitVFPddd(Cond, VadddOpcode, Dd, Dn, Dm); 2131 emitVFPddd(Cond, VsubdOpcode, Dd, Dn, Dm);
2102 } 2132 }
2103 2133
2104 void AssemblerARM32::emitVStackOp(CondARM32::Cond Cond, IValueT Opcode, 2134 void AssemblerARM32::emitVStackOp(CondARM32::Cond Cond, IValueT Opcode,
2105 const Variable *OpBaseReg, 2135 const Variable *OpBaseReg,
2106 SizeT NumConsecRegs) { 2136 SizeT NumConsecRegs) {
2107 const IValueT BaseReg = getEncodedSRegNum(OpBaseReg); 2137 const IValueT BaseReg = getEncodedSRegNum(OpBaseReg);
2108 const IValueT DLastBit = mask(BaseReg, 0, 1); // Last bit of base register. 2138 const IValueT DLastBit = mask(BaseReg, 0, 1); // Last bit of base register.
2109 const IValueT Rd = mask(BaseReg, 1, 4); // Top 4 bits of base register. 2139 const IValueT Rd = mask(BaseReg, 1, 4); // Top 4 bits of base register.
2110 assert(0 < NumConsecRegs); 2140 assert(0 < NumConsecRegs);
2111 (void)VpushVpopMaxConsecRegs; 2141 (void)VpushVpopMaxConsecRegs;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 // 2173 //
2144 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and 2174 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and
2145 // iiiiiiii=NumConsecRegs. 2175 // iiiiiiii=NumConsecRegs.
2146 constexpr IValueT VpushOpcode = 2176 constexpr IValueT VpushOpcode =
2147 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9; 2177 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9;
2148 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs); 2178 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs);
2149 } 2179 }
2150 2180
2151 } // end of namespace ARM32 2181 } // end of namespace ARM32
2152 } // end of namespace Ice 2182 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceInstARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698