From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69078 invoked by alias); 9 Dec 2016 13:08:41 -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 69001 invoked by uid 89); 9 Dec 2016 13:08:40 -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=Hx-languages-length:2558, gimplefoldc, gimple-fold.c, gimple_vuse 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:08:34 +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 AEA1E707; Fri, 9 Dec 2016 05:08:33 -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 119F63F477 for ; Fri, 9 Dec 2016 05:08:32 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [24/67] Replace a != BLKmode check with is_a References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:08: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: <87lgvpl06o.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/msg00796.txt.bz2 This patch replaces a check against BLKmode with a check of is_a , in a case where scalar integer modes were the only useful alternatives left. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * gimple-fold.c (gimple_fold_builtin_memory_op): Use is_a instead of != BLKmode. diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index d00625b..c6b5411 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -713,31 +713,29 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, unsigned ilen = tree_to_uhwi (len); if (pow2p_hwi (ilen)) { + scalar_int_mode mode; tree type = lang_hooks.types.type_for_size (ilen * 8, 1); if (type - && TYPE_MODE (type) != BLKmode - && (GET_MODE_SIZE (TYPE_MODE (type)) * BITS_PER_UNIT - == ilen * 8) + && is_a (TYPE_MODE (type), &mode) + && GET_MODE_SIZE (mode) * BITS_PER_UNIT == ilen * 8 /* If the destination pointer is not aligned we must be able to emit an unaligned store. */ - && (dest_align >= GET_MODE_ALIGNMENT (TYPE_MODE (type)) - || !SLOW_UNALIGNED_ACCESS (TYPE_MODE (type), dest_align) - || (optab_handler (movmisalign_optab, TYPE_MODE (type)) + && (dest_align >= GET_MODE_ALIGNMENT (mode) + || !SLOW_UNALIGNED_ACCESS (mode, dest_align) + || (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing))) { tree srctype = type; tree desttype = type; - if (src_align < GET_MODE_ALIGNMENT (TYPE_MODE (type))) + if (src_align < GET_MODE_ALIGNMENT (mode)) srctype = build_aligned_type (type, src_align); tree srcmem = fold_build2 (MEM_REF, srctype, src, off0); tree tem = fold_const_aggregate_ref (srcmem); if (tem) srcmem = tem; - else if (src_align < GET_MODE_ALIGNMENT (TYPE_MODE (type)) - && SLOW_UNALIGNED_ACCESS (TYPE_MODE (type), - src_align) - && (optab_handler (movmisalign_optab, - TYPE_MODE (type)) + else if (src_align < GET_MODE_ALIGNMENT (mode) + && SLOW_UNALIGNED_ACCESS (mode, src_align) + && (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing)) srcmem = NULL_TREE; if (srcmem) @@ -753,7 +751,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, gimple_set_vuse (new_stmt, gimple_vuse (stmt)); gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); } - if (dest_align < GET_MODE_ALIGNMENT (TYPE_MODE (type))) + if (dest_align < GET_MODE_ALIGNMENT (mode)) desttype = build_aligned_type (type, dest_align); new_stmt = gimple_build_assign (fold_build2 (MEM_REF, desttype,