aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:12:28 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:12:28 +0000
commit99767219d617a30394777086fa9ca776390d7098 (patch)
treeaf997f78100816cb663c1ab347f80ef1edf80c3c
parent546513775069e93d5f33f7aae5f1cb26c77ca2c9 (diff)
downloadgcc-99767219d617a30394777086fa9ca776390d7098.zip
gcc-99767219d617a30394777086fa9ca776390d7098.tar.gz
gcc-99767219d617a30394777086fa9ca776390d7098.tar.bz2
[29/77] Make some *_loc_descriptor helpers take scalar_int_mode
The *_loc_descriptor routines for clz, popcount, bswap and rotate all required SCALAR_INT_MODE_P. This patch moves the checks into the caller (mem_loc_descriptor) so that the types of the mode parameters can be scalar_int_mode instead of machine_mode. The MOD handling in mem_loc_descriptor is also specific to scalar integer modes. Adding an explicit check allows typed_binop to take a scalar_int_mode too. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * dwarf2out.c (typed_binop): Change mode parameter to scalar_int_mode. (clz_loc_descriptor): Likewise. Remove SCALAR_INT_MODE_P check. (popcount_loc_descriptor): Likewise. (bswap_loc_descriptor): Likewise. (rotate_loc_descriptor): Likewise. (mem_loc_descriptor): Add is_a <scalar_int_mode> checks before calling the functions above. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251481
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/dwarf2out.c43
2 files changed, 33 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ba1cd30..9337cda 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,18 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * dwarf2out.c (typed_binop): Change mode parameter to scalar_int_mode.
+ (clz_loc_descriptor): Likewise. Remove SCALAR_INT_MODE_P check.
+ (popcount_loc_descriptor): Likewise.
+ (bswap_loc_descriptor): Likewise.
+ (rotate_loc_descriptor): Likewise.
+ (mem_loc_descriptor): Add is_a <scalar_int_mode> checks before
+ calling the functions above.
+
+2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* combine.c (sign_extend_short_imm): Add is_a <scalar_int_mode>
checks.
(try_combine): Likewise.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0637bdd..4c840b4 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -14235,7 +14235,7 @@ minmax_loc_descriptor (rtx rtl, machine_mode mode,
static dw_loc_descr_ref
typed_binop (enum dwarf_location_atom op, rtx rtl, dw_die_ref type_die,
- machine_mode mode, machine_mode mem_mode)
+ scalar_int_mode mode, machine_mode mem_mode)
{
dw_loc_descr_ref cvt, op0, op1;
@@ -14291,7 +14291,7 @@ typed_binop (enum dwarf_location_atom op, rtx rtl, dw_die_ref type_die,
L4: DW_OP_nop */
static dw_loc_descr_ref
-clz_loc_descriptor (rtx rtl, machine_mode mode,
+clz_loc_descriptor (rtx rtl, scalar_int_mode mode,
machine_mode mem_mode)
{
dw_loc_descr_ref op0, ret, tmp;
@@ -14302,8 +14302,7 @@ clz_loc_descriptor (rtx rtl, machine_mode mode,
dw_loc_descr_ref l4jump, l4label;
rtx msb;
- if (!SCALAR_INT_MODE_P (mode)
- || GET_MODE (XEXP (rtl, 0)) != mode)
+ if (GET_MODE (XEXP (rtl, 0)) != mode)
return NULL;
op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode,
@@ -14403,15 +14402,14 @@ clz_loc_descriptor (rtx rtl, machine_mode mode,
L2: DW_OP_drop */
static dw_loc_descr_ref
-popcount_loc_descriptor (rtx rtl, machine_mode mode,
+popcount_loc_descriptor (rtx rtl, scalar_int_mode mode,
machine_mode mem_mode)
{
dw_loc_descr_ref op0, ret, tmp;
dw_loc_descr_ref l1jump, l1label;
dw_loc_descr_ref l2jump, l2label;
- if (!SCALAR_INT_MODE_P (mode)
- || GET_MODE (XEXP (rtl, 0)) != mode)
+ if (GET_MODE (XEXP (rtl, 0)) != mode)
return NULL;
op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode,
@@ -14464,17 +14462,16 @@ popcount_loc_descriptor (rtx rtl, machine_mode mode,
L2: DW_OP_drop DW_OP_swap DW_OP_drop */
static dw_loc_descr_ref
-bswap_loc_descriptor (rtx rtl, machine_mode mode,
+bswap_loc_descriptor (rtx rtl, scalar_int_mode mode,
machine_mode mem_mode)
{
dw_loc_descr_ref op0, ret, tmp;
dw_loc_descr_ref l1jump, l1label;
dw_loc_descr_ref l2jump, l2label;
- if (!SCALAR_INT_MODE_P (mode)
- || BITS_PER_UNIT != 8
+ if (BITS_PER_UNIT != 8
|| (GET_MODE_BITSIZE (mode) != 32
- && GET_MODE_BITSIZE (mode) != 64))
+ && GET_MODE_BITSIZE (mode) != 64))
return NULL;
op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode,
@@ -14549,16 +14546,13 @@ bswap_loc_descriptor (rtx rtl, machine_mode mode,
[ DW_OP_swap constMASK DW_OP_and DW_OP_swap ] DW_OP_shr DW_OP_or */
static dw_loc_descr_ref
-rotate_loc_descriptor (rtx rtl, machine_mode mode,
+rotate_loc_descriptor (rtx rtl, scalar_int_mode mode,
machine_mode mem_mode)
{
rtx rtlop1 = XEXP (rtl, 1);
dw_loc_descr_ref op0, op1, ret, mask[2] = { NULL, NULL };
int i;
- if (!SCALAR_INT_MODE_P (mode))
- return NULL;
-
if (GET_MODE (rtlop1) != VOIDmode
&& GET_MODE_BITSIZE (GET_MODE (rtlop1)) < GET_MODE_BITSIZE (mode))
rtlop1 = gen_rtx_ZERO_EXTEND (mode, rtlop1);
@@ -15167,12 +15161,13 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
break;
case MOD:
- if (GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE
- && (!dwarf_strict || dwarf_version >= 5))
+ if ((!dwarf_strict || dwarf_version >= 5)
+ && is_a <scalar_int_mode> (mode, &int_mode)
+ && GET_MODE_SIZE (int_mode) > DWARF2_ADDR_SIZE)
{
mem_loc_result = typed_binop (DW_OP_mod, rtl,
base_type_for_mode (mode, 0),
- mode, mem_mode);
+ int_mode, mem_mode);
break;
}
@@ -15524,21 +15519,25 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
case CLZ:
case CTZ:
case FFS:
- mem_loc_result = clz_loc_descriptor (rtl, mode, mem_mode);
+ if (is_a <scalar_int_mode> (mode, &int_mode))
+ mem_loc_result = clz_loc_descriptor (rtl, int_mode, mem_mode);
break;
case POPCOUNT:
case PARITY:
- mem_loc_result = popcount_loc_descriptor (rtl, mode, mem_mode);
+ if (is_a <scalar_int_mode> (mode, &int_mode))
+ mem_loc_result = popcount_loc_descriptor (rtl, int_mode, mem_mode);
break;
case BSWAP:
- mem_loc_result = bswap_loc_descriptor (rtl, mode, mem_mode);
+ if (is_a <scalar_int_mode> (mode, &int_mode))
+ mem_loc_result = bswap_loc_descriptor (rtl, int_mode, mem_mode);
break;
case ROTATE:
case ROTATERT:
- mem_loc_result = rotate_loc_descriptor (rtl, mode, mem_mode);
+ if (is_a <scalar_int_mode> (mode, &int_mode))
+ mem_loc_result = rotate_loc_descriptor (rtl, int_mode, mem_mode);
break;
case COMPARE: