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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 183028: X64: Use sahf instruction only on processors that support it. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7704 matching lines...) Expand 10 before | Expand all | Expand 10 after
7715 __ fisttp_s(Operand(rsp, 1 * kPointerSize)); 7715 __ fisttp_s(Operand(rsp, 1 * kPointerSize));
7716 __ fnstsw_ax(); 7716 __ fnstsw_ax();
7717 __ testl(rax, Immediate(1)); 7717 __ testl(rax, Immediate(1));
7718 __ j(not_zero, &operand_conversion_failure); 7718 __ j(not_zero, &operand_conversion_failure);
7719 } else { 7719 } else {
7720 // Check if right operand is int32. 7720 // Check if right operand is int32.
7721 __ fist_s(Operand(rsp, 0 * kPointerSize)); 7721 __ fist_s(Operand(rsp, 0 * kPointerSize));
7722 __ fild_s(Operand(rsp, 0 * kPointerSize)); 7722 __ fild_s(Operand(rsp, 0 * kPointerSize));
7723 __ fucompp(); 7723 __ fucompp();
7724 __ fnstsw_ax(); 7724 __ fnstsw_ax();
7725 __ sahf(); // TODO(X64): Not available. 7725 if (CpuFeatures::IsSupported(CpuFeatures::SAHF)) {
7726 __ j(not_zero, &operand_conversion_failure); 7726 __ sahf();
7727 __ j(parity_even, &operand_conversion_failure); 7727 __ j(not_zero, &operand_conversion_failure);
7728 7728 __ j(parity_even, &operand_conversion_failure);
7729 } else {
7730 __ and_(rax, Immediate(0x4400));
7731 __ cmpl(rax, Immediate(0x4000));
7732 __ j(not_zero, &operand_conversion_failure);
7733 }
7729 // Check if left operand is int32. 7734 // Check if left operand is int32.
7730 __ fist_s(Operand(rsp, 1 * kPointerSize)); 7735 __ fist_s(Operand(rsp, 1 * kPointerSize));
7731 __ fild_s(Operand(rsp, 1 * kPointerSize)); 7736 __ fild_s(Operand(rsp, 1 * kPointerSize));
7732 __ fucompp(); 7737 __ fucompp();
7733 __ fnstsw_ax(); 7738 __ fnstsw_ax();
7734 __ sahf(); // TODO(X64): Not available. Test bits in ax directly 7739 if (CpuFeatures::IsSupported(CpuFeatures::SAHF)) {
7735 __ j(not_zero, &operand_conversion_failure); 7740 __ sahf();
7736 __ j(parity_even, &operand_conversion_failure); 7741 __ j(not_zero, &operand_conversion_failure);
7742 __ j(parity_even, &operand_conversion_failure);
7743 } else {
7744 __ and_(rax, Immediate(0x4400));
7745 __ cmpl(rax, Immediate(0x4000));
7746 __ j(not_zero, &operand_conversion_failure);
7747 }
7737 } 7748 }
7738 7749
7739 // Get int32 operands and perform bitop. 7750 // Get int32 operands and perform bitop.
7740 __ pop(rcx); 7751 __ pop(rcx);
7741 __ pop(rax); 7752 __ pop(rax);
7742 switch (op_) { 7753 switch (op_) {
7743 case Token::BIT_OR: __ or_(rax, rcx); break; 7754 case Token::BIT_OR: __ or_(rax, rcx); break;
7744 case Token::BIT_AND: __ and_(rax, rcx); break; 7755 case Token::BIT_AND: __ and_(rax, rcx); break;
7745 case Token::BIT_XOR: __ xor_(rax, rcx); break; 7756 case Token::BIT_XOR: __ xor_(rax, rcx); break;
7746 case Token::SAR: __ sarl(rax); break; 7757 case Token::SAR: __ sarl(rax); break;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
7864 int CompareStub::MinorKey() { 7875 int CompareStub::MinorKey() {
7865 // Encode the two parameters in a unique 16 bit value. 7876 // Encode the two parameters in a unique 16 bit value.
7866 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7877 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7867 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7878 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7868 } 7879 }
7869 7880
7870 7881
7871 #undef __ 7882 #undef __
7872 7883
7873 } } // namespace v8::internal 7884 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698