Remove an unused macro (which also had undefined behaviours).
git-svn-id: svn://svn.valgrind.org/vex/trunk@3090 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest_s390_helpers.c b/priv/guest_s390_helpers.c
index cf223c4..622cdcc 100644
--- a/priv/guest_s390_helpers.c
+++ b/priv/guest_s390_helpers.c
@@ -1566,7 +1566,7 @@
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 (
diff --git a/priv/guest_s390_toIR.c b/priv/guest_s390_toIR.c
index e066d10..96d4432 100644
--- a/priv/guest_s390_toIR.c
+++ b/priv/guest_s390_toIR.c
@@ -94,15 +94,6 @@
/*--- 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)
diff --git a/priv/host_s390_defs.c b/priv/host_s390_defs.c
index 1746baa..ea2f718 100644
--- a/priv/host_s390_defs.c
+++ b/priv/host_s390_defs.c
@@ -185,7 +185,8 @@
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 @@
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;
}
diff --git a/priv/host_s390_isel.c b/priv/host_s390_isel.c
index e8e6fc8..f7af2a9 100644
--- a/priv/host_s390_isel.c
+++ b/priv/host_s390_isel.c
@@ -268,22 +268,22 @@
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 @@
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");
diff --git a/priv/s390_disasm.c b/priv/s390_disasm.c
index 6a52409..95cf1f7 100644
--- a/priv/s390_disasm.c
+++ b/priv/s390_disasm.c
@@ -246,7 +246,7 @@
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 @@
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;
}