public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/41538]  New: Mixing ARM/NEON intrinsic variables and inline assembly
@ 2009-10-01 20:56 gmcgrath at yahoo dot com
  2009-10-01 22:21 ` [Bug inline-asm/41538] " rguenth at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gmcgrath at yahoo dot com @ 2009-10-01 20:56 UTC (permalink / raw)
  To: gcc-bugs

Trying to peg C intrinsic variables (for ARM/NEON) to a specific 128-bit
register (e.g. q0-q15) does not work at all.  For example,

   register int16x8_t v0 asm ("q0");  // q0=d0-d1
   register int16x8_t v1 asm ("q1");  // q1=d2-d3

is totally ignored yet compiles without warning.  If I try the front door,

   int16x8x2_t v8;

   asm volatile (
      "vmulq.s16 q2, %1, %2\n\t"
      "vshrn.i16 %0, q2, #13\n\t"
      : "=r" (v0) 
      : "r" (v8.val[0]), "r" (v8.val[1])
      : "d4", "d5", "q2"
      );

it tries to use r registers.  See the error:

        /tmp/ccmAG4Ya.s:321: Error: Neon double or quad precision register
expected -
        `vmulq.s16 q2,r2,r8'
        /tmp/ccmAG4Ya.s:322: Error: bad instruction
        `vshln.i16 r2,q2,#1'

This makes mixing C and inline assembly nearly impossible for NEON code.


-- 
           Summary: Mixing ARM/NEON intrinsic variables and inline assembly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gmcgrath at yahoo dot com


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


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

* [Bug inline-asm/41538] Mixing ARM/NEON intrinsic variables and inline assembly
  2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
@ 2009-10-01 22:21 ` rguenth at gcc dot gnu dot org
  2010-03-11 20:29 ` siarhei dot siamashka at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-10-01 22:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-10-01 22:21 -------
"r" is a constraint for a general register, you need to use a proper constraint
here.  Refer to the architecture specific constraint documentaiton.


-- 


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


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

* [Bug inline-asm/41538] Mixing ARM/NEON intrinsic variables and inline assembly
  2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
  2009-10-01 22:21 ` [Bug inline-asm/41538] " rguenth at gcc dot gnu dot org
@ 2010-03-11 20:29 ` siarhei dot siamashka at gmail dot com
  2010-03-11 20:32 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: siarhei dot siamashka at gmail dot com @ 2010-03-11 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from siarhei dot siamashka at gmail dot com  2010-03-11 20:29 -------
When documentation is missing the needed bits information, these can be
typically extracted from the source code.

The only problem is that these constraints can be changed any time without
notice unless properly documented and exposed to the outside world. There is
bug 37188 about it.


-- 

siarhei dot siamashka at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siarhei dot siamashka at
                   |                            |gmail dot com


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


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

* [Bug inline-asm/41538] Mixing ARM/NEON intrinsic variables and inline assembly
  2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
  2009-10-01 22:21 ` [Bug inline-asm/41538] " rguenth at gcc dot gnu dot org
  2010-03-11 20:29 ` siarhei dot siamashka at gmail dot com
@ 2010-03-11 20:32 ` pinskia at gcc dot gnu dot org
  2010-03-11 21:48 ` gmcgrath at yahoo dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-11 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2010-03-11 20:32 -------
(In reply to comment #2)
> When documentation is missing the needed bits information, these can be
> typically extracted from the source code.
> 
> The only problem is that these constraints can be changed any time without
> notice unless properly documented and exposed to the outside world. There is
> bug 37188 about it.

That is about the modifiers rather the constraints.  Anyways w is the correct
constraints here.  Closing as invalid.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug inline-asm/41538] Mixing ARM/NEON intrinsic variables and inline assembly
  2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
                   ` (2 preceding siblings ...)
  2010-03-11 20:32 ` pinskia at gcc dot gnu dot org
@ 2010-03-11 21:48 ` gmcgrath at yahoo dot com
  2010-03-14 12:23 ` siarhei dot siamashka at gmail dot com
  2010-03-15 22:11 ` gmcgrath at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: gmcgrath at yahoo dot com @ 2010-03-11 21:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from gmcgrath at yahoo dot com  2010-03-11 21:48 -------
Bug 37188 answers half the problem.  It still does not answer why:

   register int16x8_t val asm ("q0");

compiles without warning yet does not put "val" into the "q0" NEON register. 


-- 

gmcgrath at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gmcgrath at yahoo dot com
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug inline-asm/41538] Mixing ARM/NEON intrinsic variables and inline assembly
  2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
                   ` (3 preceding siblings ...)
  2010-03-11 21:48 ` gmcgrath at yahoo dot com
@ 2010-03-14 12:23 ` siarhei dot siamashka at gmail dot com
  2010-03-15 22:11 ` gmcgrath at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: siarhei dot siamashka at gmail dot com @ 2010-03-14 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from siarhei dot siamashka at gmail dot com  2010-03-14 12:23 -------
Do you want to force data into specific neon registers because of the
restriction on the neon registers which can be used as scalar operand for
multiplication?

It works for me.

/**************************/
#include <stdint.h>
#include <arm_neon.h>

void f(int16_t *ptr)
{
    register int16x4_t mul_consts asm ("d0");
    int16x4_t data;
    int32x4_t tmp;
    mul_consts = vset_lane_s16(0x1234, mul_consts, 0);
    asm volatile (
        "vld1.16   {%P1}, [%2]\n"
        "vmull.s16  %q0, %P1, %P3[0]\n"
        "vshrn.s32 %P1, %q0, #15\n"
        "vst1.16   {%P1}, [%2]\n"
        : "=&w" (tmp), "=&w" (data)
        : "r" (ptr), "w" (mul_consts)
        : "memory"
    );
}
/**************************/

While not forcing 'mul_consts' variable into 'd0' register fails as expected:
/tmp/ccvzAXVb.s: Assembler messages:                                        
/tmp/ccvzAXVb.s:27: Error: scalar out of range for multiply instruction --
`vmull.s16 q9,d17,d16[0]'

So I don't see any problem here. Tested with gcc 4.3.4 and 4.4.3


-- 


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


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

* [Bug inline-asm/41538] Mixing ARM/NEON intrinsic variables and inline assembly
  2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
                   ` (4 preceding siblings ...)
  2010-03-14 12:23 ` siarhei dot siamashka at gmail dot com
@ 2010-03-15 22:11 ` gmcgrath at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: gmcgrath at yahoo dot com @ 2010-03-15 22:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gmcgrath at yahoo dot com  2010-03-15 22:11 -------
It seems to work in 4.4.0.  The code:

   register int16x8_t a asm ("q7");
   asm (
      "vadd.i32 %q0, %q1, %q2 \n\t"
      : "=w" (a)
      : "w" (b), "w" (c)
      );

yields an expected:

        vadd.i32 q7, q8, q7 


-- 

gmcgrath at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-03-15 22:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 20:56 [Bug inline-asm/41538] New: Mixing ARM/NEON intrinsic variables and inline assembly gmcgrath at yahoo dot com
2009-10-01 22:21 ` [Bug inline-asm/41538] " rguenth at gcc dot gnu dot org
2010-03-11 20:29 ` siarhei dot siamashka at gmail dot com
2010-03-11 20:32 ` pinskia at gcc dot gnu dot org
2010-03-11 21:48 ` gmcgrath at yahoo dot com
2010-03-14 12:23 ` siarhei dot siamashka at gmail dot com
2010-03-15 22:11 ` gmcgrath at yahoo dot com

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).