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/60473] optimization after shift sub-optimal


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

--- Comment #1 from Martin <marmoo1024 at gmail dot com> ---
After some checking I've found that the problem is with the binary OR operator.
Addition doesn't have a problem but or does. Here are my results.

unsigned long long **_rdtsc_64 () {
        unsigned long long h,l;
        asm volatile ("rdtsc" : "=a" (l), "=d" (h) );
        return **;
}

x1_rdtsc_64():
        rdtsc                           ; return l + h*(0x100000000LLU)
        salq    $32, %rdx
        addq    %rdx, %rax
        ret
x2_rdtsc_64():
        rdtsc                           ; return l | h*(0x100000000LLU) 
        salq    $32, %rdx
        orq     %rax, %rdx
        movq    %rdx, %rax
        ret
x3_rdtsc_64():
        rdtsc                           ; return l + (h<<32)
        salq    $32, %rdx
        addq    %rdx, %rax
        ret
x4_rdtsc_64():
        rdtsc                           ; return l | (h<<32)
        salq    $32, %rdx
        orq     %rax, %rdx
        movq    %rdx, %rax
        ret


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