]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Remove an unused macro (which also had undefined behaviours).
authorFlorian Krohm <florian@eich-krohm.de>
Mon, 9 Feb 2015 23:21:07 +0000 (23:21 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Mon, 9 Feb 2015 23:21:07 +0000 (23:21 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@3090

VEX/priv/guest_s390_helpers.c
VEX/priv/guest_s390_toIR.c
VEX/priv/host_s390_defs.c
VEX/priv/host_s390_isel.c
VEX/priv/s390_disasm.c

index cf223c484e1ce19568005c7c89338f574115fb2f..622cdccf555536a27f1e13ed5825995a0411f180 100644 (file)
@@ -1566,7 +1566,7 @@ s390_calculate_cc(ULong cc_op, ULong cc_dep1, ULong cc_dep2, ULong cc_ndep)
 
    case S390_CC_OP_TEST_UNDER_MASK_16: {
       /* Create a TMLL insn with the mask as given by cc_dep2 */
-      UInt insn  = (0xA701 << 16) | cc_dep2;
+      UInt insn  = (0xA701u << 16) | cc_dep2;
       UInt value = cc_dep1;
 
       __asm__ volatile (
index e066d10a38f8c88a8239a25009e112f9fd73ede7..96d4432f4760b43b61194651d312e322ac5831d8 100644 (file)
@@ -94,15 +94,6 @@ typedef enum {
 /*--- Helpers for constructing IR.                         ---*/
 /*------------------------------------------------------------*/
 
-/* Sign extend a value with the given number of bits. This is a
-   macro because it allows us to overload the type of the value.
-   Note that VALUE must have a signed type! */
-#undef sign_extend
-#define sign_extend(value,num_bits) \
-(((value) << (sizeof(__typeof__(value)) * 8 - (num_bits))) >> \
- (sizeof(__typeof__(value)) * 8 - (num_bits)))
-
-
 /* Add a statement to the current irsb. */
 static __inline__ void
 stmt(IRStmt *st)
index 1746baa972337dde9774674a0320a18e82fd58ef..ea2f718189b0708007b6fcdc3dbd5b7670332881 100644 (file)
@@ -185,7 +185,8 @@ s390_hreg_guest_state_pointer(void)
 static __inline__ Bool
 fits_signed_20bit(Int value)
 {
-   return ((value << 12) >> 12) == value;
+   UInt uval = value;
+   return ((Int)(uval << 12) >> 12) == value;
 }
 
 
@@ -4725,36 +4726,36 @@ s390_emit_LOCG(UChar *p, UChar r1, UChar m3, UChar b2, UShort dl2, UChar dh2)
 static __inline__ Bool
 uint_fits_signed_16bit(UInt val)
 {
-   Int v = val & 0xFFFFu;
+   UInt v = val & 0xFFFFu;
 
    /* sign extend */
-   v = (v << 16) >> 16;
+   v = (Int)(v << 16) >> 16;
 
-   return val == (UInt)v;
+   return val == v;
 }
 
 
 static __inline__ Bool
 ulong_fits_signed_16bit(ULong val)
 {
-   Long v = val & 0xFFFFu;
+   ULong v = val & 0xFFFFu;
 
    /* sign extend */
-   v = (v << 48) >> 48;
+   v = (Long)(v << 48) >> 48;
 
-   return val == (ULong)v;
+   return val == v;
 }
 
 
 static __inline__ Bool
 ulong_fits_signed_32bit(ULong val)
 {
-   Long v = val & 0xFFFFFFFFu;
+   ULong v = val & 0xFFFFFFFFu;
 
    /* sign extend */
-   v = (v << 32) >> 32;
+   v = (Long)(v << 32) >> 32;
 
-   return val == (ULong)v;
+   return val == v;
 }
 
 
index e8e6fc8f1d92411e7ef78e46791a3938a0e5498e..f7af2a934c7a2f55175278a8cbcad993f28c8d52 100644 (file)
@@ -268,22 +268,22 @@ ulong_fits_unsigned_12bit(ULong val)
 static __inline__ Bool
 ulong_fits_signed_20bit(ULong val)
 {
-   Long v = val & 0xFFFFFu;
+   ULong v = val & 0xFFFFFu;
 
-   v = (v << 44) >> 44;  /* sign extend */
+   v = (Long)(v << 44) >> 44;  /* sign extend */
 
-   return val == (ULong)v;
+   return val == v;
 }
 
 
 static __inline__ Bool
 ulong_fits_signed_8bit(ULong val)
 {
-   Long v = val & 0xFFu;
+   ULong v = val & 0xFFu;
 
-   v = (v << 56) >> 56;  /* sign extend */
+   v = (Long)(v << 56) >> 56;  /* sign extend */
 
-   return val == (ULong)v;
+   return val == v;
 }
 
 /* EXPR is an expression that is used as an address. Return an s390_amode
@@ -463,13 +463,13 @@ s390_expr_is_const_zero(IRExpr *expr)
 static ULong
 get_const_value_as_ulong(const IRConst *con)
 {
-   Long value;
+   ULong value;
 
    switch (con->tag) {
-   case Ico_U1:  value = con->Ico.U1;  return (ULong) ((value << 63) >> 63);
-   case Ico_U8:  value = con->Ico.U8;  return (ULong) ((value << 56) >> 56);
-   case Ico_U16: value = con->Ico.U16; return (ULong) ((value << 48) >> 48);
-   case Ico_U32: value = con->Ico.U32; return (ULong) ((value << 32) >> 32);
+   case Ico_U1:  value = con->Ico.U1;  return ((Long)(value << 63) >> 63);
+   case Ico_U8:  value = con->Ico.U8;  return ((Long)(value << 56) >> 56);
+   case Ico_U16: value = con->Ico.U16; return ((Long)(value << 48) >> 48);
+   case Ico_U32: value = con->Ico.U32; return ((Long)(value << 32) >> 32);
    case Ico_U64: return con->Ico.U64;
    default:
       vpanic("get_const_value_as_ulong");
index 6a52409f386a1e221014e566d0d87f4c653786c8..95cf1f770c606508b70dff2724f8e9e58b27b342 100644 (file)
@@ -246,7 +246,7 @@ static HChar *
 dxb_operand(HChar *p, UInt d, UInt x, UInt b, Bool displacement_is_signed)
 {
    if (displacement_is_signed) {
-      Int displ = ((Int)d << 12) >> 12;  /* sign extend */
+      Int displ = (Int)(d << 12) >> 12;  /* sign extend */
 
       p += vex_sprintf(p, "%d", displ);
    } else {
@@ -399,15 +399,15 @@ s390_disasm(UInt command, ...)
          break;
 
       case S390_ARG_PCREL: {
-         Int offset = (Int)(va_arg(args, UInt));
+         Long offset = va_arg(args, Int);
 
          /* Convert # halfwords to # bytes */
          offset <<= 1;
 
          if (offset < 0) {
-            p += vex_sprintf(p, ".%d", offset);
+            p += vex_sprintf(p, ".%lld", offset);
          } else {
-            p += vex_sprintf(p, ".+%u", offset);
+            p += vex_sprintf(p, ".+%lld", offset);
          }
          break;
       }