public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic
@ 2011-12-13 19:29 rmansfield at qnx dot com
  2011-12-13 19:53 ` [Bug target/51534] " rmansfield at qnx dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2011-12-13 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51534
           Summary: Bad code gen for vcgtq_u32 NEON intrinsic
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rmansfield@qnx.com
              Host: i686-unknown-linux-gnu
            Target: arm-unknown-linux-gnueabi
             Build: i686-unknown-linux-gnu


$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: arm-unknown-linux-gnueabi
Configured with: ../configure --target=arm-unknown-linux-gnueabi
--prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi
--with-sysroot=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi//sys-root
--disable-multilib
--with-local-prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-root
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99
--enable-long-long --enable-target-optspace
target_alias=arm-unknown-linux-gnueabi --enable-languages=c++ --disable-shared
--disable-libmudflap --disable-libssp
Thread model: posix
gcc version 4.7.0 20111213 (experimental) [trunk revision 182291] (GCC) 

$ cat ~/foo.c
#include <arm_neon.h>

void foo (unsigned * src, unsigned *dst, int width)
{
  const int32x4_t vec_alpha_shift = vdupq_n_s32 (0);
  const uint32x4_t vec_one = vdupq_n_u32 (1u);
  const uint32x4_t vec_zero = vdupq_n_u32 (0u);

while (width >= 4)
    {
      uint32x4_t s0 = vld1q_u32 (src);
      uint32x4_t d0 = vld1q_u32 (dst);
      uint32x4_t vec_alpha = vshlq_u32 (s0, vec_alpha_shift);
      vec_alpha =
    vaddq_u32 (vec_alpha,
           vandq_u32 (vcgtq_u32 (vec_alpha, vec_zero), vec_one));
      s0 = vmulq_u32 (s0, vec_alpha);
      d0 = vaddq_u32 (s0, d0);
      vst1q_u32 (dst, d0);
    }
}

$ ./xgcc -B. -O3 -ftree-vectorize -mfpu=neon -mfloat-abi=softfp ~/foo.c 
-march=armv7-a -c

Changing the code from:

const uint32x4_t vec_zero = vdupq_n_u32 (0u)

to

const uint32x4_t vec_zero = vdupq_n_u32 (1u)

results in a proper reg load and operand to vcgt. 

     vmov.i32    q9, #0  @ v4si
     vld1.32    {d16-d17}, [r8]
+    vmov.i32    q12, #1  @ v4si
     mov    r0, sl
     vld1.32    {d20-d21}, [sl]
     vshl.u32    q9, q8, q9
-    vcgt.u32    q11, q9, #0
+    vcgt.u32    q11, q9, q12
     vand    q11, q11, q4
     vadd.i32    q9, q9, q11
     vmul.i32    q8, q8, q9

Also happens on the 4.6 branch. Compiles OK with 4.4 branch. I haven't checked
4.5 yet.


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

* [Bug target/51534] Bad code gen for vcgtq_u32 NEON intrinsic
  2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
@ 2011-12-13 19:53 ` rmansfield at qnx dot com
  2011-12-14 15:01 ` rearnsha at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2011-12-13 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ryan Mansfield <rmansfield at qnx dot com> 2011-12-13 19:47:28 UTC ---
I truncated the actual error emitted by the assembler.

$ ./xgcc -B. -O3 -ftree-vectorize -mfpu=neon -mfloat-abi=softfp ~/foo.c 
-march=armv7-a -c
/tmp/ccCPCd9Z.s: Assembler messages:
/tmp/ccCPCd9Z.s:30: Error: bad type in Neon instruction -- `vcgt.u32 q11,q9,#0'


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

