[Bug target/70903] New: [4.9/5/6/7 Regression] wrong code with bfi @ aarch64 with -Os

zsojka at seznam dot cz gcc-bugzilla@gcc.gnu.org
Mon May 2 11:05:00 GMT 2016


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

            Bug ID: 70903
           Summary: [4.9/5/6/7 Regression] wrong code with bfi @ aarch64
                    with -Os
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: aarch64-unknown-linux-gnu

Created attachment 38392
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38392&action=edit
reduced testcase

Output:
$ aarch64-unknown-linux-gnu-gcc -v               
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-235588-checking-yes-rtl-df-nographite-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/7.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-checking=yes,rtl,df --without-cloog --without-ppl --without-isl
--with-sysroot=/usr/aarch64-unknown-linux-gnu
--target=aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu
--with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld
--with-as=/usr/bin/aarch64-unknown-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-235588-checking-yes-rtl-df-nographite-aarch64
Thread model: posix
gcc version 7.0.0 20160428 (experimental) (GCC) 

$ aarch64-unknown-linux-gnu-gcc -Os testcase.c
$ ./a.out 
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

$ diff -u testcase.s testcase.s.fixed 
--- testcase.s  2016-05-02 12:57:29.920221842 +0200
+++ testcase.s.fixed    2016-05-02 12:52:41.060217727 +0200
@@ -59,7 +59,7 @@
        adrp    x1, .LC0        // tmp87,
        mov     x0, x8  // tmp82,
        add     x4, x1, :lo12:.LC0      // tmp86, tmp87,
-       mov     x8, -1  // tmp95,
+       mov     x8, 255 // tmp95,
        mov     x3, 0   // D.2757,
        mov     x2, 0   // D.2757,
        bfi     x3, x8, 0, 8    // D.2757, tmp95,,

fixes the assembly for this particular testcase.

While (u8)255 == (u8)-1, x8==-1 cannot be used for 32bit load.


More information about the Gcc-bugs mailing list