From patchwork Thu Feb 20 20:12:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1241641 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519871-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=vluLgV4u; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=a/ynUjtD; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Nm3y6Xjmz9sRR for ; Fri, 21 Feb 2020 07:13:01 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=eNLX2IDpmwj4IT44Qf/OJ/VzHwllZPnn/llCP2tNBXyEJW WfF4UsIROj/OQMfJasvcHoOAYYshlxh3fn5gS5XE+A15xppxXoYcgzid9VZ9HJoh ubnAWzYPyCAWn41mxERGcBvU3VwDus4KT7qhd0N8nphG/Vpqcbt8gqtU4GorA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=c18rznNa4BMSTAJub8swEqtEHjw=; b=vluLgV4uJWPsWjWZ9iln em5DiPbwBqlIaNS+hfqBVx5SAJ5VLEwMyswZppJcbNlQdo7jVB8qi92vQmw/jQGd SGq50Pj6CmfD+feGVs4/lHnE88DCTiQv35tXQq2JSqOD9kJFgZ1gNPKoDR5y0ZQb Df7M20ME7eepJbedrXndUJ8= Received: (qmail 115113 invoked by alias); 20 Feb 2020 20:12:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 115104 invoked by uid 89); 20 Feb 2020 20:12:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-il1-f179.google.com Received: from mail-il1-f179.google.com (HELO mail-il1-f179.google.com) (209.85.166.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Feb 2020 20:12:50 +0000 Received: by mail-il1-f179.google.com with SMTP id t17so24706005ilm.13 for ; Thu, 20 Feb 2020 12:12:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=lGUdyJHHhEANwxGpFjRHk0Ky9gW71aDQF4e3pN6WPyA=; b=a/ynUjtDwsxOZVWEM/u4VYYJab+vEPqu+g555jcOKdyGQtn3DTA0MaDC0ydIaUIBJc xkLqp3489Grj9lj1c6WcFkZCtTkHYRV2jD+ptY8K56iWp5dL2Gd0qzt2PpK0vAv4AMcF fzYb6i7MvK0rMqIY5bFWtKJ1ynIUT06uu3QgLhR2baa6n/Vbrg5s24sOaiSiKyZbel+M NW8ViVkS9bZw9qhP3uPNRawUVFRDPRLRjMmB6pqE1Mp6dlUXLPeiwP6gOfjyh3UVnUGI Jg62ldkKX03aTCxOH0X/il92PuyMy1hQ1UmU9T7DqIyL3DvKrcoOIwyLe+viOvSDSp6q CPHw== MIME-Version: 1.0 From: Uros Bizjak Date: Thu, 20 Feb 2020 21:12:37 +0100 Message-ID: Subject: [committed] i386: Fix *vec_extractv2sf_1 and *vec_extractv2sf_1 shufps alternative [PR93828] To: "gcc-patches@gcc.gnu.org" shufps moves two of the four packed single-precision floating-point values from *destination* operand (first operand) into the low quadword of the destination operand. Match source operand to the destination. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline. The testcase is relevant only for MMX_WITH_SSE, the fix will be committed to release branches without testcase. 2020-02-20 Uroš Bizjak PR target/93828 * config/i386/mmx.md (*vec_extractv2sf_1): Match source operand to destination operand for shufps alternative. (*vec_extractv2si_1): Ditto. testsuite/ChangeLog: 2020-02-20 Uroš Bizjak PR target/93828 * g++.target/i386/pr93828.C: New test. Uros. diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index f695831b5b9..e1c8b0af4c7 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -645,14 +645,14 @@ (define_insn "*vec_extractv2sf_1" [(set (match_operand:SF 0 "nonimmediate_operand" "=y,x,x,y,x,f,r") (vec_select:SF - (match_operand:V2SF 1 "nonimmediate_operand" " 0,x,x,o,o,o,o") + (match_operand:V2SF 1 "nonimmediate_operand" " 0,x,0,o,o,o,o") (parallel [(const_int 1)])))] "(TARGET_MMX || TARGET_MMX_WITH_SSE) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" "@ punpckhdq\t%0, %0 %vmovshdup\t{%1, %0|%0, %1} - shufps\t{$0xe5, %1, %0|%0, %1, 0xe5} + shufps\t{$0xe5, %0, %0|%0, %0, 0xe5} # # # @@ -1794,7 +1794,7 @@ (define_insn "*vec_extractv2si_1" [(set (match_operand:SI 0 "nonimmediate_operand" "=y,rm,x,x,y,x,r") (vec_select:SI - (match_operand:V2SI 1 "nonimmediate_operand" " 0,x ,x,x,o,o,o") + (match_operand:V2SI 1 "nonimmediate_operand" " 0,x ,x,0,o,o,o") (parallel [(const_int 1)])))] "(TARGET_MMX || TARGET_MMX_WITH_SSE) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -1802,7 +1802,7 @@ punpckhdq\t%0, %0 %vpextrd\t{$1, %1, %0|%0, %1, 1} %vpshufd\t{$0xe5, %1, %0|%0, %1, 0xe5} - shufps\t{$0xe5, %1, %0|%0, %1, 0xe5} + shufps\t{$0xe5, %0, %0|%0, %0, 0xe5} # # #" diff --git a/gcc/testsuite/g++.target/i386/pr93828.C b/gcc/testsuite/g++.target/i386/pr93828.C new file mode 100644 index 00000000000..e0c19751599 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr93828.C @@ -0,0 +1,17 @@ +// { dg-do run } +// { dg-require-effective-target c++11 } +// { dg-options "-O2 -march=k8" } + +using float2[[gnu::vector_size (8)]] = float; +using int2[[gnu::vector_size (8)]] = int; +float2 y = { 2, 2 }; + +int +main () +{ + const auto k = y == float2 { 2, 2 }; + if (k[1] == 0) + __builtin_abort (); + const auto a = k & int2 { 2, 2 }; + return a[0] - 2; +}