From patchwork Mon Dec 3 15:21:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1006981 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-491508-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bQsbhXEV"; 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 437pcc0kLrz9s3C for ; Tue, 4 Dec 2018 02:21:34 +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:message-id:date:mime-version:content-type; q=dns; s= default; b=awTKxHl962noHl+w1phMeR1xJDWkFgtF3dj9ShchAvbT+xw4eJ5cM vzV4sAfYHjWDqI6RLTfoXwzctdDq4G/W+hiocFgfwitg8rXdsWoxaIuX76Q7hNnT bQ/ODP5sjx8sQUQWR2tolLM51punHZxAto9A81SxzmmF8dnVM/d/3A= 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:message-id:date:mime-version:content-type; s= default; bh=OA+tR54C8dFILXyb2+wguWbVIL0=; b=bQsbhXEVnh0w0JLTVjNO kYgZmjtHprO8RMhMVFnsiLSggfh0xHxBVXIGe0s8HSlQXhkK/jBbeTeu8mz/Hyhx 1pamwfb8EoxYFadOcVSSFhqbm0DOeWTvtj/5KBqHLF64qsYGhRrxxSiQWUujYugD Cn0YHab2S2DYTQYnLBtGEBw= Received: (qmail 37836 invoked by alias); 3 Dec 2018 15:21:27 -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 37818 invoked by uid 89); 3 Dec 2018 15:21:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=concern X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Dec 2018 15:21:25 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DFB72D2BD3 for ; Mon, 3 Dec 2018 15:21:24 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-27.rdu2.redhat.com [10.10.112.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id B72991868F for ; Mon, 3 Dec 2018 15:21:23 +0000 (UTC) From: Jeff Law Openpgp: preference=signencrypt To: gcc-patches Subject: [committed] Fix ICE due to bogus operand predicate in H8 port peepholes Message-ID: <2fa4692d-ce8b-c3d4-c0a2-3ca60a90dc57@redhat.com> Date: Mon, 3 Dec 2018 08:21:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 X-IsSubscribed: yes This is a bit more interesting than the last H8 fix. The H8 has peepholes to optimize masking a value down to a byte. They rely on using gen_lowpart to extract the low byte value of the source operand which works well on the H8 because accessing the low byte of a reg is particularly cheap. THey also work on memory operands. These peepholes don't really work on symbolic operands. And if one makes it into the peephole we'll abort in gen_lowpart. Anyway, the peepholes currently accept "general_operand", which of course allows those problematical symbolic operands. Changing the operand to "nonimmediate_operand" resolves the issue. Note that compile-time constants aren't really a concern here as the expression would have already been simplified. This fixes a half-dozen failures in the H8 testsuite. More importantly it makes it less likely that a test will suddenly fail because of improvements to constant propagation or forward propagation. Installing on the trunk. Jeff diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bde3cd4f042..be0aab2c876 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-12-03 Jeff Law + + * config/h8300/h8300.md (low byte masking peepholes): Only accept + nonimmediate_operand for the to-be-masked operand. + 2018-12-03 Richard Biener * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index b3ba7e0f719..9e8f7159846 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -4647,7 +4647,7 @@ (define_peephole2 [(set (match_operand:SI 0 "register_operand" "") - (match_operand:SI 1 "general_operand" "")) + (match_operand:SI 1 "nonimmediate_operand" "")) (set (match_dup 0) (and:SI (match_dup 0) (const_int 255)))] @@ -4666,7 +4666,7 @@ (define_peephole2 [(set (match_operand 0 "register_operand" "") - (match_operand 1 "general_operand" "")) + (match_operand 1 "nonimmediate_operand" "")) (set (match_operand:SI 2 "register_operand" "") (and:SI (match_dup 2) (match_operand:SI 3 "const_int_qi_operand" "")))]