From: Uros Bizjak Date: Thu, 5 May 2016 22:48:29 +0000 (+0200) Subject: re PR target/70873 ([7 Regressio] 20% performance regression at 482.sphinx3 after... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38302a21028c448f1082f2cad5d1f36c78559138;p=gcc.git re PR target/70873 ([7 Regressio] 20% performance regression at 482.sphinx3 after r235442 with -O2 -m32 on Haswell.) PR target/70873 * config/i386/i386-protos.h (ix86_standard_x87sse_constant_load_p): New prototype. * config/i386/i386.c (ix86_standard_x87sse_constant_load_p): New. * config/i386/i386.md (push mem splitter): Use find_constant_src in the splitter condition. (FP load splitter): Use ix86_standard_x87sse_constant_load_p in the splitter condition. (FP float_extend load splitter): Ditto. From-SVN: r235936 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 230f5d34e82..6bf86daa042 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,8 +1,20 @@ +2016-05-06 Uros Bizjak + + PR target/70873 + * config/i386/i386-protos.h (ix86_standard_x87sse_constant_load_p): + New prototype. + * config/i386/i386.c (ix86_standard_x87sse_constant_load_p): New. + * config/i386/i386.md (push mem splitter): Use find_constant_src in + the splitter condition. + (FP load splitter): Use ix86_standard_x87sse_constant_load_p in + the splitter condition. + (FP float_extend load splitter): Ditto. + 2016-05-05 Uros Bizjak * config/i386/i386.md (peehole2 patterns): Change true_regnum - to REGNUM in all peephole2 patterns. - (post-reload splitters): Change true_regnum to REGNUM in + to REGNO in all peephole2 patterns. + (post-reload splitters): Change true_regnum to REGNO in post-reload splitters. (zero_extend splitters): Use general_reg_operand and nonimmediate_gr_operand predicates. diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 4145ed56658..447f67e2dff 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -52,6 +52,7 @@ extern const char *standard_80387_constant_opcode (rtx); extern rtx standard_80387_constant_rtx (int); extern int standard_sse_constant_p (rtx, machine_mode); extern const char *standard_sse_constant_opcode (rtx_insn *, rtx); +extern bool ix86_standard_x87sse_constant_load_p (const rtx_insn *, rtx); extern bool symbolic_reference_mentioned_p (rtx); extern bool extended_reg_mentioned_p (rtx); extern bool x86_extended_QIreg_mentioned_p (rtx_insn *); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9680aaf3f50..05476f37449 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -11219,6 +11219,26 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx x) gcc_unreachable (); } +/* Returns true if INSN can be transformed from a memory load + to a supported FP constant load. */ + +bool +ix86_standard_x87sse_constant_load_p (const rtx_insn *insn, rtx dst) +{ + rtx src = find_constant_src (insn); + + gcc_assert (REG_P (dst)); + + if (src == NULL + || (SSE_REGNO_P (REGNO (dst)) + && standard_sse_constant_p (src, GET_MODE (dst)) != 1) + || (STACK_REGNO_P (REGNO (dst)) + && standard_80387_constant_p (src) < 1)) + return false; + + return true; +} + /* Returns true if OP contains a symbol reference */ bool diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 22ad8221ef8..0bf01ab1fad 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -3072,14 +3072,10 @@ (define_split [(set (match_operand:SF 0 "push_operand") (match_operand:SF 1 "memory_operand"))] - "reload_completed" + "reload_completed + && find_constant_src (insn)" [(set (match_dup 0) (match_dup 2))] -{ - operands[2] = find_constant_src (curr_insn); - - if (operands[2] == NULL_RTX) - FAIL; -}) + "operands[2] = find_constant_src (curr_insn);") (define_split [(set (match_operand 0 "push_operand") @@ -3601,19 +3597,10 @@ && (GET_MODE (operands[0]) == TFmode || GET_MODE (operands[0]) == XFmode || GET_MODE (operands[0]) == DFmode - || GET_MODE (operands[0]) == SFmode)" + || GET_MODE (operands[0]) == SFmode) + && ix86_standard_x87sse_constant_load_p (insn, operands[0])" [(set (match_dup 0) (match_dup 2))] -{ - operands[2] = find_constant_src (curr_insn); - - if (operands[2] == NULL_RTX - || (SSE_REGNO_P (REGNO (operands[0])) - && standard_sse_constant_p (operands[2], - GET_MODE (operands[0])) != 1) - || (STACK_REGNO_P (REGNO (operands[0])) - && standard_80387_constant_p (operands[2]) < 1)) - FAIL; -}) + "operands[2] = find_constant_src (curr_insn);") (define_split [(set (match_operand 0 "any_fp_register_operand") @@ -3621,19 +3608,10 @@ "reload_completed && (GET_MODE (operands[0]) == TFmode || GET_MODE (operands[0]) == XFmode - || GET_MODE (operands[0]) == DFmode)" + || GET_MODE (operands[0]) == DFmode) + && ix86_standard_x87sse_constant_load_p (insn, operands[0])" [(set (match_dup 0) (match_dup 2))] -{ - operands[2] = find_constant_src (curr_insn); - - if (operands[2] == NULL_RTX - || (SSE_REGNO_P (REGNO (operands[0])) - && standard_sse_constant_p (operands[2], - GET_MODE (operands[0])) != 1) - || (STACK_REGNO_P (REGNO (operands[0])) - && standard_80387_constant_p (operands[2]) < 1)) - FAIL; -}) + "operands[2] = find_constant_src (curr_insn);") ;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence (define_split