From patchwork Wed Apr 29 21:07:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 466299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 747C314008D for ; Thu, 30 Apr 2015 07:08:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=MRGs0MHZ; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:content-type; q=dns; s=default; b=IFZQfNnd2Yew+2PbrUB0h 21mS3H+TfZT/+OPqJiksCUYyhVCsp9aAhtyxEvHGslPz/Pv0ZJRqdeeayMq32+2s iUfF+EUo3UoYDVOC8pp7zygs9rZmBpF7sPNQ7lTQCemupcU0z/vZGxKUXUCW1B3w VOJ2SFZgwKw3RFlVIaHkyo= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:content-type; s=default; bh=eoGx9G+7LCGgd5m4bRK8ZagPosE =; b=MRGs0MHZMJmP/0tX8U/po3SDkLmYLa7NcUaH40fzxrV+9A1lxQNhReUuUnN hbk48JWnT1Ar/uvzROm1QozdsOXaxctB6/IGdv/rNNBWoPx1MYYwI9wr3+RHQnnq 1BWf7DUPU3ikJJZb+z9ml8tu6l+N/ePEHL739P3MM+DrqXAU= Received: (qmail 117840 invoked by alias); 29 Apr 2015 21:07:53 -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 117831 invoked by uid 89); 29 Apr 2015 21:07:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 29 Apr 2015 21:07:52 +0000 Received: by oica37 with SMTP id a37so32619331oic.0 for ; Wed, 29 Apr 2015 14:07:50 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.211.129 with SMTP id k123mr778048oig.43.1430341669928; Wed, 29 Apr 2015 14:07:49 -0700 (PDT) Received: by 10.60.147.170 with HTTP; Wed, 29 Apr 2015 14:07:49 -0700 (PDT) In-Reply-To: References: Date: Wed, 29 Apr 2015 23:07:49 +0200 Message-ID: Subject: Re: [PATCH, i386]: Fix PR 65871, bzhi builtin/intrinsic wrongly assumes bzhi instruction doesn't set the ZF flag From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" On Wed, Apr 29, 2015 at 9:02 PM, Uros Bizjak wrote: > Hello! > > Attached patch implements a CCZ-only setting pattern for a couple of > BMI[,2] intrinsics. These two insns are three operand instructions, and some peephole2 patterns were not prepared for this. Please note that clobbered register can be different than input registers. Attached patch fixes this omission. 2015-04-29 Uros Bizjak PR target/65871 * config/i386/i386.md (*bmi_bextr__cczonly): New pattern. (*bmi2_bzhi_3_1_cczonly): Ditto. (setcc+movzbl peephole2): Check also clobbered reg. (setcc+andl peephole2): Ditto. Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN. Uros. Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 222590) +++ config/i386/i386.md (working copy) @@ -11567,7 +11567,9 @@ (zero_extend (match_dup 1)))] "(peep2_reg_dead_p (3, operands[1]) || operands_match_p (operands[1], operands[3])) - && ! reg_overlap_mentioned_p (operands[3], operands[0])" + && ! reg_overlap_mentioned_p (operands[3], operands[0]) + && ! (GET_CODE (operands[4]) == CLOBBER + && reg_mentioned_p (operands[3], operands[4]))" [(parallel [(set (match_dup 5) (match_dup 0)) (match_dup 4)]) (set (strict_low_part (match_dup 6)) @@ -11610,7 +11612,9 @@ (clobber (reg:CC FLAGS_REG))])] "(peep2_reg_dead_p (3, operands[1]) || operands_match_p (operands[1], operands[3])) - && ! reg_overlap_mentioned_p (operands[3], operands[0])" + && ! reg_overlap_mentioned_p (operands[3], operands[0]) + && ! (GET_CODE (operands[4]) == CLOBBER + && reg_mentioned_p (operands[3], operands[4]))" [(parallel [(set (match_dup 5) (match_dup 0)) (match_dup 4)]) (set (strict_low_part (match_dup 6))