[llvm-bugs] [Bug 30430] New: AVX512: incorrect code generation for very basic code

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 17 10:16:14 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30430

            Bug ID: 30430
           Summary: AVX512: incorrect code generation for very basic code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: wenzel.jakob at epfl.ch
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hi,

I'm getting invalid code for a very basic snippet which constructs a packed
float array and prints it. I suspect an issue with calling conventions. The
problem only appears at optimization level -O0.

Observed output:

$ clang test.c -o test -mavx512f -stdlib=libc++ -O0
$ ./test                                                                       
                                                                               
                                                                               
        0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
9.000000 10.000000 11.000000 12.000000 13.000000 14.000000 15.000000 16.000000

Expected output:
$ ./test                                                                       
                                                                               
                                                                               
        1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000
9.000000 10.000000 11.000000 12.000000 13.000000 14.000000 15.000000 16.000000

For reference, this is with

$ clang -v
clang version 4.0.0 (trunk 281812)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

===============
#include <immintrin.h>

__m512 makefloat(float f1, float f2, float f3, float f4, float f5, float f6,
float f7, float f8, float f9, float f10, float f11, float f12, float f13, float
f14, float f15, float f16) {
    return _mm512_setr_ps(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12,
f13, f14, f15, f16);
}

int main(int argc, char *argv[]) {
    __m512 x = makefloat(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16);

    float result[16];
    _mm512_storeu_ps(result, x);
    for (int i = 0; i < 16; ++i)
        printf("%f ", result[i]);

    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160917/46289aa9/attachment-0001.html>


More information about the llvm-bugs mailing list