Of possible interest: fast UTF8 validation
David Nadlinger
code at klickverbot.at
Sat May 19 03:39:32 UTC 2018
On Wednesday, 16 May 2018 at 14:48:54 UTC, Ethan Watson wrote:
> And even better - LDC doesn't support core.simd and has its own
> intrinsics that don't match the SSE/AVX intrinsics API
> published by Intel.
To provide some context here: LDC only supports the types from
core.simd, but not the __simd "assembler macro" that DMD uses to
more or less directly emit the corresponding x86 opcodes.
LDC does support most of the GCC-style SIMD builtins for the
respective target (x86, ARM, …), but there are two problems with
this:
1) As Ethan pointed out, the GCC API does not match Intel's
intrinsics; for example, it is
`__builtin_ia32_vfnmsubpd256_mask3` instead of
`_mm256_mask_fnmsub_pd`, and the argument orders differ as well.
2) The functions that LDC exposes as intrinsics are those that
are intrinsics on the LLVM IR level. However, some operations can
be directly represented in normal, instruction-set-independent
LLVM IR – no explicit intrinsics are provided for these.
Unfortunately, LLVM doesn't seem to provide any particularly
helpful tools for implementing Intel's intrinsics API.
x86intrin.h is manually implemented for Clang as a collection of
various macros and functions.
It would be seriously cool if someone could write a small tool to
parse those headers, (semi-)automatically convert them to D, and
generate tests for comparing the emitted IR against Clang. I'm
happy to help with the LDC side of things.
— David
More information about the Digitalmars-d
mailing list