This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Emit vzerouppers after reload
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org, Uros Bizjak <ubizjak at gmail dot com>
- Date: Tue, 2 Nov 2010 15:06:02 -0700
- Subject: Re: PATCH: Emit vzerouppers after reload
- References: <20101102180606.GA4551@intel.com> <20101102213517.GA9519@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Tue, Nov 02, 2010 at 02:35:17PM -0700, H.J. Lu wrote:
> On Tue, Nov 02, 2010 at 11:06:06AM -0700, H.J. Lu wrote:
> > Hi,
> >
> > This patch changes vzeroupper optimization to emit vzerouppers after
> > reload. I checked in it as approved by Uros offline.
> >
> > Thanks.
> >
> >
> > H.J.
> > ---
> > gcc/
> >
> > 2010-11-02 Uros Bizjak <ubizjak@gmail.com>
> > H.J. Lu <hongjiu.lu@intel.com>
> >
> > * config/i386/i386-protos.h (ix86_split_call_vzeroupper): New.
> > (ix86_split_call_pop_vzeroupper): Likewise.
> >
> > * config/i386/i386.c (move_or_delete_vzeroupper_2): Rewrite
> > the loop.
> > (ix86_expand_call): Use UNSPEC_CALL_NEEDS_VZEROUPPER.
> > (ix86_split_call_vzeroupper): New.
> > (ix86_split_call_pop_vzeroupper): Likewise.
> >
> > * config/i386/i386.md (UNSPEC_CALL_NEEDS_VZEROUPPER): New.
> > (*call_pop_0_vzeroupper): Likewise.
> > (*call_pop_1_vzeroupper): Likewise.
> > (*sibcall_pop_1_vzeroupper): Likewise.
> > (*call_0_vzeroupper): Likewise.
> > (*call_1_vzeroupper): Likewise.
> > (*sibcall_1_vzeroupper): Likewise.
> > (*call_1_rex64_vzeroupper): Likewise.
> > (*call_1_rex64_ms_sysv_vzeroupper): New.
> > (*call_1_rex64_large_vzeroupper): Likewise.
> > (*sibcall_1_rex64_vzeroupper): Likewise.
> > (*call_value_pop_0_vzeroupper): New.
> > (*call_value_pop_1_vzeroupper): Likewise.
> > (*sibcall_value_pop_1_vzeroupper): Likewise.
> > (*call_value_0_vzeroupper): New.
> > (*call_value_0_rex64_vzeroupper): Use
> > (*call_value_0_rex64_ms_sysv_vzeroupper): Likewise.
> > (*call_value_1_vzeroupper): Likewise.
> > (*sibcall_value_1_vzeroupper): Likewise.
> > (*call_value_1_rex64_vzeroupper): Likewise.
> > (*call_value_1_rex64_ms_sysv_vzeroupper): Likewise.
> > (*call_value_1_rex64_large_vzeroupper): Likewise.
> > (*sibcall_value_1_rex64_vzeroupper): Likewise.
> >
>
> I checkec in this patch as an obvious fix to correct a typo.
>
>
ix86_split_call_pop_vzeroupper isn't needed. call pop vzeroupper
patterns should use parallel and just call ix86_split_call_vzeroupper.
Checked in as an obvious fix.
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 166215)
+++ ChangeLog (working copy)
@@ -1,5 +1,20 @@
2010-11-02 H.J. Lu <hongjiu.lu@intel.com>
+ * config/i386/i386-protos.h (ix86_split_call_pop_vzeroupper):
+ Removed.
+ * config/i386/i386.c (ix86_split_call_pop_vzeroupper): Likewise.
+
+ * config/i386/i386.md (*call_pop_0_vzeroupper): Use parallel
+ and call ix86_split_call_vzeroupper instead of
+ ix86_split_call_pop_vzeroupper.
+ (*call_pop_1_vzeroupper): Likewise.
+ (*sibcall_pop_1_vzeroupper): Likewise.
+ (*call_value_pop_0_vzeroupper): Likewise.
+ (*call_value_pop_1_vzeroupper): Likewise.
+ (*sibcall_value_pop_1_vzeroupper): Likewise.
+
+2010-11-02 H.J. Lu <hongjiu.lu@intel.com>
+
* config/i386/i386.md (*sibcall_1_rex64_vzeroupper): Fix a
typo.
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 166215)
+++ config/i386/i386.md (working copy)
@@ -11262,18 +11262,19 @@
})
(define_insn_and_split "*call_pop_0_vzeroupper"
- [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" ""))
- (match_operand:SI 1 "" ""))
- (set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG)
- (match_operand:SI 2 "immediate_operand" "")))
+ [(parallel
+ [(call (mem:QI (match_operand:SI 0 "constant_call_address_operand" ""))
+ (match_operand:SI 1 "" ""))
+ (set (reg:SI SP_REG)
+ (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 2 "immediate_operand" "")))])
(unspec [(match_operand 3 "const_int_operand" "")]
UNSPEC_CALL_NEEDS_VZEROUPPER)]
"TARGET_VZEROUPPER && !TARGET_64BIT"
"#"
"&& reload_completed"
[(const_int 0)]
- "ix86_split_call_pop_vzeroupper (curr_insn, operands[3]); DONE;"
+ "ix86_split_call_vzeroupper (curr_insn, operands[3]); DONE;"
[(set_attr "type" "call")])
(define_insn "*call_pop_0"
@@ -11292,18 +11293,19 @@
[(set_attr "type" "call")])
(define_insn_and_split "*call_pop_1_vzeroupper"
- [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lsm"))
- (match_operand:SI 1 "" ""))
- (set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG)
- (match_operand:SI 2 "immediate_operand" "i")))
+ [(parallel
+ [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lsm"))
+ (match_operand:SI 1 "" ""))
+ (set (reg:SI SP_REG)
+ (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 2 "immediate_operand" "i")))])
(unspec [(match_operand 3 "const_int_operand" "")]
UNSPEC_CALL_NEEDS_VZEROUPPER)]
"TARGET_VZEROUPPER && !TARGET_64BIT && !SIBLING_CALL_P (insn)"
"#"
"&& reload_completed"
[(const_int 0)]
- "ix86_split_call_pop_vzeroupper (curr_insn, operands[3]); DONE;"
+ "ix86_split_call_vzeroupper (curr_insn, operands[3]); DONE;"
[(set_attr "type" "call")])
(define_insn "*call_pop_1"
@@ -11321,18 +11323,19 @@
[(set_attr "type" "call")])
(define_insn_and_split "*sibcall_pop_1_vzeroupper"
- [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,U"))
- (match_operand:SI 1 "" ""))
- (set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG)
- (match_operand:SI 2 "immediate_operand" "i,i")))
+ [(parallel
+ [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,U"))
+ (match_operand:SI 1 "" ""))
+ (set (reg:SI SP_REG)
+ (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 2 "immediate_operand" "i,i")))])
(unspec [(match_operand 3 "const_int_operand" "")]
UNSPEC_CALL_NEEDS_VZEROUPPER)]
"TARGET_VZEROUPPER && !TARGET_64BIT && SIBLING_CALL_P (insn)"
"#"
"&& reload_completed"
[(const_int 0)]
- "ix86_split_call_pop_vzeroupper (curr_insn, operands[3]); DONE;"
+ "ix86_split_call_vzeroupper (curr_insn, operands[3]); DONE;"
[(set_attr "type" "call")])
(define_insn "*sibcall_pop_1"
@@ -17269,19 +17272,20 @@
;; disrupt insn-recog's switch tables.
(define_insn_and_split "*call_value_pop_0_vzeroupper"
- [(set (match_operand 0 "" "")
- (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
- (match_operand:SI 2 "" "")))
- (set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG)
- (match_operand:SI 3 "immediate_operand" "")))
+ [(parallel
+ [(set (match_operand 0 "" "")
+ (call (mem:QI (match_operand:SI 1 "constant_call_address_operand" ""))
+ (match_operand:SI 2 "" "")))
+ (set (reg:SI SP_REG)
+ (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 3 "immediate_operand" "")))])
(unspec [(match_operand 4 "const_int_operand" "")]
UNSPEC_CALL_NEEDS_VZEROUPPER)]
"TARGET_VZEROUPPER && !TARGET_64BIT"
"#"
"&& reload_completed"
[(const_int 0)]
- "ix86_split_call_pop_vzeroupper (curr_insn, operands[4]); DONE;"
+ "ix86_split_call_vzeroupper (curr_insn, operands[4]); DONE;"
[(set_attr "type" "callv")])
(define_insn "*call_value_pop_0"
@@ -17296,19 +17300,20 @@
[(set_attr "type" "callv")])
(define_insn_and_split "*call_value_pop_1_vzeroupper"
- [(set (match_operand 0 "" "")
- (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lsm"))
- (match_operand:SI 2 "" "")))
- (set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG)
- (match_operand:SI 3 "immediate_operand" "i")))
+ [(parallel
+ [(set (match_operand 0 "" "")
+ (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lsm"))
+ (match_operand:SI 2 "" "")))
+ (set (reg:SI SP_REG)
+ (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 3 "immediate_operand" "i")))])
(unspec [(match_operand 4 "const_int_operand" "")]
UNSPEC_CALL_NEEDS_VZEROUPPER)]
"TARGET_VZEROUPPER && !TARGET_64BIT && !SIBLING_CALL_P (insn)"
"#"
"&& reload_completed"
[(const_int 0)]
- "ix86_split_call_pop_vzeroupper (curr_insn, operands[4]); DONE;"
+ "ix86_split_call_vzeroupper (curr_insn, operands[4]); DONE;"
[(set_attr "type" "callv")])
(define_insn "*call_value_pop_1"
@@ -17323,19 +17328,20 @@
[(set_attr "type" "callv")])
(define_insn_and_split "*sibcall_value_pop_1_vzeroupper"
- [(set (match_operand 0 "" "")
- (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,U"))
- (match_operand:SI 2 "" "")))
- (set (reg:SI SP_REG)
- (plus:SI (reg:SI SP_REG)
- (match_operand:SI 3 "immediate_operand" "i,i")))
+ [(parallel
+ [(set (match_operand 0 "" "")
+ (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,U"))
+ (match_operand:SI 2 "" "")))
+ (set (reg:SI SP_REG)
+ (plus:SI (reg:SI SP_REG)
+ (match_operand:SI 3 "immediate_operand" "i,i")))])
(unspec [(match_operand 4 "const_int_operand" "")]
UNSPEC_CALL_NEEDS_VZEROUPPER)]
"TARGET_VZEROUPPER && !TARGET_64BIT && SIBLING_CALL_P (insn)"
"#"
"&& reload_completed"
[(const_int 0)]
- "ix86_split_call_pop_vzeroupper (curr_insn, operands[4]); DONE;"
+ "ix86_split_call_vzeroupper (curr_insn, operands[4]); DONE;"
[(set_attr "type" "callv")])
(define_insn "*sibcall_value_pop_1"
Index: config/i386/i386-protos.h
===================================================================
--- config/i386/i386-protos.h (revision 166214)
+++ config/i386/i386-protos.h (working copy)
@@ -120,7 +120,6 @@ extern void ix86_expand_sse4_unpack (rtx
extern bool ix86_expand_int_addcc (rtx[]);
extern rtx ix86_expand_call (rtx, rtx, rtx, rtx, rtx, int);
extern void ix86_split_call_vzeroupper (rtx, rtx);
-extern void ix86_split_call_pop_vzeroupper (rtx, rtx);
extern void x86_initialize_trampoline (rtx, rtx, rtx);
extern rtx ix86_zero_extend_to_Pmode (rtx);
extern void ix86_split_long_move (rtx[]);
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 166214)
+++ config/i386/i386.c (working copy)
@@ -21561,16 +21561,6 @@ ix86_split_call_vzeroupper (rtx insn, rt
emit_call_insn (call);
}
-void
-ix86_split_call_pop_vzeroupper (rtx insn, rtx vzeroupper)
-{
- rtx call = XVECEXP (PATTERN (insn), 0, 0);
- rtx pop = XVECEXP (PATTERN (insn), 0, 1);
- emit_insn (gen_avx_vzeroupper (vzeroupper));
- emit_call_insn (gen_rtx_PARALLEL (VOIDmode,
- gen_rtvec (2, call, pop)));
-}
-
/* Output the assembly for a call instruction. */
const char *