diff mbox

S/390: Use macros from hwint.h where possible.

Message ID 20170126204523.GB18640@linux.vnet.ibm.com
State New
Headers show

Commit Message

Dominik Vogt Jan. 26, 2017, 8:45 p.m. UTC
The attached patch uses macros from hwint.h in the s390 backend
where possible.

Bootstrapped and regression tested on a zEC12 with s390x biarch
and s390.

Ciao

Dominik ^_^  ^_^

Comments

Dominik Vogt Feb. 6, 2017, 10:10 a.m. UTC | #1
Ping.

On Thu, Jan 26, 2017 at 09:45:23PM +0100, Dominik Vogt wrote:
> The attached patch uses macros from hwint.h in the s390 backend
> where possible.
> 
> Bootstrapped and regression tested on a zEC12 with s390x biarch
> and s390.
> 
> Ciao
> 
> Dominik ^_^  ^_^
> 
> -- 
> 
> Dominik Vogt
> IBM Germany

> gcc/ChangeLog-macros
> 
> 	* config/s390/predicates.md ("larl_operand"): Use macros from hwint.h.
> 	* config/s390/s390.c (s390_const_operand_ok)
> 	(s390_canonicalize_comparison, s390_extract_part)
> 	(s390_single_part, s390_contiguous_bitmask_nowrap_p)
> 	(s390_contiguous_bitmask_p, s390_rtx_costs)
> 	(legitimize_pic_address): Likewise.
> 	* config/s390/s390.md ("clzdi2", "clztidi2"): Likewise.
> 	* config/s390/vx-builtins.md ("vec_genbytemaskv16qi")
> 	("vec_permi<mode>", "vfae<mode>", "*vfaes<mode>", "vstrc<mode>")
> 	("*vstrcs<mode>"): Use UINTVAL() to set unsigned HOST_WIDE_INT.
> 	* config/s390/vector.md ("vec_vfenes<mode>"): Likewise.

