Patchwork PowerPC -mcmodel preprocessor define

login
register
mail settings
Submitter Alan Modra
Date Jan. 20, 2011, 12:41 p.m.
Message ID <20110120124136.GE11694@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/79679/
State New
Headers show

Comments

Alan Modra - Jan. 20, 2011, 12:41 p.m.
Someone in IBM (Ulrich Weigand?) observed that some powerpc asm may
need changing for -mcmodel=medium, so it would be a good idea to
define builtin macros to allow selection of the correct asm.

Bootstrapped etc. powerpc64-linux.  OK for 4.6?  I know this isn't a
regression fix, but I'm hoping the rules can be bent enough for this
to go in.

	* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Add
	builtin_define __CMODEL_MEDIUM__ and __CMODEL_LARGE__.
David Edelsohn - Jan. 20, 2011, 3:54 p.m.
On Thu, Jan 20, 2011 at 7:41 AM, Alan Modra <amodra@gmail.com> wrote:
> Someone in IBM (Ulrich Weigand?) observed that some powerpc asm may
> need changing for -mcmodel=medium, so it would be a good idea to
> define builtin macros to allow selection of the correct asm.
>
> Bootstrapped etc. powerpc64-linux.  OK for 4.6?  I know this isn't a
> regression fix, but I'm hoping the rules can be bent enough for this
> to go in.
>
>        * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Add
>        builtin_define __CMODEL_MEDIUM__ and __CMODEL_LARGE__.

Okay.

Thanks, David

Patch

Index: gcc/config/rs6000/rs6000-c.c
===================================================================
--- gcc/config/rs6000/rs6000-c.c	(revision 167467)
+++ gcc/config/rs6000/rs6000-c.c	(working copy)
@@ -385,6 +385,20 @@  rs6000_cpu_cpp_builtins (cpp_reader *pfi
       builtin_define ("__LONGDOUBLE128");
     }
 
+  switch (TARGET_CMODEL)
+    {
+      /* Deliberately omit __CMODEL_SMALL__ since that was the default
+	 before -mcmodel support was added.  */
+    case CMODEL_MEDIUM:
+      builtin_define ("__CMODEL_MEDIUM__");
+      break;
+    case CMODEL_LARGE:
+      builtin_define ("__CMODEL_LARGE__");
+      break;
+    default:
+      break;
+    }
+
   switch (rs6000_current_abi)
     {
     case ABI_V4: