From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88471 invoked by alias); 9 Dec 2016 13:12:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 88460 invoked by uid 89); 9 Dec 2016 13:12:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=mod, msb X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 13:12:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4931D707; Fri, 9 Dec 2016 05:12:03 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E90D83F477 for ; Fri, 9 Dec 2016 05:12:02 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [29/67] Make some *_loc_descriptor helpers take scalar_int_mode References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:12:00 -0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <87zik5jlge.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-12/txt/msg00801.txt.bz2 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. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * 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 checks before calling the functions above. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0b8b12d..ed5ec24 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -14040,7 +14040,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; @@ -14096,7 +14096,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; @@ -14107,8 +14107,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, @@ -14208,15 +14207,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, @@ -14269,17 +14267,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, @@ -14354,16 +14351,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); @@ -14969,12 +14963,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 (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; } @@ -15326,21 +15321,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 (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 (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 (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 (mode, &int_mode)) + mem_loc_result = rotate_loc_descriptor (rtl, int_mode, mem_mode); break; case COMPARE: