From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2809 invoked by alias); 18 Oct 2011 17:20:43 -0000 Received: (qmail 2615 invoked by uid 22791); 18 Oct 2011 17:20:38 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-bw0-f47.google.com (HELO mail-bw0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 17:20:24 +0000 Received: by bkat8 with SMTP id t8so1248314bka.20 for ; Tue, 18 Oct 2011 10:20:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.63.75 with SMTP id a11mr5291350fai.9.1318958422490; Tue, 18 Oct 2011 10:20:22 -0700 (PDT) Received: by 10.152.2.199 with HTTP; Tue, 18 Oct 2011 10:20:22 -0700 (PDT) In-Reply-To: References: Date: Tue, 18 Oct 2011 17:20:00 -0000 Message-ID: Subject: Re: Complex half-word operations From: Ayonam Ray To: Ian Lance Taylor Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00171.txt.bz2 On 18 October 2011 22:38, Ian Lance Taylor wrote: > On Tue, Oct 18, 2011 at 9:30 AM, Ayonam Ray wrote: >> I'm trying to define a complex half word operation (add:CHI) using the >> following RTL: >> >> (define_insn "addchi3" >> =A0 [(set (match_operand:CHI 0 "register_operand" "=3Dr") >> =A0=A0=A0=A0=A0=A0=A0 (plus:CHI (match_operand:CHI 1 "register_operand" = "r") >> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (match_operand:CHI 2= "register_operand" "r")))] >> =A0 "" >> =A0 "cmplxadd\t%1, %2, %0" >> =A0 [(set_attr "type" "complex") >> =A0=A0 (set_attr "slot" "s1") >> =A0=A0 (set_attr "predicable" "no") >> =A0=A0 (set_attr "length" "4")]) >> >> This architecture can perform arithmetic operations on "complex short" >> data by packing the real and imaginary parts into two half words of a >> 32-bit general register. >> >> However, the instruction matcher doesn't seem to generate this RTL at >> all.=A0 It splits the operation into two half word additions.=A0 I have >> handled the CHImode in the macros HARD_REGNO_NREGS, and >> HARD_REGNO_MODE_OK.=A0 How do we tell GCC that the real and imaginary >> parts are actually packed into a single register?=A0 I tried defining >> two RTLs to pack and unpack the two parts using the concat:CHI >> operation. > > I don't think the gcc middle-end has any support for machines which provi= de > special handling for complex int. =A0I think the middle-end always breaks= up > complex int operations into pairs of int operations. =A0So to make this w= ork you > would probably have to add that support. > > Ian > Thanks Ian for the reply. Can you please point me to the files in the middle-end where I may find the relevant code?