From patchwork Thu May 11 18:56:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1780269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=TVoEv1ay; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QHLjs0KZFz213w for ; Fri, 12 May 2023 04:57:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E272F3858C5F for ; Thu, 11 May 2023 18:57:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E272F3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683831437; bh=2HV+CoO3TDGqy7m4Ypb5Slot1bGz/dZJBXFrvC0ndQs=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TVoEv1ayHxfYP5K89GQeVkCUhqULvqIUAKHHda/PpRWu+Ie6ii87IFo/6+1YSSd7g 1bTBFr5C0N63vwwOgEm85nGZiUKmMQtm2msXbPrgFxHuhJ1/M1N0rRvnmNcRYJS7RQ ZSZJX3hScuVhKJ5O9yivqQqZngRoz7JDNIB8mBII= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by sourceware.org (Postfix) with ESMTPS id 953CB3857030 for ; Thu, 11 May 2023 18:56:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 953CB3857030 Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-75765c213fbso333628085a.2 for ; Thu, 11 May 2023 11:56:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683831401; x=1686423401; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2HV+CoO3TDGqy7m4Ypb5Slot1bGz/dZJBXFrvC0ndQs=; b=el+7Hyoq3EDizAPlwgj2JjxsLXFGE6WHPqEin8AbuxvBV598jHS+wI2c6JR3rJQY6a /F0ps+sGDZ16EjpKsHMQL/7845fDi4SbO30XQ9vXUlCeQt/YLrQFWIe30CJjzbaQuENs jxeKxJvdLt7LaXx3pQie/zzUMoe8j62ey5B/ndOz8I72gSA38DnqzjlI31+Qd5PTTTqK LnlPiQv/xQ0A3B7zgUlHCiWgKhkY+GMkziUGy7SjffA0uquThHP1k1248BpPw6DgRawh tNXZw8JQmba3DbDYwHFSibARrlskRy5dDEukVFn0HkzMXVklTf4q9wyuBERwgvSgBf1N UXhg== X-Gm-Message-State: AC+VfDx8co1dLCCprwKNFcrHekuvj1tOH7mVv3aAMS41lfZBfdbqJ780 gqJAS49SXjyNaqbF/9/u7iL7WFwJynpNg3hHHC47BiZPK31Cvw== X-Google-Smtp-Source: ACHHUZ5cZ/qVjLVIMTPCpY1LeIglYIS9W+PR9m0Q8Xdg6KEUO5g1pI8Ba7Aqg0f4uNlAE2b7rp19EB3Ae7MhHU4+518= X-Received: by 2002:a05:6214:2627:b0:61b:75e0:6a19 with SMTP id gv7-20020a056214262700b0061b75e06a19mr36865055qvb.14.1683831401554; Thu, 11 May 2023 11:56:41 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 11 May 2023 20:56:30 +0200 Message-ID: Subject: [PATCH] i386: Handle V4HI and V2SImode in ix86_widen_mult_cost [PR109807] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Do not crash when asking ix86_widen_mult_cost for the cost of a widening mul operation to V4HI or V2SImode. gcc/ChangeLog: PR target/109807 * config/i386/i386.cc (ix86_widen_mult_cost): Handle V4HImode and V2SImode. gcc/testsuite/ChangeLog: PR target/109807 * gcc.target/i386/pr109807.c: New test. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Pushed to master. Uros. diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index b1d08ecdb3d..62fe06fdbaa 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -20417,12 +20417,14 @@ ix86_widen_mult_cost (const struct processor_costs *cost, int basic_cost = 0; switch (mode) { + case V4HImode: case V8HImode: case V16HImode: if (!uns_p || mode == V16HImode) extra_cost = cost->sse_op * 2; basic_cost = cost->mulss * 2 + cost->sse_op * 4; break; + case V2SImode: case V4SImode: case V8SImode: /* pmulhw/pmullw can be used. */ diff --git a/gcc/testsuite/gcc.target/i386/pr109807.c b/gcc/testsuite/gcc.target/i386/pr109807.c new file mode 100644 index 00000000000..6380eb35312 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr109807.c @@ -0,0 +1,4 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -msse4" } */ + +#include "sse2-mmx-pmaddwd.c"