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

            Bug ID: 87817
           Summary: [9 Regression] gcc.target/i386/bmi2-bzhi-2.c execution
                    test
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: segher at kernel dot crashing.org
  Target Milestone: ---

On x86-64, r265398 caused:

FAIL: gcc.target/i386/bmi2-bzhi-2.c execution test

on BMI2 machines:

[hjl@gnu-cfl-1 gcc]$
/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/bmi2-bzhi-2.c 
  -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never   -O2 -mbmi2  -lm  -o ./bmi2-bzhi-2.exe  -g
gd[hjl@gnu-cfl-1 gcc]$ gdb ./bmi2-bzhi-2.exe
GNU gdb (GDB) Fedora 8.1.1-3.fc28
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
BFD: warning:
/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/testsuite/gcc/bmi2-bzhi-2.exe:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning:
/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/testsuite/gcc/bmi2-bzhi-2.exe:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
Reading symbols from ./bmi2-bzhi-2.exe...done.
(gdb) r
Starting program:
/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/testsuite/gcc/bmi2-bzhi-2.exe
 
BFD: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5)
type: 0xc0010000
BFD: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5)
type: 0xc0010001
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.27-33.2.fc28.x86_64
BFD: warning: /lib64/libm.so.6: unsupported GNU_PROPERTY_TYPE (5) type:
0xc0010000
BFD: warning: /lib64/libm.so.6: unsupported GNU_PROPERTY_TYPE (5) type:
0xc0010001
BFD: warning: /lib64/libc.so.6: unsupported GNU_PROPERTY_TYPE (5) type:
0xc0010000
BFD: warning: /lib64/libc.so.6: unsupported GNU_PROPERTY_TYPE (5) type:
0xc0010001

Program received signal SIGABRT, Aborted.
0x00007ffff7c874cf in raise () from /lib64/libc.so.6
(gdb) f 2
#2  0x0000000000401045 in bmi2_test ()
    at
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.target/i386/bmi2-bzhi-2.c:56
56          abort ();
(gdb) list
51            || f5 () != 0x7fffffffU || f6 (-1U) != 0x7fffffffU
52            || f7 () != -1U || f8 (-1U) != -1U
53            || f9 () != -1U || f10 (-1U) != -1U
54            || f11 () != 1 || f12 (-1U) != 1
55            || f13 () != -1U || f14 (-1U) != -1U)
56          abort ();
57      #ifdef __x86_64__
58        if (f21 () != 0 || f22 (-1ULL) != 0
59            || f23 () != 0x1f || f24 (-1ULL) != 0x1f
60            || f25 () != 0x7fffffffffffffffULL || f26 (-1ULL) !=
0x7fffffffffffffffULL
(gdb) 

[hjl@gnu-cfl-1 gcc]$ cat /tmp/x.c
#include <x86intrin.h>

__attribute__((noinline, noclone))
unsigned long long
f22 (unsigned long long x)
{
  return _bzhi_u64 (x, 0);
}

int
main ()
{
  if (f22 (-1ULL) != 0)
    abort ();
  return 0;
}
[hjl@gnu-cfl-1 gcc]$  ./xgcc -B./ -O -mbmi2 /tmp/x.c -g
[hjl@gnu-cfl-1 gcc]$ ./a.out 
Aborted
[hjl@gnu-cfl-1 gcc]$ 

[hjl@gnu-cfl-1 gcc]$ cat f.c
#include <x86intrin.h>

unsigned long long
f22 (unsigned long long x)
{
  return _bzhi_u64 (x, 0);
}
[hjl@gnu-cfl-1 gcc]$  ./xgcc -B./ -O -mbmi2 f.c -S
cat[hjl@gnu-cfl-1 gcc]$ cat f.s
        .file   "f.c"
        .text
        .globl  f22
        .type   f22, @function
f22:
.LFB5459:
        .cfi_startproc
        movl    $64, %edx
        shlx    %rdx, %rdi, %rax
        shrx    %rdx, %rax, %rax
        ret
        .cfi_endproc
.LFE5459:
        .size   f22, .-f22
        .ident  "GCC: (GNU) 9.0.0 20181030 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-1 gcc]$ gcc -O -mbmi2 f.c -S
[hjl@gnu-cfl-1 gcc]$ cat f.s
        .file   "f.c"
        .text
        .globl  f22
        .type   f22, @function
f22:
.LFB5447:
        .cfi_startproc
        movl    $0, %eax
        bzhi    %rax, %rdi, %rax
        ret
        .cfi_endproc
.LFE5447:
        .size   f22, .-f22
        .ident  "GCC: (GNU) 8.2.1 20181011 (Red Hat 8.2.1-4)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-1 gcc]$

Reply via email to