> >From 55d162e6bbbd56aa4d67e86fe029eeb21477c60a Mon Sep 17 00:00:00 2001
> From: Dominik Vogt <vogt@linux.vnet.ibm.com>
> Date: Thu, 26 Jan 2017 18:21:02 +0100
> Subject: [PATCH] S/390: Use macros from hwint.h where possible.
> 
> ---
>  gcc/config/s390/predicates.md  |  4 ++--
>  gcc/config/s390/s390.c         | 50 ++++++++++++++++++++----------------------
>  gcc/config/s390/s390.md        |  5 ++---
>  gcc/config/s390/vector.md      |  2 +-
>  gcc/config/s390/vx-builtins.md | 14 ++++++------
>  5 files changed, 36 insertions(+), 39 deletions(-)
> 
> diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
> index a233aaf..0c82efc 100644
> --- a/gcc/config/s390/predicates.md
> +++ b/gcc/config/s390/predicates.md
> @@ -147,8 +147,8 @@
>        if (GET_CODE (XEXP (op, 1)) != CONST_INT
>            || (INTVAL (XEXP (op, 1)) & 1) != 0)
>          return false;
> -      if (INTVAL (XEXP (op, 1)) >= (HOST_WIDE_INT)1 << 31
> -	  || INTVAL (XEXP (op, 1)) < -((HOST_WIDE_INT)1 << 31))
> +      if (INTVAL (XEXP (op, 1)) >= HOST_WIDE_INT_1 << 31
> +	  || INTVAL (XEXP (op, 1)) < -(HOST_WIDE_INT_1 << 31))
>          return false;
>        op = XEXP (op, 0);
>      }
> diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
> index fe65846..4c7e9a7 100644
> --- a/gcc/config/s390/s390.c
> +++ b/gcc/config/s390/s390.c
> @@ -750,12 +750,12 @@ s390_const_operand_ok (tree arg, int argnum, int op_flags, tree decl)
>        int bitwidth = bitwidths[op_flags - O_U1];
>  
>        if (!tree_fits_uhwi_p (arg)
> -	  || tree_to_uhwi (arg) > ((unsigned HOST_WIDE_INT)1 << bitwidth) - 1)
> +	  || tree_to_uhwi (arg) > (HOST_WIDE_INT_1U << bitwidth) - 1)
>  	{
>  	  error("constant argument %d for builtin %qF is out of range (0.."
>  		HOST_WIDE_INT_PRINT_UNSIGNED ")",
>  		argnum, decl,
> -		((unsigned HOST_WIDE_INT)1 << bitwidth) - 1);
> +		(HOST_WIDE_INT_1U << bitwidth) - 1);
>  	  return false;
>  	}
>      }
> @@ -766,15 +766,15 @@ s390_const_operand_ok (tree arg, int argnum, int op_flags, tree decl)
>        int bitwidth = bitwidths[op_flags - O_S2];
>  
>        if (!tree_fits_shwi_p (arg)
> -	  || tree_to_shwi (arg) < -((HOST_WIDE_INT)1 << (bitwidth - 1))
> -	  || tree_to_shwi (arg) > (((HOST_WIDE_INT)1 << (bitwidth - 1)) - 1))
> +	  || tree_to_shwi (arg) < -(HOST_WIDE_INT_1 << (bitwidth - 1))
> +	  || tree_to_shwi (arg) > ((HOST_WIDE_INT_1 << (bitwidth - 1)) - 1))
>  	{
>  	  error("constant argument %d for builtin %qF is out of range ("
>  		HOST_WIDE_INT_PRINT_DEC ".."
>  		HOST_WIDE_INT_PRINT_DEC ")",
>  		argnum, decl,
> -		-((HOST_WIDE_INT)1 << (bitwidth - 1)),
> -		((HOST_WIDE_INT)1 << (bitwidth - 1)) - 1);
> +		-(HOST_WIDE_INT_1 << (bitwidth - 1)),
> +		(HOST_WIDE_INT_1 << (bitwidth - 1)) - 1);
>  	  return false;
>  	}
>      }
> @@ -1561,7 +1561,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
>  	  && modesize <= HOST_BITS_PER_WIDE_INT)
>  	{
>  	  unsigned HOST_WIDE_INT block;
> -	  block = ((unsigned HOST_WIDE_INT) 1 << len) - 1;
> +	  block = (HOST_WIDE_INT_1U << len) - 1;
>  	  block <<= modesize - pos - len;
>  
>  	  *op0 = gen_rtx_AND (GET_MODE (inner), inner,
> @@ -1610,7 +1610,7 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
>        && INTVAL (*op1) == 0xffff
>        && SCALAR_INT_MODE_P (GET_MODE (*op0))
>        && (nonzero_bits (*op0, GET_MODE (*op0))
> -	  & ~(unsigned HOST_WIDE_INT) 0xffff) == 0)
> +	  & ~HOST_WIDE_INT_UC (0xffff)) == 0)
>      {
>        *op0 = gen_lowpart (HImode, *op0);
>        *op1 = constm1_rtx;
> @@ -2212,14 +2212,13 @@ s390_extract_part (rtx op, machine_mode mode, int def)
>    unsigned HOST_WIDE_INT value = 0;
>    int max_parts = HOST_BITS_PER_WIDE_INT / GET_MODE_BITSIZE (mode);
>    int part_bits = GET_MODE_BITSIZE (mode);
> -  unsigned HOST_WIDE_INT part_mask
> -    = ((unsigned HOST_WIDE_INT)1 << part_bits) - 1;
> +  unsigned HOST_WIDE_INT part_mask = (HOST_WIDE_INT_1U << part_bits) - 1;
>    int i;
>  
>    for (i = 0; i < max_parts; i++)
>      {
>        if (i == 0)
> -	value = (unsigned HOST_WIDE_INT) INTVAL (op);
> +	value = UINTVAL (op);
>        else
>  	value >>= part_bits;
>  
> @@ -2243,7 +2242,7 @@ s390_single_part (rtx op,
>    unsigned HOST_WIDE_INT value = 0;
>    int n_parts = GET_MODE_SIZE (mode) / GET_MODE_SIZE (part_mode);
>    unsigned HOST_WIDE_INT part_mask
> -    = ((unsigned HOST_WIDE_INT)1 << GET_MODE_BITSIZE (part_mode)) - 1;
> +    = (HOST_WIDE_INT_1U << GET_MODE_BITSIZE (part_mode)) - 1;
>    int i, part = -1;
>  
>    if (GET_CODE (op) != CONST_INT)
> @@ -2252,7 +2251,7 @@ s390_single_part (rtx op,
>    for (i = 0; i < n_parts; i++)
>      {
>        if (i == 0)
> -	value = (unsigned HOST_WIDE_INT) INTVAL (op);
> +	value = UINTVAL (op);
>        else
>  	value >>= GET_MODE_BITSIZE (part_mode);
>  
> @@ -2282,9 +2281,9 @@ s390_contiguous_bitmask_nowrap_p (unsigned HOST_WIDE_INT in, int size,
>  {
>    int start;
>    int end = -1;
> -  int lowbit = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - 1;
> -  int highbit = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - size;
> -  unsigned HOST_WIDE_INT bitmask = 1ULL;
> +  int lowbit = HOST_BITS_PER_WIDE_INT - 1;
> +  int highbit = HOST_BITS_PER_WIDE_INT - size;
> +  unsigned HOST_WIDE_INT bitmask = HOST_WIDE_INT_1U;
>  
>    gcc_assert (!!pstart == !!pend);
>    for (start = lowbit; start >= highbit; bitmask <<= 1, start--)
> @@ -2314,7 +2313,8 @@ s390_contiguous_bitmask_nowrap_p (unsigned HOST_WIDE_INT in, int size,
>        unsigned HOST_WIDE_INT mask;
>  
>        /* Calculate a mask for all bits beyond the contiguous bits.  */
> -      mask = ((~(0ULL) >> highbit) & (~(0ULL) << (lowbit - start + 1)));
> +      mask = ((~HOST_WIDE_INT_0U >> highbit)
> +	      & (~HOST_WIDE_INT_0U << (lowbit - start + 1)));
>        if (mask & in)
>  	/* There are more bits set beyond the first range of one bits.  */
>  	return false;
> @@ -2343,11 +2343,11 @@ bool
>  s390_contiguous_bitmask_p (unsigned HOST_WIDE_INT in, bool wrap_p,
>  			   int size, int *start, int *end)
>  {
> -  int bs = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT;
> +  int bs = HOST_BITS_PER_WIDE_INT;
>    bool b;
>  
>    gcc_assert (!!start == !!end);
> -  if ((in & ((~(0ULL)) >> (bs - size))) == 0)
> +  if ((in & ((~HOST_WIDE_INT_0U) >> (bs - size))) == 0)
>      /* This cannot be expressed as a contiguous bitmask.  Exit early because
>         the second call of s390_contiguous_bitmask_nowrap_p would accept this as
>         a valid bitmask.  */
> @@ -2406,10 +2406,8 @@ s390_contiguous_bitmask_vector_p (rtx op, int *start, int *end)
>      {
>        if (start)
>  	{
> -	  int bs = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT;
> -
> -	  *start -= (bs - size);
> -	  *end -= (bs - size);
> +	  *start -= (HOST_BITS_PER_WIDE_INT - size);
> +	  *end -= (HOST_BITS_PER_WIDE_INT - size);
>  	}
>        return true;
>      }
> @@ -3470,7 +3468,7 @@ s390_rtx_costs (rtx x, machine_mode mode, int outer_code,
>  	  && CONST_INT_P (XEXP (XEXP (x, 0), 1))
>  	  && CONST_INT_P (XEXP (XEXP (x, 1), 1))
>  	  && (UINTVAL (XEXP (XEXP (x, 0), 1)) ==
> -	      (1UL << UINTVAL (XEXP (XEXP (x, 1), 1))) - 1))
> +	      (HOST_WIDE_INT_1U << UINTVAL (XEXP (XEXP (x, 1), 1))) - 1))
>  	{
>  	  *total = COSTS_N_INSNS (2);
>  	  return true;
> @@ -4596,8 +4594,8 @@ legitimize_pic_address (rtx orig, rtx reg)
>  
>        if (TARGET_CPU_ZARCH
>  	  && larl_operand (const_addr, VOIDmode)
> -	  && INTVAL (addend) < (HOST_WIDE_INT)1 << 31
> -	  && INTVAL (addend) >= -((HOST_WIDE_INT)1 << 31))
> +	  && INTVAL (addend) < HOST_WIDE_INT_1 << 31
> +	  && INTVAL (addend) >= -(HOST_WIDE_INT_1 << 31))
>  	{
>  	  if (INTVAL (addend) & 1)
>  	    {
> diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
> index e47c2e9..e076da2 100644
> --- a/gcc/config/s390/s390.md
> +++ b/gcc/config/s390/s390.md
> @@ -8620,7 +8620,7 @@
>    rtx_insn *insn;
>    rtx clz_equal;
>    rtx wide_reg = gen_reg_rtx (TImode);
> -  rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
> +  rtx msb = gen_rtx_CONST_INT (DImode, HOST_WIDE_INT_1U << 63);
>  
>    clz_equal = gen_rtx_CLZ (DImode, operands[1]);
>  
> @@ -8644,8 +8644,7 @@
>  	    (const_int 64))
>            (zero_extend:TI (clz:DI (match_dup 1)))))
>     (clobber (reg:CC CC_REGNUM))]
> -  "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
> -   == (unsigned HOST_WIDE_INT) 1 << 63
> +  "UINTVAL (operands[2]) == HOST_WIDE_INT_1U << 63
>     && TARGET_EXTIMM && TARGET_ZARCH"
>    "flogr\t%0,%1"
>    [(set_attr "op_type"  "RRE")])
> diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md
> index d8c56d5..c0a36fa 100644
> --- a/gcc/config/s390/vector.md
> +++ b/gcc/config/s390/vector.md
> @@ -1109,7 +1109,7 @@
>  		      UNSPEC_VEC_VFENECC))]
>    "TARGET_VX"
>  {
> -  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
> +  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
>  
>    gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS)));
>    flags &= ~VSTRING_FLAG_CS;
> diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md
> index f2f430a..29ff396 100644
> --- a/gcc/config/s390/vx-builtins.md
> +++ b/gcc/config/s390/vx-builtins.md
> @@ -125,7 +125,7 @@
>    int i;
>    unsigned mask = 0x8000;
>    rtx const_vec[16];
> -  unsigned HOST_WIDE_INT byte_mask = INTVAL (operands[1]);
> +  unsigned HOST_WIDE_INT byte_mask = UINTVAL (operands[1]);
>  
>    for (i = 0; i < 16; i++)
>      {
> @@ -357,7 +357,7 @@
>  			UNSPEC_VEC_PERMI))]
>    "TARGET_VX"
>  {
> -  HOST_WIDE_INT val = INTVAL (operands[3]);
> +  HOST_WIDE_INT val = UINTVAL (operands[3]);
>    operands[3] = GEN_INT ((val & 1) | (val & 2) << 1);
>  })
>  
> @@ -1214,7 +1214,7 @@
>  			  UNSPEC_VEC_VFAE))]
>    "TARGET_VX"
>  {
> -  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
> +  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
>  
>    if (flags & VSTRING_FLAG_ZS)
>      {
> @@ -1241,7 +1241,7 @@
>  		      UNSPEC_VEC_VFAECC))]
>    "TARGET_VX"
>  {
> -  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
> +  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
>  
>    if (flags & VSTRING_FLAG_ZS)
>      {
> @@ -1320,7 +1320,7 @@
>  		      UNSPEC_VEC_VFEECC))]
>    "TARGET_VX"
>  {
> -  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
> +  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
>  
>    gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS)));
>    flags &= ~VSTRING_FLAG_CS;
> @@ -1497,7 +1497,7 @@
>  			  UNSPEC_VEC_VSTRC))]
>    "TARGET_VX"
>  {
> -  unsigned HOST_WIDE_INT flags = INTVAL (operands[4]);
> +  unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]);
>  
>    if (flags & VSTRING_FLAG_ZS)
>      {
> @@ -1526,7 +1526,7 @@
>  		      UNSPEC_VEC_VSTRCCC))]
>    "TARGET_VX"
>  {
> -  unsigned HOST_WIDE_INT flags = INTVAL (operands[4]);
> +  unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]);
>  
>    if (flags & VSTRING_FLAG_ZS)
>      {
> -- 
> 2.3.0
> 



Ciao

Dominik ^_^  ^_^
Andreas Krebbel Feb. 6, 2017, 11:40 a.m. UTC | #2
On 01/26/2017 09:45 PM, Dominik Vogt wrote:

	* config/s390/predicates.md ("larl_operand"): Use macros from hwint.h.
	* config/s390/s390.c (s390_const_operand_ok)
	(s390_canonicalize_comparison, s390_extract_part)
	(s390_single_part, s390_contiguous_bitmask_nowrap_p)
	(s390_contiguous_bitmask_p, s390_rtx_costs)
	(legitimize_pic_address): Likewise.
	* config/s390/s390.md ("clzdi2", "clztidi2"): Likewise.
	* config/s390/vx-builtins.md ("vec_genbytemaskv16qi")
	("vec_permi<mode>", "vfae<mode>", "*vfaes<mode>", "vstrc<mode>")
	("*vstrcs<mode>"): Use UINTVAL() to set unsigned HOST_WIDE_INT.
	* config/s390/vector.md ("vec_vfenes<mode>"): Likewise.

Applied. Thanks!

-Andreas-
diff mbox

Patch

diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
index a233aaf..0c82efc 100644
--- a/gcc/config/s390/predicates.md
+++ b/gcc/config/s390/predicates.md
@@ -147,8 +147,8 @@ 
       if (GET_CODE (XEXP (op, 1)) != CONST_INT
           || (INTVAL (XEXP (op, 1)) & 1) != 0)
         return false;
-      if (INTVAL (XEXP (op, 1)) >= (HOST_WIDE_INT)1 << 31
-	  || INTVAL (XEXP (op, 1)) < -((HOST_WIDE_INT)1 << 31))
+      if (INTVAL (XEXP (op, 1)) >= HOST_WIDE_INT_1 << 31
+	  || INTVAL (XEXP (op, 1)) < -(HOST_WIDE_INT_1 << 31))
         return false;
       op = XEXP (op, 0);
     }
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index fe65846..4c7e9a7 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -750,12 +750,12 @@  s390_const_operand_ok (tree arg, int argnum, int op_flags, tree decl)
       int bitwidth = bitwidths[op_flags - O_U1];
 
       if (!tree_fits_uhwi_p (arg)
-	  || tree_to_uhwi (arg) > ((unsigned HOST_WIDE_INT)1 << bitwidth) - 1)
+	  || tree_to_uhwi (arg) > (HOST_WIDE_INT_1U << bitwidth) - 1)
 	{
 	  error("constant argument %d for builtin %qF is out of range (0.."
 		HOST_WIDE_INT_PRINT_UNSIGNED ")",
 		argnum, decl,
-		((unsigned HOST_WIDE_INT)1 << bitwidth) - 1);
+		(HOST_WIDE_INT_1U << bitwidth) - 1);
 	  return false;
 	}
     }
