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

Robin Dapp <rdapp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rdapp at gcc dot gnu.org

--- Comment #5 from Robin Dapp <rdapp at gcc dot gnu.org> ---
(In reply to Kansei Motoe from comment #4)
> The two types come from two registration passes. register_builtin_types
> creates the types valid for the TU's -march at its real VLEN. The pragma
> then pollutes the ISA flags, including zvl4096b, and creates the missing
> types at VLEN 4096.
> 
> A type with SEW/LMUL = r has VLEN/r elements. At ELEN 32 the valid types
> have r <= 32; the polluted ones add r = 64 with 4096/64 = 64 elements. A
> valid type with r = V/64 has the same count, so they collide for every
> real VLEN V from 64 to 2048 (zvl256b: vuint8m2_t = vuint8mf8_t, this
> report; zvl128b: vint8m4_t = vint8mf8_t, vbool2_t = vbool64_t). The C++
> front end compares RVV types structurally, so the pair is one type and
> the overloads clash. The PR116883 fix (r15-4240) introduced the 4096;
> it is only safe for zvl32b, the case it looked at. 14.2.0 predates the
> gcc-14 backport (r14-10802).
> 
> At zvl64b the return types collide too (vint8m8_t = vint8mf8_t), so the
> overloads merge silently and a valid call fails later:
> 
>   vint8m8_t f (vbool1_t m, const int8_t *p, size_t vl)
>   { return __riscv_vle8 (m, p, vl); }
>   -march=rv32im_zve32f_zvl64b: error: built-in function '__riscv_vle8'
>   requires the zve64x, zve64f, zve64d or v ISA extension
> 
> Fix: keep the real VLEN during the pollution when it is at least 64, and
> use 4096 only without V or at zvl32b. Polluted types then have V/64
> elements and valid ones at least V/32.
> 
> Patch: https://gcc.gnu.org/pipermail/gcc-patches/2026-November/737568.html

Yes, the direction is right but I'm still thinking whether we need a more
comprehensive solution.  I'm going to get back to your patch after stage 1
closes (start of next week).

Reply via email to