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 middle-end/17958] expand_divmod fails to optimize division of 64-bit quantity by small constant when BITS_PER_WORD is 32


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17958

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2007-07-02 21:30:35         |2016-1-27
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |4.8.3, 4.9.3, 5.3.0, 6.0

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
It doesn't look like the patch referenced in comment #2 was ever committed and
the 32-bit code still emits a call to __divdi3, not just on powerpc but also on
x86_64.  This affects all still supported GCC versions.

$ cat ~/tmp/t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -O2 -S
-Wall -Wextra -Wpedantic -m32 -o/dev/stdout ~/tmp/t.c
long long div10(long long n) { return n / 10; }
        .file   "t.c"
        .machine power4
        .globl __divdi3
        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl div10
        .type   div10, @function
div10:
        stwu 1,-16(1)
        li 5,0
        mflr 0
        li 6,10
        stw 0,20(1)
        bl __divdi3
        lwz 0,20(1)
        addi 1,1,16
        mtlr 0
        blr
        .size   div10,.-div10
        .ident  "GCC: (GNU) 6.0.0 20160125 (experimental)"
        .section        .note.GNU-stack,"",@progbits

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