When using vshll_n_u8 intrinsic, gcc 4.4.1 incorrectly rejects shift operand having value >= 8, claiming that it is out of range. When using the following test code /*************/ #include <arm_neon.h> uint16x8_t test_vshll_n_u8 (uint8x8_t a) { return vshll_n_u8(a, 8); } /*************/ Test with gcc 4.4.1: # gcc -c -O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fomit-frame-pointer test.c test.c: In function ‘test_vshll_n_u8’: test.c:6: error: constant out of range It used to work fine with cs2007q3: # gcc -c -O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fomit-frame-pointer test.c # objdump -d test.o test.o: file format elf32-littlearm Disassembly of section .text: 00000000 <test_vshll_n_u8>: 0: ec410b17 vmov d7, r0, r1 4: f3b26307 vshll.i8 q3, d7, #8 8: ec510b16 vmov r0, r1, d6 c: ec532b17 vmov r2, r3, d7 10: e12fff1e bx lr
Also occurs with trunk.
I'm working on this now, and will post a fix tomorrow. Please assign this bug to me, since seems I don't have permissions enough to do that myself. Thanks, Daniel.
Created attachment 18651 [details] Proposed fix The attached patch attempts to solve the issue, by augmenting the range check in order to match 0 < imm <= size (increasing size in 1). I checked that the assembler DTRT, so the fix applies to gcc only. I tested the patch with the gcc test suite plus a test cases I added (included in the patch).
I forgot the ChangeLog: gcc/ * config/arm/neon.md (neon_vshll_n<mode>): Checking Bounds fixed. gcc/testsuite/ * gcc.target/arm/neon/vfp-shift-a2t2.c: New test case.
Committed since approved in http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00906.html
(In reply to comment #5) > Committed since approved in > http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00906.html This needs to be backported to 4.4 branch after the 4.4.2 release because the original bug report came with the 4.4.1 release. Daniel - could you take care of doing this once the 4.4 branch is updated ? I'm reopening this bug as a 4.4 only bug at the minute.
Subject: Re: The use of ARM NEON vshll_n_u8 intrinsic results in compile error on valid code [4.4 only] ramana at gcc dot gnu dot org wrote: > ------- Comment #6 from ramana at gcc dot gnu dot org 2009-10-15 08:19 ------- > (In reply to comment #5) >> Committed since approved in >> http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00906.html > > This needs to be backported to 4.4 branch after the 4.4.2 release because the > original bug report came with the 4.4.1 release. > > Daniel - could you take care of doing this once the 4.4 branch is updated ? I'm > reopening this bug as a 4.4 only bug at the minute. Sure, I will. Daniel.
4.4 branch is again open for bugfixes...
Subject: Bug 41196 Author: ramana Date: Fri Dec 11 11:53:46 2009 New Revision: 155158 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155158 Log: Fix target/41196 2009-12-11 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> PR target/41196 2009-10-14 Daniel Gutson <dgutson@codesourcery.com> * config/arm/neon.md (neon_vshll_n<mode>): Checking Bounds fixed. 2009-12-11 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> PR target/41196 2009-10-14 Daniel Gutson <dgutson@codesourcery.com> * testsuite/gcc.target/arm/neon/vfp-shift-a2t2.c: New test case. Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/config/arm/neon.md branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Fixed.
(In reply to comment #10) > Fixed. You forgot to add the test case in the 4.4 backport.