This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix __builtin_constant_p on Sparc
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 1 Apr 2003 13:45:47 +0200
- Subject: [PATCH] Fix __builtin_constant_p on Sparc
Hi,
For some reason, the Sparc back-end expects CONSTANT_P_RTXs to be wrapped up
in a CONST. Now the middle-end appears to send only bare CONSTANT_P_RTXs
which, therefore, are not recognized and end up being systematically forced
into memory. This of course fools purge_builtin_constant_p.
Bootstrapped on sparc-sun-solaris2.9 (c,c++,objc,f77 mainline) with no
regressions, a dozen of testsuite failures being fixed. Ok for mainline?
--
Eric Botcazou
2003-04-01 Eric Botcazou <ebotcazou at libertysurf dot fr>
* config/sparc/sparc.c (input_operand): Accept bare
CONSTANT_P_RTX operands.
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.237
diff -u -p -r1.237 sparc.c
--- config/sparc/sparc.c 19 Feb 2003 18:03:10 -0000 1.237
+++ config/sparc/sparc.c 31 Mar 2003 20:56:10 -0000
@@ -1297,8 +1297,8 @@ input_operand (op, mode)
if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op))
return 0;
- /* Only a tiny bit of handling for CONSTANT_P_RTX is necessary. */
- if (GET_CODE (op) == CONST && GET_CODE (XEXP (op, 0)) == CONSTANT_P_RTX)
+ /* Accept CONSTANT_P_RTX, since it will be gone by CSE1 and result in 0/1. */
+ if (GET_CODE (op) == CONSTANT_P_RTX)
return 1;
/* Allow any one instruction integer constant, and all CONST_INT