s390x: fpr - gpr transfer facility
We need to introduce a new hwcap to model the presence of the fpr - gpr
transfer facility. If it is not available, we cannot use the LDGR and LGDR
insns and need to use a trick similar to what ppc does (write/read stack
location).
Fixes #268619 (vex side).
(Florian Krohm, britzel@acm.org)



git-svn-id: svn://svn.valgrind.org/vex/trunk@2131 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/main_main.c b/priv/main_main.c
index 12dcbfd..9d93901 100644
--- a/priv/main_main.c
+++ b/priv/main_main.c
@@ -933,23 +933,38 @@
 
 static HChar* show_hwcaps_s390x ( UInt hwcaps )
 {
-   const UInt LD = VEX_HWCAPS_S390X_LDISP;
-   const UInt EI = VEX_HWCAPS_S390X_EIMM;
-   const UInt GE = VEX_HWCAPS_S390X_GIE;
-   const UInt DF = VEX_HWCAPS_S390X_DFP;
+   static const HChar prefix[] = "s390x";
+   static const HChar facilities[][6] = {
+     { "ldisp" },
+     { "eimm" },
+     { "gie" },
+     { "dfp" },
+     { "fgx" },
+   };
+   static HChar buf[sizeof facilities + sizeof prefix + 1];
+   static HChar *p;
+
+   if (buf[0] != '\0') return buf;  /* already constructed */
 
    hwcaps = VEX_HWCAPS_S390X(hwcaps);
 
-   if (hwcaps == (LD))          return "s390x-ldisp";
-   if (hwcaps == (LD|EI))       return "s390x-ldisp-eimm";
-   if (hwcaps == (LD|GE))       return "s390x-ldisp-gie";
-   if (hwcaps == (LD|DF))       return "s390x-ldisp-dfp";
-   if (hwcaps == (LD|EI|GE))    return "s390x-ldisp-eimm-gie";
-   if (hwcaps == (LD|EI|DF))    return "s390x-ldisp-eimm-dfp";
-   if (hwcaps == (LD|GE|DF))    return "s390x-ldisp-gie-dfp";
-   if (hwcaps == (LD|EI|GE|DF)) return "s390x-ldisp-eimm-gie-dfp";
+   p = buf + vex_sprintf(buf, "%s", prefix);
+   if (hwcaps & VEX_HWCAPS_S390X_LDISP)
+     p = p + vex_sprintf(p, "-%s", facilities[0]);
+   if (hwcaps & VEX_HWCAPS_S390X_EIMM)
+     p = p + vex_sprintf(p, "-%s", facilities[1]);
+   if (hwcaps & VEX_HWCAPS_S390X_GIE)
+     p = p + vex_sprintf(p, "-%s", facilities[2]);
+   if (hwcaps & VEX_HWCAPS_S390X_DFP)
+     p = p + vex_sprintf(p, "-%s", facilities[3]);
+   if (hwcaps & VEX_HWCAPS_S390X_FGX)
+     p = p + vex_sprintf(p, "-%s", facilities[4]);
 
-   return "s390-zarch";
+   /* If there are no facilities, add "zarch" */
+   if (hwcaps == 0)
+     vex_sprintf(p, "-%s", "zarch");
+
+   return buf;
 }
 
 /* ---- */