* [Bug target/51534] Bad code gen for vcgtq_u32 NEON intrinsic
  2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
  2011-12-13 19:53 ` [Bug target/51534] " rmansfield at qnx dot com
@ 2011-12-14 15:01 ` rearnsha at gcc dot gnu.org
  2012-02-28 16:15 ` mgretton at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2011-12-14 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-14
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-12-14 14:36:51 UTC ---
Confirmed.

The VCGT ..., #0 instruction only operates on signed types.  Also applies to
VCLE.


Alternatives for unsigned are:
- load 0 into a register
- convert the comparison to VCEQ then, for GT only, invert the result.


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

* [Bug target/51534] Bad code gen for vcgtq_u32 NEON intrinsic
  2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
  2011-12-13 19:53 ` [Bug target/51534] " rmansfield at qnx dot com
  2011-12-14 15:01 ` rearnsha at gcc dot gnu.org
@ 2012-02-28 16:15 ` mgretton at gcc dot gnu.org
  2012-02-28 16:19 ` mgretton at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mgretton at gcc dot gnu.org @ 2012-02-28 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from mgretton at gcc dot gnu.org 2012-02-28 16:14:03 UTC ---
Author: mgretton
Date: Tue Feb 28 16:13:52 2012
New Revision: 184629

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184629
Log:
    PR target/51534
    * gcc/config/arm/arm.c (neon_builtin_data): Add entries for vcgeu
    and vcgtu.
    * gcc/config/arm/arm_neon.h: Regenerate.
    * gcc/config/arm/neon.md (unspec): Add UNSPEC_VCGEU, and UNSPEC_VCGTU.
    (neon_vcgeu): New insn.
    (neon_vcgtu): Likewise.
    * gcc/config/arm/neon.ml (s_8_32, u_8_32): New lists.
    (ops): Unsigned comparison intrinsics call a different
    builtin.
    * gcc/testsuite/gcc.target/arm/neon/pr51534.c: New testcase.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/config/arm/arm_neon.h
    trunk/gcc/config/arm/neon.md
    trunk/gcc/config/arm/neon.ml
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/51534] Bad code gen for vcgtq_u32 NEON intrinsic
  2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
                   ` (2 preceding siblings ...)
  2012-02-28 16:15 ` mgretton at gcc dot gnu.org
@ 2012-02-28 16:19 ` mgretton at gcc dot gnu.org
  2014-08-10 16:46 ` rmansfield at qnx dot com
  2023-03-03 19:10 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mgretton at gcc dot gnu.org @ 2012-02-28 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from mgretton at gcc dot gnu.org 2012-02-28 16:17:44 UTC ---
Author: mgretton
Date: Tue Feb 28 16:17:36 2012
New Revision: 184630

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184630
Log:
    PR target/51534
    Add testcase forgotten in last commit, ChangeLog entry already present.


Added:
    trunk/gcc/testsuite/gcc.target/arm/neon/pr51534.c


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

* [Bug target/51534] Bad code gen for vcgtq_u32 NEON intrinsic
  2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
                   ` (3 preceding siblings ...)
  2012-02-28 16:19 ` mgretton at gcc dot gnu.org
@ 2014-08-10 16:46 ` rmansfield at qnx dot com
  2023-03-03 19:10 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2014-08-10 16:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51534

Ryan Mansfield <rmansfield at qnx dot com> changed:

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

--- Comment #5 from Ryan Mansfield <rmansfield at qnx dot com> ---
Fixed awhile ago.


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

* [Bug target/51534] Bad code gen for vcgtq_u32 NEON intrinsic
  2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
                   ` (4 preceding siblings ...)
  2014-08-10 16:46 ` rmansfield at qnx dot com
@ 2023-03-03 19:10 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-03 19:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51534

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:cc9cc5a9a5fb0c16532a16b87fbd155037a7ed89

commit r13-6457-gcc9cc5a9a5fb0c16532a16b87fbd155037a7ed89
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Mar 3 15:59:21 2023 -0300

    [PR51534] [arm] split out pr51534 test for softfp

    The test uses arm_hard_ok and arm_softfp_ok as if they were mutually
    exclusive, but they test whether the corresponding -mfloat-abi= flag
    is usable, not whether it is in effect, so it is possible for both to
    pass, and then the test comes out with incorrect expectations
    whichever the default float-abi is.

    Separate the test into hard and softfp variants, and extend the softfp
    variant to accept both ARM and Thumb opcodes; it unwarrantedly assumed
    the latter.


    for  gcc/testsuite/ChangeLog

            PR target/51534
            * gcc.target/arm/pr51534.c: Split softfp variant into...
            * gcc.target/arm/pr51534s.c: ... this, and support ARM too.

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

end of thread, other threads:[~2023-03-03 19:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13 19:29 [Bug target/51534] New: Bad code gen for vcgtq_u32 NEON intrinsic rmansfield at qnx dot com
2011-12-13 19:53 ` [Bug target/51534] " rmansfield at qnx dot com
2011-12-14 15:01 ` rearnsha at gcc dot gnu.org
2012-02-28 16:15 ` mgretton at gcc dot gnu.org
2012-02-28 16:19 ` mgretton at gcc dot gnu.org
2014-08-10 16:46 ` rmansfield at qnx dot com
2023-03-03 19:10 ` cvs-commit 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).