NEON lowering errors in Clang/LLVM

Hi,

I found some errors in the Clang/LLVM lowering of NEON instructions.
There are three types of errors:

1. In Clang's arm_neon.h, the definition of vshl_u8 is wrong.
According to ARM's document [1], the shift amount parameter is
*always* signed, even for unsigned values, since a negative shift
means right shift.

I believe the header should be changed to conform to ARM's specification.

2. Compare absolute intrinsics, as defined in ARMInstrNEON.td (and
lowered by Clang), is not being converted to a NEON instruction in the
back-end, and silently becoming a function call to the LLVM intrinsic
(ex. "llvm.arm.neon.vacged.v2i32")

3. LLVM explodes when exporting VPADDL and VPADAL:

0. Program arguments: /work/bin/clang -cc1 -triple
armv7-none-eabi -emit-llvm -disable-free -main-file-name vpadal.c
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-target-abi apcs-gnu -target-cpu cortex-a8 -mfloat-abi hard
-target-linker-version 2.17.50.0.6 -v -resource-dir
/work/lib/clang/2.9 -w -ferror-limit 19 -fmessage-length 209
-fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
vpadal.s -x c vpadal.c
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. /work/lib/clang/2.9/include/arm_neon.h:1520:16: Generating
code for declaration 'vpaddl_s8'
4. /work/lib/clang/2.9/include/arm_neon.h:1520:38: LLVM IR
generation of compound statement ('{}')
clang: error: clang frontend command failed due to signal 11 (use -v
to see invocation)

Attached is a zip with the examples + command line to make it fail.
I'm using current trunk (updated a few minutes ago) but I've been seen
this errors for a while now.

I'll see if I can trace errors 2 and 3, but if any of you have an idea
where to start, I'd appreciate. I'm guessing both are TableGen
related...

neon-bugs.zip (1.45 KB)

Hello Renato,

I found some errors in the Clang/LLVM lowering of NEON instructions.
There are three types of errors:

Please use llvm.org/bugs for reporting, thanks!

done!

--renato