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

Side by Side Diff: src/assembler_ia32.cpp

Issue 634333002: emitIAS for fld and fstp (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: handle st(0) Created 6 years, 2 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/assembler_ia32.h ('k') | tests_lit/llvm2ice_tests/fp.pnacl.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Modified by the Subzero authors. 5 // Modified by the Subzero authors.
6 // 6 //
7 //===- subzero/src/assembler_ia32.cpp - Assembler for x86-32 -------------===// 7 //===- subzero/src/assembler_ia32.cpp - Assembler for x86-32 -------------===//
8 // 8 //
9 // The Subzero Code Generator 9 // The Subzero Code Generator
10 // 10 //
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 EmitUint8(0x40 + cond); 265 EmitUint8(0x40 + cond);
266 EmitRegisterOperand(dst, src); 266 EmitRegisterOperand(dst, src);
267 } 267 }
268 268
269 void AssemblerX86::rep_movsb() { 269 void AssemblerX86::rep_movsb() {
270 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 270 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
271 EmitUint8(0xF3); 271 EmitUint8(0xF3);
272 EmitUint8(0xA4); 272 EmitUint8(0xA4);
273 } 273 }
274 274
275 void AssemblerX86::movss(XmmRegister dst, const Address &src) { 275 void AssemblerX86::movss(Type Ty, XmmRegister dst, const Address &src) {
276 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 276 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
277 EmitUint8(0xF3); 277 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xF3 : 0xF2);
278 EmitUint8(0x0F); 278 EmitUint8(0x0F);
279 EmitUint8(0x10); 279 EmitUint8(0x10);
280 EmitOperand(dst, src); 280 EmitOperand(dst, src);
281 } 281 }
282 282
283 void AssemblerX86::movss(const Address &dst, XmmRegister src) { 283 void AssemblerX86::movss(Type Ty, const Address &dst, XmmRegister src) {
284 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 284 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
285 EmitUint8(0xF3); 285 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xF3 : 0xF2);
286 EmitUint8(0x0F); 286 EmitUint8(0x0F);
287 EmitUint8(0x11); 287 EmitUint8(0x11);
288 EmitOperand(src, dst); 288 EmitOperand(src, dst);
289 } 289 }
290 290
291 void AssemblerX86::movss(XmmRegister dst, XmmRegister src) { 291 void AssemblerX86::movss(Type Ty, XmmRegister dst, XmmRegister src) {
292 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 292 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
293 EmitUint8(0xF3); 293 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xF3 : 0xF2);
294 EmitUint8(0x0F); 294 EmitUint8(0x0F);
295 EmitUint8(0x11); 295 EmitUint8(0x11);
296 EmitXmmRegisterOperand(src, dst); 296 EmitXmmRegisterOperand(src, dst);
297 } 297 }
298 298
299 void AssemblerX86::movd(XmmRegister dst, GPRRegister src) { 299 void AssemblerX86::movd(XmmRegister dst, GPRRegister src) {
300 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 300 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
301 EmitUint8(0x66); 301 EmitUint8(0x66);
302 EmitUint8(0x0F); 302 EmitUint8(0x0F);
303 EmitUint8(0x6E); 303 EmitUint8(0x6E);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 409 }
410 410
411 void AssemblerX86::divss(Type Ty, XmmRegister dst, const Address &src) { 411 void AssemblerX86::divss(Type Ty, XmmRegister dst, const Address &src) {
412 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 412 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
413 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xF3 : 0xF2); 413 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xF3 : 0xF2);
414 EmitUint8(0x0F); 414 EmitUint8(0x0F);
415 EmitUint8(0x5E); 415 EmitUint8(0x5E);
416 EmitOperand(dst, src); 416 EmitOperand(dst, src);
417 } 417 }
418 418
419 void AssemblerX86::flds(const Address &src) { 419 void AssemblerX86::fld(Type Ty, const Address &src) {
420 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 420 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
421 EmitUint8(0xD9); 421 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xD9 : 0xDD);
422 EmitOperand(0, src); 422 EmitOperand(0, src);
423 } 423 }
424 424
425 void AssemblerX86::fstps(const Address &dst) { 425 void AssemblerX86::fstp(Type Ty, const Address &dst) {
426 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 426 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
427 EmitUint8(0xD9); 427 EmitUint8(isFloat32Asserting32Or64(Ty) ? 0xD9 : 0xDD);
428 EmitOperand(3, dst); 428 EmitOperand(3, dst);
429 } 429 }
430 430
431 void AssemblerX86::movsd(XmmRegister dst, const Address &src) { 431 void AssemblerX86::fstp(X87STRegister st) {
432 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 432 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
433 EmitUint8(0xF2); 433 EmitUint8(0xDD);
434 EmitUint8(0x0F); 434 EmitUint8(0xD8 + st);
435 EmitUint8(0x10);
436 EmitOperand(dst, src);
437 }
438
439 void AssemblerX86::movsd(const Address &dst, XmmRegister src) {
440 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
441 EmitUint8(0xF2);
442 EmitUint8(0x0F);
443 EmitUint8(0x11);
444 EmitOperand(src, dst);
445 }
446
447 void AssemblerX86::movsd(XmmRegister dst, XmmRegister src) {
448 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
449 EmitUint8(0xF2);
450 EmitUint8(0x0F);
451 EmitUint8(0x11);
452 EmitXmmRegisterOperand(src, dst);
453 } 435 }
454 436
455 void AssemblerX86::movaps(XmmRegister dst, XmmRegister src) { 437 void AssemblerX86::movaps(XmmRegister dst, XmmRegister src) {
456 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 438 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
457 EmitUint8(0x0F); 439 EmitUint8(0x0F);
458 EmitUint8(0x28); 440 EmitUint8(0x28);
459 EmitXmmRegisterOperand(dst, src); 441 EmitXmmRegisterOperand(dst, src);
460 } 442 }
461 443
462 void AssemblerX86::movups(XmmRegister dst, XmmRegister src) { 444 void AssemblerX86::movups(XmmRegister dst, XmmRegister src) {
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1213 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1232 EmitUint8(0x66); 1214 EmitUint8(0x66);
1233 EmitUint8(0x0F); 1215 EmitUint8(0x0F);
1234 EmitUint8(0x3A); 1216 EmitUint8(0x3A);
1235 EmitUint8(0x0B); 1217 EmitUint8(0x0B);
1236 EmitXmmRegisterOperand(dst, src); 1218 EmitXmmRegisterOperand(dst, src);
1237 // Mask precision exeption. 1219 // Mask precision exeption.
1238 EmitUint8(static_cast<uint8_t>(mode) | 0x8); 1220 EmitUint8(static_cast<uint8_t>(mode) | 0x8);
1239 } 1221 }
1240 1222
1241 void AssemblerX86::fldl(const Address &src) {
1242 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1243 EmitUint8(0xDD);
1244 EmitOperand(0, src);
1245 }
1246
1247 void AssemblerX86::fstpl(const Address &dst) {
1248 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1249 EmitUint8(0xDD);
1250 EmitOperand(3, dst);
1251 }
1252
1253 void AssemblerX86::fnstcw(const Address &dst) { 1223 void AssemblerX86::fnstcw(const Address &dst) {
1254 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1224 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1255 EmitUint8(0xD9); 1225 EmitUint8(0xD9);
1256 EmitOperand(7, dst); 1226 EmitOperand(7, dst);
1257 } 1227 }
1258 1228
1259 void AssemblerX86::fldcw(const Address &src) { 1229 void AssemblerX86::fldcw(const Address &src) {
1260 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1230 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1261 EmitUint8(0xD9); 1231 EmitUint8(0xD9);
1262 EmitOperand(5, src); 1232 EmitOperand(5, src);
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 assert(shifter == RegX8632::Encoded_Reg_ecx); 2317 assert(shifter == RegX8632::Encoded_Reg_ecx);
2348 (void)shifter; 2318 (void)shifter;
2349 if (Ty == IceType_i16) 2319 if (Ty == IceType_i16)
2350 EmitOperandSizeOverride(); 2320 EmitOperandSizeOverride();
2351 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); 2321 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3);
2352 EmitOperand(rm, operand); 2322 EmitOperand(rm, operand);
2353 } 2323 }
2354 2324
2355 } // end of namespace x86 2325 } // end of namespace x86
2356 } // end of namespace Ice 2326 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/assembler_ia32.h ('k') | tests_lit/llvm2ice_tests/fp.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698