]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
icc -Wall cleanups
authorJulian Seward <jseward@acm.org>
Sat, 26 Mar 2005 11:59:23 +0000 (11:59 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 26 Mar 2005 11:59:23 +0000 (11:59 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1092

VEX/priv/guest-amd64/ghelpers.c
VEX/priv/guest-x86/ghelpers.c
VEX/priv/guest-x86/toIR.c
VEX/priv/host-generic/h_generic_regs.c

index d5225454c64ab1c2ec29bb09a3b0c76d24b692da..940e481990556e7eb28134128881c2c12a4096ff 100644 (file)
@@ -147,7 +147,7 @@ static const UChar parity_table[256] = {
     0, AMD64G_CC_MASK_P, AMD64G_CC_MASK_P, 0, AMD64G_CC_MASK_P, 0, 0, AMD64G_CC_MASK_P,
 };
 
-/* n must be a constant to be efficient */
+/* generalised left-shifter */
 static inline Long lshift ( Long x, Int n )
 {
    if (n >= 0)
index 3e0d5470c61d4c9ea6fcec01eb6dab38c987b5df..4c39139b3a7cbb1d3c50fb6bd4e290cde0a390e5 100644 (file)
@@ -107,7 +107,7 @@ static const UChar parity_table[256] = {
     0, X86G_CC_MASK_P, X86G_CC_MASK_P, 0, X86G_CC_MASK_P, 0, 0, X86G_CC_MASK_P,
 };
 
-/* n must be a constant to be efficient */
+/* generalised left-shifter */
 inline static Int lshift ( Int x, Int n )
 {
    if (n >= 0)
@@ -116,6 +116,12 @@ inline static Int lshift ( Int x, Int n )
       return x >> (-n);
 }
 
+/* identity on ULong */
+static inline ULong idULong ( ULong x )
+{
+   return x;
+}
+
 
 #define PREAMBLE(__data_bits)                                  \
    /* const */ UInt DATA_MASK                                  \
@@ -356,16 +362,20 @@ inline static Int lshift ( Int x, Int n )
 
 /*-------------------------------------------------------------*/
 
-#define ACTIONS_UMUL(DATA_BITS,DATA_UTYPE,DATA_U2TYPE)          \
+#define ACTIONS_UMUL(DATA_BITS, DATA_UTYPE,  NARROWtoU,         \
+                                DATA_U2TYPE, NARROWto2U)        \
 {                                                               \
    PREAMBLE(DATA_BITS);                                         \
    { Int cf, pf, af, zf, sf, of;                                \
      DATA_UTYPE  hi;                                            \
-     DATA_UTYPE  lo = ((DATA_UTYPE)CC_DEP1)                     \
-                      * ((DATA_UTYPE)CC_DEP2);                  \
-     DATA_U2TYPE rr = ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP1))      \
-                      * ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP2));   \
-     hi = (DATA_UTYPE)(rr >>/*u*/ DATA_BITS);                   \
+     DATA_UTYPE  lo                                             \
+        = NARROWtoU( ((DATA_UTYPE)CC_DEP1)                      \
+                     * ((DATA_UTYPE)CC_DEP2) );                 \
+     DATA_U2TYPE rr                                             \
+        = NARROWto2U(                                           \
+             ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP1))               \
+             * ((DATA_U2TYPE)((DATA_UTYPE)CC_DEP2)) );          \
+     hi = NARROWtoU(rr >>/*u*/ DATA_BITS);                      \
      cf = (hi != 0);                                            \
      pf = parity_table[(UChar)lo];                              \
      af = 0; /* undefined */                                    \
@@ -378,16 +388,20 @@ inline static Int lshift ( Int x, Int n )
 
 /*-------------------------------------------------------------*/
 
