public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114017] New: RISC-V: wrong __riscv_v_intrinsic predefined macro value (14.x)
@ 2024-02-20 19:34 maksim.shabunin at gmail dot com
  2024-02-22  1:23 ` [Bug target/114017] " cvs-commit at gcc dot gnu.org
  2024-02-22 16:04 ` maksim.shabunin at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: maksim.shabunin at gmail dot com @ 2024-02-20 19:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114017
           Summary: RISC-V: wrong __riscv_v_intrinsic predefined macro
                    value (14.x)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maksim.shabunin at gmail dot com
  Target Milestone: ---

Recent master branch version defines wrong RVV intrinsics version macro.

### GCC version and predefined value

./riscv-gcc-master/bin/riscv64-unknown-linux-gnu-g++ --version                  
riscv64-unknown-linux-gnu-g++ (g61ab046a327) 14.0.1 20240220 (experimental)

./riscv-gcc-master/bin/riscv64-unknown-linux-gnu-g++ -dM -E -march=rv64gcv - <
/dev/null | grep riscv_v_intrin
#define __riscv_v_intrinsic 11000


### Description

Predefined value must be at least v0.12 (12000) because this is what is
actually supported by the compiler. Following snippet demonstrates the problem
by calling intrinsic which has been modified in v0.12. Without workaround the
first block will be used and will fail to compile because actual builtin
intrinsic requires `vxrm` argument.


### Example of code

#include <riscv_vector.h>

int main()
{

    vuint16m1_t val;
    size_t shift = 1;
    size_t vl = 8;
    vuint8mf2_t res;

#define GCC_WORKAROUND (__GNUC__ == 14 && __riscv_v_intrinsic==11000)

#if __riscv_v_intrinsic==11000 && !GCC_WORKAROUND
    #warning "RVV Intrinsics v0.11"
    res = __riscv_vnclipu(val, shift, vl);
#endif

#if __riscv_v_intrinsic==12000 || GCC_WORKAROUND
    #warning "RVV Intrinsics v0.12"
    const unsigned int vxrm = 0;
    res = __riscv_vnclipu(val, shift, vxrm, vl);
#endif

    return 0;
}


### Error shown without workaround

rvv_snippet.cpp:16:26: error: no matching function for call to
'__riscv_vnclipu(vuint16m1_t&, size_t&, size_t&)'
   16 |     res = __riscv_vnclipu(val, shift, vl);
      |           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from rvv_snippet.cpp:1:
/work/chains/riscv-gcc-master/lib/gcc/riscv64-unknown-linux-gnu/14.0.1/include/riscv_vector.h:43:25:
note: candidate: 'vuint8mf8_t __riscv_vnclipu(vuint16mf4_t, vuint8mf8_t,
unsigned int, long unsigned int)'
   43 | #pragma riscv intrinsic "vector"
      |                         ^~~~~~~~
/work/chains/riscv-gcc-master/lib/gcc/riscv64-unknown-linux-gnu/14.0.1/include/riscv_vector.h:43:25:
note:   candidate expects 4 arguments, 3 provided
<...long list of candidates...>

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

* [Bug target/114017] RISC-V: wrong __riscv_v_intrinsic predefined macro value (14.x)
  2024-02-20 19:34 [Bug target/114017] New: RISC-V: wrong __riscv_v_intrinsic predefined macro value (14.x) maksim.shabunin at gmail dot com
@ 2024-02-22  1:23 ` cvs-commit at gcc dot gnu.org
  2024-02-22 16:04 ` maksim.shabunin at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-22  1:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pan Li <panli@gcc.gnu.org>:

https://gcc.gnu.org/g:3688c2b1a604a16b9ff46935770976960016b15c

commit r14-9128-g3688c2b1a604a16b9ff46935770976960016b15c
Author: Pan Li <pan2.li@intel.com>
Date:   Wed Feb 21 12:06:22 2024 +0800

    RISC-V: Upgrade RVV intrinsic version to 0.12

    Upgrade the version of RVV intrinsic from 0.11 to 0.12.

            PR target/114017

    gcc/ChangeLog:

            * config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Upgrade
            the version to 0.12.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/predef-__riscv_v_intrinsic.c: Update the
            version to 0.12.
            * gcc.target/riscv/rvv/base/pr114017-1.c: New test.

    Signed-off-by: Pan Li <pan2.li@intel.com>

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

* [Bug target/114017] RISC-V: wrong __riscv_v_intrinsic predefined macro value (14.x)
  2024-02-20 19:34 [Bug target/114017] New: RISC-V: wrong __riscv_v_intrinsic predefined macro value (14.x) maksim.shabunin at gmail dot com
  2024-02-22  1:23 ` [Bug target/114017] " cvs-commit at gcc dot gnu.org
@ 2024-02-22 16:04 ` maksim.shabunin at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: maksim.shabunin at gmail dot com @ 2024-02-22 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

Maksim Shabunin <maksim.shabunin at gmail dot com> changed:

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

--- Comment #2 from Maksim Shabunin <maksim.shabunin at gmail dot com> ---
Verified with version riscv64-unknown-linux-gnu-g++ (g7d8585c0c0e) 14.0.1
20240222 (experimental) (branch master).

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

end of thread, other threads:[~2024-02-22 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 19:34 [Bug target/114017] New: RISC-V: wrong __riscv_v_intrinsic predefined macro value (14.x) maksim.shabunin at gmail dot com
2024-02-22  1:23 ` [Bug target/114017] " cvs-commit at gcc dot gnu.org
2024-02-22 16:04 ` maksim.shabunin at gmail 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).