From: Florian Krohm Date: Mon, 29 Sep 2025 21:34:56 +0000 (+0000) Subject: s390: Add testcases for unhandled IEEE exceptions. Fixes BZ 306098 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d60982b80c6a7ae7a731305e3087345de4c1a023;p=thirdparty%2Fvalgrind.git s390: Add testcases for unhandled IEEE exceptions. Fixes BZ 306098 New emulation warnings: EmWarn_S390X_XxC_not_zero and EmWarn_S390X_XiC_not_zero New testcases bfp-XxC, dfp-XxC, and dfp-XiC. New testcase driver emwarn-gen.pl to get around valgrind's restriction on the number of emulation warnings. Fixes https://bugs.kde.org/show_bug.cgi?id=306098 --- diff --git a/NEWS b/NEWS index 1d2a6ea65..d7367ba05 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +306098 s390x: Alternate opcode form for convert to/from fixed and friends 309100 s390x: Testcases for extended BFP 309554 Wrap syscall remap_file_pages (216) 331311 Valgrind shows open files in /proc/self/fd that don't work for the process diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 1f18fee66..aad1a0dbb 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -778,7 +778,7 @@ static void s390_print(HChar *text, IRExpr *value) { IRDirty *d; - + d = unsafeIRDirty_0_N(0 /* regparms */, "s390_do_print", &s390_do_print, mkIRExprVec_2(mkU64((ULong)text), value)); stmt(IRStmt_Dirty(d)); @@ -11458,13 +11458,14 @@ s390_irgen_ADB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CEFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cefbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I32); @@ -11477,10 +11478,11 @@ s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDFBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CDFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cdfbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11491,13 +11493,14 @@ s390_irgen_CDFBRA(UChar m3, } static const HChar * -s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CEGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cegbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I64); @@ -11510,13 +11513,14 @@ s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("cdgbra", is_valid_rounding_mode(m3)); IRTemp op2 = newTemp(Ity_I64); @@ -11529,13 +11533,14 @@ s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CELFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("celfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11547,13 +11552,14 @@ s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLFBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CDLFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cdlfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -11564,13 +11570,14 @@ s390_irgen_CDLFBR(UChar m3, } static const HChar * -s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CELGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("celgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -11582,13 +11589,14 @@ s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDLGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cdlgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -11601,13 +11609,14 @@ s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFEBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfebr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); @@ -11623,13 +11632,14 @@ s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFDBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfdbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); @@ -11645,13 +11655,14 @@ s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGEBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgebr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); @@ -11667,13 +11678,14 @@ s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGDBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgdbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); @@ -11689,10 +11701,11 @@ s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); @@ -11708,10 +11721,11 @@ s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfdbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); @@ -11727,10 +11741,11 @@ s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); @@ -11746,10 +11761,11 @@ s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgdbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); @@ -11903,13 +11919,14 @@ s390_irgen_LDEB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_LEDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("ledbra", is_valid_rounding_mode(m3)); IRTemp op = newTemp(Ity_F64); @@ -12162,11 +12179,13 @@ s390_irgen_CXTR(UChar r1, UChar r2) static const HChar * s390_irgen_CDFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12177,12 +12196,14 @@ s390_irgen_CDFTR(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CXFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { s390_insn_assert("cxftr", is_valid_fpr_pair(r1)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -12193,8 +12214,7 @@ s390_irgen_CXFTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDGTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12205,6 +12225,8 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); assign(op2, get_gpr_dw0(r2)); put_dpr_dw0(r1, binop(Iop_I64StoD64, mkexpr(encode_dfp_rounding_mode(m3)), @@ -12215,12 +12237,14 @@ s390_irgen_CDGTRA(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { s390_insn_assert("cxgtra", is_valid_fpr_pair(r1)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -12235,7 +12259,7 @@ s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12243,6 +12267,8 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12254,7 +12280,7 @@ s390_irgen_CDLFTR(UChar m3 __attribute__((unused)), static const HChar * s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12263,6 +12289,8 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlftr", is_valid_fpr_pair(r1)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -12274,8 +12302,7 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CDLGTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12283,6 +12310,8 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -12296,7 +12325,7 @@ s390_irgen_CDLGTR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), - UChar m4 __attribute__((unused)), UChar r1, UChar r2) + UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12305,6 +12334,8 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlgtr", is_valid_fpr_pair(r1)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -12316,8 +12347,7 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12325,6 +12355,8 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12340,8 +12372,7 @@ s390_irgen_CFDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12350,6 +12381,8 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cfxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); @@ -12367,8 +12400,7 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGDTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12376,6 +12408,8 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12388,8 +12422,7 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGXTRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12398,6 +12431,8 @@ s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cgxtra", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12456,8 +12491,7 @@ s390_irgen_CEXTR(UChar r1, UChar r2) } static const HChar * -s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12465,6 +12499,8 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12480,8 +12516,7 @@ s390_irgen_CLFDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12490,6 +12525,8 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); @@ -12507,8 +12544,7 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12516,6 +12552,8 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12531,8 +12569,7 @@ s390_irgen_CLGDTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12541,6 +12578,8 @@ s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgxtr", is_valid_fpr_pair(r2)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I64); @@ -12701,11 +12740,13 @@ s390_irgen_IEXTR(UChar r3, UChar r1, UChar r2) } static const HChar * -s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_LDETR(UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); IRTemp op = newTemp(Ity_D32); assign(op, get_dpr_w0(r2)); @@ -12715,11 +12756,13 @@ s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_LXDTR(UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); s390_insn_assert("lxdtr", is_valid_fpr_pair(r1)); IRTemp op = newTemp(Ity_D64); @@ -12731,8 +12774,7 @@ s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LDXTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12746,6 +12788,10 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_D64); assign(result, binop(Iop_D128toD64, mkexpr(encode_dfp_rounding_mode(m3)), @@ -12756,8 +12802,7 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEDTR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); @@ -12768,6 +12813,10 @@ s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_DFP_ROUND_PER_FPC_0; } + if ((m4 & 0x8) != 0) + emulation_warning(EmWarn_S390X_XiC_not_zero); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_D64); assign(op, get_dpr_dw0(r2)); @@ -14855,11 +14904,12 @@ s390_irgen_KDB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CXFBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXFBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cxfbra", is_valid_fpr_pair(r1)); s390_insn_assert("cxfbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -14870,14 +14920,15 @@ s390_irgen_CXFBRA(UChar m3, } static const HChar * -s390_irgen_CXLFBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXLFBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlfbr", is_valid_fpr_pair(r1)); s390_insn_assert("cxlfbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I32); @@ -14889,11 +14940,12 @@ s390_irgen_CXLFBR(UChar m3, static const HChar * -s390_irgen_CXGBRA(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXGBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cxgbra", is_valid_fpr_pair(r1)); s390_insn_assert("cxgbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -14904,14 +14956,15 @@ s390_irgen_CXGBRA(UChar m3, } static const HChar * -s390_irgen_CXLGBR(UChar m3, - UChar m4 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_CXLGBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("cxlgbr", is_valid_fpr_pair(r1)); s390_insn_assert("cxlgbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op2 = newTemp(Ity_I64); @@ -14922,11 +14975,12 @@ s390_irgen_CXLGBR(UChar m3, } static const HChar * -s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CFXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cfxbra", is_valid_fpr_pair(r2)); s390_insn_assert("cfxbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); @@ -14942,14 +14996,15 @@ s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLFXBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clfxbr", is_valid_fpr_pair(r2)); s390_insn_assert("clfxbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); @@ -14966,11 +15021,12 @@ s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * -s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CGXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("cgxbra", is_valid_fpr_pair(r2)); s390_insn_assert("cgxbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); @@ -14986,14 +15042,15 @@ s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CLGXBR(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_CLGXBR(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { s390_insn_assert("clgxbr", is_valid_fpr_pair(r2)); s390_insn_assert("clgxbr", is_valid_rounding_mode(m3)); + if ((m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); @@ -15112,10 +15169,11 @@ s390_irgen_LXEB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIEBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fiebra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F32); @@ -15127,10 +15185,11 @@ s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIDBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fidbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F64); @@ -15142,12 +15201,13 @@ s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_FIXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_FIXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { s390_insn_assert("fixbra", is_valid_fpr_pair(r1)); s390_insn_assert("fixbra", is_valid_fpr_pair(r2)); s390_insn_assert("fixbra", is_valid_rounding_mode(m3)); + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); IRTemp result = newTemp(Ity_F128); @@ -15237,13 +15297,14 @@ s390_irgen_LPXBR(UChar r1, UChar r2) } static const HChar * -s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LDXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("ldxbra", is_valid_fpr_pair(r1)); s390_insn_assert("ldxbra", is_valid_fpr_pair(r2)); s390_insn_assert("ldxbra", is_valid_rounding_mode(m3)); @@ -15258,13 +15319,14 @@ s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_LEXBRA(UChar m3, UChar m4 __attribute__((unused)), - UChar r1, UChar r2) +s390_irgen_LEXBRA(UChar m3, UChar m4, UChar r1, UChar r2) { if (! s390_host_has_fpext && m3 != S390_BFP_ROUND_PER_FPC) { emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + if (s390_host_has_fpext && (m4 & 0x4) != 0) + emulation_warning(EmWarn_S390X_XxC_not_zero); s390_insn_assert("lexbra", is_valid_fpr_pair(r1)); s390_insn_assert("lexbra", is_valid_fpr_pair(r2)); s390_insn_assert("lexbra", is_valid_rounding_mode(m3)); @@ -16088,7 +16150,7 @@ s390_irgen_TRE(UChar r1,UChar r2) /* Load character from source string and compare with test byte */ assign(op, load(Ity_I8, mkexpr(src_addr))); - + s390_cc_set_val(1); next_insn_if(binop(Iop_CmpEQ8, mkexpr(op), mkexpr(test_byte))); diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index db78238ae..85da551d5 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -719,7 +719,7 @@ IRSB* LibVEX_FrontEnd ( /*MOD*/ VexTranslateArgs* vta, vta->guest_extents, &vta->archinfo_host, guest_word_type, host_word_type); - + if (vex_traceflags & VEX_TRACE_INST) { vex_printf("\n------------------------" " After instrumentation " @@ -1541,6 +1541,14 @@ const HChar* LibVEX_EmNote_string ( VexEmNote ew ) " feature requires the floating point extension facility\n" " which is not available on this host. Continuing using\n" " the rounding mode from FPC. Results may differ!"; + case EmWarn_S390X_XxC_not_zero: + return "Encountered an insn with the IEEE-inexact-exception control\n" + " (XxC) bit set to 1. This is not supported. Continuing anyway.\n" + " IEEE-inexact exceptions will not be suppressed."; + case EmWarn_S390X_XiC_not_zero: + return "Encountered an insn with the IEEE-invalid-operation-exception\n" + " control (XiC) bit set to 1. This is not supported. Continuing anyway.\n" + " IEEE-invalid-operation exceptions will not be suppressed."; case EmFail_S390X_stfle: return "Instruction stfle is not supported on this host"; case EmFail_S390X_stckf: diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index be17a8922..bd998a1c0 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -37,7 +37,7 @@ #include "libvex_basictypes.h" /* VEX can sometimes generate code which returns to the dispatcher - with the guest state pointer set to VEX_TRC_JMP_EMWARN or + with the guest state pointer set to VEX_TRC_JMP_EMWARN or VEX_TRC_JMP_EMFAIL. This means that VEX is trying to tell Valgrind something noteworthy about emulation progress. For example, that Valgrind is doing imprecise emulation in some sense. The guest's pseudo-register @@ -67,16 +67,16 @@ typedef /* unmasking SSE FP exceptions is not supported */ EmWarn_X86_sseExns, - + /* setting mxcsr.fz is not supported */ EmWarn_X86_fz, - + /* setting mxcsr.daz is not supported */ EmWarn_X86_daz, /* settings to %eflags.ac (alignment check) are noted but ignored */ EmWarn_X86_acFlag, - + /* unmasking PPC32/64 FP exceptions is not supported */ EmWarn_PPCexns, @@ -89,6 +89,16 @@ typedef facility is not available on this host */ EmWarn_S390X_fpext_rounding, + /* Various BFP insns have an M4 field containing the + IEEE-inexact-exception (XxC) control bit. That bit cannot me modelled + in VEX and is expected to be zero. */ + EmWarn_S390X_XxC_not_zero, + + /* Various DFP insns have an M4 field containing the + IEEE-invalid-operation (XiC) control bit. That bit cannot me modelled + in VEX and is expected to be zero. */ + EmWarn_S390X_XiC_not_zero, + /* stfle insn is not supported on this host */ EmFail_S390X_stfle, diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index 66254c3bb..e0ca00d5b 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl +dist_noinst_SCRIPTS = filter_stderr bfp-emit.pl emwarn-gen.pl INSN_TESTS = clc clcle cvb cvd icm lpr lam_stam xc mvst add sub mul \ and or xor insert div srst fold_And16 flogr sub_EI add_EI \ @@ -44,6 +44,7 @@ EXTRA_DIST = \ bfp-load.vgtest bfp-load.stdout.exp bfp-load.stderr.exp \ bfp-tdc.vgtest bfp-tdc.stdout.exp bfp-tdc.stderr.exp \ bfp-emit.vgtest bfp-emit.stderr.exp bfp-emit.post.exp \ + bfp-XxC.vgtest bfp-XxC.stderr.exp bfp-XxC.post.exp \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ ecag.stdout.exp-z16 \ @@ -57,6 +58,8 @@ EXTRA_DIST = \ dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest \ dfpext.stderr.exp dfpext.stdout.exp dfpext.vgtest \ dfpconv.stderr.exp dfpconv.stdout.exp dfpconv.vgtest \ + dfp-XxC.vgtest dfp-XxC.stderr.exp dfp-XxC.post.exp \ + dfp-XiC.vgtest dfp-XiC.stderr.exp dfp-XiC.post.exp \ srnmt.stderr.exp srnmt.stdout.exp srnmt.vgtest \ stfle.stdout.exp-z16 \ pfpo.stderr.exp pfpo.stdout.exp pfpo.vgtest diff --git a/none/tests/s390x/bfp-XxC.post.exp b/none/tests/s390x/bfp-XxC.post.exp new file mode 100644 index 000000000..4e63c6b4e --- /dev/null +++ b/none/tests/s390x/bfp-XxC.post.exp @@ -0,0 +1,234 @@ + +============================================================ +BFP CONVERT FROM FIXED +============================================================ +Testing: cefbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdfbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxfbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cegbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdgbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxgbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT FROM LOGICAL +============================================================ +Testing: celfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlfbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: celgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlgbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT TO FIXED +============================================================ +Testing: cfebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfdbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgdbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP CONVERT TO LOGICAL +============================================================ +Testing: clfebr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfdbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfxbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgebr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgdbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgxbr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP LOAD FP INTEGER +============================================================ +Testing: fiebra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: fidbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: fixbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +BFP LOAD ROUNDED +============================================================ +Testing: ledbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: lexbra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/bfp-XxC.stderr.exp b/none/tests/s390x/bfp-XxC.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/bfp-XxC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/bfp-XxC.vgtest b/none/tests/s390x/bfp-XxC.vgtest new file mode 100644 index 000000000..af289c94a --- /dev/null +++ b/none/tests/s390x/bfp-XxC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext +prog: /bin/true +post: ./emwarn-gen.pl --bfp-XxC diff --git a/none/tests/s390x/dfp-XiC.post.exp b/none/tests/s390x/dfp-XiC.post.exp new file mode 100644 index 000000000..e51ad8330 --- /dev/null +++ b/none/tests/s390x/dfp-XiC.post.exp @@ -0,0 +1,36 @@ + +============================================================ +DFP LOAD LENGTHENED +============================================================ +Testing: ldetr 0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + +Testing: lxdtr 0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP LOAD ROUNDED +============================================================ +Testing: ledtr 0,0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxtr 0,0,0,8 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-invalid-operation-exception + control (XiC) bit set to 1. This is not supported. Continuing anyway. + IEEE-invalid-operation exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/dfp-XiC.stderr.exp b/none/tests/s390x/dfp-XiC.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/dfp-XiC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/dfp-XiC.vgtest b/none/tests/s390x/dfp-XiC.vgtest new file mode 100644 index 000000000..bea81fbee --- /dev/null +++ b/none/tests/s390x/dfp-XiC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp +prog: /bin/true +post: ./emwarn-gen.pl --dfp-XiC diff --git a/none/tests/s390x/dfp-XxC.post.exp b/none/tests/s390x/dfp-XxC.post.exp new file mode 100644 index 000000000..a3af32011 --- /dev/null +++ b/none/tests/s390x/dfp-XxC.post.exp @@ -0,0 +1,146 @@ + +============================================================ +DFP CONVERT FROM FIXED +============================================================ +Testing: cdgtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxgtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT FROM LOGICAL +============================================================ +Testing: cdlgtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlgtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cdlftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cxlftr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT TO FIXED +============================================================ +Testing: cgdtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cgxtra 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: cfxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP CONVERT TO LOGICAL +============================================================ +Testing: clgdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clgxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfdtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: clfxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + + +============================================================ +DFP LOAD ROUNDED +============================================================ +Testing: ledtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + +Testing: ldxtr 0,0,0,4 +Emulation warning: unsupported action: + Encountered an insn with the IEEE-inexact-exception control + (XxC) bit set to 1. This is not supported. Continuing anyway. + IEEE-inexact exceptions will not be suppressed. + at 0x........: (below main) + diff --git a/none/tests/s390x/dfp-XxC.stderr.exp b/none/tests/s390x/dfp-XxC.stderr.exp new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/none/tests/s390x/dfp-XxC.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/dfp-XxC.vgtest b/none/tests/s390x/dfp-XxC.vgtest new file mode 100644 index 000000000..681c300a1 --- /dev/null +++ b/none/tests/s390x/dfp-XxC.vgtest @@ -0,0 +1,3 @@ +prereq: ../../../tests/s390x_features s390x-fpext && ../../../tests/s390x_features s390x-dfp +prog: /bin/true +post: ./emwarn-gen.pl --dfp-XxC diff --git a/none/tests/s390x/emwarn-gen.pl b/none/tests/s390x/emwarn-gen.pl new file mode 100755 index 000000000..7a142d795 --- /dev/null +++ b/none/tests/s390x/emwarn-gen.pl @@ -0,0 +1,179 @@ +#!/usr/bin/env perl + +#-------------------------------------------------------------------- +# Create testcases for checking BFP/DFP emulation warnings +# +# This machinery is to circumwent valgrind's limitation of at most +# 3 emulation warnings per emulation kind. +#-------------------------------------------------------------------- + +use strict; +use warnings; +use Cwd 'abs_path'; +use Getopt::Long; + +my $rootdir = get_rootdir(); +my $runone = "$rootdir/auxprogs/s390-runone"; +my $valgrind = "$rootdir/coregrind/valgrind"; +my $valargs = "-q --tool=none --show-emwarns=yes"; + +&main; + +sub main +{ + GetOptions("bfp-XxC" => sub { test_bfp_XxC(); }, + "dfp-XiC" => sub { test_dfp_XiC(); }, + "dfp-XxC" => sub { test_dfp_XxC(); }, + ) or exit 1; + exit 0; +} + +sub test_bfp_XxC +{ + header("BFP CONVERT FROM FIXED"); + run_insn_test("cefbra 0,0,0,4"); + run_insn_test("cdfbra 0,0,0,4"); + run_insn_test("cxfbra 0,0,0,4"); + run_insn_test("cegbra 0,0,0,4"); + run_insn_test("cdgbra 0,0,0,4"); + run_insn_test("cxgbra 0,0,0,4"); + + header("BFP CONVERT FROM LOGICAL"); + run_insn_test("celfbr 0,0,0,4"); + run_insn_test("cdlfbr 0,0,0,4"); + run_insn_test("cxlfbr 0,0,0,4"); + run_insn_test("celgbr 0,0,0,4"); + run_insn_test("cdlgbr 0,0,0,4"); + run_insn_test("cxlgbr 0,0,0,4"); + + header("BFP CONVERT TO FIXED"); + run_insn_test("cfebra 0,0,0,4"); + run_insn_test("cfdbra 0,0,0,4"); + run_insn_test("cfxbra 0,0,0,4"); + run_insn_test("cgebra 0,0,0,4"); + run_insn_test("cgdbra 0,0,0,4"); + run_insn_test("cgxbra 0,0,0,4"); + + header("BFP CONVERT TO LOGICAL"); + run_insn_test("clfebr 0,0,0,4"); + run_insn_test("clfdbr 0,0,0,4"); + run_insn_test("clfxbr 0,0,0,4"); + run_insn_test("clgebr 0,0,0,4"); + run_insn_test("clgdbr 0,0,0,4"); + run_insn_test("clgxbr 0,0,0,4"); + + header("BFP LOAD FP INTEGER"); + run_insn_test("fiebra 0,0,0,4"); + run_insn_test("fidbra 0,0,0,4"); + run_insn_test("fixbra 0,0,0,4"); + + header("BFP LOAD ROUNDED"); + run_insn_test("ledbra 0,0,0,4"); + run_insn_test("ldxbra 0,0,0,4"); + run_insn_test("lexbra 0,0,0,4"); +} + +sub test_dfp_XxC +{ + header("DFP CONVERT FROM FIXED"); + run_insn_test("cdgtra 0,0,0,4"); + run_insn_test("cxgtra 0,0,0,4"); + run_insn_test("cdftr 0,0,0,4"); + run_insn_test("cxftr 0,0,0,4"); + + header("DFP CONVERT FROM LOGICAL"); + run_insn_test("cdlgtr 0,0,0,4"); + run_insn_test("cxlgtr 0,0,0,4"); + run_insn_test("cdlftr 0,0,0,4"); + run_insn_test("cxlftr 0,0,0,4"); + + header("DFP CONVERT TO FIXED"); + run_insn_test("cgdtra 0,0,0,4"); + run_insn_test("cgxtra 0,0,0,4"); + run_insn_test("cfdtr 0,0,0,4"); + run_insn_test("cfxtr 0,0,0,4"); + + header("DFP CONVERT TO LOGICAL"); + run_insn_test("clgdtr 0,0,0,4"); + run_insn_test("clgxtr 0,0,0,4"); + run_insn_test("clfdtr 0,0,0,4"); + run_insn_test("clfxtr 0,0,0,4"); + + header("DFP LOAD ROUNDED"); + run_insn_test("ledtr 0,0,0,4"); + run_insn_test("ldxtr 0,0,0,4"); +} + +sub test_dfp_XiC +{ + header("DFP LOAD LENGTHENED"); + run_insn_test("ldetr 0,0,8"); + run_insn_test("lxdtr 0,0,8"); + + header("DFP LOAD ROUNDED"); + run_insn_test("ledtr 0,0,0,8"); + run_insn_test("ldxtr 0,0,0,8"); +} + +sub run_insn_test +{ + my ($insn) = @_; + $insn =~ s/\s+/ /g; + my ($mnm) = $insn; + + $mnm =~ s/\s.*//; + print "Testing: $insn\n"; + + my $exe = "xxemwarn-$mnm"; + my $cfile = "$exe.c"; + + # Create template + `$runone --template --insn=\"$insn\" > $cfile`; + + # Compile + my $stderr = `$runone --build $cfile 2>&1`; + if ($? != 0) { + error("runone failed\n$stderr"); + return; + } + + # Run valgrind + my $output = `$valgrind $valargs ./$exe 2>&1 | ./filter_stderr`; + print STDOUT "$output\n"; + + # Remove files + unlink ($exe, $cfile, "$exe.s", "$exe.s.orig"); +} + +sub get_rootdir +{ + my $dir = "."; + while (abs_path($dir) ne "/") { + if (-e "$dir/AUTHORS") { + return abs_path($dir); + } + $dir = "$dir/.."; + } + fatal("Coud not determine root directory. \"AUTHORS\" file not found\n"); +} + +sub header +{ + my ($txt) = @_; + + print "\n"; + print "============================================================\n"; + print "$txt\n"; + print "============================================================\n"; +} + +sub error +{ + print STDERR "*** $_[0]\n"; +} + +sub fatal +{ + error($_[0]); + exit 1; +}