Index: src/s390/simulator-s390.cc |
diff --git a/src/s390/simulator-s390.cc b/src/s390/simulator-s390.cc |
index deba02fb024096e693f6f13539d46e337391da76..53e18d410036577936cb8e4eafe0d9f570048cf1 100644 |
--- a/src/s390/simulator-s390.cc |
+++ b/src/s390/simulator-s390.cc |
@@ -2975,7 +2975,8 @@ void Simulator::DecodeFourByteFloatingPointIntConversion(Instruction* instr) { |
case CLFDBR: |
case CLGDBR: |
case CELFBR: |
- case CLGEBR: { |
+ case CLGEBR: |
+ case CLFEBR: { |
RREInstruction* rreInstr = reinterpret_cast<RREInstruction*>(instr); |
int r1 = rreInstr->R1Value(); |
int r2 = rreInstr->R2Value(); |
@@ -2999,17 +3000,22 @@ void Simulator::DecodeFourByteFloatingPointIntConversion(Instruction* instr) { |
double r2_val = get_double_from_d_register(r2); |
uint32_t r1_val = static_cast<uint32_t>(r2_val); |
set_low_register(r1, r1_val); |
- SetS390ConditionCode<double>(r2_val, 0); |
+ SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); |
+ } else if (op == CLFEBR) { |
+ float r2_val = get_float32_from_d_register(r2); |
+ uint32_t r1_val = static_cast<uint32_t>(r2_val); |
+ set_low_register(r1, r1_val); |
+ SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT32_MAX); |
} else if (op == CLGDBR) { |
double r2_val = get_double_from_d_register(r2); |
uint64_t r1_val = static_cast<uint64_t>(r2_val); |
set_register(r1, r1_val); |
- SetS390ConditionCode<double>(r2_val, 0); |
+ SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT64_MAX); |
} else if (op == CLGEBR) { |
float r2_val = get_float32_from_d_register(r2); |
uint64_t r1_val = static_cast<uint64_t>(r2_val); |
set_register(r1, r1_val); |
- SetS390ConditionCode<double>(r2_val, 0); |
+ SetS390ConvertConditionCode<double>(r2_val, r1_val, UINT64_MAX); |
} |
break; |
} |
@@ -3031,14 +3037,7 @@ void Simulator::DecodeFourByteFloatingPointRound(Instruction* instr) { |
int mask_val = rreInstr->M3Value(); |
int32_t r1_val = 0; |
- if (r2_val == 0.0) |
- condition_reg_ = 8; |
- else if (r2_val < 0.0) |
- condition_reg_ = 4; |
- else if (r2_val > 0.0) |
- condition_reg_ = 2; |
- else |
- condition_reg_ = 1; |
+ SetS390RoundConditionCode(r2_val, INT32_MAX, INT32_MIN); |
switch (mask_val) { |
case CURRENT_ROUNDING_MODE: |
@@ -3119,14 +3118,7 @@ void Simulator::DecodeFourByteFloatingPointRound(Instruction* instr) { |
int mask_val = rreInstr->M3Value(); |
int64_t r1_val = 0; |
- if (r2_val == 0.0) |
- condition_reg_ = 8; |
- else if (r2_val < 0.0) |
- condition_reg_ = 4; |
- else if (r2_val > 0.0) |
- condition_reg_ = 2; |
- else |
- condition_reg_ = 1; |
+ SetS390RoundConditionCode(r2_val, INT64_MAX, INT64_MIN); |
switch (mask_val) { |
case CURRENT_ROUNDING_MODE: |
@@ -3175,14 +3167,7 @@ void Simulator::DecodeFourByteFloatingPointRound(Instruction* instr) { |
int mask_val = rreInstr->M3Value(); |
int64_t r1_val = 0; |
- if (r2_fval == 0.0) |
- condition_reg_ = 8; |
- else if (r2_fval < 0.0) |
- condition_reg_ = 4; |
- else if (r2_fval > 0.0) |
- condition_reg_ = 2; |
- else |
- condition_reg_ = 1; |
+ SetS390RoundConditionCode(r2_fval, INT64_MAX, INT64_MIN); |
switch (mask_val) { |
case CURRENT_ROUNDING_MODE: |
@@ -3231,14 +3216,7 @@ void Simulator::DecodeFourByteFloatingPointRound(Instruction* instr) { |
int mask_val = rreInstr->M3Value(); |
int32_t r1_val = 0; |
- if (r2_fval == 0.0) |
- condition_reg_ = 8; |
- else if (r2_fval < 0.0) |
- condition_reg_ = 4; |
- else if (r2_fval > 0.0) |
- condition_reg_ = 2; |
- else |
- condition_reg_ = 1; |
+ SetS390RoundConditionCode(r2_fval, INT32_MAX, INT32_MIN); |
switch (mask_val) { |
case CURRENT_ROUNDING_MODE: |
@@ -3487,7 +3465,8 @@ bool Simulator::DecodeFourByteFloatingPoint(Instruction* instr) { |
case CLFDBR: |
case CELFBR: |
case CLGDBR: |
- case CLGEBR: { |
+ case CLGEBR: |
+ case CLFEBR: { |
DecodeFourByteFloatingPointIntConversion(instr); |
break; |
} |