From patchwork Thu May 14 17:55:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1290590 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=8.43.85.97; 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=X0ixECrA; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 49NK332V1Tz9sPF for ; Fri, 15 May 2020 03:55:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 129243971C45; Thu, 14 May 2020 17:55:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 129243971C45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589478955; bh=O6fIBLjeZzVR8A8XkOWvFa383k1NFsRYo7wI1pH1ah8=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=X0ixECrAwjmWQ0AzVnXnHSINLhELZDiXGxTPUhxO/B0viD/1TpJdny+5ubJjwb9ND xZHO3XC8fuE7HshQ+h838UtktHLCmkRqu6o3PRmuqDl/Mb4PkOnA9xpB9x9I5wY4LT MD7GkzXSzBpAH8iJZ8zbOnM3cQdkvaAjIF2NsBPo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id A7089396D830 for ; Thu, 14 May 2020 17:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A7089396D830 Received: by mail-il1-x132.google.com with SMTP id 4so1426914ilg.1 for ; Thu, 14 May 2020 10:55:43 -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=O6fIBLjeZzVR8A8XkOWvFa383k1NFsRYo7wI1pH1ah8=; b=ndiKi6g/nfYL3z2B+t/Eyi5H1PuQRonmdINMzFQCofza3FfG2A8zDIHkFvVehhIwMQ H+wXekSAwmJMo4rqYmQ+IAhehXKERpfVqkGu8JQtrU+If3l9j9jF2yamvZQqHnNtffpx eTuQuLF06C+PLozOGasLnYUajdr7euZNYoe5eL5YaB9fSgFlAeUbD9k/dbC7pDd4Auf2 hTWz4J5vkLo/mYnL/3QbqmgLpNHGAyTl55i3X2CSfVI63dy3uZ25JCqKqc3wp4WoPk4d MC23kIni6QW3F1lgpNWO9hZRy0N/zBW8r3Va0Ie0rGc36Bdqqo9P+HyafgcTIMjOyOOp hDdA== X-Gm-Message-State: AOAM532bIol28HyBp8zM0/2a5xcUSXMvJ+dH9A3LsNdswQkWB5romh84 pb2k0WHPwkmj1uxhCL4GLSh6AylkpyGflwTPxtN3k51coSg= X-Google-Smtp-Source: ABdhPJzaMGnVhV8XNfsEb19T95X7N3AEQS09MQeOvhDk6nLKoQxIyGm+ubdgw1Gyw5g8lI3XnRnR57GhlEC/ZzxuSzM= X-Received: by 2002:a92:8b43:: with SMTP id i64mr5459142ild.171.1589478942962; Thu, 14 May 2020 10:55:42 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 14 May 2020 19:55:31 +0200 Message-ID: Subject: [committed] i386: Add V2DFmode float trunc/extend functions [PR95046] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-11.4 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-14 Uroš Bizjak PR target/95046 * config/i386/sse.md (truncv2dfv2df2): New insn pattern. (extendv2sfv2df2): Ditto. testsuite/ChangeLog: 2020-05-14 Uroš Bizjak PR target/95046 * gcc.target/i386/pr95046-7.c: New test. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros. diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index dc0ecbc182e..28d2c434caf 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -6504,6 +6504,25 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "V4SF")]) +(define_insn "truncv2dfv2sf2" + [(set (match_operand:V2SF 0 "register_operand" "=v") + (float_truncate:V2SF + (match_operand:V2DF 1 "vector_operand" "vBm")))] + "TARGET_MMX_WITH_SSE" +{ + if (TARGET_AVX) + return "vcvtpd2ps{x}\t{%1, %0|%0, %1}"; + else + return "cvtpd2ps\t{%1, %0|%0, %1}"; +} + [(set_attr "type" "ssecvt") + (set_attr "amdfam10_decode" "double") + (set_attr "athlon_decode" "vector") + (set_attr "bdver1_decode" "double") + (set_attr "prefix_data16" "1") + (set_attr "prefix" "maybe_vex") + (set_attr "mode" "V4SF")]) + (define_insn "*sse2_cvtpd2ps_mask" [(set (match_operand:V4SF 0 "register_operand" "=v") (vec_concat:V4SF @@ -6664,6 +6683,20 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "V2DF")]) +(define_insn "extendv2sfv2df2" + [(set (match_operand:V2DF 0 "register_operand" "=v") + (float_extend:V2DF + (match_operand:V2SF 1 "register_operand" "v")))] + "TARGET_MMX_WITH_SSE" + "%vcvtps2pd\t{%1, %0|%0, %1}" + [(set_attr "type" "ssecvt") + (set_attr "amdfam10_decode" "direct") + (set_attr "athlon_decode" "double") + (set_attr "bdver1_decode" "double") + (set_attr "prefix_data16" "0") + (set_attr "prefix" "maybe_vex") + (set_attr "mode" "V2DF")]) + (define_expand "vec_unpacks_hi_v4sf" [(set (match_dup 2) (vec_select:V4SF diff --git a/gcc/testsuite/gcc.target/i386/pr95046-7.c b/gcc/testsuite/gcc.target/i386/pr95046-7.c new file mode 100644 index 00000000000..b3702a5d761 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr95046-7.c @@ -0,0 +1,25 @@ +/* PR target/95046 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O3 -msse2" } */ + + +float f[2]; +double d[2]; + +void +test_float_truncate (void) +{ + for (int i = 0; i < 2; i++) + f[i] = d[i]; +} + +/* { dg-final { scan-assembler "\tv?cvtpd2psx?" } } */ + +void +test_float_extend (void) +{ + for (int i = 0; i < 2; i++) + d[i] = f[i]; +} + +/* { dg-final { scan-assembler "\tv?cvtps2pd" } } */