From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11160 invoked by alias); 11 Jul 2002 18:54:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10983 invoked from network); 11 Jul 2002 18:54:13 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 11 Jul 2002 18:54:13 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id g6BIsCFN015222; Thu, 11 Jul 2002 14:54:12 -0400 (EDT) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id g6BIsBkg015221; Thu, 11 Jul 2002 14:54:11 -0400 (EDT) Message-Id: <200207111854.g6BIsBkg015221@hiauly1.hia.nrc.ca> Subject: Re: PATCH: Fix failure of arith-rand-ll.c on hppa 32-bit targets To: dave@hiauly1.hia.nrc.ca (John David Anglin) Date: Thu, 11 Jul 2002 12:17:00 -0000 From: "John David Anglin" Cc: gcc-patches@gcc.gnu.org In-Reply-To: from "John David Anglin" at Jul 11, 2002 01:42:24 am MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-07/txt/msg00515.txt.bz2 > After installing this patch, I realized that the predicate for the adddi3 > expander can be improved rather than forcing constants that don't fit > into a register. Here is the patch. Tested on hppa-linux, hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11. Applied to main. A combined version of this patch and the previous patch has been applied to the 3.1 branch. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605) 2002-07-11 John David Anglin * pa.md (adddi3): Change predicate of operand 2 to adddi3_operand and delete code to force constant to register. * pa-protos.h (adddi3_operand): Add prototype. * pa.c (adddi3_operand): New function. Index: config/pa/pa.md =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa.md,v retrieving revision 1.108 diff -u -3 -p -r1.108 pa.md --- config/pa/pa.md 11 Jul 2002 05:04:54 -0000 1.108 +++ config/pa/pa.md 11 Jul 2002 15:57:30 -0000 @@ -3813,15 +3813,9 @@ (define_expand "adddi3" [(set (match_operand:DI 0 "register_operand" "") (plus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "arith_operand" "")))] + (match_operand:DI 2 "adddi3_operand" "")))] "" - " -{ - if (!TARGET_64BIT - && GET_CODE (operands[2]) == CONST_INT - && !VAL_11_BITS_P (INTVAL (operands[2]))) - operands[2] = force_reg (DImode, operands[2]); -}") + "") (define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") Index: config/pa/pa-protos.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa-protos.h,v retrieving revision 1.14 diff -u -3 -p -r1.14 pa-protos.h --- config/pa/pa-protos.h 21 Jun 2002 01:37:47 -0000 1.14 +++ config/pa/pa-protos.h 11 Jul 2002 15:57:30 -0000 @@ -63,6 +63,7 @@ extern rtx legitimize_pic_address PARAMS extern struct rtx_def *gen_cmp_fp PARAMS ((enum rtx_code, rtx, rtx)); extern void hppa_encode_label PARAMS ((rtx)); extern int arith11_operand PARAMS ((rtx, enum machine_mode)); +extern int adddi3_operand PARAMS ((rtx, enum machine_mode)); extern int symbolic_expression_p PARAMS ((rtx)); extern int hppa_address_cost PARAMS ((rtx)); extern int symbolic_memory_operand PARAMS ((rtx, enum machine_mode)); Index: config/pa/pa.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa.c,v retrieving revision 1.171 diff -u -3 -p -r1.171 pa.c --- config/pa/pa.c 11 Jul 2002 05:04:55 -0000 1.171 +++ config/pa/pa.c 11 Jul 2002 15:57:31 -0000 @@ -578,6 +578,18 @@ arith11_operand (op, mode) || (GET_CODE (op) == CONST_INT && INT_11_BITS (op))); } +/* Return truth value of whether OP can be used as an operand in a + adddi3 insn. */ +int +adddi3_operand (op, mode) + rtx op; + enum machine_mode mode; +{ + return (register_operand (op, mode) + || (GET_CODE (op) == CONST_INT + && (TARGET_64BIT ? INT_14_BITS (op) : INT_11_BITS (op)))); +} + /* A constant integer suitable for use in a PRE_MODIFY memory reference. */ int