From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 367E4389443C for ; Mon, 7 Jun 2021 18:00:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 367E4389443C Received: by mail-ej1-x629.google.com with SMTP id ho18so17161227ejc.8 for ; Mon, 07 Jun 2021 11:00:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GJzYHnm8J71MVTOr/Iaw1hb9GeAhTDFOivvZWuXhbJ0=; b=QPZB5/Uc+qyvJJHlZZWHBF3Au5VyIrhvKTjjcLhUj8UPDifdglb5Ckdf+Dw+t91W4q 7E79Y6ARZb5wxFtcdWD8qJ5sN137/YhcMDJZ7YlFYy5i+UOA8cBuwygSIBis8m0nUb/G BVhyadKscY0hBggEjUJB5lhVAjUI24JmsBwjt+r7Rv2bSylNHBVIyM7rHh6ABm8hiZCf IcdtQ/i+13q1PklEY5K5afXsrylt82y80tFtmX/aodZx712XuZbl2lmaS7Dkj4vGRSU+ 4bhPGo9CVwP2FDpN+Y30zIygwO4PFVLu+pyL2CvoYjvsp22DXafgT+ifwAn2KCuXjses A1nQ== X-Gm-Message-State: AOAM530+yQFCMM2WuVTHMljFDh2maPyiL+SYH1jAqT8NglirVpf/iTRq gFozkYa2QlroZ5OGl7mrG78et0Fl8zIsk10w8wU= X-Google-Smtp-Source: ABdhPJzO4OHFtPVzeYHG8yntg1D3IIXjGR1TkKx0GhRtkqmMIrREngVcvgxL3BhTDb1PGJvt4M/smidtmHnrK3B294c= X-Received: by 2002:a17:906:ce4a:: with SMTP id se10mr19856836ejb.235.1623088806285; Mon, 07 Jun 2021 11:00:06 -0700 (PDT) MIME-Version: 1.0 References: <20210605151844.470344-1-hjl.tools@gmail.com> <20210605151844.470344-2-hjl.tools@gmail.com> In-Reply-To: From: Richard Biener Date: Mon, 7 Jun 2021 19:59:55 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] Allow vec_duplicate_optab to fail To: "H.J. Lu" Cc: GCC Patches , Uros Bizjak , Jakub Jelinek , Richard Sandiford Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 18:00:08 -0000 On Mon, Jun 7, 2021 at 4:19 PM H.J. Lu wrote: > > On Mon, Jun 7, 2021 at 12:12 AM Richard Sandiford > wrote: > > > > "H.J. Lu" writes: > > > Update vec_duplicate to allow to fail so that backend can only allow > > > broadcasting an integer constant to a vector when broadcast instructi= on > > > is available. > > > > I'm not sure why we need this to fail though. Once the optab is define= d > > for target X, the optab should handle all duplicates for target X, > > even if there are different strategies it can use. > > > > AIUI the case you want to make conditional is the constant case. > > I guess the first question is: why don't we simplify those CONSTRUCTORs > > to VECTOR_CSTs in gimple? I'm surprised we still see the constant case > > as a constructor here. > > The particular testcase for vec_duplicate is gcc.dg/pr100239.c. > > > If we can't rely on that happening, then would it work to change: > > > > /* Try using vec_duplicate_optab for uniform vectors. */ > > if (!TREE_SIDE_EFFECTS (exp) > > && VECTOR_MODE_P (mode) > > && eltmode =3D=3D GET_MODE_INNER (mode) > > && ((icode =3D optab_handler (vec_duplicate_optab, mode)) > > !=3D CODE_FOR_nothing) > > && (elt =3D uniform_vector_p (exp))) > > > > to something like: > > > > /* Try using vec_duplicate_optab for uniform vectors. */ > > if (!TREE_SIDE_EFFECTS (exp) > > && VECTOR_MODE_P (mode) > > && eltmode =3D=3D GET_MODE_INNER (mode) > > && (elt =3D uniform_vector_p (exp))) > > { > > if (TREE_CODE (elt) =3D=3D INTEGER_CST > > || TREE_CODE (elt) =3D=3D POLY_INT_CST > > || TREE_CODE (elt) =3D=3D REAL_CST > > || TREE_CODE (elt) =3D=3D FIXED_CST) > > { > > rtx src =3D gen_const_vec_duplicate (mode, expand_norma= l (node)); > > emit_move_insn (target, src); > > break; > > } > > =E2=80=A6 > > } > > I will give it a try. I can confirm that veclower leaves us with an unfolded constant CTOR. If you file a PR to remind me I'll fix that. Richard. > Thanks. > > -- > H.J.