From patchwork Sun Oct 22 20:13:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 829072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464692-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="WPAiopUr"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yKrMF3tS3z9sRV for ; Mon, 23 Oct 2017 07:13:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=AXUxLKR3QjecVmVt1Y1qmsOWJtT+xSqdE8m09K0OHrk8YEwY20kl6 0uIb8CNOjykjUu8mF7/5oPb7xjBPel5aSmEFqdENchNmzne0C68nF8Kruvu2X2hW 89sMK0bMCfpzVU94+D5HWqcfFPkVXjG1+/7vLSdAwKSvU+Cn00IZvo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=bDnqfwCltdPUd8Uyycq7UoB4Rpw=; b=WPAiopUrc+bJYcbZKxbm cYTJiNO9k7vC7exNm2A4hwCx/fSo8KaMiI6Tm6tkpe5rwSmGGMelQaR5WB8h26Pp DiPksAtUEclYNRbpbYJ/YI7pnjiaO0TLSN69O9ibB7tS5YCVCYE8CorH0voBYlyB YoKx9btbLhwUW4RGchGqGtI= Received: (qmail 129300 invoked by alias); 22 Oct 2017 20:13:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 128363 invoked by uid 89); 22 Oct 2017 20:13:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 22 Oct 2017 20:13:17 +0000 Received: by mail-wm0-f49.google.com with SMTP id b9so507180wmh.0 for ; Sun, 22 Oct 2017 13:13:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=DbHxQIRGY53s/r69q8JprhtIv4ysdULcLmLBGZ4ImQA=; b=calWXjn+PwNTI0A9UG7UZ82m0Tho2gLgz+dgvCjGBNguiCkLcpZwwYJ7ftQ05UNsag 2lVMmXCOuTpw560gFX82/tTtxUHhxEXaFN8jvHhbZy6DbaoRRidpnlFCJeDWr6IlRQ/3 zDdeYJGQKf+XEYNvsI+7Y2RAnU3avH1iHRc/YB8sqlgzna9aUhUebTwaW6HPldwthnFl MhlsuLaTspieHs+bJis2shoXb2nAWx0oTZpTL/R7CN10FASwGvE/kr7zHg6+S8ELXXsZ C0kYBPpGwPxWS5WTtkkz2JP/zi+uxRQURD8zGcvXGrTHCUck7ZiHbXL3vFe9mjX4K38k IVHg== X-Gm-Message-State: AMCzsaVpKCsaEGlp6/nMAtpmDVAEMqhhuRgv2Ne3WXkS7mUkzF3opbAz K1u/+rHeFD0xxI8bsXx/fqyI78au7lQ= X-Google-Smtp-Source: ABhQp+SwIz3NfaQs0GQ9LbCPXRGbiOw7Rw0bQ5mbVJsmzidZWEtWkBGcHutA6Pm/8eKwqqXV0x7xHw== X-Received: by 10.28.69.8 with SMTP id s8mr3219261wma.65.1508703194759; Sun, 22 Oct 2017 13:13:14 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id h185sm8468997wma.19.2017.10.22.13.13.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Oct 2017 13:13:13 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Fix HWI + -unsigned in combine.c Date: Sun, 22 Oct 2017 21:13:11 +0100 Message-ID: <87tvyrym94.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 rtx_equal_for_field_assignment_p had: x = adjust_address_nv (x, GET_MODE (y), -subreg_lowpart_offset (GET_MODE (x), GET_MODE (y))); But subreg_lowpart_offset returns an unsigned int and adjust_address_nv takes a HWI, so a subreg offset of 4 would give a memory offset of 0x00000000fffffffffc. The SVE series makes this go away by using HWI-based types for both interfaces, but in this case the fix is also a minor clean-up. Tested on aarch64-linux-gnu, powerpc64le-linux-gnu and x86_64-linux-gnu. OK to install? Richard 2017-10-22 Richard Sandiford gcc/ * combine.c (rtx_equal_for_field_assignment_p): Use byte_lowpart_offset. Index: gcc/combine.c =================================================================== --- gcc/combine.c 2017-10-22 21:04:50.138830154 +0100 +++ gcc/combine.c 2017-10-22 21:04:59.000825360 +0100 @@ -9526,13 +9526,9 @@ rtx_equal_for_field_assignment_p (rtx x, return 0; if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN) return 0; - /* For big endian, adjust the memory offset. */ - if (BYTES_BIG_ENDIAN) - x = adjust_address_nv (x, GET_MODE (y), - -subreg_lowpart_offset (GET_MODE (x), - GET_MODE (y))); - else - x = adjust_address_nv (x, GET_MODE (y), 0); + x = adjust_address_nv (x, GET_MODE (y), + byte_lowpart_offset (GET_MODE (y), + GET_MODE (x))); } if (x == y || rtx_equal_p (x, y))