From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10644 invoked by alias); 16 Jun 2011 23:31:37 -0000 Received: (qmail 10636 invoked by uid 22791); 16 Jun 2011 23:31:37 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_MX,TW_VC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 23:31:18 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5GNVGpY024612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Jun 2011 19:31:16 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5GNVFFJ000427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Jun 2011 19:31:16 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p5GNVEwK006848; Fri, 17 Jun 2011 01:31:14 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p5GNVEKv006846; Fri, 17 Jun 2011 01:31:14 +0200 Date: Fri, 17 Jun 2011 00:24:00 -0000 From: Jakub Jelinek To: Uros Bizjak , Quentin Neill Cc: Sebastian Pop , "Fang, Changpeng" , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix ICEs with -mxop __builtin_ia32_vpermil2p[sd]{,256} and __builtin_ia32_vprot[bwdq]i intrinsics (PR target/49411) Message-ID: <20110616233114.GQ17079@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20110615095406.GI17079@tyan-ft48-01.lab.bos.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg01313.txt.bz2 On Thu, Jun 16, 2011 at 05:57:12PM -0500, Quentin Neill wrote: > Does it need to also handle the VCVTP[SH]2P[HS] insns like this? > > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c > index 675888f..584f722 100644 > --- a/gcc/config/i386/i386.c > +++ b/gcc/config/i386/i386.c > @@ -25571,6 +25571,10 @@ ix86_expand_multi_arg_builtin (enum insn_code > icode, tree exp, rtx target, > case CODE_FOR_xop_vpermil2v4sf3: > case CODE_FOR_xop_vpermil2v4df3: > case CODE_FOR_xop_vpermil2v8sf3: > + case CODE_FOR_vcvtph2ps: > + case CODE_FOR_vcvtph2ps256: > + case CODE_FOR_vcvtps2ph: > + case CODE_FOR_vcvtps2ph256: > if (!CONST_INT_P (op)) > { > error ("last argument must be an immediate"); Not here, those are handled by ix86_expand_args_builtin instead of ix86_expand_multi_arg_builtin. Furthermore, only CODE_FOR_vcvtps2ph and CODE_FOR_vcvtps2ph256 have CONST_INT argument. And I believe ix86_expand_args_builtin handles it fine, what's wrong is the actual predicates those insns use. E.g. #include __m128i a; __m128 b; void foo (int i) { a = _mm_cvtps_ph (b, 256); // a = _mm_cvtps_ph (b, i); } ICEs during reload. I don't see how reload could ever fix up if there is an CONST_INT operand which isn't from 0..255 range to make that operand in range. When the operand is non-constant, ix86_expand_args_builtin correctly errors out that the operand must be an 8-bit immediate. So something like untested: 2011-06-17 Jakub Jelinek * config/i386/sse.md (vcvtps2ph, *vcvtps2ph, *vcvtps2ph_store, vcvtps2ph256): Use const_0_to_255_operand predicate instead of immediate_operand. --- gcc/config/i386/sse.md 2011-06-06 10:24:40.000000000 +0200 +++ gcc/config/i386/sse.md 2011-06-17 01:19:45.371681174 +0200 @@ -10290,7 +10290,7 @@ [(set (match_operand:V8HI 0 "register_operand" "") (vec_concat:V8HI (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "") - (match_operand:SI 2 "immediate_operand" "")] + (match_operand:SI 2 "const_0_to_255_operand" "")] UNSPEC_VCVTPS2PH) (match_dup 3)))] "TARGET_F16C" @@ -10300,7 +10300,7 @@ [(set (match_operand:V8HI 0 "register_operand" "=x") (vec_concat:V8HI (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "x") - (match_operand:SI 2 "immediate_operand" "N")] + (match_operand:SI 2 "const_0_to_255_operand" "N")] UNSPEC_VCVTPS2PH) (match_operand:V4HI 3 "const0_operand" "")))] "TARGET_F16C" @@ -10312,7 +10312,7 @@ (define_insn "*vcvtps2ph_store" [(set (match_operand:V4HI 0 "memory_operand" "=m") (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "x") - (match_operand:SI 2 "immediate_operand" "N")] + (match_operand:SI 2 "const_0_to_255_operand" "N")] UNSPEC_VCVTPS2PH))] "TARGET_F16C" "vcvtps2ph\t{%2, %1, %0|%0, %1, %2}" @@ -10323,7 +10323,7 @@ (define_insn "vcvtps2ph256" [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm") (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "x") - (match_operand:SI 2 "immediate_operand" "N")] + (match_operand:SI 2 "const_0_to_255_operand" "N")] UNSPEC_VCVTPS2PH))] "TARGET_F16C" "vcvtps2ph\t{%2, %1, %0|%0, %1, %2}" Jakub