From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4642 invoked by alias); 15 Apr 2002 13:36:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 4607 invoked by uid 71); 15 Apr 2002 13:36:01 -0000 Date: Mon, 15 Apr 2002 06:36:00 -0000 Message-ID: <20020415133601.4606.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Marco Altieri" Subject: Re: middle-end/5100: Wrong register class selected by find_valid_class Reply-To: "Marco Altieri" X-SW-Source: 2002-04/txt/msg00771.txt.bz2 List-Id: The following reply was made to PR middle-end/5100; it has been noted by GNATS. From: "Marco Altieri" To: , , , , , , Cc: Subject: Re: middle-end/5100: Wrong register class selected by find_valid_class Date: Mon, 15 Apr 2002 15:32:51 +0200 In a simplified example we have only 4 registers (named 0, 1, 2, 3) and 3 classes of registers: EVEN_REGS = { 0, 2 } ODD_REGS = { 1, 3 } GENERAL_REGS = { 0, 1, 2, 3 } A pointer can be reloaded only on even/odd pair. In this simplified example the possible pair are only (0, 1) and (2, 3). The macro HARD_REGNO_MODE_OK have to return a not null value for the Pmode mode only for registers 0 and 2: HARD_REGNO_MODE_OK(0, Pmode) = 1 HARD_REGNO_MODE_OK(1, Pmode) = 0 HARD_REGNO_MODE_OK(2, Pmode) = 1 HARD_REGNO_MODE_OK(3, Pmode) = 0 find_valid_class have to return GENERAL_REGS because EVEN_REGS and ODD_REGS have not any even/odd pair. But the algorithm, used in find_valid_class, rejects GENERAL_REGS and accepts EVEN_REGS. Infact when (regno == 0 || regno == 2) && m1 == Pmode && class == GENERAL_REGISTER && n == 1 we have: HARD_REGNO_MODE_OK (regno + n, m1) == 0 TEST_HARD_REG_BIT (reg_class_contents[class], regno) == 1 TEST_HARD_REG_BIT (reg_class_contents[class], regno + n) == 1 and when (regno == 0 || regno == 2) && m1 == Pmode && class == EVEN_REGS && n == 1 we have: HARD_REGNO_MODE_OK (regno + n, m1) == 0 TEST_HARD_REG_BIT (reg_class_contents[class], regno) == 1 TEST_HARD_REG_BIT (reg_class_contents[class], regno + n) == 0 So, the algorithm in find_valid_class selects EVEN_REGS for a mode == Pmode and n==1. thanks, Marco Altieri