gcc/libphobos
Iain Buclaw b93ae1a01b d: Add SIMD intrinsics module and compiler built-ins.
Vectors in D are exposed by the use of the `__vector(T[N])' type, and
whilst most unary and binary operations work as you'd expect, there are
some operations that are not possible without doing the operation
unrolled, or calling some target-specific built-in, or with inline asm.

This introduces a new `gcc.simd' module that introduces the following.

 - Prefetching has been exposed by a convenient `prefetch' function in
   the library.

 - Loading and storing from an unaligned address have been exposed by
   `loadUnaligned' and `storeUnaligned' intrinsics.

 - Vector permutations have been exposed by `shuffle`, and
   `shufflevector' intrinsics.

 - Converting between two vectors with a different element type has been
   exposed by a `convertvector' intrinsic.

 - The ternary operator has been exposed with a `blendvector' intrinsic.

 - Comparison operators have been exposed by `equalMask',
   `notEqualMask', `greaterMask', and `greaterEqualMask' intrinsics.

 - Logic operators have been exposed by convenient `notMask',
   `andAndMask', and `orOrMask' functions in the library.

To be compatible with the LLVM D compiler's own SIMD intrinsic module,
there is also the addition of an `extractelement' and `insertelement'
convenience functions, and an alternative interface for calling the
`shufflevector' function.

The addition of these intrinsics lowers the boundary for users working
in SIMD to get the desired codegen they want out of the compiler.

Most of what is present here - apart from tests - is the adding of
machinery in the intrinsics suite of functions to do validation on
templated intrinsics.  Whilst these are still matched from the library
by their generic (untyped) signature, there is a still an assumption
that what has been instantiated and handed down to the code generator is
valid, because why would these definitions be found outside of the
in-tree D runtime library?  The majority of intrinsics are not
templates, so the test on the mangled signature string still guarantees
all types are as we expect them to be.  However there are still a small
handful of other templated intrinsics (core.bitop.{rol,ror},
core.math.toPrec, std.math.traits.isNaN, ...) that are currently
unchecked, so would benefit from being included into this built-in
checking function at some point in the future.

gcc/d/ChangeLog:

	* intrinsics.cc: Include diagnostic.h, langhooks.h,
	vec-perm-indices.h.
	(maybe_set_intrinsic): Add cases for new simd intrinsics.
	(warn_mismatched_return_type): New function.
	(warn_mismatched_argument): New function.
	(build_shuffle_mask_type): New function.
	(maybe_warn_intrinsic_mismatch): New function.
	(expand_intrinsic_vec_cond): New function.
	(expand_intrinsic_vec_convert): New function.
	(expand_intrinsic_vec_blend): New function.
	(expand_intrinsic_vec_shuffle): New function.
	(expand_intrinsic_vec_shufflevector): New function.
	(expand_intrinsic_vec_load_unaligned): New function.
	(expand_intrinsic_vec_store_unaligned): New function.
	(maybe_expand_intrinsic): Check signature of intrinsic before handing
	off to front-end lowering.  Add cases for new simd intrinsics.
	* intrinsics.def (INTRINSIC_LOADUNALIGNED): Define intrinsic.
	(INTRINSIC_STOREUNALIGNED): Define intrinsic.
	(INTRINSIC_SHUFFLE): Define intrinsic.
	(INTRINSIC_SHUFFLEVECTOR): Define intrinsic.
	(INTRINSIC_CONVERTVECTOR): Define intrinsic.
	(INTRINSIC_BLENDVECTOR): Define intrinsic.
	(INTRINSIC_EQUALMASK): Define intrinsic.
	(INTRINSIC_NOTEQUALMASK): Define intrinsic.
	(INTRINSIC_GREATERMASK): Define intrinsic.
	(INTRINSIC_GREATEREQUALMASK): Define intrinsic.

libphobos/ChangeLog:

	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add gcc/simd.d.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/gcc/simd.d: New file.

gcc/testsuite/ChangeLog:

	* gdc.dg/Wbuiltin_declaration_mismatch.d: Rename to...
	* gdc.dg/Wbuiltin_declaration_mismatch1.d: ...this.
	* gdc.dg/Wbuiltin_declaration_mismatch2.d: New test.
	* gdc.dg/torture/simd_blendvector.d: New test.
	* gdc.dg/torture/simd_cond.d: New test.
	* gdc.dg/torture/simd_convertvector.d: New test.
	* gdc.dg/torture/simd_load.d: New test.
	* gdc.dg/torture/simd_logical.d: New test.
	* gdc.dg/torture/simd_shuffle.d: New test.
	* gdc.dg/torture/simd_shufflevector.d: New test.
	* gdc.dg/torture/simd_store.d: New test.
2022-06-29 02:28:20 +02:00
..
libdruntime d: Add SIMD intrinsics module and compiler built-ins. 2022-06-29 02:28:20 +02:00
m4 libphobos: Update comment for DRUNTIME_OS_SOURCES 2021-09-01 14:19:35 +02:00
src d: Merge upstream dmd 6203135dc, druntime e150cca1, phobos a4a18d21c. 2022-06-22 17:57:56 +02:00
testsuite d: Merge upstream dmd 6203135dc, druntime e150cca1, phobos a4a18d21c. 2022-06-22 17:57:56 +02:00
acinclude.m4 Update copyright years. 2022-01-03 10:42:10 +01:00
aclocal.m4 libphobos: Add --enable-cet to configure 2020-05-08 15:11:41 -07:00
ChangeLog Daily bump. 2022-06-29 00:17:00 +00:00
config.h.in libphobos: Fix configure test for backtrace-supported.h 2019-04-16 05:58:25 +00:00
configure libphobos: Enable on Solaris/SPARC or with /bin/as [PR 103528] 2022-03-11 09:37:44 +01:00
configure.ac libphobos: Enable on Solaris/SPARC or with /bin/as [PR 103528] 2022-03-11 09:37:44 +01:00
configure.tgt libphobos: Enable on Solaris/SPARC or with /bin/as [PR 103528] 2022-03-11 09:37:44 +01:00
d_rules.am Update copyright years. 2022-01-03 10:42:10 +01:00
Makefile.am Update copyright years. 2022-01-03 10:42:10 +01:00
Makefile.in d: Merge upstream dmd 52844d4b1, druntime dbd0c874, phobos 896b1d0e1. 2022-02-16 11:15:02 +01:00
README.gcc Document merge process for dmd, druntime and phobos. 2019-01-12 19:50:41 +00:00

The files in this directory where noted are part of the DRuntime
and Phobos library.

DRuntime is the low-level runtime library backing the D programming
language, hosted at https://github.com/dlang/druntime/.

Phobos is the standard library for the D Programming Language, hosted
at https://github.com/dlang/phobos/.

The following sources and directories are part of DRuntime:
  libdruntime/core/
  libdruntime/gc/
  libdruntime/gcstub/
  libdruntime/object.d
  libdruntime/rt/

The following sources and directories are part of Phobos:
  src/etc/
  src/index.d
  src/std/

To report a bug or look up known issues with the runtime or standard
library please visit the issue tracker at https://issues.dlang.org/.

All changes to either of these libraries should go through the
upstream repository first, then merged back to GCC.