/opt/winchester/mcore/mcore-elf/bin/mcore-elf-gcc-4.0.0 -v --save-temps 
lshrdi-1.c
Using built-in specs.
Target: mcore-elf
Configured with: ../../src/gcc/gcc-4.0.0/configure --target=mcore-elf
--prefix=/opt/winchester/mcore/mcore-elf/ --enable-languages=c --with-newlib
Thread model: single
gcc version 4.0.0
 /opt/winchester/mcore/mcore-elf/bin/../libexec/gcc/mcore-elf/4.0.0/cc1 -E
-quiet -v -iprefix
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/ lshrdi-1.c
-funsigned-bitfields -fpch-preprocess -o lshrdi-1.i
ignoring nonexistent directory
"/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/sys-include"
ignoring duplicate directory
"/opt/winchester/mcore/mcore-elf//lib/gcc/mcore-elf/4.0.0/include"
ignoring nonexistent directory
"/opt/winchester/mcore/mcore-elf//lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/sys-include"
ignoring duplicate directory
"/opt/winchester/mcore/mcore-elf//lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/include
 
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/include
End of search list.
 /opt/winchester/mcore/mcore-elf/bin/../libexec/gcc/mcore-elf/4.0.0/cc1
-fpreprocessed lshrdi-1.i -funsigned-bitfields -quiet -dumpbase lshrdi-1.c
-auxbase lshrdi-1 -version -o lshrdi-1.s
GNU C version 4.0.0 (mcore-elf)
        compiled by GNU C version 3.3.5 (Debian 1:3.3.5-8).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=129126
 
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/bin/as
-o lshrdi-1.o lshrdi-1.s
 /opt/winchester/mcore/mcore-elf/bin/../libexec/gcc/mcore-elf/4.0.0/collect2 -X
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/lib/crt0.o
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/crti.o
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/crtbegin.o
-L/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0
-L/opt/winchester/mcore/mcore-elf/bin/../lib/gcc
-L/opt/winchester/mcore/mcore-elf//lib/gcc/mcore-elf/4.0.0
-L/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/lib
-L/opt/winchester/mcore/mcore-elf//lib/gcc/mcore-elf/4.0.0/../../../../mcore-elf/lib
lshrdi-1.o -lgcc -lc -lgcc -lsim
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/crtend.o
/opt/winchester/mcore/mcore-elf/bin/../lib/gcc/mcore-elf/4.0.0/crtn.o


The assembly code for this is incorrect.  Specifically, the following gets
generated for variable_shift:

        .type   variable_shift, @function
variable_shift:
        subi    sp,32
        stw     r8,(sp,24)
        mov     r8,sp
        stw     r2,(r8)
        stw     r3,(r8,4)
        stw     r4,(r8,8)
        ldw     r7,(r8,8)
        movi    r6,32
        and     r7,r6
        cmpnei  r7,0
        jbf     .L2

### Here if we didn't jump to .L2 we are shifting by more than 32, so we should
just take the high word and shift it by (the shift value - 32), but we shift it
by the shift value itself, which results in 0.

        ldw     r6,(r8,4)
        ldw     r7,(r8,8)
        lsr     r6,r7
        stw     r6,(r8,16)
        movi    r7,0
        stw     r7,(r8,20)
        jbr     .L3

-- 
           Summary: MCore testsuite file gcc.c-torture/execute/lshrdi3-1.c
                    compiles to incorrect assembly
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: winchester at amirix dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mcore-unknown-elf


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

Reply via email to