From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28782 invoked by alias); 21 Nov 2006 14:24:07 -0000 Received: (qmail 28771 invoked by uid 22791); 21 Nov 2006 14:24:05 -0000 X-Spam-Check-By: sourceware.org Received: from smtpout1439.sc1.he.tucows.com (HELO n034.sc1.cp.net) (64.97.157.139) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 21 Nov 2006 14:23:54 +0000 Received: from fh1035.dia.cp.net (64.97.139.2) by n034.sc1.cp.net (7.2.069.1) id 455A206B001BC468 for gcc-help@gcc.gnu.org; Tue, 21 Nov 2006 14:23:52 +0000 Received: from 62.254.216.217 (authenticated as user tom@womack.net) by 64.97.168.45 with HTTP; Tue, 21 Nov 2006 14:23:51 UTC Message-ID: <12011776.1164119032361.JavaMail.?@fh1035.dia.cp.net> Date: Tue, 21 Nov 2006 14:24:00 -0000 From: "tom@womack.net" Reply-To: "tom@womack.net" To: gcc-help@gcc.gnu.org Subject: Another clobber problem MIME-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2006-11/txt/msg00255.txt.bz2 What's the right way of telling gcc that an input register is clobbered? I've two asm statements in the same function, both of which have "a" (a) as an input constraint; the code corrupts RAX, and the optimiser is not reloading a into RAX before starting the second bit of code. If I add "rax" to the clobbers list, I get an error modp2.cpp:55: error: can't find a register in class ___AREG___ while reloading ___asm___ Also: how do I refer to r8 through r15 in register constraints on x64? If I replace "r" (p) by "r9" (p) in the second asm statement, I get an error modp2.cpp:64: error: matching constraint references invalid operand number --- the function asm("mulq %2\n mov %%rdx, %%r12 \n mov %%rax, %%r13 \n" \ "mov %3,%%rax \n mulq %%r13 \n mov %%rdx, %%r10 \n mov %%rax, %% r11 \n" \ "mov %4,%%rax \n mulq %%r12 \n mov %%rdx, %%r8 \n mov %%rax, %% r9 \n" \ "mov %3,%%rax \n mulq %%r12 \n add %%rax, %%r10 \n adc %%rdx, %% r9 \n adc $0, %%r8 \n" \ "mov %4,%%rax \n mulq %%r13 \n add %%rax, %%r10 \n adc %%rdx, %% r9 \n adc $0, %%r8 \n" \ "shrd %%cl, %%r8, %%r9\n mov %%r9, %%rdx" : "=&d" (aus) : "a" (a), "r" (b), "r" (il), "r" (ih), "c" (pis) : "r8", "r9", "r10", "r11", "r12", "r13"); quotient=aus; u64 rem; asm("mulq %2\nmov %%rdx,%%r12 \n mov %%rax, %%r13 \n" \ "mov %3,%%rax\nmulq %4\n" \ "sub %%rax,%%r13 \n" \ "mov %%r13, %%rdx" : "=&d" (rem) : "a" (a), "r" (b), "c" (aus), "r" (p) : "r12", "r13");