Patchwork constant that doesn't fit in 32bits in alpha.c

login
register
mail settings
Submitter Richard Henderson
Date June 11, 2012, 11:06 p.m.
Message ID <4FD679DB.7010105@redhat.com>
Download mbox | patch
Permalink /patch/164288/
State New
Headers show

Comments

Richard Henderson - June 11, 2012, 11:06 p.m.
Bah.  Wrong patch.


r~
* config/alpha/alpha.c (alpha_trampoline_init): Split large constants.
Jay K - June 11, 2012, 11:23 p.m.
Thank you. I like it. May I have another?

book2:gcc jay$ grep -i epoch vms*
vmsdbgout.c:/* Difference in seconds between the VMS Epoch and the Unix Epoch */
vmsdbgout.c:static const long long vms_epoch_offset = 3506716800ll;
vmsdbgout.c:#define VMS_EPOCH_OFFSET 35067168000000000
vmsdbgout.c:                        + VMS_EPOCH_OFFSET;


 :)

  - Jay


----------------------------------------
> Date: Mon, 11 Jun 2012 16:06:03 -0700
> From: rth@redhat.com
> To: jay.krell@cornell.edu
> CC: gcc-patches@gcc.gnu.org
> Subject: Re: constant that doesn't fit in 32bits in alpha.c
>
> Bah. Wrong patch.
>
>
> r~
Mike Stump - June 11, 2012, 11:23 p.m.
On Jun 11, 2012, at 4:06 PM, Richard Henderson wrote:
> Bah.  Wrong patch.
> 
> 
> r~
> <z.txt>


Hum, I'm trying to see how this patch works...  I feel like there is something I'm missing, like a shift?
Jay K - June 11, 2012, 11:38 p.m.
Oops, agreed, shift missing. Also, I've been bitten, unable to find stuff (grep) due to token pasting, so I am a little slower to use it.
But I understand it is useful in general for reuse.

 - Jay


----------------------------------------
> Subject: Re: constant that doesn't fit in 32bits in alpha.c
> From: mikestump@comcast.net
> Date: Mon, 11 Jun 2012 16:23:57 -0700
> CC: jay.krell@cornell.edu; gcc-patches@gcc.gnu.org
> To: rth@redhat.com
>
> On Jun 11, 2012, at 4:06 PM, Richard Henderson wrote:
> > Bah. Wrong patch.
> >
> >
> > r~
> > <z.txt>
>
>
> Hum, I'm trying to see how this patch works... I feel like there is something I'm missing, like a shift?

Patch

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 6d15bf7..3dda9fb 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -5451,6 +5451,8 @@  alpha_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   chain_value = convert_memory_address (Pmode, chain_value);
 #endif
 
+#define HWI_HEX2(X,Y)	(((HOST_WIDE_INT)0x ## X ## u) | 0x ## Y ## u)
+
   if (TARGET_ABI_OPEN_VMS)
     {
       const char *fnname;
@@ -5468,7 +5470,8 @@  alpha_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 	 the function's procedure descriptor with certain fields zeroed IAW
 	 the VMS calling standard. This is stored in the first quadword.  */
       word1 = force_reg (DImode, gen_const_mem (DImode, fnaddr));
-      word1 = expand_and (DImode, word1, GEN_INT (0xffff0fff0000fff0), NULL);
+      word1 = expand_and (DImode, word1,
+			  GEN_INT (HWI_HEX2(ffff0fff,0000fff0)), NULL);
     }
   else
     {
@@ -5479,10 +5482,12 @@  alpha_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 	    nop
 	 We don't bother setting the HINT field of the jump; the nop
 	 is merely there for padding.  */
-      word1 = GEN_INT (0xa77b0010a43b0018);
-      word2 = GEN_INT (0x47ff041f6bfb0000);
+      word1 = GEN_INT (HWI_HEX2 (a77b0010,a43b0018));
+      word2 = GEN_INT (HWI_HEX2 (47ff041f,6bfb0000));
     }
 
+#undef HWI_HEX2
+
   /* Store the first two words, as computed above.  */
   mem = adjust_address (m_tramp, DImode, 0);
   emit_move_insn (mem, word1);