From patchwork Mon May 11 18:14:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1287953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=OTdxgozw; 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49LTcV6f2jz9sRf for ; Tue, 12 May 2020 04:15:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62244386F454; Mon, 11 May 2020 18:15:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62244386F454 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589220902; bh=jYvskalaFYPdc1ybZzVKAQ+zcjfDR2/01QR7V/TTrBo=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=OTdxgozwXUhH+6GVExAuYRSr1lxAfPqi2AMDzK8bwlJqbyNuKiAH/kyK7QO23BMKH +pWjQ70N03D0y27I0dUQ23+zpfMdWhw+/iZrxZa8J4da6ojTgxXpiQyG3ad2DMnTiM h8c/iR162i8rEDV5ViNnccXAcyTcVr6sln7DOLTw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by sourceware.org (Postfix) with ESMTPS id E3001386F454 for ; Mon, 11 May 2020 18:14:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E3001386F454 Received: by mail-io1-xd2a.google.com with SMTP id w11so10866404iov.8 for ; Mon, 11 May 2020 11:14:58 -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:from:date:message-id:subject:to; bh=jYvskalaFYPdc1ybZzVKAQ+zcjfDR2/01QR7V/TTrBo=; b=KCjL8ImcNZs+KQ2SlO25uMcxirFwJSqY3++P81ouROpZwtlO/deqcz1fjPH62Huwam 73zCzHui2QQdHSOQeALqNVlzgN6CfQi6grbzDSnR6afcHdldO96VvciQz2O2sanOZ+fg xt7ByvTTKn27iNeSbSt2z+PqFFZ++Q18xcec+kZmrkqtSqOY/6wrowkF8T7udkOsZAV+ XZldDxb79Ojh13+Qge45DI8oT81a62NZuaOHCVbda0QinLlJZD1EL7jWlzUQcObznxCu sOX1DERx2GueEZmqoF2t93KmbpOueMxdUF+ZFCwfcZrqhlTrVTWB7tNCIbeWn/45BW5K G6zQ== X-Gm-Message-State: AGi0PuaECpOk9WnUG0qLyoC5Si54yYvEHMEjvC4GpmaIynTjavrmCiIW VxH+Q5iTCk/K3Banff3jflEyVfsdJJIRbnEYEpHvQ8qPJvU= X-Google-Smtp-Source: APiQypIum+GHf6k2i+pjA8VlrULgbsnNob7YTl/fBOdhW1otMPjTuMA7nQneOCjXZI9oCNDdLm/N03EeWfE8+5jIhdA= X-Received: by 2002:a02:c998:: with SMTP id b24mr16507248jap.23.1589220897873; Mon, 11 May 2020 11:14:57 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 11 May 2020 20:14:46 +0200 Message-ID: Subject: [committed] i386: Add V2SFmode sqrt insn pattern [PR95046] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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-Patchwork-Original-From: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: 2020-05-11 Uroš Bizjak PR target/95046 * config/i386/mmx.md (sqrtv2sf2): New insn pattern. testsuite/ChangeLog: 2020-05-11 Uroš Bizjak PR target/95046 * gcc.target/i386/pr95046-1.c (test_sqrt): Add. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros. diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 7d76c631a77..a8f603b94f8 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -461,6 +461,20 @@ (set_attr "prefix_extra" "1") (set_attr "mode" "V2SF")]) +(define_insn "sqrtv2sf2" + [(set (match_operand:V2SF 0 "register_operand" "=x,v") + (sqrt:V2SF (match_operand:V2SF 1 "register_operand" "0,v")))] + "TARGET_MMX_WITH_SSE" + "@ + sqrtps\t{%1, %0|%0, %1} + vsqrtps\t{%1, %0|%0, %1}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sse") + (set_attr "atom_sse_attr" "sqrt") + (set_attr "btver2_sse_attr" "sqrt") + (set_attr "prefix" "orig,vex") + (set_attr "mode" "V4SF")]) + (define_insn "mmx_rsqrtv2sf2" [(set (match_operand:V2SF 0 "register_operand" "=y") (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] diff --git a/gcc/testsuite/gcc.target/i386/pr95046-1.c b/gcc/testsuite/gcc.target/i386/pr95046-1.c index f93d9e1a507..7adc2069c53 100644 --- a/gcc/testsuite/gcc.target/i386/pr95046-1.c +++ b/gcc/testsuite/gcc.target/i386/pr95046-1.c @@ -49,3 +49,14 @@ test_max (void) } /* { dg-final { scan-assembler "maxps" } } */ + +float sqrtf (float); + +void +test_sqrt (void) +{ + for (int i = 0; i < 2; i++) + r[i] = sqrtf (a[i]); +} + +/* { dg-final { scan-assembler "sqrtps" } } */