public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53124] New: Arm NEON narrowing right shift instructions impose incorrect operand bounds (intrinsic and asm)
@ 2012-04-25 19:57 ksebov at rim dot com
  2012-04-25 20:55 ` [Bug target/53124] " ksebov at rim dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ksebov at rim dot com @ 2012-04-25 19:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53124

             Bug #: 53124
           Summary: Arm NEON narrowing right shift instructions impose
                    incorrect operand bounds (intrinsic and asm)
    Classification: Unclassified
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ksebov@rim.com


The following code produces "Constant out of range" compiler error, even though
it's supposed to allow any immediate up to (size(datatype) - 1), or 31 in this
case. See
http://infocenter.arm.com/help/topic/com.arm.doc.dui0489c/CIHGJIHA.html

Using inline assembly implementation doesn't work either resulting in "Error:
immediate out of range for narrowing operation". 

int16x4_t rshift8_and_saturate_uint12( int32x4_t arg )
{
    uint32x4_t saturated_at32 = vqshluq_n_s32( arg, 32-(8+12) );
#if 1
    return vshrn_n_s32( vreinterpretq_s32_u32( saturated_at32 ), 32-12 );
#else
    int16x4_t result;
    asm volatile( "VSHRN.I32 %P0, %q1, #20" : "=w"(result) :
"w"(saturated_at32));
    return result;
#endif
}

It appears similar to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41196
although in this case the ssembler code will probably need to be fixed as well.

Also, by looking at /gcc/config/arm/neon.md it seems all V[Q]SHR[U]N are
affected.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-27 12:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 19:57 [Bug c/53124] New: Arm NEON narrowing right shift instructions impose incorrect operand bounds (intrinsic and asm) ksebov at rim dot com
2012-04-25 20:55 ` [Bug target/53124] " ksebov at rim dot com
2012-04-26 14:22 ` rearnsha at gcc dot gnu.org
2012-04-26 14:29 ` ksebov at rim dot com
2012-04-26 16:48 ` rearnsha at gcc dot gnu.org
2012-04-26 16:48 ` rearnsha at gcc dot gnu.org
2012-04-27 12:25 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).