[Bug target/45548] Add with carry - missed optimization on x86

2021-09-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45548

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |11.0

[Bug target/45548] Add with carry - missed optimization on x86

2021-06-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45548

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
This is all fixed in GCC 11 at least.

[Bug target/45548] Add with carry - missed optimization on x86

2010-09-12 Thread tmartsum at gmail dot com


--- Comment #2 from tmartsum at gmail dot com  2010-09-12 15:01 ---
With Subtraction the situation is very similar:

struct Skew1 // Even
{
  unsigned long long data;
  unsigned long unused;
};

struct Skew2 // Odd
{
  unsigned long unused;
  unsigned long long data;
};

struct ULongLongLong
{
  union
  {
unsigned long m_data[3];
Skew1 m_rep1;
Skew2 m_rep2;
  };
  ULongLongLong()
  {
m_data[0]=0;
m_data[1]=0;
m_data[2]=0;
  }
  void print() {  std::cout << m_data[0] << "," << m_data[1] << "," <<
m_data[2] << "\n";}
//  void addtest(const ULongLongLong &b); // operator += 
  void subtest(const ULongLongLong &b); // operator -=   
};

It gives the following code:

.globl _ZN13ULongLongLong7subtestERKS_
.type   _ZN13ULongLongLong7subtestERKS_, @function
_ZN13ULongLongLong7subtestERKS_:
.LFB965:
.cfi_startproc
.cfi_personality 0x0,__gxx_personality_v0
pushl   %ebp
.cfi_def_cfa_offset 8
movl%esp, %ebp
.cfi_offset 5, -8
.cfi_def_cfa_register 5
movl12(%ebp), %edx
movl8(%ebp), %eax
pushl   %ebx
xorl%ebx, %ebx
.cfi_offset 3, -12
movl(%edx), %ecx
subl%ecx, (%eax)
sbbl%ebx, 4(%eax)
xorl%ebx, %ebx
movl4(%edx), %ecx
subl%ecx, 4(%eax)
sbbl%ebx, 8(%eax)
movl8(%edx), %edx
subl%edx, 8(%eax)
popl%ebx
popl%ebp
ret
.cfi_endproc

This could be optimized (just like the addition).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45548



[Bug target/45548] Add with carry - missed optimization on x86

2010-09-05 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2010-09-05 22:15 ---
Confirmed. zero_extendsidi2_32 and  adddi3_doubleword are being split too late.
 Which causes no optimizations to happen on those two things.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||missed-optimization
   Last reconfirmed|-00-00 00:00:00 |2010-09-05 22:15:50
   date||
Summary|Add with carry - missed |Add with carry - missed
   |optimization|optimization on x86


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45548