[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-14 Thread thutt at vmware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #7 from thutt at vmware dot com ---
(In reply to Uroš Bizjak from comment #6)
 (In reply to thutt from comment #5)
  
  Does the same error exist in the 4.8 branch, or any other forward moving
  branch?
 
 No, 4.8 and newer branches already contain the original patch.

Sorry to be a bother, but can you tell me if the issue was / is in the 4.4
branch?

[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-14 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #8 from Uroš Bizjak ubizjak at gmail dot com ---
(In reply to thutt from comment #7)
 (In reply to Uroš Bizjak from comment #6)
  (In reply to thutt from comment #5)
   
   Does the same error exist in the 4.8 branch, or any other forward moving
   branch?
  
  No, 4.8 and newer branches already contain the original patch.
 
 Sorry to be a bother, but can you tell me if the issue was / is in the 4.4
 branch?

Yes, cld was removed in 4.3.0. Please see PR36079 that introduced -mcld.

[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-14 Thread thutt at vmware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #9 from thutt at vmware dot com ---
(In reply to Uroš Bizjak from comment #8)
 (In reply to thutt from comment #7)
  (In reply to Uroš Bizjak from comment #6)
   (In reply to thutt from comment #5)

Does the same error exist in the 4.8 branch, or any other forward moving
branch?
   
   No, 4.8 and newer branches already contain the original patch.
  
  Sorry to be a bother, but can you tell me if the issue was / is in the 4.4
  branch?
 
 Yes, cld was removed in 4.3.0. Please see PR36079 that introduced -mcld.

When the sample test program provided above was compiled with gcc 4.4, it did
not generate the stos instruction.  However, each of 4.5, 4.6 and 4.7 did
generate the stos instruction.

Given this, I'd like to clarify your answer.  If I may summarize:

  4.3.0 stopped using cld.
  After cld was not used, an error existed in versions 4.4, 4.5, 4.6 and 4.7.
  The error was fixed in 4.8.
  You have backported the fix from 4.8 to 4.7.
  You did not backport to 4.5 and 4.6 because they are closed.
  You do not state, but I infer that 4.4 is also closed.

Do you have an idea why the test case does not demonstrate the error on 4.4?
Is there a test case that will demonstrate the error on 4.4?

Thanks for your help and patience

[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-14 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #10 from Uroš Bizjak ubizjak at gmail dot com ---
(In reply to thutt from comment #9)

 When the sample test program provided above was compiled with gcc 4.4, it
 did not generate the stos instruction.  However, each of 4.5, 4.6 and 4.7
 did generate the stos instruction.
 
 Given this, I'd like to clarify your answer.  If I may summarize:
 
   4.3.0 stopped using cld.

Yes.

   After cld was not used, an error existed in versions 4.4, 4.5, 4.6 and 4.7.

This was not an error, x86 ABI specifies that direction flag has to be cleared.
As a convenient feature, -mcld was introduced to fix non-conforming binaries
that played tricks with x86 direction flag.

   The error was fixed in 4.8.

4.8 fixed this issue as a secondary effect of some other bugfix.

   You have backported the fix from 4.8 to 4.7.

Yes.

   You did not backport to 4.5 and 4.6 because they are closed.

Yes.

   You do not state, but I infer that 4.4 is also closed.

Yes.

 Do you have an idea why the test case does not demonstrate the error on 4.4?
 Is there a test case that will demonstrate the error on 4.4?

As you have found out, the test is very fragile and depends on exact code
sequence of two consecutive instructions. This sequence is recognized in
combine pass as STOSL instruction. However, the dependence of STOSL on
direction flag is not modelled in the compiler, since it is not necessary for
ABI conformant binaries. In 4.4, the generated sequence is probably slightly
different, and for this reason not recognized as STOSL.

[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-13 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

Uros Bizjak ubizjak at gmail dot com changed:

   What|Removed |Added

 Target||x86
 Status|UNCONFIRMED |NEW
Version|unknown |4.7.3
   Last reconfirmed||2013-05-13
  Component|c   |target
 CC||ubizjak at gmail dot com
 Ever confirmed|0   |1
   Target Milestone|--- |4.7.4

--- Comment #1 from Uros Bizjak ubizjak at gmail dot com ---
The stosl insn is created by the combine pass, not via expander, so flag that
triggers the cld insertion is not set. I propose to backport r195381 to disable
unwanted insn combination.

Can you please test the backport?


[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-13 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

Uros Bizjak ubizjak at gmail dot com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com

--- Comment #2 from Uros Bizjak ubizjak at gmail dot com ---
I am preparing the backport.


[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-13 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #3 from Uros Bizjak ubizjak at gmail dot com ---
Author: uros
Date: Mon May 13 17:14:26 2013
New Revision: 198837

URL: http://gcc.gnu.org/viewcvs?rev=198837root=gccview=rev
Log:
PR target/57264
Backport from mainline
2013-01-22  Jakub Jelinek  ja...@redhat.com

PR target/55686
* config/i386/i386.md (UNSPEC_STOS): New.
(strset_singleop, *strsetdi_rex_1, *strsetsi_1, *strsethi_1,
*strsetqi_1): Add UNSPEC_STOS.

testsuite/ChangeLog:

PR target/57264
* gcc.target/i386/pr57264.c: New test.


Added:
branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr57264.c
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/config/i386/i386.md
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-13 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

Uros Bizjak ubizjak at gmail dot com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
URL||http://gcc.gnu.org/ml/gcc-p
   ||atches/2013-05/msg00655.htm
   ||l
 Resolution|--- |FIXED

--- Comment #4 from Uros Bizjak ubizjak at gmail dot com ---
Fixed in 4.7 branch by [1]. 4.5 and 4.6 branches are closed.

[1] http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00655.html


[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-13 Thread thutt at vmware dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #5 from thutt at vmware dot com ---
(In reply to Uros Bizjak from comment #3)
 Author: uros
 Date: Mon May 13 17:14:26 2013
 New Revision: 198837
 
 URL: http://gcc.gnu.org/viewcvs?rev=198837root=gccview=rev
 Log:
   PR target/57264
   Backport from mainline
   2013-01-22  Jakub Jelinek  ja...@redhat.com
 
   PR target/55686
   * config/i386/i386.md (UNSPEC_STOS): New.
   (strset_singleop, *strsetdi_rex_1, *strsetsi_1, *strsethi_1,
   *strsetqi_1): Add UNSPEC_STOS.
 
 testsuite/ChangeLog:
 
   PR target/57264
   * gcc.target/i386/pr57264.c: New test.
 
 
 Added:
 branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr57264.c
 Modified:
 branches/gcc-4_7-branch/gcc/ChangeLog
 branches/gcc-4_7-branch/gcc/config/i386/i386.md
 branches/gcc-4_7-branch/gcc/testsuite/ChangeLog

Does the same error exist in the 4.8 branch, or any other forward moving
branch?

[Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line

2013-05-13 Thread ubizjak at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57264

--- Comment #6 from Uros Bizjak ubizjak at gmail dot com ---
(In reply to thutt from comment #5)
 
 Does the same error exist in the 4.8 branch, or any other forward moving
 branch?

No, 4.8 and newer branches already contain the original patch.