Re: Implementation of VIS C API

nia <[email protected]> Mon, 10 Nov 2025 16:04:54 +0000
Newsgroups gmane.os.netbsd.ports.sparc64
Message-ID <[email protected]>
On Mon, Nov 10, 2025 at 02:44:42PM +0000, Sad Clouds wrote:
> On Mon, 10 Nov 2025 12:10:50 +0000
> nia <[email protected]> wrote:
> 
> > Hi, recently got interested in SIMD instructions on sparc64.
> > 
> > While GCC provides some builtins, they're both incomplete and
> > incompatible with the C API described in "VIS Instruction
> > Set User's Manual", published by Sun in 2001.
> 
> I think GCC has various -mvis* options, but it's a bit of a mystery
> what code it auto-generates with those and under what conditions.
> 
> It's a different use case compared to directly calling builtin
> functions, but it all depends on how smart GCC can be when it comes to
> translating C statements into SIMD assembly.

These options actually define __VIS__ and enable the use of
the compiler builtins.

Clang has the same option, but it works differently, since clang
has no such builtins and never defines __VIS__. Without the option,
clang will error if vis instructions are used in inline assembler.