Re: [PATCH 2/8] [i386] Add option -moutline-msabi-xlogues

2017-04-01 Thread Daniel Santos
Uros, can I please get your opinion on this?  I have no objections to 
this, but I want to check with you first.


On 02/10/2017 10:54 AM, Sandra Loosemore wrote:
I'd like to re-iterate my previous request that the option be renamed 
-mno-inline-msabi-xlogues.  No other option that controls inlining 
uses "outline" for the negative (disabling inlining).  We have way too 
many options and the least we can do is try to make them use 
consistent conventions.


-Sandra


So the default would be -minline-msabi-xlogues and 
-mno-inline-msabi-xlogues would enable this optimization.


Thanks,
Daniel


Re: [PATCH 2/8] [i386] Add option -moutline-msabi-xlogues

2017-02-10 Thread Daniel Santos

On 02/10/2017 10:54 AM, Sandra Loosemore wrote:

On 02/09/2017 09:46 PM, Daniel Santos wrote:

On 02/08/2017 05:28 PM, Bernhard Reutner-Fischer wrote:

On 7 February 2017 19:40:17 CET, Daniel Santos
 wrote:


+{ "-mmoutline-msabi-xlogues", MASK_OUTLINE_MSABI_XLOGUES }
   };

s/mm/m/


I'd like to re-iterate my previous request that the option be renamed 
-mno-inline-msabi-xlogues.  No other option that controls inlining 
uses "outline" for the negative (disabling inlining).  We have way too 
many options and the least we can do is try to make them use 
consistent conventions.


-Sandra


Thank you.  I was just mentioning that and I agree, I just thought I 
should get feedback from i386 guys. I did quote you in the main email on 
this issue:


For now, I have called this feature -moutline-msabi-xlogues, but 
Sandra Loosemore has this suggestion: 
(https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02670.html)



Just as a suggestion (I'm not an i386 maintainer), I'd recommend
spelling the name of this option -mno-inline-msabi-xlogues instead of
-moutline-msabi-xlogues, and making the default -minline-msabi-xlogues.


Daniel


Re: [PATCH 2/8] [i386] Add option -moutline-msabi-xlogues

2017-02-10 Thread Sandra Loosemore

On 02/09/2017 09:46 PM, Daniel Santos wrote:

On 02/08/2017 05:28 PM, Bernhard Reutner-Fischer wrote:

On 7 February 2017 19:40:17 CET, Daniel Santos
 wrote:


+{ "-mmoutline-msabi-xlogues",MASK_OUTLINE_MSABI_XLOGUES }
   };

s/mm/m/


I'd like to re-iterate my previous request that the option be renamed 
-mno-inline-msabi-xlogues.  No other option that controls inlining uses 
"outline" for the negative (disabling inlining).  We have way too many 
options and the least we can do is try to make them use consistent 
conventions.


-Sandra



Re: [PATCH 2/8] [i386] Add option -moutline-msabi-xlogues

2017-02-09 Thread Daniel Santos

On 02/08/2017 05:28 PM, Bernhard Reutner-Fischer wrote:

On 7 February 2017 19:40:17 CET, Daniel Santos  wrote:


+{ "-mmoutline-msabi-xlogues",MASK_OUTLINE_MSABI_XLOGUES }
   };

s/mm/m/


+thus reducing function size at the cost of and few extra instructions.

s/and/a/



Thanks for catching these. I have them corrected, but I'm going to wait 
for feedback from the i386 guys before I post a revised patch set.


Daniel



Re: [PATCH 2/8] [i386] Add option -moutline-msabi-xlogues

2017-02-08 Thread Bernhard Reutner-Fischer
On 7 February 2017 19:40:17 CET, Daniel Santos  wrote:

>+{ "-mmoutline-msabi-xlogues", MASK_OUTLINE_MSABI_XLOGUES }
>   };

s/mm/m/

>+thus reducing function size at the cost of and few extra instructions.

s/and/a/


[PATCH 2/8] [i386] Add option -moutline-msabi-xlogues

2017-02-07 Thread Daniel Santos
Adds the option to i386.opt and i386.c and adds documentation to
invoke.texi.

Signed-off-by: Daniel Santos 
---
 gcc/config/i386/i386.c   |  3 ++-
 gcc/config/i386/i386.opt |  5 +
 gcc/doc/invoke.texi  | 11 ++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 05974208a27..9a0dfdc77ba 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4361,7 +4361,8 @@ ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2,
 { "-mstv", MASK_STV },
 { "-mavx256-split-unaligned-load", MASK_AVX256_SPLIT_UNALIGNED_LOAD },
 { "-mavx256-split-unaligned-store",
MASK_AVX256_SPLIT_UNALIGNED_STORE },
-{ "-mprefer-avx128",   MASK_PREFER_AVX128 }
+{ "-mprefer-avx128",   MASK_PREFER_AVX128 },
+{ "-mmoutline-msabi-xlogues",  MASK_OUTLINE_MSABI_XLOGUES }
   };
 
   /* Additional flag options.  */
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 0ee31845eba..0ff93f831c0 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -538,6 +538,11 @@ Enum(calling_abi) String(sysv) Value(SYSV_ABI)
 EnumValue
 Enum(calling_abi) String(ms) Value(MS_ABI)
 
+moutline-msabi-xlogues
+Target Report Mask(OUTLINE_MSABI_XLOGUES) Save
+Reduces function size by using out-of-line stubs to save & restore registers
+clobberd by differences in Microsoft and System V ABIs.
+
 mveclibabi=
 Target RejectNegative Joined Var(ix86_veclibabi_type) Enum(ix86_veclibabi) 
Init(ix86_veclibabi_type_none)
 Vector library ABI to use.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4b13aeb7426..901abbf99d6 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1210,7 +1210,7 @@ See RS/6000 and PowerPC Options.
 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv @gol
 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store @gol
 -malign-data=@var{type}  -mstack-protector-guard=@var{guard} @gol
--mmitigate-rop  -mgeneral-regs-only}
+-mmitigate-rop  -mgeneral-regs-only  -moutline-msabi-xlogues}
 
 @emph{x86 Windows Options}
 @gccoptlist{-mconsole  -mcygwin  -mno-cygwin  -mdll @gol
@@ -25304,6 +25304,15 @@ You can control this behavior for specific functions by
 using the function attributes @code{ms_abi} and @code{sysv_abi}.
 @xref{Function Attributes}.
 
+@item -moutline-msabi-xlogues
+@opindex moutline-msabi-xlogues
+@opindex no-moutline-msabi-xlogues
+Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
+SysV ABI function must consider RSI, RDI and XMM6-15 as clobbered, emitting
+fairly lengthy prologues and epilogues.  This option generates prologues and
+epilogues that instead call stubs in libgcc to perform these saves & restores,
+thus reducing function size at the cost of and few extra instructions.
+
 @item -mtls-dialect=@var{type}
 @opindex mtls-dialect
 Generate code to access thread-local storage using the @samp{gnu} or
-- 
2.11.0