xref: /llvm-project/flang/include/flang/Runtime/matmul-transpose.h (revision 8ce1aed55f3dbb71406dc6feaed3f162ac183d21)
1 //===-- include/flang/Runtime/matmul-transpose.h ----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // API for optimised MATMUL(TRANSPOSE(a), b)
10 
11 #ifndef FORTRAN_RUNTIME_MATMUL_TRANSPOSE_H_
12 #define FORTRAN_RUNTIME_MATMUL_TRANSPOSE_H_
13 #include "flang/Common/float128.h"
14 #include "flang/Common/uint128.h"
15 #include "flang/Runtime/entry-names.h"
16 namespace Fortran::runtime {
17 class Descriptor;
18 extern "C" {
19 
20 // The most general MATMUL(TRANSPOSE()).  All type and shape information is
21 // taken from the arguments' descriptors, and the result is dynamically
22 // allocated.
23 void RTDECL(MatmulTranspose)(Descriptor &, const Descriptor &,
24     const Descriptor &, const char *sourceFile = nullptr, int line = 0);
25 
26 // A non-allocating variant; the result's descriptor must be established
27 // and have a valid base address.
28 void RTDECL(MatmulTransposeDirect)(const Descriptor &, const Descriptor &,
29     const Descriptor &, const char *sourceFile = nullptr, int line = 0);
30 
31 // MATMUL(TRANSPOSE()) versions specialized by the categories of the operand
32 // types. The KIND and shape information is taken from the argument's
33 // descriptors.
34 #define MATMUL_INSTANCE(XCAT, XKIND, YCAT, YKIND) \
35   void RTDECL(MatmulTranspose##XCAT##XKIND##YCAT##YKIND)(Descriptor & result, \
36       const Descriptor &x, const Descriptor &y, const char *sourceFile, \
37       int line);
38 #define MATMUL_DIRECT_INSTANCE(XCAT, XKIND, YCAT, YKIND) \
39   void RTDECL(MatmulTransposeDirect##XCAT##XKIND##YCAT##YKIND)( \
40       Descriptor & result, const Descriptor &x, const Descriptor &y, \
41       const char *sourceFile, int line);
42 
43 #define MATMUL_FORCE_ALL_TYPES 0
44 
45 #include "matmul-instances.inc"
46 
47 } // extern "C"
48 } // namespace Fortran::runtime
49 #endif // FORTRAN_RUNTIME_MATMUL_TRANSPOSE_H_
50