|
[Valgrind-developers] vex: r2272: Fixes for capabilities checking
w.r.t. Power DFP instructions (VEX
From: <sv...@va...> - 2012-04-02 21:24:19
|
sewardj 2012-04-02 22:24:12 +0100 (Mon, 02 Apr 2012)
New Revision: 2272
Log:
Fixes for capabilities checking w.r.t. Power DFP instructions (VEX
side). Fixes #297329. (Maynard Johnson, may...@us...)
Modified files:
trunk/priv/guest_ppc_toIR.c
trunk/priv/host_ppc_isel.c
trunk/priv/main_main.c
trunk/pub/libvex.h
Modified: trunk/priv/main_main.c (+6 -2)
===================================================================
--- trunk/priv/main_main.c 2012-04-02 15:08:42 +01:00 (rev 2271)
+++ trunk/priv/main_main.c 2012-04-02 22:24:12 +01:00 (rev 2272)
@@ -890,6 +890,7 @@
const UInt FX = VEX_HWCAPS_PPC32_FX;
const UInt GX = VEX_HWCAPS_PPC32_GX;
const UInt VX = VEX_HWCAPS_PPC32_VX;
+ const UInt DFP = VEX_HWCAPS_PPC32_DFP;
UInt c = hwcaps;
if (c == 0) return "ppc32-int";
if (c == F) return "ppc32-int-flt";
@@ -900,7 +901,8 @@
if (c == (F|V|FX)) return "ppc32-int-flt-vmx-FX";
if (c == (F|V|GX)) return "ppc32-int-flt-vmx-GX";
if (c == (F|V|FX|GX)) return "ppc32-int-flt-vmx-FX-GX";
- if (c == (F|V|FX|GX|VX)) return "ppc32-int-flt-vmx-FX-GX-VX";
+ if (c == (F|V|FX|GX|DFP)) return "ppc32-int-flt-vmx-FX-GX-DFP";
+ if (c == (F|V|FX|GX|VX|DFP)) return "ppc32-int-flt-vmx-FX-GX-VX-DFP";
return NULL;
}
@@ -912,6 +914,7 @@
const UInt FX = VEX_HWCAPS_PPC64_FX;
const UInt GX = VEX_HWCAPS_PPC64_GX;
const UInt VX = VEX_HWCAPS_PPC64_VX;
+ const UInt DFP = VEX_HWCAPS_PPC64_DFP;
UInt c = hwcaps;
if (c == 0) return "ppc64-int-flt";
if (c == FX) return "ppc64-int-flt-FX";
@@ -921,7 +924,8 @@
if (c == (V|FX)) return "ppc64-int-flt-vmx-FX";
if (c == (V|GX)) return "ppc64-int-flt-vmx-GX";
if (c == (V|FX|GX)) return "ppc64-int-flt-vmx-FX-GX";
- if (c == (V|FX|GX|VX)) return "ppc64-int-flt-vmx-FX-GX-VX";
+ if (c == (V|FX|GX|DFP)) return "ppc64-int-flt-vmx-FX-GX-DFP";
+ if (c == (V|FX|GX|VX|DFP)) return "ppc64-int-flt-vmx-FX-GX-VX-DFP";
return NULL;
}
Modified: trunk/priv/guest_ppc_toIR.c (+14 -4)
===================================================================
--- trunk/priv/guest_ppc_toIR.c 2012-04-02 15:08:42 +01:00 (rev 2271)
+++ trunk/priv/guest_ppc_toIR.c 2012-04-02 22:24:12 +01:00 (rev 2272)
@@ -13591,6 +13591,7 @@
Bool allow_FX = False;
Bool allow_GX = False;
Bool allow_VX = False; // Equates to "supports Power ISA 2.06
+ Bool allow_DFP = False;
UInt hwcaps = archinfo->hwcaps;
Long delta;
@@ -13601,12 +13602,14 @@
allow_FX = (0 != (hwcaps & VEX_HWCAPS_PPC64_FX));
allow_GX = (0 != (hwcaps & VEX_HWCAPS_PPC64_GX));
allow_VX = (0 != (hwcaps & VEX_HWCAPS_PPC64_VX));
+ allow_DFP = (0 != (hwcaps & VEX_HWCAPS_PPC64_DFP));
} else {
allow_F = (0 != (hwcaps & VEX_HWCAPS_PPC32_F));
allow_V = (0 != (hwcaps & VEX_HWCAPS_PPC32_V));
allow_FX = (0 != (hwcaps & VEX_HWCAPS_PPC32_FX));
allow_GX = (0 != (hwcaps & VEX_HWCAPS_PPC32_GX));
allow_VX = (0 != (hwcaps & VEX_HWCAPS_PPC32_VX));
+ allow_DFP = (0 != (hwcaps & VEX_HWCAPS_PPC32_DFP));
}
/* The running delta */
@@ -13805,7 +13808,7 @@
case 0x202: // dsub - DFP Subtract
case 0x22: // dmul - DFP Mult
case 0x222: // ddiv - DFP Divide
- if (!allow_GX) goto decode_failure;
+ if (!allow_DFP) goto decode_noDFP;
if (dis_dfp_arith( theInstr ))
goto decode_success;
case 0x3CE: // fcfidus (implemented as native insn)
@@ -14029,7 +14032,7 @@
case 0x202: // dsubq - DFP Subtract
case 0x22: // dmulq - DFP Mult
case 0x222: // ddivq - DFP Divide
- if (!allow_GX) goto decode_failure;
+ if (!allow_DFP) goto decode_noDFP;
if (dis_dfp_arithq( theInstr ))
goto decode_success;
goto decode_failure;
@@ -14586,7 +14589,13 @@
vex_printf("disInstr(ppc): "
"declined to decode a Graphics-Optional insn.\n");
goto decode_failure;
+ decode_noDFP:
+ vassert(!allow_DFP);
+ vex_printf("disInstr(ppc): "
+ "declined to decode a Decimal Floating Point insn.\n");
+ goto decode_failure;
+
decode_failure:
/* All decode failures end up here. */
opc2 = (theInstr) & 0x7FF;
@@ -14658,10 +14667,11 @@
/* do some sanity checks */
mask32 = VEX_HWCAPS_PPC32_F | VEX_HWCAPS_PPC32_V
- | VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX;
+ | VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX
+ | VEX_HWCAPS_PPC32_DFP;
mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX
- | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX;
+ | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP;
if (mode64) {
vassert((hwcaps_guest & mask32) == 0);
Modified: trunk/priv/host_ppc_isel.c (+3 -2)
===================================================================
--- trunk/priv/host_ppc_isel.c 2012-04-02 15:08:42 +01:00 (rev 2271)
+++ trunk/priv/host_ppc_isel.c 2012-04-02 22:24:12 +01:00 (rev 2272)
@@ -4610,10 +4610,11 @@
/* do some sanity checks */
mask32 = VEX_HWCAPS_PPC32_F | VEX_HWCAPS_PPC32_V
- | VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX;
+ | VEX_HWCAPS_PPC32_FX | VEX_HWCAPS_PPC32_GX | VEX_HWCAPS_PPC32_VX
+ | VEX_HWCAPS_PPC32_DFP;
mask64 = VEX_HWCAPS_PPC64_V | VEX_HWCAPS_PPC64_FX
- | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX;
+ | VEX_HWCAPS_PPC64_GX | VEX_HWCAPS_PPC64_VX | VEX_HWCAPS_PPC64_DFP;
if (mode64) {
vassert((hwcaps_host & mask32) == 0);
Modified: trunk/pub/libvex.h (+3 -0)
===================================================================
--- trunk/pub/libvex.h 2012-04-02 15:08:42 +01:00 (rev 2271)
+++ trunk/pub/libvex.h 2012-04-02 22:24:12 +01:00 (rev 2272)
@@ -96,6 +96,9 @@
(fres,frsqrte,fsel,stfiwx) */
#define VEX_HWCAPS_PPC64_VX (1<<16) /* Vector-scalar floating-point (VSX); implies ISA 2.06 or higher */
+#define VEX_HWCAPS_PPC32_DFP (1<<17) /* Decimal Floating Point (DFP) -- e.g., dadd */
+#define VEX_HWCAPS_PPC64_DFP (1<<18) /* Decimal Floating Point (DFP) -- e.g., dadd */
+
/* s390x: Hardware capability encoding
Bits Information
|