This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/51954] New: __int128_t negation can be optimized


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

             Bug #: 51954
           Summary: __int128_t negation can be optimized
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: svfuerst@gmail.com


__int128_t neg(__int128_t x)
{
    return -x;
}

Compiles into with -O3 :

mov    %rdi, %rax
mov    %rsi, %rdx
neg    %rax
adc    $0x0, %rdx
neg    %rdx
retq

Note how the last three instructions before the return are dependent on each
other.  This can be  slightly improved with slightly more inter-instruction
parallelism:

mov    %rdi, %rax
mov    %rsi, %rdx
neg    %rdx
neg    %rax
sbb    $0x0, %rdx
retq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]