-#define ACTIONS_SMUL(DATA_BITS,DATA_STYPE,DATA_S2TYPE)          \
+#define ACTIONS_SMUL(DATA_BITS, DATA_STYPE,  NARROWtoS,         \
+                                DATA_S2TYPE, NARROWto2S)        \
 {                                                               \
    PREAMBLE(DATA_BITS);                                         \
    { Int cf, pf, af, zf, sf, of;                                \
      DATA_STYPE  hi;                                            \
-     DATA_STYPE  lo = ((DATA_STYPE)CC_DEP1)                     \
-                      * ((DATA_STYPE)CC_DEP2);                  \
-     DATA_S2TYPE rr = ((DATA_S2TYPE)((DATA_STYPE)CC_DEP1))      \
-                      * ((DATA_S2TYPE)((DATA_STYPE)CC_DEP2));   \
-     hi = (DATA_STYPE)(rr >>/*s*/ DATA_BITS);                   \
+     DATA_STYPE  lo                                             \
+        = NARROWtoS( ((DATA_STYPE)CC_DEP1)                      \
+                     * ((DATA_STYPE)CC_DEP2) );                 \
+     DATA_S2TYPE rr                                             \
+        = NARROWto2S(                                           \
+             ((DATA_S2TYPE)((DATA_STYPE)CC_DEP1))               \
+             * ((DATA_S2TYPE)((DATA_STYPE)CC_DEP2)) );          \
+     hi = NARROWtoS(rr >>/*s*/ DATA_BITS);                      \
      cf = (hi != (lo >>/*s*/ (DATA_BITS-1)));                   \
      pf = parity_table[(UChar)lo];                              \
      af = 0; /* undefined */                                    \
@@ -530,13 +544,19 @@ UInt x86g_calculate_eflags_all_WRK ( UInt cc_op,
       case X86G_CC_OP_RORW:   ACTIONS_ROR( 16, UShort );
       case X86G_CC_OP_RORL:   ACTIONS_ROR( 32, UInt   );
 
-      case X86G_CC_OP_UMULB:  ACTIONS_UMUL(  8, UChar,  UShort );
-      case X86G_CC_OP_UMULW:  ACTIONS_UMUL( 16, UShort, UInt   );
-      case X86G_CC_OP_UMULL:  ACTIONS_UMUL( 32, UInt,   ULong  );
-
-      case X86G_CC_OP_SMULB:  ACTIONS_SMUL(  8, Char,   Short );
-      case X86G_CC_OP_SMULW:  ACTIONS_SMUL( 16, Short,  Int   );
-      case X86G_CC_OP_SMULL:  ACTIONS_SMUL( 32, Int,    Long  );
+      case X86G_CC_OP_UMULB:  ACTIONS_UMUL(  8, UChar,  toUChar,
+                                                UShort, toUShort );
+      case X86G_CC_OP_UMULW:  ACTIONS_UMUL( 16, UShort, toUShort,
+                                                UInt,   toUInt );
+      case X86G_CC_OP_UMULL:  ACTIONS_UMUL( 32, UInt,   toUInt,
+                                                ULong,  idULong );
+
+      case X86G_CC_OP_SMULB:  ACTIONS_SMUL(  8, Char,   toUChar,
+                                                Short,  toUShort );
+      case X86G_CC_OP_SMULW:  ACTIONS_SMUL( 16, Short,  toUShort, 
+                                                Int,    toUInt   );
+      case X86G_CC_OP_SMULL:  ACTIONS_SMUL( 32, Int,    toUInt,
+                                                Long,   idULong );
 
       default:
          /* shouldn't really make these calls from generated code */
index bed949d8ba4b7e92f55dc75f51accc3aa36e3498..02e36af324536cd685133a019d0f10348ce0cfd8 100644 (file)
@@ -4704,7 +4704,7 @@ UInt dis_FPU ( Bool* decode_ok, UChar sorb, UInt delta )
 
             case 0xC0 ... 0xC7: /* FFREE %st(?) */
                r_dst = (UInt)modrm - 0xC0;
-               DIP("ffree %%st(%d)\n", r_dst);
+               DIP("ffree %%st(%d)\n", (Int)r_dst);
                put_ST_TAG ( r_dst, mkU8(0) );
                break;
 
index 1692d119c719a47b491082ce49372f4461874ebe..500c19dc31cb892aa2c572beff312ca646401404 100644 (file)
@@ -74,8 +74,8 @@ void ppHReg ( HReg r )
 
 void ppHRegUsage ( HRegUsage* tab )
 {
-   Int   i;
-   Char* str;
+   Int    i;
+   HChar* str;
    vex_printf("HRegUsage {\n");
    for (i = 0; i < tab->n_used; i++) {
       switch (tab->mode[i]) {