[Bug target/86763] [8/9 Regression] Wrong code comparing member of copy of a 237 byte object with nontrivial default constructor on x86-64 arch

2018-08-01 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86763

--- Comment #4 from Uroš Bizjak  ---
(In reply to Richard Biener from comment #3)
> see how the compare is moved very far away from the branch possibly across
> flag clobbering insns (rep movsq?).  Target sounds good.

No, rep movsq doesn't clobber flags [1].

[1] http://www.felixcloutier.com/x86/MOVS:MOVSB:MOVSW:MOVSD:MOVSQ.html

[Bug target/86763] [8/9 Regression] Wrong code comparing member of copy of a 237 byte object with nontrivial default constructor on x86-64 arch

2018-08-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86763

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
 Target|x86_64- |x86_64-*-*
   Priority|P3  |P2
 CC||uros at gcc dot gnu.org
   Target Milestone|--- |8.3

--- Comment #3 from Richard Biener  ---
RTL expansion shows different alignment of some stack vars, -O1
-fstrict-aliasing is also broken.  Assembler difference -O1 vs. -O2 is

 main:
@@ -45,24 +48,24 @@
subq$488, %rsp
.cfi_def_cfa_offset 496
call_Z8init_msgv
-   movq%rax, (%rsp)
-   movq%rdx, 8(%rsp)
-   leaq240(%rsp), %rdi
-   movq%rsp, %rsi
+   movq%rsp, %rdi
movl$29, %ecx
+   leaq240(%rsp), %rsi
+   movq%rax, 240(%rsp)
+   cmpq$1001, 8(%rsp)
+   movq%rdx, 248(%rsp)
rep movsq
movl(%rsi), %eax
movl%eax, (%rdi)
movzbl  4(%rsi), %eax
movb%al, 4(%rdi)
-   cmpq$1001, 248(%rsp)
-   jne .L7
-   movl$0, %eax
+   jne .L8
+   xorl%eax, %eax
addq$488, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
-.L7:
+.L8:
.cfi_restore_state


see how the compare is moved very far away from the branch possibly across
flag clobbering insns (rep movsq?).  Target sounds good.

[Bug target/86763] [8/9 Regression] Wrong code comparing member of copy of a 237 byte object with nontrivial default constructor on x86-64 arch

2018-07-31 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86763

H.J. Lu  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com,
   ||mjambor at suse dot cz

--- Comment #2 from H.J. Lu  ---
This is caused by r255510.

[Bug target/86763] [8/9 Regression] Wrong code comparing member of copy of a 237 byte object with nontrivial default constructor on x86-64 arch

2018-07-31 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86763

Marc Glisse  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-07-31
Summary|Wrong code comparing member |[8/9 Regression] Wrong code
   |of copy of a 237 byte   |comparing member of copy of
   |object with nontrivial  |a 237 byte object with
   |default constructor on  |nontrivial default
   |x86-64 arch |constructor on x86-64 arch
 Ever confirmed|0   |1

--- Comment #1 from Marc Glisse  ---
gimple is the same for -O vs -O2, so the issue is either RTL or target.