FLANG
matmul.h
1//===-- include/flang/Runtime/matmul.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 the transformational intrinsic function MATMUL.
10
11#ifndef FORTRAN_RUNTIME_MATMUL_H_
12#define FORTRAN_RUNTIME_MATMUL_H_
13#include "flang/Common/float128.h"
14#include "flang/Common/uint128.h"
15#include "flang/Runtime/entry-names.h"
16namespace Fortran::runtime {
17class Descriptor;
18extern "C" {
19
20// The most general MATMUL. All type and shape information is taken from the
21// arguments' descriptors, and the result is dynamically allocated.
22void RTDECL(Matmul)(Descriptor &, const Descriptor &, const Descriptor &,
23 const char *sourceFile = nullptr, int line = 0);
24
25// A non-allocating variant; the result's descriptor must be established
26// and have a valid base address.
27void RTDECL(MatmulDirect)(const Descriptor &, const Descriptor &,
28 const Descriptor &, const char *sourceFile = nullptr, int line = 0);
29
30// MATMUL versions specialized by the categories of the operand types.
31// The KIND and shape information is taken from the argument's
32// descriptors.
33#define MATMUL_INSTANCE(XCAT, XKIND, YCAT, YKIND) \
34 void RTDECL(Matmul##XCAT##XKIND##YCAT##YKIND)(Descriptor & result, \
35 const Descriptor &x, const Descriptor &y, const char *sourceFile, \
36 int line);
37#define MATMUL_DIRECT_INSTANCE(XCAT, XKIND, YCAT, YKIND) \
38 void RTDECL(MatmulDirect##XCAT##XKIND##YCAT##YKIND)(Descriptor & result, \
39 const Descriptor &x, const Descriptor &y, const char *sourceFile, \
40 int line);
41
42#define MATMUL_FORCE_ALL_TYPES 0
43
44#include "matmul-instances.inc"
45
46} // extern "C"
47} // namespace Fortran::runtime
48#endif // FORTRAN_RUNTIME_MATMUL_H_