From patchwork Thu Apr 21 11:50:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 92399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 13DF7B704A for ; Thu, 21 Apr 2011 21:50:51 +1000 (EST) Received: (qmail 19694 invoked by alias); 21 Apr 2011 11:50:49 -0000 Received: (qmail 19685 invoked by uid 22791); 21 Apr 2011 11:50:47 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pv0-f175.google.com (HELO mail-pv0-f175.google.com) (74.125.83.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Apr 2011 11:50:34 +0000 Received: by pvc30 with SMTP id 30so962869pvc.20 for ; Thu, 21 Apr 2011 04:50:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.150.16 with SMTP id x16mr4728896wfd.173.1303386633632; Thu, 21 Apr 2011 04:50:33 -0700 (PDT) Received: by 10.142.87.14 with HTTP; Thu, 21 Apr 2011 04:50:33 -0700 (PDT) Date: Thu, 21 Apr 2011 13:50:33 +0200 Message-ID: Subject: [PATCH, i386]: Fix target/48708 - Invalid V2DI vector set insn generated From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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 Hello! ix86_expand_vector_set (around line 31485) synthesizes unrecognisable vec_concat/vec_select insn in invalid mode. The problem is, that V2DImode goes through the same code path as V2DFmode. 2011-04-21 Uros Bizjak * config/i386/i386.c (ix86_expand_vector_set) : Generate vec_extract and vec_concat for non-SSE4_1 targets. testsuite/ChangeLog: 2011-04-21 Uros Bizjak * gcc.target/i386/pr48708.c: New test. Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}. Patch was committed to mainline SVN and will be committed to all relevant release branches. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 172811) +++ config/i386/i386.c (working copy) @@ -31483,10 +31483,19 @@ ix86_expand_vector_set (bool mmx_ok, rtx break; case V2DImode: - use_vec_merge = TARGET_SSE4_1; + use_vec_merge = TARGET_SSE4_1 && TARGET_64BIT; if (use_vec_merge) break; + tmp = gen_reg_rtx (GET_MODE_INNER (mode)); + ix86_expand_vector_extract (false, tmp, target, 1 - elt); + if (elt == 0) + tmp = gen_rtx_VEC_CONCAT (mode, tmp, val); + else + tmp = gen_rtx_VEC_CONCAT (mode, val, tmp); + emit_insn (gen_rtx_SET (VOIDmode, target, tmp)); + return; + case V2DFmode: { rtx op0, op1; Index: testsuite/gcc.target/i386/pr48708.c =================================================================== --- testsuite/gcc.target/i386/pr48708.c (revision 0) +++ testsuite/gcc.target/i386/pr48708.c (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#include + +typedef long long T __attribute__((may_alias)); +struct S { __m128i d; }; + +__m128i +foo (long long *x, struct S *y, __m128i *z) +{ + struct S s = *y; + ((T *) &s.d)[0] = *x; + return _mm_cmpeq_epi16 (s.d, *z); +}