@@ -766,15 +766,15 @@  s390_const_operand_ok (tree arg, int argnum, int op_flags, tree decl)
       int bitwidth = bitwidths[op_flags - O_S2];
 
       if (!tree_fits_shwi_p (arg)
-	  || tree_to_shwi (arg) < -((HOST_WIDE_INT)1 << (bitwidth - 1))
-	  || tree_to_shwi (arg) > (((HOST_WIDE_INT)1 << (bitwidth - 1)) - 1))
+	  || tree_to_shwi (arg) < -(HOST_WIDE_INT_1 << (bitwidth - 1))
+	  || tree_to_shwi (arg) > ((HOST_WIDE_INT_1 << (bitwidth - 1)) - 1))
 	{
 	  error("constant argument %d for builtin %qF is out of range ("
 		HOST_WIDE_INT_PRINT_DEC ".."
 		HOST_WIDE_INT_PRINT_DEC ")",
 		argnum, decl,
-		-((HOST_WIDE_INT)1 << (bitwidth - 1)),
-		((HOST_WIDE_INT)1 << (bitwidth - 1)) - 1);
+		-(HOST_WIDE_INT_1 << (bitwidth - 1)),
+		(HOST_WIDE_INT_1 << (bitwidth - 1)) - 1);
 	  return false;
 	}
     }
