[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-15 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

Segher Boessenkool  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Segher Boessenkool  ---
Ah, you don't have permission to edit the field.  I backported it to GCC 8
and GCC 7; closing now.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-15 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #13 from Segher Boessenkool  ---
Author: segher
Date: Sat Dec 15 12:07:42 2018
New Revision: 267172

URL: https://gcc.gnu.org/viewcvs?rev=267172&root=gcc&view=rev
Log:
Backport from trunk
2018-12-14  Segher Boessenkool  

PR rtl-optimization/88001
* function.c (match_asm_constraints_1): Don't invalidly share RTL.

Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/function.c

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-15 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #12 from Segher Boessenkool  ---
Author: segher
Date: Sat Dec 15 12:05:08 2018
New Revision: 267171

URL: https://gcc.gnu.org/viewcvs?rev=267171&root=gcc&view=rev
Log:
Backport from trunk
2018-12-14  Segher Boessenkool  

PR rtl-optimization/88001
* function.c (match_asm_constraints_1): Don't invalidly share RTL.

Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/function.c

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-14 Thread vgupta at synopsys dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #11 from Vineet Gupta  ---
Sure, but how can I ? if i click the "known to work" field it takes me to help.

The issue certainly with gcc-8-branch for ARC and presumably also with
tip/trunk.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-14 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #10 from Segher Boessenkool  ---
Sure this can be backported...  But can you fill in known-to-{work,fail}
then please?  Thanks.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-14 Thread vgupta at synopsys dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #9 from Vineet Gupta  ---
Can this be stable backported to gcc-8-branch as well.
glibc folks use that branch for their regular smoke testing and without that
ARC tools don't even build.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-14 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #8 from Segher Boessenkool  ---
Author: segher
Date: Fri Dec 14 08:29:34 2018
New Revision: 267122

URL: https://gcc.gnu.org/viewcvs?rev=267122&root=gcc&view=rev
Log:
match_asm_constraints: Use copy_rtx where needed (PR88001)

The new insn here (temporarily) illegally shares RTL.  This fixes it.


PR rtl-optimization/88001
* function.c (match_asm_constraints_1): Don't invalidly share RTL.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/function.c

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-12 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #7 from Segher Boessenkool  ---
Patch posted at https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00865.html .

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-11 Thread claziss at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #6 from Claudiu Zissulescu  ---
The dejagnu tests for ARC look alright. No extra failures.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-11 Thread vgupta at synopsys dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

Vineet Gupta  changed:

   What|Removed |Added

 CC||vgupta at synopsys dot com

--- Comment #5 from Vineet Gupta  ---
Hi, I'm the ARC glibc maintainer (and desperate for this fix).

The proposed (one liner) patch seems to fix the compiler assert for sue. I'm
still running more tests to make sure it is functional but looks promising.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-11 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #4 from Segher Boessenkool  ---
Claudiu: could you test that patch please?  (On the real thing, not just
this testcase :-) )

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-11 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

--- Comment #3 from Segher Boessenkool  ---
Created attachment 45210
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45210&action=edit
proposed patch

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-12-11 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

Segher Boessenkool  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-12-11
 CC||segher at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Segher Boessenkool  ---
Ah yes, I had release checking there.  Confirmed.

[Bug rtl-optimization/88001] ASMCONS cannot handle properly UNSPEC(CONST)

2018-11-13 Thread claziss at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88001

Claudiu Zissulescu  changed:

   What|Removed |Added

 CC||claziss at gmail dot com

--- Comment #1 from Claudiu Zissulescu  ---
My solution, on a side branch, is this patch, but we need it to run also for
mainline gcc as we cannot build glibc or uclibc toolchains. Any help is
appreciated.

---
 gcc/function.c | 34 +-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/gcc/function.c b/gcc/function.c
index 302438323c8..36227f77074 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6374,6 +6374,37 @@ make_pass_thread_prologue_and_epilogue (gcc::context
*ctxt)
 }


+/* Helper match_asm_constraints_1.  */
+static int
+constant_overlap_mentioned_p (const_rtx x, const_rtx in)
+{
+  const char *fmt;
+  int i, j;
+
+  if (CONST_INT_P (in))
+return 0;
+
+  if (!CONSTANT_P (in))
+return 0;
+
+  if (x == 0)
+return 0;
+
+  if (x == in)
+return 1;
+
+  fmt = GET_RTX_FORMAT (GET_CODE (x));
+  for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
+{
+  if (fmt[i] == 'e')
+return constant_overlap_mentioned_p (XEXP (x, i), in);
+  else if (fmt[i] == 'E')
+   for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+ return constant_overlap_mentioned_p (XVECEXP (x, i, j), in);
+}
+  return 0;
+}
+
 /* This mini-pass fixes fall-out from SSA in asm statements that have
in-out constraints.  Say you start with

@@ -6509,7 +6540,8 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int
noutputs)
  SET_DEST (p_sets[j]) = replace_rtx (SET_DEST (p_sets[j]),
  input, output);
   for (j = 0; j < ninputs; j++)
-   if (reg_overlap_mentioned_p (input, RTVEC_ELT (inputs, j)))
+   if (reg_overlap_mentioned_p (input, RTVEC_ELT (inputs, j))
+   || constant_overlap_mentioned_p (RTVEC_ELT (inputs, j), input))
  RTVEC_ELT (inputs, j) = replace_rtx (RTVEC_ELT (inputs, j),
   input, output);

-- 
2.19.1