Index: src/x64/codegen-x64.cc |
=================================================================== |
--- src/x64/codegen-x64.cc (revision 2791) |
+++ src/x64/codegen-x64.cc (working copy) |
@@ -7722,18 +7722,29 @@ |
__ fild_s(Operand(rsp, 0 * kPointerSize)); |
__ fucompp(); |
__ fnstsw_ax(); |
- __ sahf(); // TODO(X64): Not available. |
- __ j(not_zero, &operand_conversion_failure); |
- __ j(parity_even, &operand_conversion_failure); |
- |
+ if (CpuFeatures::IsSupported(CpuFeatures::SAHF)) { |
+ __ sahf(); |
+ __ j(not_zero, &operand_conversion_failure); |
+ __ j(parity_even, &operand_conversion_failure); |
+ } else { |
+ __ and_(rax, Immediate(0x4400)); |
+ __ cmpl(rax, Immediate(0x4000)); |
+ __ j(not_zero, &operand_conversion_failure); |
+ } |
// Check if left operand is int32. |
__ fist_s(Operand(rsp, 1 * kPointerSize)); |
__ fild_s(Operand(rsp, 1 * kPointerSize)); |
__ fucompp(); |
__ fnstsw_ax(); |
- __ sahf(); // TODO(X64): Not available. Test bits in ax directly |
- __ j(not_zero, &operand_conversion_failure); |
- __ j(parity_even, &operand_conversion_failure); |
+ if (CpuFeatures::IsSupported(CpuFeatures::SAHF)) { |
+ __ sahf(); |
+ __ j(not_zero, &operand_conversion_failure); |
+ __ j(parity_even, &operand_conversion_failure); |
+ } else { |
+ __ and_(rax, Immediate(0x4400)); |
+ __ cmpl(rax, Immediate(0x4000)); |
+ __ j(not_zero, &operand_conversion_failure); |
+ } |
} |
// Get int32 operands and perform bitop. |