/* Convert an IRRoundingMode value to s390_round_t */
#if defined(VGA_s390x)
-static s390_round_t
+static s390_bfp_round_t
decode_bfp_rounding_mode(UInt irrm)
{
switch (irrm) {
- case Irrm_NEAREST: return S390_ROUND_NEAREST_EVEN;
- case Irrm_NegINF: return S390_ROUND_NEGINF;
- case Irrm_PosINF: return S390_ROUND_POSINF;
- case Irrm_ZERO: return S390_ROUND_ZERO;
+ case Irrm_NEAREST: return S390_BFP_ROUND_NEAREST_EVEN;
+ case Irrm_NegINF: return S390_BFP_ROUND_NEGINF;
+ case Irrm_PosINF: return S390_BFP_ROUND_POSINF;
+ case Irrm_ZERO: return S390_BFP_ROUND_ZERO;
}
vpanic("decode_bfp_rounding_mode");
}
({ \
UInt cc; \
switch (decode_bfp_rounding_mode(cc_dep2)) { \
- case S390_ROUND_NEAREST_EVEN: \
+ case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,4); \
break; \
- case S390_ROUND_ZERO: \
+ case S390_BFP_ROUND_ZERO: \
cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,5); \
break; \
- case S390_ROUND_POSINF: \
+ case S390_BFP_ROUND_POSINF: \
cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,6); \
break; \
- case S390_ROUND_NEGINF: \
+ case S390_BFP_ROUND_NEGINF: \
cc = S390_CC_FOR_BFP_CONVERT_AUX(opcode,cc_dep1,7); \
break; \
default: \
- vpanic("unexpected rounding mode"); \
+ vpanic("unexpected bfp rounding mode"); \
} \
cc; \
})
({ \
UInt cc; \
switch (decode_bfp_rounding_mode(cc_dep2)) { \
- case S390_ROUND_NEAREST_EVEN: \
+ case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,4); \
break; \
- case S390_ROUND_ZERO: \
+ case S390_BFP_ROUND_ZERO: \
cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,5); \
break; \
- case S390_ROUND_POSINF: \
+ case S390_BFP_ROUND_POSINF: \
cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,6); \
break; \
- case S390_ROUND_NEGINF: \
+ case S390_BFP_ROUND_NEGINF: \
cc = S390_CC_FOR_BFP_UCONVERT_AUX(opcode,cc_dep1,7); \
break; \
default: \
- vpanic("unexpected rounding mode"); \
+ vpanic("unexpected bfp rounding mode"); \
} \
cc; \
})
s390_cc_thunk_put3 for rationale. */ \
cc_dep2 = cc_dep2 ^ cc_ndep; \
switch (decode_bfp_rounding_mode(cc_ndep)) { \
- case S390_ROUND_NEAREST_EVEN: \
+ case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \
break; \
- case S390_ROUND_ZERO: \
+ case S390_BFP_ROUND_ZERO: \
cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,5); \
break; \
- case S390_ROUND_POSINF: \
+ case S390_BFP_ROUND_POSINF: \
cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,6); \
break; \
- case S390_ROUND_NEGINF: \
+ case S390_BFP_ROUND_NEGINF: \
cc = S390_CC_FOR_BFP128_CONVERT_AUX(opcode,cc_dep1,cc_dep2,7); \
break; \
default: \
- vpanic("unexpected rounding mode"); \
+ vpanic("unexpected bfp rounding mode"); \
} \
cc; \
})
s390_cc_thunk_put3 for rationale. */ \
cc_dep2 = cc_dep2 ^ cc_ndep; \
switch (decode_bfp_rounding_mode(cc_ndep)) { \
- case S390_ROUND_NEAREST_EVEN: \
+ case S390_BFP_ROUND_NEAREST_EVEN: \
cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,4); \
break; \
- case S390_ROUND_ZERO: \
+ case S390_BFP_ROUND_ZERO: \
cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,5); \
break; \
- case S390_ROUND_POSINF: \
+ case S390_BFP_ROUND_POSINF: \
cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,6); \
break; \
- case S390_ROUND_NEGINF: \
+ case S390_BFP_ROUND_NEGINF: \
cc = S390_CC_FOR_BFP128_UCONVERT_AUX(opcode,cc_dep1,cc_dep2,7); \
break; \
default: \
- vpanic("unexpected rounding mode"); \
+ vpanic("unexpected bfp rounding mode"); \
} \
cc; \
})
/*--- Rounding modes ---*/
/*------------------------------------------------------------*/
-/* Extract the rounding mode from the guest FPC reg and encode it as an
+/* Extract the bfp rounding mode from the guest FPC reg and encode it as an
IRRoundingMode:
rounding mode | s390 | IR
So: IR = (4 - s390) & 3
*/
static IRExpr *
-get_rounding_mode_from_fpc(void)
+get_bfp_rounding_mode_from_fpc(void)
{
IRTemp fpc_bits = newTemp(Ity_I32);
/* For now silently adjust an unsupported rounding mode to "nearest" */
IRExpr *rm_s390 = mkite(binop(Iop_CmpLE32S, mkexpr(fpc_bits), mkU32(3)),
mkexpr(fpc_bits),
- mkU32(S390_FPC_ROUND_NEAREST_EVEN));
+ mkU32(S390_FPC_BFP_ROUND_NEAREST_EVEN));
// rm_IR = (4 - rm_s390) & 3;
return binop(Iop_And32, binop(Iop_Sub32, mkU32(4), rm_s390), mkU32(3));
IRExpr *rm;
switch (mode) {
- case S390_ROUND_PER_FPC: rm = get_rounding_mode_from_fpc(); break;
- case S390_ROUND_NEAREST_AWAY: /* not supported */
- case S390_ROUND_PREPARE_SHORT: /* not supported */
- case S390_ROUND_NEAREST_EVEN: rm = mkU32(Irrm_NEAREST); break;
- case S390_ROUND_ZERO: rm = mkU32(Irrm_ZERO); break;
- case S390_ROUND_POSINF: rm = mkU32(Irrm_PosINF); break;
- case S390_ROUND_NEGINF: rm = mkU32(Irrm_NegINF); break;
+ case S390_BFP_ROUND_PER_FPC:
+ rm = get_bfp_rounding_mode_from_fpc();
+ break;
+ case S390_BFP_ROUND_NEAREST_AWAY: /* not supported */
+ case S390_BFP_ROUND_PREPARE_SHORT: /* not supported */
+ case S390_BFP_ROUND_NEAREST_EVEN: rm = mkU32(Irrm_NEAREST); break;
+ case S390_BFP_ROUND_ZERO: rm = mkU32(Irrm_ZERO); break;
+ case S390_BFP_ROUND_POSINF: rm = mkU32(Irrm_PosINF); break;
+ case S390_BFP_ROUND_NEGINF: rm = mkU32(Irrm_NegINF); break;
default:
vpanic("encode_bfp_rounding_mode");
}
/* ok */
} else {
emulation_warning(EmWarn_S390X_invalid_rounding);
- d2 = S390_FPC_ROUND_NEAREST_EVEN;
+ d2 = S390_FPC_BFP_ROUND_NEAREST_EVEN;
}
}
}
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, get_fpr_w0(r2));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, get_fpr_dw0(r2));
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, load(Ity_F32, mkexpr(op2addr)));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, load(Ity_F64, mkexpr(op2addr)));
s390_irgen_CEFBR(UChar m3, UChar m4 __attribute__((unused)),
UChar r1, UChar r2)
{
- if (! s390_host_has_fpext && m3 != S390_ROUND_PER_FPC) {
+ if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
- m3 = S390_ROUND_PER_FPC;
+ m3 = S390_BFP_ROUND_PER_FPC;
}
IRTemp op2 = newTemp(Ity_I32);
s390_irgen_CEGBR(UChar m3, UChar m4 __attribute__((unused)),
UChar r1, UChar r2)
{
- if (! s390_host_has_fpext && m3 != S390_ROUND_PER_FPC) {
+ if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
- m3 = S390_ROUND_PER_FPC;
+ m3 = S390_BFP_ROUND_PER_FPC;
}
IRTemp op2 = newTemp(Ity_I64);
s390_irgen_CDGBR(UChar m3, UChar m4 __attribute__((unused)),
UChar r1, UChar r2)
{
- if (! s390_host_has_fpext && m3 != S390_ROUND_PER_FPC) {
+ if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
- m3 = S390_ROUND_PER_FPC;
+ m3 = S390_BFP_ROUND_PER_FPC;
}
IRTemp op2 = newTemp(Ity_I64);
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, get_fpr_w0(r2));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, get_fpr_dw0(r2));
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, load(Ity_F32, mkexpr(op2addr)));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, load(Ity_F64, mkexpr(op2addr)));
s390_irgen_LEDBR(UChar m3, UChar m4 __attribute__((unused)),
UChar r1, UChar r2)
{
- if (! s390_host_has_fpext && m3 != S390_ROUND_PER_FPC) {
+ if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
- m3 = S390_ROUND_PER_FPC;
+ m3 = S390_BFP_ROUND_PER_FPC;
}
IRTemp op = newTemp(Ity_F64);
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRRoundingMode rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRRoundingMode rounding_mode =
+ encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, get_fpr_w0(r2));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, get_fpr_dw0(r2));
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, load(Ity_F32, mkexpr(op2addr)));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, load(Ity_F64, mkexpr(op2addr)));
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, get_fpr_w0(r2));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, get_fpr_dw0(r2));
IRTemp op1 = newTemp(Ity_F32);
IRTemp op2 = newTemp(Ity_F32);
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_w0(r1));
assign(op2, load(Ity_F32, mkexpr(op2addr)));
IRTemp op1 = newTemp(Ity_F64);
IRTemp op2 = newTemp(Ity_F64);
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_dw0(r1));
assign(op2, load(Ity_F64, mkexpr(op2addr)));
IRTemp op1 = newTemp(Ity_F128);
IRTemp op2 = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_F128);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_pair(r1));
assign(op2, get_fpr_pair(r2));
IRTemp op1 = newTemp(Ity_F128);
IRTemp op2 = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_F128);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_pair(r1));
assign(op2, get_fpr_pair(r2));
s390_irgen_LDXBR(UChar m3, UChar m4 __attribute__((unused)),
UChar r1, UChar r2)
{
- if (! s390_host_has_fpext && m3 != S390_ROUND_PER_FPC) {
+ if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
- m3 = S390_ROUND_PER_FPC;
+ m3 = S390_BFP_ROUND_PER_FPC;
}
IRTemp result = newTemp(Ity_F64);
s390_irgen_LEXBR(UChar m3, UChar m4 __attribute__((unused)),
UChar r1, UChar r2)
{
- if (! s390_host_has_fpext && m3 != S390_ROUND_PER_FPC) {
+ if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) {
emulation_warning(EmWarn_S390X_fpext_rounding);
- m3 = S390_ROUND_PER_FPC;
+ m3 = S390_BFP_ROUND_PER_FPC;
}
IRTemp result = newTemp(Ity_F32);
IRTemp op1 = newTemp(Ity_F128);
IRTemp op2 = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_F128);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_pair(r1));
assign(op2, get_fpr_pair(r2));
static HChar *
s390_irgen_MAEBR(UChar r1, UChar r3, UChar r2)
{
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_w0(r1, qop(Iop_MAddF32, mkexpr(rounding_mode),
get_fpr_w0(r1), get_fpr_w0(r2), get_fpr_w0(r3)));
static HChar *
s390_irgen_MADBR(UChar r1, UChar r3, UChar r2)
{
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_dw0(r1, qop(Iop_MAddF64, mkexpr(rounding_mode),
get_fpr_dw0(r1), get_fpr_dw0(r2), get_fpr_dw0(r3)));
s390_irgen_MAEB(UChar r3, IRTemp op2addr, UChar r1)
{
IRExpr *op2 = load(Ity_F32, mkexpr(op2addr));
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_w0(r1, qop(Iop_MAddF32, mkexpr(rounding_mode),
get_fpr_w0(r1), op2, get_fpr_w0(r3)));
s390_irgen_MADB(UChar r3, IRTemp op2addr, UChar r1)
{
IRExpr *op2 = load(Ity_F64, mkexpr(op2addr));
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_dw0(r1, qop(Iop_MAddF64, mkexpr(rounding_mode),
get_fpr_dw0(r1), op2, get_fpr_dw0(r3)));
static HChar *
s390_irgen_MSEBR(UChar r1, UChar r3, UChar r2)
{
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_w0(r1, qop(Iop_MSubF32, mkexpr(rounding_mode),
get_fpr_w0(r1), get_fpr_w0(r2), get_fpr_w0(r3)));
static HChar *
s390_irgen_MSDBR(UChar r1, UChar r3, UChar r2)
{
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_dw0(r1, qop(Iop_MSubF64, mkexpr(rounding_mode),
get_fpr_dw0(r1), get_fpr_dw0(r2), get_fpr_dw0(r3)));
s390_irgen_MSEB(UChar r3, IRTemp op2addr, UChar r1)
{
IRExpr *op2 = load(Ity_F32, mkexpr(op2addr));
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_w0(r1, qop(Iop_MSubF32, mkexpr(rounding_mode),
get_fpr_w0(r1), op2, get_fpr_w0(r3)));
s390_irgen_MSDB(UChar r3, IRTemp op2addr, UChar r1)
{
IRExpr *op2 = load(Ity_F64, mkexpr(op2addr));
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
put_fpr_dw0(r1, qop(Iop_MSubF64, mkexpr(rounding_mode),
get_fpr_dw0(r1), op2, get_fpr_dw0(r3)));
s390_irgen_SQEBR(UChar r1, UChar r2)
{
IRTemp result = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(result, binop(Iop_SqrtF32, mkexpr(rounding_mode), get_fpr_w0(r2)));
put_fpr_w0(r1, mkexpr(result));
s390_irgen_SQDBR(UChar r1, UChar r2)
{
IRTemp result = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(result, binop(Iop_SqrtF64, mkexpr(rounding_mode), get_fpr_dw0(r2)));
put_fpr_dw0(r1, mkexpr(result));
s390_irgen_SQXBR(UChar r1, UChar r2)
{
IRTemp result = newTemp(Ity_F128);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(result, binop(Iop_SqrtF128, mkexpr(rounding_mode),
get_fpr_pair(r2)));
s390_irgen_SQEB(UChar r1, IRTemp op2addr)
{
IRTemp op = newTemp(Ity_F32);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op, load(Ity_F32, mkexpr(op2addr)));
put_fpr_w0(r1, binop(Iop_SqrtF32, mkexpr(rounding_mode), mkexpr(op)));
s390_irgen_SQDB(UChar r1, IRTemp op2addr)
{
IRTemp op = newTemp(Ity_F64);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op, load(Ity_F64, mkexpr(op2addr)));
put_fpr_dw0(r1, binop(Iop_SqrtF64, mkexpr(rounding_mode), mkexpr(op)));
IRTemp op1 = newTemp(Ity_F128);
IRTemp op2 = newTemp(Ity_F128);
IRTemp result = newTemp(Ity_F128);
- IRTemp rounding_mode = encode_bfp_rounding_mode(S390_ROUND_PER_FPC);
+ IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC);
assign(op1, get_fpr_pair(r1));
assign(op2, get_fpr_pair(r2));
case S390_INSN_GADD:
break;
- case S390_INSN_SET_FPCRM:
- addHRegUse(u, HRmRead, insn->variant.set_fpcrm.mode);
+ case S390_INSN_SET_FPC_BFPRM:
+ addHRegUse(u, HRmRead, insn->variant.set_fpc_bfprm.mode);
break;
case S390_INSN_EVCHECK:
case S390_INSN_GADD:
break;
- case S390_INSN_SET_FPCRM:
- insn->variant.set_fpcrm.mode =
- lookupHRegRemap(m, insn->variant.set_fpcrm.mode);
+ case S390_INSN_SET_FPC_BFPRM:
+ insn->variant.set_fpc_bfprm.mode =
+ lookupHRegRemap(m, insn->variant.set_fpc_bfprm.mode);
break;
case S390_INSN_EVCHECK:
s390_insn *
s390_insn_bfp_convert(UChar size, s390_conv_t tag, HReg dst, HReg op,
- s390_round_t rounding_mode)
+ s390_bfp_round_t rounding_mode)
{
s390_insn *insn = LibVEX_Alloc(sizeof(s390_insn));
static s390_insn *
s390_insn_bfp128_convert(UChar size, s390_conv_t tag, HReg dst_hi,
HReg dst_lo, HReg op_hi, HReg op_lo,
- s390_round_t rounding_mode)
+ s390_bfp_round_t rounding_mode)
{
s390_insn *insn = LibVEX_Alloc(sizeof(s390_insn));
{
/* Conversion to bfp128 never requires a rounding mode. Provide default
rounding mode. It will not be used when emitting insns. */
- s390_round_t rounding_mode = S390_ROUND_NEAREST_EVEN;
+ s390_bfp_round_t rounding_mode = S390_BFP_ROUND_NEAREST_EVEN;
return s390_insn_bfp128_convert(size, tag, dst_hi, dst_lo, op,
INVALID_HREG, rounding_mode);
s390_insn *
s390_insn_bfp128_convert_from(UChar size, s390_conv_t tag, HReg dst,
HReg op_hi, HReg op_lo,
- s390_round_t rounding_mode)
+ s390_bfp_round_t rounding_mode)
{
return s390_insn_bfp128_convert(size, tag, dst, INVALID_HREG, op_hi, op_lo,
rounding_mode);
s390_insn *
-s390_insn_set_fpcrm(UChar size, HReg mode)
+s390_insn_set_fpc_bfprm(UChar size, HReg mode)
{
vassert(size == 4);
s390_insn *insn = LibVEX_Alloc(sizeof(s390_insn));
- insn->tag = S390_INSN_SET_FPCRM;
+ insn->tag = S390_INSN_SET_FPC_BFPRM;
insn->size = size;
- insn->variant.set_fpcrm.mode = mode;
+ insn->variant.set_fpc_bfprm.mode = mode;
return insn;
}
insn->variant.gadd.value);
break;
- case S390_INSN_SET_FPCRM:
- s390_sprintf(buf, "%M %R", "v-set-fpcrm", insn->variant.set_fpcrm.mode);
+ case S390_INSN_SET_FPC_BFPRM:
+ s390_sprintf(buf, "%M %R", "v-set-fpc-bfprm",
+ insn->variant.set_fpc_bfprm.mode);
break;
case S390_INSN_EVCHECK:
{
UInt r1 = hregNumber(insn->variant.bfp_convert.dst_hi);
UInt r2 = hregNumber(insn->variant.bfp_convert.op_hi);
- s390_round_t m3 = insn->variant.bfp_convert.rounding_mode;
+ s390_bfp_round_t m3 = insn->variant.bfp_convert.rounding_mode;
/* The IEEE-inexact-exception control is not modelled. So the
m4 field is 0 (which is what GCC does, too) */
const UInt m4 = 0;
static UChar *
-s390_insn_set_fpcrm_emit(UChar *buf, const s390_insn *insn)
+s390_insn_set_fpc_bfprm_emit(UChar *buf, const s390_insn *insn)
{
- UInt mode = hregNumber(insn->variant.set_fpcrm.mode);
+ UInt mode = hregNumber(insn->variant.set_fpc_bfprm.mode);
/* Copy FPC from guest state to R0 and OR in the new rounding mode */
buf = s390_emit_L(buf, R0, 0, S390_REGNO_GUEST_STATE_POINTER,
end = s390_insn_gadd_emit(buf, insn);
break;
- case S390_INSN_SET_FPCRM:
- end = s390_insn_set_fpcrm_emit(buf, insn);
+ case S390_INSN_SET_FPC_BFPRM:
+ end = s390_insn_set_fpc_bfprm_emit(buf, insn);
break;
case S390_INSN_PROFINC:
S390_INSN_MFENCE,
S390_INSN_GZERO, /* Assign zero to a guest register */
S390_INSN_GADD, /* Add a value to a guest register */
- S390_INSN_SET_FPCRM, /* Set the rounding mode in the FPC */
+ S390_INSN_SET_FPC_BFPRM, /* Set the bfp rounding mode in the FPC */
/* The following 5 insns are mandated by translation chaining */
S390_INSN_XDIRECT, /* direct transfer to guest address */
S390_INSN_XINDIR, /* indirect transfer to guest address */
/* Rounding mode as it is encoded in the m3 field of certain
instructions (e.g. CFEBR) */
typedef enum {
- S390_ROUND_PER_FPC = 0,
- S390_ROUND_NEAREST_AWAY = 1,
+ S390_BFP_ROUND_PER_FPC = 0,
+ S390_BFP_ROUND_NEAREST_AWAY = 1,
/* 2 is not allowed */
- S390_ROUND_PREPARE_SHORT = 3,
- S390_ROUND_NEAREST_EVEN = 4,
- S390_ROUND_ZERO = 5,
- S390_ROUND_POSINF = 6,
- S390_ROUND_NEGINF = 7
-} s390_round_t;
+ S390_BFP_ROUND_PREPARE_SHORT = 3,
+ S390_BFP_ROUND_NEAREST_EVEN = 4,
+ S390_BFP_ROUND_ZERO = 5,
+ S390_BFP_ROUND_POSINF = 6,
+ S390_BFP_ROUND_NEGINF = 7
+} s390_bfp_round_t;
/* Rounding mode as it is encoded in bits [29:31] of the FPC register.
Only rounding modes 0..3 are universally supported. Others require
additional hardware facilities. */
typedef enum {
- S390_FPC_ROUND_NEAREST_EVEN = 0,
- S390_FPC_ROUND_ZERO = 1,
- S390_FPC_ROUND_POSINF = 2,
- S390_FPC_ROUND_NEGINF = 3,
+ S390_FPC_BFP_ROUND_NEAREST_EVEN = 0,
+ S390_FPC_BFP_ROUND_ZERO = 1,
+ S390_FPC_BFP_ROUND_POSINF = 2,
+ S390_FPC_BFP_ROUND_NEGINF = 3,
/* 4,5,6 are not allowed */
- S390_FPC_ROUND_PREPARE_SHORT = 7
-} s390_fpc_round_t;
+ S390_FPC_BFP_ROUND_PREPARE_SHORT = 7
+} s390_fpc_bfp_round_t;
/* Invert the condition code */
} bfp_unop;
struct {
s390_conv_t tag;
- s390_round_t rounding_mode;
+ s390_bfp_round_t rounding_mode;
HReg dst_hi; /* 128-bit result high part; 32/64-bit result */
HReg dst_lo; /* 128-bit result low part */
HReg op_hi; /* 128-bit operand high part; 32/64-bit opnd */
} gadd;
struct {
HReg mode;
- } set_fpcrm;
+ } set_fpc_bfprm;
/* The next 5 entries are generic to support translation chaining */
HReg op);
s390_insn *s390_insn_bfp_compare(UChar size, HReg dst, HReg op1, HReg op2);
s390_insn *s390_insn_bfp_convert(UChar size, s390_conv_t tag, HReg dst,
- HReg op, s390_round_t);
+ HReg op, s390_bfp_round_t);
s390_insn *s390_insn_bfp128_binop(UChar size, s390_bfp_binop_t, HReg dst_hi,
HReg dst_lo, HReg op2_hi, HReg op2_lo);
s390_insn *s390_insn_bfp128_unop(UChar size, s390_bfp_unop_t, HReg dst_hi,
HReg dst_hi, HReg dst_lo, HReg op);
s390_insn *s390_insn_bfp128_convert_from(UChar size, s390_conv_t,
HReg dst, HReg op_hi, HReg op_lo,
- s390_round_t);
+ s390_bfp_round_t);
s390_insn *s390_insn_mfence(void);
s390_insn *s390_insn_gzero(UChar size, UInt offset);
s390_insn *s390_insn_gadd(UChar size, UInt offset, UChar delta, ULong value);
-s390_insn *s390_insn_set_fpcrm(UChar size, HReg mode);
+s390_insn *s390_insn_set_fpc_bfprm(UChar size, HReg mode);
/* Five for translation chaining */
s390_insn *s390_insn_xdirect(s390_cc_t cond, Addr64 dst, s390_amode *guest_IA,