Bug 41196 - The use of ARM NEON vshll_n_u8 intrinsic results in compile error on valid code [4.4 only]
Summary: The use of ARM NEON vshll_n_u8 intrinsic results in compile error on valid co...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: 4.4.3
Assignee: Daniel Gutson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-31 12:14 UTC by Siarhei Siamashka
Modified: 2009-12-21 11:55 UTC (History)
3 users (show)

See Also:
Host: armv4tl-softfloat-linux-gnueabi
Target: armv4tl-softfloat-linux-gnueabi
Build: armv4tl-softfloat-linux-gnueabi
Known to work:
Known to fail:
Last reconfirmed: 2009-09-04 19:41:04


Attachments
Proposed fix (725 bytes, patch)
2009-09-25 21:28 UTC, Daniel Gutson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Siarhei Siamashka 2009-08-31 12:14:06 UTC
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
Comment 1 Ramana Radhakrishnan 2009-09-01 11:13:16 UTC
Also occurs with trunk.
Comment 2 Daniel Gutson 2009-09-04 01:10:31 UTC
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.
Comment 3 Daniel Gutson 2009-09-25 21:28:53 UTC
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).
Comment 4 Daniel Gutson 2009-09-25 21:35:50 UTC
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.
Comment 5 Daniel Gutson 2009-10-14 19:20:44 UTC
Committed since approved in http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00906.html
Comment 6 Ramana Radhakrishnan 2009-10-15 08:19:27 UTC
(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.
Comment 7 Daniel Gutson 2009-10-15 12:33:08 UTC
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.

Comment 8 Jakub Jelinek 2009-10-19 14:08:50 UTC
4.4 branch is again open for bugfixes...
Comment 9 Ramana Radhakrishnan 2009-12-11 11:54:04 UTC
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

Comment 10 Ramana Radhakrishnan 2009-12-11 11:54:56 UTC
Fixed.
Comment 11 Mikael Pettersson 2009-12-21 11:55:15 UTC
(In reply to comment #10)
> Fixed.

You forgot to add the test case in the 4.4 backport.