[LLVMbugs] [Bug 16641] New: Code generation problem with Altivec vec_sel intrinsic

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 16 20:02:10 PDT 2013


            Bug ID: 16641
           Summary: Code generation problem with Altivec vec_sel intrinsic
           Product: new-bugs
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: schnetter at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I am encountering a code generation problem likely related to the Altivec
vec_sel intrinsic.

I am using

$ /home/projects/llvm/bin/clang++ -v
clang version 3.4 (login1.mcs.anl.gov:src/llvm-trunk/tools/clang
0a67b3629eee1e58a45415e07d1bfcd908d73c77) (login1.mcs.anl.gov:src/llvm-trunk
Target: powerpc64-unknown-linux-gnu
Thread model: posix

on a Power 7 system. The failing program is a test suite for Vecmathlib
<http://bitbucket.org/eschnett/vecmathlib/>, a library for SIMD vectorization.
When I build it with the options

$ /home/projects/llvm/bin/clang++ -faltivec -o test test.cc

it produces the output

$ ./test | head -n 20
Testing math functions:
Vecmathlib configuration: [conf-DEBUG-Altivec]

Testing math functions for type <Altivec:4*float>:
   testing boolean operations...
Error in ifthen(bool):
   x=[0,1,0,0] [0x00000fffdfb681800000000010003918]
   y=[0,0,0,0] [0x00000000000000000000000000000000]
   z=[0,0,1,1] [0xffffffffffffffff0000000000000000]
   fstd(x,y,z)=[0,0,1,1] [0x00000000000000000000000000000000]
   fvml(x,y,z)=[0,0,0,0] [0x00000000000000000000000000000000]
   error(x,y,z)=[0,0,1,1] [0x00000000000000000000000000000000]

indicating that a self-test fails; there should be no output starting with
"Error in ...". This particular self-test checks an "ifthen(x,y,z)" function,
which is for Altivec a wrapper around vec_sel, which x the condition (vector of
bool), and y and z the then- and else-values, respectively. As you can see, the
value for x is bogus; this should be a boolean vector, which is on Altivec a
vector of unsigned integers with either all bits unset or all bits set. I
assume there is a code generation problem that corrupts the value for x.

I attach the original source code (files test.cc and vec_altivec_float4.h) as
well as the pre-processed source code test.i.

I expect this pre-processed source code to be built with the command

$ /home/projects/llvm/bin/clang++ -faltivec -o test -x c++-cpp-output test.i

but this leads to the error

In file included from <built-in>:163:
<command line>:1:10: fatal error: 'altivec.h' file not found
#include "altivec.h"
1 error generated.

which is bogus since there is no #include statement at all in test.i. I hope
that test.i is nevertheless useful.

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/20130717/0b12360f/attachment.html>

More information about the llvm-bugs mailing list