diff mbox

PATCH: Properly set ix86_gen_leave and ix86_gen_monitor

Message ID 20120311230211.GA13460@intel.com
State New
Headers show

Commit Message

H.J. Lu March 11, 2012, 11:02 p.m. UTC
Hi,

leave_rex64 works on DImode and sse3_monitor64 works on Pmode.  This
patch properly sets ix86_gen_leave and ix86_gen_monitor, depending on
TARGET_64BIT and Pmode.  Tested on Linux/x86-64.  OK for trunk?

Thanks.


H.J.
---
2012-03-11  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (ix86_option_override_internal): Properly
	set ix86_gen_leave and ix86_gen_monitor.  Check Pmode == DImode.

	* config/i386/sse.md (sse3_monitor64): Renamed to ...
	(sse3_monitor64_<mode>): This.

Comments

Uros Bizjak March 12, 2012, 7:40 a.m. UTC | #1
On Mon, Mar 12, 2012 at 12:02 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> leave_rex64 works on DImode and sse3_monitor64 works on Pmode.  This
> patch properly sets ix86_gen_leave and ix86_gen_monitor, depending on
> TARGET_64BIT and Pmode.  Tested on Linux/x86-64.  OK for trunk?
>
> 2012-03-11  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * config/i386/i386.c (ix86_option_override_internal): Properly
>        set ix86_gen_leave and ix86_gen_monitor.  Check Pmode == DImode.
>
>        * config/i386/sse.md (sse3_monitor64): Renamed to ...
>        (sse3_monitor64_<mode>): This.

Please provide more descriptive ChangeLog. You are changing the check
on quite some global variables, please state them explicitly.

Otherwise the patch is OK.

BTW: I sincerely hope you reviewed all the places where these globals
are used...

Uros.
H.J. Lu March 12, 2012, 3:59 p.m. UTC | #2
On Mon, Mar 12, 2012 at 12:40 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Mon, Mar 12, 2012 at 12:02 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>
>> leave_rex64 works on DImode and sse3_monitor64 works on Pmode.  This
>> patch properly sets ix86_gen_leave and ix86_gen_monitor, depending on
>> TARGET_64BIT and Pmode.  Tested on Linux/x86-64.  OK for trunk?
>>
>> 2012-03-11  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>        * config/i386/i386.c (ix86_option_override_internal): Properly
>>        set ix86_gen_leave and ix86_gen_monitor.  Check Pmode == DImode.
>>
>>        * config/i386/sse.md (sse3_monitor64): Renamed to ...
>>        (sse3_monitor64_<mode>): This.
>
> Please provide more descriptive ChangeLog. You are changing the check
> on quite some global variables, please state them explicitly.

Here is the ChangeLog entry I checked in.

> Otherwise the patch is OK.
>
> BTW: I sincerely hope you reviewed all the places where these globals
> are used...
>
> Uros.

I verified that those ix86_gen_xxx function pointers I changed to
check Pmode == DImode are used to work on Pmode, like
stack or pointers.

Thanks.
diff mbox

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d673101..f21721f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3748,11 +3748,23 @@  ix86_option_override_internal (bool main_args_p)
   if (TARGET_64BIT)
     {
       ix86_gen_leave = gen_leave_rex64;
+      if (Pmode == DImode)
+	ix86_gen_monitor = gen_sse3_monitor64_di;
+      else
+	ix86_gen_monitor = gen_sse3_monitor64_si;
+    }
+  else
+    {
+      ix86_gen_leave = gen_leave;
+      ix86_gen_monitor = gen_sse3_monitor;
+    }
+
+  if (Pmode == DImode)
+    {
       ix86_gen_add3 = gen_adddi3;
       ix86_gen_sub3 = gen_subdi3;
       ix86_gen_sub3_carry = gen_subdi3_carry;
       ix86_gen_one_cmpl2 = gen_one_cmpldi2;
-      ix86_gen_monitor = gen_sse3_monitor64;
       ix86_gen_andsp = gen_anddi3;
       ix86_gen_allocate_stack_worker = gen_allocate_stack_worker_probe_di;
       ix86_gen_adjust_stack_and_probe = gen_adjust_stack_and_probedi;
@@ -3760,12 +3772,10 @@  ix86_option_override_internal (bool main_args_p)
     }
   else
     {
-      ix86_gen_leave = gen_leave;
       ix86_gen_add3 = gen_addsi3;
       ix86_gen_sub3 = gen_subsi3;
       ix86_gen_sub3_carry = gen_subsi3_carry;
       ix86_gen_one_cmpl2 = gen_one_cmplsi2;
-      ix86_gen_monitor = gen_sse3_monitor;
       ix86_gen_andsp = gen_andsi3;
       ix86_gen_allocate_stack_worker = gen_allocate_stack_worker_probe_si;
       ix86_gen_adjust_stack_and_probe = gen_adjust_stack_and_probesi;
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 4afc4b3..f5935f1 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -8147,8 +8147,8 @@ 
   "monitor\t%0, %1, %2"
   [(set_attr "length" "3")])
 
-(define_insn "sse3_monitor64"
-  [(unspec_volatile [(match_operand:DI 0 "register_operand" "a")
+(define_insn "sse3_monitor64_<mode>"
+  [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
 		     (match_operand:SI 1 "register_operand" "c")
 		     (match_operand:SI 2 "register_operand" "d")]
 		    UNSPECV_MONITOR)]