From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14375 invoked by alias); 26 Dec 2007 15:00:18 -0000 Received: (qmail 14363 invoked by uid 22791); 26 Dec 2007 15:00:17 -0000 X-Spam-Check-By: sourceware.org Received: from rv-out-0910.google.com (HELO rv-out-0910.google.com) (209.85.198.185) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 26 Dec 2007 15:00:05 +0000 Received: by rv-out-0910.google.com with SMTP id g11so1780064rvb.56 for ; Wed, 26 Dec 2007 07:00:03 -0800 (PST) Received: by 10.140.147.18 with SMTP id u18mr3336426rvd.267.1198681203395; Wed, 26 Dec 2007 07:00:03 -0800 (PST) Received: from ?192.168.0.123? ( [222.244.188.69]) by mx.google.com with ESMTPS id c3sm5389175rvf.32.2007.12.26.06.59.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 26 Dec 2007 07:00:01 -0800 (PST) Message-ID: <47726C5B.4050701@gmail.com> Date: Wed, 26 Dec 2007 17:38:00 -0000 From: Qing Wei User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Tim Prince , gcc@gcc.gnu.org Subject: Re: How to describe a FMAC insn References: <4771EDE8.9030709@gmail.com> <477201FF.10802@computer.org> In-Reply-To: <477201FF.10802@computer.org> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2007-12/txt/msg00688.txt.bz2 I tried by referring the ia64.md, unfortunately it does not work. The insn I wrote for FMAC is as follows, (define_insn "maddsi4" [(set (match_operand:SI 0 "register_operand" "=r") (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "register_operand" "r")) (match_operand:SI 3 "register_operand" "r")))] "" "fma %0, %1, %2, %3") And besides this, I defined other two insns for dedicated add and mult operations as follows, (define_insn "addsi3" [(set (match_operand:SI 0 "register_operand" "=r") (plus:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "register_operand" "r")) )] "" "add %0, %1, %2") (define_insn "mulsi3" [(set (match_operand:SI 0 "register_operand" "=r") (mult:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "register_operand" "r")) )] "" "mul %0, %1, %2") It seems trivial. But after I rebuilt GCC for this new target, I found that no optabs entry is initialized for maddsi4 in insn-opinit.c which is generated by genopinit. However, the add_optab and smul_optab do be initialized with Code_for_addsi3/mulsi3. As a result, when I test the following simple program, cc1 produces separate add and mul instructions rather than fma, where the problem is? Thanks. void f(int s1[], int s2[], int s3[], int s4[]) { int j; for (j = 0; j < 16; j++) s4[j] = s1[j]*s2[j]+s3[j]; } Qing >> Could someone give some hints of how to describe a FMAC (float mult and >> add) insn in machine description, it matches d = b*c+a, which is a four >> operands float instrution. >> > There are plenty of examples in ia64.md and rs6000.md. >