@@ -1561,7 +1561,7 @@  s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
 	  && modesize <= HOST_BITS_PER_WIDE_INT)
 	{
 	  unsigned HOST_WIDE_INT block;
-	  block = ((unsigned HOST_WIDE_INT) 1 << len) - 1;
+	  block = (HOST_WIDE_INT_1U << len) - 1;
 	  block <<= modesize - pos - len;
 
 	  *op0 = gen_rtx_AND (GET_MODE (inner), inner,
@@ -1610,7 +1610,7 @@  s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
       && INTVAL (*op1) == 0xffff
       && SCALAR_INT_MODE_P (GET_MODE (*op0))
       && (nonzero_bits (*op0, GET_MODE (*op0))
-	  & ~(unsigned HOST_WIDE_INT) 0xffff) == 0)
+	  & ~HOST_WIDE_INT_UC (0xffff)) == 0)
     {
       *op0 = gen_lowpart (HImode, *op0);
       *op1 = constm1_rtx;
@@ -2212,14 +2212,13 @@  s390_extract_part (rtx op, machine_mode mode, int def)
   unsigned HOST_WIDE_INT value = 0;
   int max_parts = HOST_BITS_PER_WIDE_INT / GET_MODE_BITSIZE (mode);
   int part_bits = GET_MODE_BITSIZE (mode);
-  unsigned HOST_WIDE_INT part_mask
-    = ((unsigned HOST_WIDE_INT)1 << part_bits) - 1;
+  unsigned HOST_WIDE_INT part_mask = (HOST_WIDE_INT_1U << part_bits) - 1;
   int i;
 
   for (i = 0; i < max_parts; i++)
     {
       if (i == 0)
-	value = (unsigned HOST_WIDE_INT) INTVAL (op);
+	value = UINTVAL (op);
       else
 	value >>= part_bits;
 
@@ -2243,7 +2242,7 @@  s390_single_part (rtx op,
   unsigned HOST_WIDE_INT value = 0;
   int n_parts = GET_MODE_SIZE (mode) / GET_MODE_SIZE (part_mode);
   unsigned HOST_WIDE_INT part_mask
-    = ((unsigned HOST_WIDE_INT)1 << GET_MODE_BITSIZE (part_mode)) - 1;
+    = (HOST_WIDE_INT_1U << GET_MODE_BITSIZE (part_mode)) - 1;
   int i, part = -1;
 
   if (GET_CODE (op) != CONST_INT)
@@ -2252,7 +2251,7 @@  s390_single_part (rtx op,
   for (i = 0; i < n_parts; i++)
     {
       if (i == 0)
-	value = (unsigned HOST_WIDE_INT) INTVAL (op);
+	value = UINTVAL (op);
       else
 	value >>= GET_MODE_BITSIZE (part_mode);
 
@@ -2282,9 +2281,9 @@  s390_contiguous_bitmask_nowrap_p (unsigned HOST_WIDE_INT in, int size,
 {
   int start;
   int end = -1;
-  int lowbit = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - 1;
-  int highbit = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT - size;
-  unsigned HOST_WIDE_INT bitmask = 1ULL;
+  int lowbit = HOST_BITS_PER_WIDE_INT - 1;
+  int highbit = HOST_BITS_PER_WIDE_INT - size;
+  unsigned HOST_WIDE_INT bitmask = HOST_WIDE_INT_1U;
 
   gcc_assert (!!pstart == !!pend);
   for (start = lowbit; start >= highbit; bitmask <<= 1, start--)
@@ -2314,7 +2313,8 @@  s390_contiguous_bitmask_nowrap_p (unsigned HOST_WIDE_INT in, int size,
       unsigned HOST_WIDE_INT mask;
 
       /* Calculate a mask for all bits beyond the contiguous bits.  */
-      mask = ((~(0ULL) >> highbit) & (~(0ULL) << (lowbit - start + 1)));
+      mask = ((~HOST_WIDE_INT_0U >> highbit)
+	      & (~HOST_WIDE_INT_0U << (lowbit - start + 1)));
       if (mask & in)
 	/* There are more bits set beyond the first range of one bits.  */
 	return false;
@@ -2343,11 +2343,11 @@  bool
 s390_contiguous_bitmask_p (unsigned HOST_WIDE_INT in, bool wrap_p,
 			   int size, int *start, int *end)
 {
-  int bs = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT;
+  int bs = HOST_BITS_PER_WIDE_INT;
   bool b;
 
   gcc_assert (!!start == !!end);
-  if ((in & ((~(0ULL)) >> (bs - size))) == 0)
+  if ((in & ((~HOST_WIDE_INT_0U) >> (bs - size))) == 0)
     /* This cannot be expressed as a contiguous bitmask.  Exit early because
        the second call of s390_contiguous_bitmask_nowrap_p would accept this as
        a valid bitmask.  */
@@ -2406,10 +2406,8 @@  s390_contiguous_bitmask_vector_p (rtx op, int *start, int *end)
     {
       if (start)
 	{
-	  int bs = sizeof (HOST_WIDE_INT) * BITS_PER_UNIT;
-
-	  *start -= (bs - size);
-	  *end -= (bs - size);
+	  *start -= (HOST_BITS_PER_WIDE_INT - size);
+	  *end -= (HOST_BITS_PER_WIDE_INT - size);
 	}
       return true;
     }
@@ -3470,7 +3468,7 @@  s390_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  && CONST_INT_P (XEXP (XEXP (x, 0), 1))
 	  && CONST_INT_P (XEXP (XEXP (x, 1), 1))
 	  && (UINTVAL (XEXP (XEXP (x, 0), 1)) ==
-	      (1UL << UINTVAL (XEXP (XEXP (x, 1), 1))) - 1))
+	      (HOST_WIDE_INT_1U << UINTVAL (XEXP (XEXP (x, 1), 1))) - 1))
 	{
 	  *total = COSTS_N_INSNS (2);
 	  return true;
@@ -4596,8 +4594,8 @@  legitimize_pic_address (rtx orig, rtx reg)
 
       if (TARGET_CPU_ZARCH
 	  && larl_operand (const_addr, VOIDmode)
-	  && INTVAL (addend) < (HOST_WIDE_INT)1 << 31
-	  && INTVAL (addend) >= -((HOST_WIDE_INT)1 << 31))
+	  && INTVAL (addend) < HOST_WIDE_INT_1 << 31
+	  && INTVAL (addend) >= -(HOST_WIDE_INT_1 << 31))
 	{
 	  if (INTVAL (addend) & 1)
 	    {
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index e47c2e9..e076da2 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -8620,7 +8620,7 @@ 
   rtx_insn *insn;
   rtx clz_equal;
   rtx wide_reg = gen_reg_rtx (TImode);
-  rtx msb = gen_rtx_CONST_INT (DImode, (unsigned HOST_WIDE_INT) 1 << 63);
+  rtx msb = gen_rtx_CONST_INT (DImode, HOST_WIDE_INT_1U << 63);
 
   clz_equal = gen_rtx_CLZ (DImode, operands[1]);
 
@@ -8644,8 +8644,7 @@ 
 	    (const_int 64))
           (zero_extend:TI (clz:DI (match_dup 1)))))
    (clobber (reg:CC CC_REGNUM))]
-  "(unsigned HOST_WIDE_INT) INTVAL (operands[2])
-   == (unsigned HOST_WIDE_INT) 1 << 63
+  "UINTVAL (operands[2]) == HOST_WIDE_INT_1U << 63
    && TARGET_EXTIMM && TARGET_ZARCH"
   "flogr\t%0,%1"
   [(set_attr "op_type"  "RRE")])
diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md
index d8c56d5..c0a36fa 100644
--- a/gcc/config/s390/vector.md
+++ b/gcc/config/s390/vector.md
@@ -1109,7 +1109,7 @@ 
 		      UNSPEC_VEC_VFENECC))]
   "TARGET_VX"
 {
-  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
+  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
 
   gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS)));
   flags &= ~VSTRING_FLAG_CS;
diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md
index f2f430a..29ff396 100644
--- a/gcc/config/s390/vx-builtins.md
+++ b/gcc/config/s390/vx-builtins.md
@@ -125,7 +125,7 @@ 
   int i;
   unsigned mask = 0x8000;
   rtx const_vec[16];
-  unsigned HOST_WIDE_INT byte_mask = INTVAL (operands[1]);
+  unsigned HOST_WIDE_INT byte_mask = UINTVAL (operands[1]);
 
   for (i = 0; i < 16; i++)
     {
@@ -357,7 +357,7 @@ 
 			UNSPEC_VEC_PERMI))]
   "TARGET_VX"
 {
-  HOST_WIDE_INT val = INTVAL (operands[3]);
+  HOST_WIDE_INT val = UINTVAL (operands[3]);
   operands[3] = GEN_INT ((val & 1) | (val & 2) << 1);
 })
 
@@ -1214,7 +1214,7 @@ 
 			  UNSPEC_VEC_VFAE))]
   "TARGET_VX"
 {
-  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
+  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
 
   if (flags & VSTRING_FLAG_ZS)
     {
@@ -1241,7 +1241,7 @@ 
 		      UNSPEC_VEC_VFAECC))]
   "TARGET_VX"
 {
-  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
+  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
 
   if (flags & VSTRING_FLAG_ZS)
     {
@@ -1320,7 +1320,7 @@ 
 		      UNSPEC_VEC_VFEECC))]
   "TARGET_VX"
 {
-  unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
+  unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]);
 
   gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS)));
   flags &= ~VSTRING_FLAG_CS;
@@ -1497,7 +1497,7 @@ 
 			  UNSPEC_VEC_VSTRC))]
   "TARGET_VX"
 {
-  unsigned HOST_WIDE_INT flags = INTVAL (operands[4]);
+  unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]);
 
   if (flags & VSTRING_FLAG_ZS)
     {
@@ -1526,7 +1526,7 @@ 
 		      UNSPEC_VEC_VSTRCCC))]
   "TARGET_VX"
 {
-  unsigned HOST_WIDE_INT flags = INTVAL (operands[4]);
+  unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]);
 
   if (flags & VSTRING_FLAG_ZS)
     {