This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR optimization/11974 (bitop libcall ICEs on Alpha)


Here's what happens:

expand_unop in optabs.c sees it's an ffs, and hardcodes outmode SI.
emit_library_call_value however returns a DI mode value, since Alpha's
function_value says int returns are really DI. Then emit_libcall_block
gets called with target in SImode and value DImode, which passes it on
to emit_move_insn, which ICEs.

I'm not really sure how to fix it. I propose to promote the libcall
outmode according to the architecture's LIBCALL_VALUE. At least, that
works on Alpha and i386.

2003-10-06  Falk Hueffner  <>

	PR optimization/11974
	* optabs.c (expand_unop): Promote libcall outmode according to

--- gcc/gcc/optabs.c~	2003-10-05 20:11:22.000000000 +0200
+++ gcc/gcc/optabs.c	2003-10-06 12:38:55.000000000 +0200
@@ -2639,7 +2639,8 @@
 	 have them return something that isn't a double-word.  */
       if (unoptab == ffs_optab || unoptab == clz_optab || unoptab == ctz_optab
 	  || unoptab == popcount_optab || unoptab == parity_optab)
-	outmode = TYPE_MODE (integer_type_node);
+	outmode
+	    = GET_MODE (hard_libcall_value (TYPE_MODE (integer_type_node)));
       start_sequence ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]