From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15907 invoked by alias); 13 Dec 2001 02:24:47 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 15763 invoked from network); 13 Dec 2001 02:23:25 -0000 Received: from unknown (HELO mail.pathwayconnect.com) (209.91.95.13) by sources.redhat.com with SMTP; 13 Dec 2001 02:23:25 -0000 Received: (qmail 13360 invoked from network); 13 Dec 2001 02:23:18 -0000 Received: from unknown (HELO dazed) (192.168.0.149) by 0 with SMTP; 13 Dec 2001 02:23:18 -0000 Received: from dazed ([127.0.0.1] helo=there ident=sjackman) by dazed with smtp (Exim 3.32 #1 (Debian)) id 16ELWE-0001ue-00 for ; Wed, 12 Dec 2001 19:22:42 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Shaun Jackman Organization: Pathway Connectivity To: gcc-help@gcc.gnu.org Subject: ARM register constraint Date: Wed, 12 Dec 2001 18:24:00 -0000 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: X-SW-Source: 2001-12/txt/msg00097.txt.bz2 I took this function from the ARM documentation to load an unaligned pointer. It has one constraint that I can't seem to express though. %0 must be less than %3. (ie r1 and r2, not r2 and r1) or the ldmia will end up with the values swapped in those two registers. How can I express this constraint to GCC? Please cc me as I'm not a member of this list, Thanks, Shaun /** * unaligned load */ uint32 ld32( const uint32* p) { uint32 ret, a, b; // enter with address in %1 (32 bits) // uses %2, %3; result in %0. // Note %0 must be less than %3 e.g. 0,1 asm( "\n\t@ get word aligned address" "\n\tbic %2,%1,#3" "\n\t@ get 64 bits containing answer" "\n\tldmia %2,{%0,%3}" "\n\t@ correction factor in bytes" "\n\tand %2,%1,#3" "\n\t@ ...now in bits and test if aligned" "\n\tmovs %2,%2,lsl#3" "\n\t@ produce bottom of result word ; (if not aligned)" "\n\tmovne %0,%0,lsr %2" "\n\t@ get other shift amount" "\n\trsbne %2,%2,#32" "\n\t@ combine two halves to get result" "\n\torrne %0,%0,%3,lsl %2" : "=r" (ret), "+r" (p), "=r" (a), "=r" (b)); return ret; }