Snapshot 971225 : Problem with alpha TARGET_CPU_DEFAULT definition

Kanazawa Yuzi kanazawa@flab.fujitsu.co.jp
Wed Jan 7 03:25:00 GMT 1998


  I compiled snapshot 971225 on RedHat 5.0 alpha
(alphaev5-unknown-linux-gnu-gcc). When I used the compiler, I noticed
that it generated code much slower than before. It appeared that the
compiler optimized the code for EV6, though the configuration said the
cpu is EV5.

  This problem was caused by `TARGET_CPU_DEFAULT' definition created
by gcc/configure.  In my case, TARGET_CPU_DEFAULT was defined like
this.

tm.h:
#define TARGET_CPU_DEFAULT MASK_CPU_EV5|MASK_GAS


  It makes `alpha_cpu' wrong because the variable is set by the
following statement.

config/alpha/alpha.c:
  alpha_cpu
    = TARGET_CPU_DEFAULT & MASK_CPU_EV6 ? PROCESSOR_EV6
      : (TARGET_CPU_DEFAULT & MASK_CPU_EV5 ? PROCESSOR_EV5 : PROCESSOR_EV4);


  Since TARGET_CPU_DEFAULT is not protected by parenthesis,
`TARGET_CPU_DEFAULT & MASK_CPU_EV6' is always true. Thus alpha_cpu is
set to PROCESSOR_EV6.

  Here is my patch. Note that with this fix rather ugly definition
like (MASK_SUPPORT_ARCH|((MASK_CPU_EV5|MASK_BWX|TASK_MAX)|MASK_GAS))
can be generated. Does anybody mind that?


Wed Jan  7 14:08:47 1998  Kanazawa Yuzi <kanazawa@flab.fujitsu.co.jp>
        * gcc/configure.in: Add parenthesis to some
target_cpu_default2 definitions.

--- gcc/configure.in.orig	Thu Dec 25 08:55:51 1997
+++ gcc/configure.in	Wed Jan  7 14:08:47 1998
@@ -2672,13 +2672,13 @@
 	alpha*-*-*)
 		case $machine in
 			alphaev6*)
-				target_cpu_default2="MASK_CPU_EV6|MASK_BXW|MASK_CIX|MASK_MAX"
+				target_cpu_default2="(MASK_CPU_EV6|MASK_BXW|MASK_CIX|MASK_MAX)"
 				;;
 			alphapca56*)
-				target_cpu_default2="MASK_CPU_EV5|MASK_BWX|TASK_MAX"
+				target_cpu_default2="(MASK_CPU_EV5|MASK_BWX|TASK_MAX)"
 				;;
 			alphaev56*)
-				target_cpu_default2="MASK_CPU_EV5|MASK_BWX"
+				target_cpu_default2="(MASK_CPU_EV5|MASK_BWX)"
 				;;
 			alphaev5*)
 				target_cpu_default2="MASK_CPU_EV5"
@@ -2691,7 +2691,7 @@
 			then
 				target_cpu_default2="MASK_GAS"
 			else
-				target_cpu_default2="${target_cpu_default2}|MASK_GAS"
+				target_cpu_default2="(${target_cpu_default2}|MASK_GAS)"
 			fi
 		fi
 		;;

-- 
Kanazawa Yuzi
kanazawa@flab.fujitsu.co.jp



More information about the Gcc-bugs mailing list