From patchwork Fri Mar 22 08:56:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1060992 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-498294-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 44Qcw12kD6z9sRf for ; Fri, 22 Mar 2019 19:56: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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=BvBhwaesMN8bChpEvogH05lGVTV4K vHNgRNYL4QBF8NfC16PNcAeIYX8UIpJJOMKvQTCLiEobALIoDWRmjcFb4t3rubF9 dIJhaanz4W+iPhQ+TvaeVIWlCaiOhoDdDF3wqYqnGEfQRZz2vb5HAoNId82M5Vmf GXGlkCRbdTGZtM= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=INZTSD+zs7GbSJxXSrGNTOygnow=; b=Kyi 5+KROplrBWfs+LGWPGGE9SfVA/MLzJg9K5lf6DiNSGvmnovYQ/JeNhdndHHZ4WGn tTRtcqO6CrUbFDtpKK0isFwMonhIJFTomWP3Oi5KSdkn/9yAkYMdDTebbjsVm27h rvRaVhu4l6ecCgafOA+z3P7X2s6Fcqgu3ChQpG4Q= Received: (qmail 87560 invoked by alias); 22 Mar 2019 08:56:20 -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 87551 invoked by uid 89); 22 Mar 2019 08:56:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=vmv 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; Fri, 22 Mar 2019 08:56:17 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 238353078AAC; Fri, 22 Mar 2019 08:56:16 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-107.ams2.redhat.com [10.36.116.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F81160BEC; Fri, 22 Mar 2019 08:56:15 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x2M8uDKF000456; Fri, 22 Mar 2019 09:56:13 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x2M8uBKK000455; Fri, 22 Mar 2019 09:56:11 +0100 Date: Fri, 22 Mar 2019 09:56:11 +0100 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org, Hongtao Liu , "H.J. Lu" Subject: [PATCH] Fix up various fma operand predicates Message-ID: <20190322085611.GH7611@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi! While working on the PR89784 patch, I've noticed various inconsistencies in the fma patterns between constraints and predicates. Most of them time it was correct though. This is what I found: 1) if the constraint is like or ,v or v,, then it will be just v or v,v with rounding, while without rounding vm or vm,v or v,vm, so IMHO we don't want unconditional nonimmediate_operand predicate, but which is vector_operand when not rounding and register_operand otherwise. 2) if the constraint is 0 or 0,0 (and the output is always =v or =v,v in those cases), then using makes no sense, even without rounding we will not really allow memory in there, so this patch uses register_operand in those cases. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-03-22 Jakub Jelinek * config/i386/sse.md (_fmadd__mask, _fmadd__mask3, _fmsub__mask, _fmsub__mask3, _fnmadd__mask, _fnmadd__mask3, _fnmsub__mask, _fnmsub__mask3, _fmaddsub__mask, _fmaddsub__mask3, _fmsubadd__mask, _fmsubadd__mask3): Use instead of nonimmediate_operand. (fmai_vmfmadd_, fmai_vmfmsub_, fmai_vmfnmadd_, fmai_vmfnmsub_): Use register_operand instead of for the operand that needs to match output. (*fmai_fmadd_, *fmai_fmsub_, *fmai_fnmadd_, *fmai_fnmsub_): Likewise. Formatting fixes. Jakub --- gcc/config/i386/sse.md.jj 2019-03-14 09:55:49.291867091 +0100 +++ gcc/config/i386/sse.md 2019-03-21 19:15:21.292495008 +0100 @@ -3958,8 +3958,8 @@ (define_insn "_fmadd__mask (vec_merge:VF_AVX512VL (fma:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "0,0") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") - (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,")) + (match_operand:VF_AVX512VL 2 "" ",v") + (match_operand:VF_AVX512VL 3 "" "v,")) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] "TARGET_AVX512F && " @@ -3974,7 +3974,7 @@ (define_insn "_fmadd__mask (vec_merge:VF_AVX512VL (fma:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "v") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 2 "" "") (match_operand:VF_AVX512VL 3 "register_operand" "0")) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] @@ -4078,9 +4078,9 @@ (define_insn "_fmsub__mask (vec_merge:VF_AVX512VL (fma:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "0,0") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (match_operand:VF_AVX512VL 2 "" ",v") (neg:VF_AVX512VL - (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,"))) + (match_operand:VF_AVX512VL 3 "" "v,"))) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] "TARGET_AVX512F" @@ -4095,7 +4095,7 @@ (define_insn "_fmsub__mask (vec_merge:VF_AVX512VL (fma:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "v") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 2 "" "") (neg:VF_AVX512VL (match_operand:VF_AVX512VL 3 "register_operand" "0"))) (match_dup 3) @@ -4201,8 +4201,8 @@ (define_insn "_fnmadd__mas (fma:VF_AVX512VL (neg:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "0,0")) - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") - (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,")) + (match_operand:VF_AVX512VL 2 "" ",v") + (match_operand:VF_AVX512VL 3 "" "v,")) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] "TARGET_AVX512F && " @@ -4218,7 +4218,7 @@ (define_insn "_fnmadd__mas (fma:VF_AVX512VL (neg:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "v")) - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 2 "" "") (match_operand:VF_AVX512VL 3 "register_operand" "0")) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] @@ -4328,9 +4328,9 @@ (define_insn "_fnmsub__mas (fma:VF_AVX512VL (neg:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "0,0")) - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (match_operand:VF_AVX512VL 2 "" ",v") (neg:VF_AVX512VL - (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,"))) + (match_operand:VF_AVX512VL 3 "" "v,"))) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] "TARGET_AVX512F && " @@ -4346,7 +4346,7 @@ (define_insn "_fnmsub__mas (fma:VF_AVX512VL (neg:VF_AVX512VL (match_operand:VF_AVX512VL 1 "register_operand" "v")) - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 2 "" "") (neg:VF_AVX512VL (match_operand:VF_AVX512VL 3 "register_operand" "0"))) (match_dup 3) @@ -4428,8 +4428,8 @@ (define_insn "_fmaddsub__m (vec_merge:VF_AVX512VL (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "register_operand" "0,0") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") - (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,")] + (match_operand:VF_AVX512VL 2 "" ",v") + (match_operand:VF_AVX512VL 3 "" "v,")] UNSPEC_FMADDSUB) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] @@ -4445,7 +4445,7 @@ (define_insn "_fmaddsub__m (vec_merge:VF_AVX512VL (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "register_operand" "v") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 2 "" "") (match_operand:VF_AVX512VL 3 "register_operand" "0")] UNSPEC_FMADDSUB) (match_dup 3) @@ -4495,9 +4495,9 @@ (define_insn "_fmsubadd__m (vec_merge:VF_AVX512VL (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "register_operand" "0,0") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (match_operand:VF_AVX512VL 2 "" ",v") (neg:VF_AVX512VL - (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,"))] + (match_operand:VF_AVX512VL 3 "" "v,"))] UNSPEC_FMADDSUB) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] @@ -4513,7 +4513,7 @@ (define_insn "_fmsubadd__m (vec_merge:VF_AVX512VL (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "register_operand" "v") - (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 2 "" "") (neg:VF_AVX512VL (match_operand:VF_AVX512VL 3 "register_operand" "0"))] UNSPEC_FMADDSUB) @@ -4531,7 +4531,7 @@ (define_expand "fmai_vmfmadd_") + (match_operand:VF_128 1 "register_operand") (match_operand:VF_128 2 "") (match_operand:VF_128 3 "")) (match_dup 1) @@ -4542,7 +4542,7 @@ (define_expand "fmai_vmfmsub_") + (match_operand:VF_128 1 "register_operand") (match_operand:VF_128 2 "") (neg:VF_128 (match_operand:VF_128 3 ""))) @@ -4556,7 +4556,7 @@ (define_expand "fmai_vmfnmadd_")) - (match_operand:VF_128 1 "") + (match_operand:VF_128 1 "register_operand") (match_operand:VF_128 3 "")) (match_dup 1) (const_int 1)))] @@ -4568,7 +4568,7 @@ (define_expand "fmai_vmfnmsub_")) - (match_operand:VF_128 1 "") + (match_operand:VF_128 1 "register_operand") (neg:VF_128 (match_operand:VF_128 3 ""))) (match_dup 1) @@ -4579,9 +4579,9 @@ (define_insn "*fmai_fmadd_" [(set (match_operand:VF_128 0 "register_operand" "=v,v") (vec_merge:VF_128 (fma:VF_128 - (match_operand:VF_128 1 "" " 0, 0") + (match_operand:VF_128 1 "register_operand" "0,0") (match_operand:VF_128 2 "" ", v") - (match_operand:VF_128 3 "" " v,")) + (match_operand:VF_128 3 "" "v,")) (match_dup 1) (const_int 1)))] "TARGET_FMA || TARGET_AVX512F" @@ -4595,10 +4595,10 @@ (define_insn "*fmai_fmsub_" [(set (match_operand:VF_128 0 "register_operand" "=v,v") (vec_merge:VF_128 (fma:VF_128 - (match_operand:VF_128 1 "" "0,0") + (match_operand:VF_128 1 "register_operand" "0,0") (match_operand:VF_128 2 "" ",v") (neg:VF_128 - (match_operand:VF_128 3 "" " v,"))) + (match_operand:VF_128 3 "" "v,"))) (match_dup 1) (const_int 1)))] "TARGET_FMA || TARGET_AVX512F" @@ -4614,7 +4614,7 @@ (define_insn "*fmai_fnmadd_" ",v")) - (match_operand:VF_128 1 "" "0,0") + (match_operand:VF_128 1 "register_operand" "0,0") (match_operand:VF_128 3 "" "v,")) (match_dup 1) (const_int 1)))] @@ -4630,10 +4630,10 @@ (define_insn "*fmai_fnmsub_" ", v")) - (match_operand:VF_128 1 "" " 0, 0") + (match_operand:VF_128 2 "" ",v")) + (match_operand:VF_128 1 "register_operand" "0,0") (neg:VF_128 - (match_operand:VF_128 3 "" " v,"))) + (match_operand:VF_128 3 "" "v,"))) (match_dup 1) (const_int 1)))] "TARGET_FMA || TARGET_AVX512F"