LLVM 24.0.0git
PISAIntrinsicUtils.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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/// \file
10/// This file declares utility interfaces for PISA intrinsics.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_IR_PISAINTRINSICUTILS_H
15#define LLVM_IR_PISAINTRINSICUTILS_H
16#include "llvm/ADT/StringRef.h"
17#include "llvm/IR/Constants.h"
18#include "llvm/IR/Intrinsics.h"
19#include "llvm/IR/IntrinsicsPISA.h"
22
23namespace llvm {
24namespace pisa {
25
26// Integer reduction operations:
27// https://intel.github.io/pisa/instructions_cross_lane.html#ired
28namespace IRedOp {
29enum : unsigned {
30 SUM = 0,
31 SMIN = 1,
32 SMAX = 2,
33 UMIN = 3,
34 UMAX = 4,
35 AND = 5,
36 OR = 6,
37 XOR = 7,
38 ABSMAX = 8,
40};
41} // namespace IRedOp
42
43// Floating-point reduction operations:
44// https://intel.github.io/pisa/instructions_cross_lane.html#fred
45namespace FRedOp {
46enum : unsigned { MIN = 0, MAX = 1, ABSMAX = 2, Last };
47} // namespace FRedOp
48
49// Sub-group shuffle modes:
50// https://intel.github.io/pisa/instructions_cross_lane.html#shfl
51namespace SHFLMode {
52enum : unsigned { UP = 0, DOWN = 1, XOR = 2, IDX = 3, Last };
53} // namespace SHFLMode
54
55// Print a string corresponding to various immediate arguments to OS.
56//
57// If the value is invalid/unsupported, the functions print nothing; no errors
58// are raised. This is because these functions may be called during printing of
59// invalid IR, which should not crash the compiler. Other code (like the PISA
60// Verifier) is responsible for reporting errors on invalid IR.
61
62LLVM_ABI void printMemoryOrdering(raw_ostream &OS, const Constant *ImmArgVal);
63LLVM_ABI void printRoundingMode(raw_ostream &OS, const Constant *ImmArgVal);
64LLVM_ABI void printIRedOp(raw_ostream &OS, const Constant *ImmArgVal);
65LLVM_ABI void printFRedOp(raw_ostream &OS, const Constant *ImmArgVal);
66LLVM_ABI void printSHFLMode(raw_ostream &OS, const Constant *ImmArgVal);
67
68} // namespace pisa
69} // namespace llvm
70#endif // LLVM_IR_PISAINTRINSICUTILS_H
#define LLVM_ABI
Definition Compiler.h:211
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This is an important base class in LLVM.
Definition Constant.h:44
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
LLVM_ABI void printSHFLMode(raw_ostream &OS, const Constant *ImmArgVal)
LLVM_ABI void printFRedOp(raw_ostream &OS, const Constant *ImmArgVal)
LLVM_ABI void printRoundingMode(raw_ostream &OS, const Constant *ImmArgVal)
LLVM_ABI void printIRedOp(raw_ostream &OS, const Constant *ImmArgVal)
LLVM_ABI void printMemoryOrdering(raw_ostream &OS, const Constant *ImmArgVal)
This is an optimization pass for GlobalISel generic memory operations.