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: 92821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4597790vqo; Thu, 11 May 2023 11:57:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6xboMmIOUFheXUAnOpdYupJpF+buonT6hmnUdcN/fo9WyhB/AZvOxvtN5yeeOiw4M0D0JT X-Received: by 2002:aa7:d59a:0:b0:50b:5dbe:e0f6 with SMTP id r26-20020aa7d59a000000b0050b5dbee0f6mr18403404edq.25.1683831466822; Thu, 11 May 2023 11:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683831466; cv=none; d=google.com; s=arc-20160816; b=UVRVuAtMBsanTO12l8TSaTmkHi+qFA/pfmH8PlfyYEE06aZEsiJTxPUE2ZhAKhph7/ yIOfs1ggx3ybh/BgEY4zOoGM6OTML1swHmJNIsv7Qgu69lQ3qR7pL7fmSWhlffyyj3YA HdHP32cbVXYeRuJf5EdeQpgNIl2CEmUctA0nvXPy2bXwD7QcHl/wBcsI9D6aM2cPpf5c bvzNJFYWz9gyjtec/Oqe+5W9Fnsm+Us8xJGljext/nNWz7GNnuBBpIUxeiFD/5wjoV1C /445kENkyTMkKu56s7cxgx6xqBmPVUtXoVx9BTkd7YU8bqUyCXS5rrS3DOZkoHgD0s3Q Hmmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=2HV+CoO3TDGqy7m4Ypb5Slot1bGz/dZJBXFrvC0ndQs=; b=ubYAYjtMGzKldODyzY7EKz42IIcnr2mKgqsbNk+P35+9BuoFSkpZQQL4eMt0b2HunD cXAX3LHawhhRfNQZXTu8qH8N4ww3xx2T0yY3VoAT+apCu4tH654XeEM4cEkYwnFM6Rcs +emRZ3/wduuFZ4rs8Sa47PQFgfb4g2xAhgh9UscY+rFj/RhIZQjZL3w2E3Pk4q2+D1Qz tT42xj8eIGJ9zGmuXVCoUzYeuJN3c00IrKYqoE0FFfEHaasU5NJ2AX4JOk/m55WrQOR2 OX6OZsCjiOBcnZ2Q71qyqr4Zf8epuxgADgI/diK9oM/+5wUTvp6zFEg3gA5Fm9xIwWvD CQFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=w2Is1KAh; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id v21-20020aa7d815000000b0050df8855941si1728768edq.506.2023.05.11.11.57.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 11:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=w2Is1KAh; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 285F63858434 for ; Thu, 11 May 2023 18:57:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 285F63858434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683831462; 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=w2Is1KAhAcZHQ/uj5YQDZmbYRG3aHadO08u5dqkHgo7tPaEo1rnnNWEEXFONLOHI5 8SzmcT8P5TXWGemNPe4f9oFRMAIr0l0EkmKU31b597xAlHQkGqw4RYe2d+00oWEfzT 8rgleFunp1IsqpJCxErIgB9ga0bhcmzeY8mufN78= 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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765625263886833473?= X-GMAIL-MSGID: =?utf-8?q?1765625263886833473?= 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"