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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1623433004: Add missing vcvt instructions to integrated ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit. 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 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 assert(CondARM32::isDefined(Cond)); 2125 assert(CondARM32::isDefined(Cond));
2126 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 2126 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
2127 constexpr IValueT VFPOpcode = B27 | B26 | B25 | B11 | B9; 2127 constexpr IValueT VFPOpcode = B27 | B26 | B25 | B11 | B9;
2128 const IValueT Encoding = 2128 const IValueT Encoding =
2129 Opcode | VFPOpcode | (encodeCondition(Cond) << kConditionShift) | 2129 Opcode | VFPOpcode | (encodeCondition(Cond) << kConditionShift) |
2130 (getYInRegXXXXY(Sd) << 22) | (getXXXXInRegXXXXY(Sd) << 12) | 2130 (getYInRegXXXXY(Sd) << 22) | (getXXXXInRegXXXXY(Sd) << 12) |
2131 (getYInRegYXXXX(Dm) << 5) | getXXXXInRegYXXXX(Dm); 2131 (getYInRegYXXXX(Dm) << 5) | getXXXXInRegYXXXX(Dm);
2132 emitInst(Encoding); 2132 emitInst(Encoding);
2133 } 2133 }
2134 2134
2135 void AssemblerARM32::vcvtdi(const Operand *OpDd, const Operand *OpSm,
2136 CondARM32::Cond Cond) {
2137 // VCVT (between floating-point and integer, Floating-point)
2138 // - ARM Section A8.8.306, encoding A1:
2139 // vcvt<c>.f64.s32 <Dd>, <Sm>
2140 //
2141 // cccc11101D111000dddd10111M0mmmm where cccc=Cond, Ddddd=Dd, and mmmmM=Sm.
2142 constexpr const char *Vcvtdi = "vcvtdi";
2143 IValueT Dd = encodeDRegister(OpDd, "Dd", Vcvtdi);
2144 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtdi);
2145 constexpr IValueT VcvtdiOpcode = B23 | B21 | B20 | B19 | B8 | B7 | B6;
2146 emitVFPds(Cond, VcvtdiOpcode, Dd, Sm);
2147 }
2148
2149 void AssemblerARM32::vcvtdu(const Operand *OpDd, const Operand *OpSm,
2150 CondARM32::Cond Cond) {
2151 // VCVT (between floating-point and integer, Floating-point)
2152 // - ARM Section A8.8.306, encoding A1:
2153 // vcvt<c>.f64.u32 <Dd>, <Sm>
2154 //
2155 // cccc11101D111000dddd10101M0mmmm where cccc=Cond, Ddddd=Dd, and mmmmM=Sm.
2156 constexpr const char *Vcvtdu = "vcvtdu";
2157 IValueT Dd = encodeDRegister(OpDd, "Dd", Vcvtdu);
2158 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtdu);
2159 constexpr IValueT VcvtduOpcode = B23 | B21 | B20 | B19 | B8 | B6;
2160 emitVFPds(Cond, VcvtduOpcode, Dd, Sm);
2161 }
2162
2135 void AssemblerARM32::vcvtsd(const Operand *OpSd, const Operand *OpDm, 2163 void AssemblerARM32::vcvtsd(const Operand *OpSd, const Operand *OpDm,
2136 CondARM32::Cond Cond) { 2164 CondARM32::Cond Cond) {
2137 constexpr const char *Vcvtsd = "vcvtsd"; 2165 constexpr const char *Vcvtsd = "vcvtsd";
2138 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtsd); 2166 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtsd);
2139 IValueT Dm = encodeDRegister(OpDm, "Dm", Vcvtsd); 2167 IValueT Dm = encodeDRegister(OpDm, "Dm", Vcvtsd);
2140 constexpr IValueT VcvtsdOpcode = 2168 constexpr IValueT VcvtsdOpcode =
2141 B23 | B21 | B20 | B18 | B17 | B16 | B8 | B7 | B6; 2169 B23 | B21 | B20 | B18 | B17 | B16 | B8 | B7 | B6;
2142 emitVFPsd(Cond, VcvtsdOpcode, Sd, Dm); 2170 emitVFPsd(Cond, VcvtsdOpcode, Sd, Dm);
2143 } 2171 }
2144 2172
2145 void AssemblerARM32::vcvtis(const Operand *OpSd, const Operand *OpSm, 2173 void AssemblerARM32::vcvtis(const Operand *OpSd, const Operand *OpSm,
2146 CondARM32::Cond Cond) { 2174 CondARM32::Cond Cond) {
2147 // VCVT (between floating-point and integer, Floating-point) 2175 // VCVT (between floating-point and integer, Floating-point)
2148 // - ARM Section A8.8.306, encoding A1: 2176 // - ARM Section A8.8.306, encoding A1:
2149 // vcvt<c>.s32.f32 <Sd>, <Sm> 2177 // vcvt<c>.s32.f32 <Sd>, <Sm>
2150 // 2178 //
2151 // cccc11101D111101dddd10101M0mmmm where cccc=Cond, ddddD=Sd, and mmmmM=Sm. 2179 // cccc11101D111101dddd10011M0mmmm where cccc=Cond, ddddD=Sd, and mmmmM=Sm.
2152 constexpr const char *Vcvtis = "vcvtis"; 2180 constexpr const char *Vcvtis = "vcvtis";
2153 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtis); 2181 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtis);
2154 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtis); 2182 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtis);
2155 constexpr IValueT VcvtsiOpcode = B23 | B21 | B20 | B19 | B18 | B16 | B7 | B6; 2183 constexpr IValueT VcvtisOpcode = B23 | B21 | B20 | B19 | B18 | B16 | B7 | B6;
2184 constexpr IValueT S0 = 0;
2185 emitVFPsss(Cond, VcvtisOpcode, Sd, S0, Sm);
2186 }
2187
2188 void AssemblerARM32::vcvtid(const Operand *OpSd, const Operand *OpDm,
2189 CondARM32::Cond Cond) {
2190 // VCVT (between floating-point and integer, Floating-point)
2191 // - ARM Section A8.8.306, encoding A1:
2192 // vcvt<c>.s32.f64 <Sd>, <Dm>
2193 //
2194 // cccc11101D111101dddd10111M0mmmm where cccc=Cond, ddddD=Sd, and Mmmmm=Dm.
2195 constexpr const char *Vcvtid = "vcvtid";
2196 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtid);
2197 IValueT Dm = encodeDRegister(OpDm, "Dm", Vcvtid);
2198 constexpr IValueT VcvtidOpcode =
2199 B23 | B21 | B20 | B19 | B18 | B16 | B8 | B7 | B6;
2200 emitVFPsd(Cond, VcvtidOpcode, Sd, Dm);
2201 }
2202
2203 void AssemblerARM32::vcvtsi(const Operand *OpSd, const Operand *OpSm,
2204 CondARM32::Cond Cond) {
2205 // VCVT (between floating-point and integer, Floating-point)
2206 // - ARM Section A8.8.306, encoding A1:
2207 // vcvt<c>.f32.s32 <Sd>, <Sm>
2208 //
2209 // cccc11101D111000dddd10011M0mmmm where cccc=Cond, ddddD=Sd, and mmmmM=Sm.
2210 constexpr const char *Vcvtsi = "vcvtsi";
2211 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtsi);
2212 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtsi);
2213 constexpr IValueT VcvtsiOpcode = B23 | B21 | B20 | B19 | B7 | B6;
2156 constexpr IValueT S0 = 0; 2214 constexpr IValueT S0 = 0;
2157 emitVFPsss(Cond, VcvtsiOpcode, Sd, S0, Sm); 2215 emitVFPsss(Cond, VcvtsiOpcode, Sd, S0, Sm);
2158 } 2216 }
2217
2218 void AssemblerARM32::vcvtsu(const Operand *OpSd, const Operand *OpSm,
2219 CondARM32::Cond Cond) {
2220 // VCVT (between floating-point and integer, Floating-point)
2221 // - ARM Section A8.8.306, encoding A1:
2222 // vcvt<c>.f32.u32 <Sd>, <Sm>
2223 //
2224 // cccc11101D111000dddd10001M0mmmm where cccc=Cond, ddddD=Sd, and mmmmM=Sm.
2225 constexpr const char *Vcvtsu = "vcvtsu";
2226 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtsu);
2227 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtsu);
2228 constexpr IValueT VcvtsuOpcode = B23 | B21 | B20 | B19 | B6;
2229 constexpr IValueT S0 = 0;
2230 emitVFPsss(Cond, VcvtsuOpcode, Sd, S0, Sm);
2231 }
2232
2233 void AssemblerARM32::vcvtud(const Operand *OpSd, const Operand *OpDm,
2234 CondARM32::Cond Cond) {
2235 // VCVT (between floating-point and integer, Floating-point)
2236 // - ARM Section A8.8.306, encoding A1:
2237 // vcvt<c>.u32.f64 <Sd>, <Dm>
2238 //
2239 // cccc11101D111100dddd10111M0mmmm where cccc=Cond, ddddD=Sd, and Mmmmm=Dm.
2240 constexpr const char *Vcvtud = "vcvtud";
2241 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtud);
2242 IValueT Dm = encodeDRegister(OpDm, "Dm", Vcvtud);
2243 constexpr IValueT VcvtudOpcode = B23 | B21 | B20 | B19 | B18 | B8 | B7 | B6;
2244 emitVFPsd(Cond, VcvtudOpcode, Sd, Dm);
2245 }
2246
2247 void AssemblerARM32::vcvtus(const Operand *OpSd, const Operand *OpSm,
2248 CondARM32::Cond Cond) {
2249 // VCVT (between floating-point and integer, Floating-point)
2250 // - ARM Section A8.8.306, encoding A1:
2251 // vcvt<c>.u32.f32 <Sd>, <Sm>
2252 //
2253 // cccc11101D111100dddd10011M0mmmm where cccc=Cond, ddddD=Sd, and mmmmM=Sm.
2254 constexpr const char *Vcvtus = "vcvtus";
2255 IValueT Sd = encodeSRegister(OpSd, "Sd", Vcvtus);
2256 IValueT Sm = encodeSRegister(OpSm, "Sm", Vcvtus);
2257 constexpr IValueT VcvtsiOpcode = B23 | B21 | B20 | B19 | B18 | B7 | B6;
2258 constexpr IValueT S0 = 0;
2259 emitVFPsss(Cond, VcvtsiOpcode, Sd, S0, Sm);
2260 }
2159 2261
2160 void AssemblerARM32::emitVFPds(CondARM32::Cond Cond, IValueT Opcode, IValueT Dd, 2262 void AssemblerARM32::emitVFPds(CondARM32::Cond Cond, IValueT Opcode, IValueT Dd,
2161 IValueT Sm) { 2263 IValueT Sm) {
2162 assert(Dd < RegARM32::getNumDRegs()); 2264 assert(Dd < RegARM32::getNumDRegs());
2163 assert(Sm < RegARM32::getNumSRegs()); 2265 assert(Sm < RegARM32::getNumSRegs());
2164 assert(CondARM32::isDefined(Cond)); 2266 assert(CondARM32::isDefined(Cond));
2165 AssemblerBuffer::EnsureCapacity ensured(&Buffer); 2267 AssemblerBuffer::EnsureCapacity ensured(&Buffer);
2166 constexpr IValueT VFPOpcode = B27 | B26 | B25 | B11 | B9; 2268 constexpr IValueT VFPOpcode = B27 | B26 | B25 | B11 | B9;
2167 const IValueT Encoding = 2269 const IValueT Encoding =
2168 Opcode | VFPOpcode | (encodeCondition(Cond) << kConditionShift) | 2270 Opcode | VFPOpcode | (encodeCondition(Cond) << kConditionShift) |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 // 2525 //
2424 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and 2526 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and
2425 // iiiiiiii=NumConsecRegs. 2527 // iiiiiiii=NumConsecRegs.
2426 constexpr IValueT VpushOpcode = 2528 constexpr IValueT VpushOpcode =
2427 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9; 2529 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9;
2428 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs); 2530 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs);
2429 } 2531 }
2430 2532
2431 } // end of namespace ARM32 2533 } // end of namespace ARM32
2432 } // end of namespace Ice 2534 } // 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