1//===- llvm/IR/ConstrainedOps.def - Constrained intrinsics ------*- 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// Defines properties of constrained intrinsics, in particular corresponding
10// floating point operations and DAG nodes.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef INSTRUCTION
15#define INSTRUCTION(N,A,R,I,D)
16#endif
17
18// In most cases intrinsic function is handled similar to instruction.
19#ifndef FUNCTION
20#define FUNCTION INSTRUCTION
21#endif
22
23// Likewise for compare instructions.
24#ifndef CMP_INSTRUCTION
25#define CMP_INSTRUCTION INSTRUCTION
26#endif
27
28// Arguments of the entries are:
29// - instruction or intrinsic function name.
30// - Number of original instruction/intrinsic arguments.
31// - 1 if the corresponding constrained intrinsic has rounding mode argument.
32// - name of the constrained intrinsic to represent this instruction/function.
33// - DAG node corresponding to the constrained intrinsic without prefix STRICT_.
34
35// These are definitions for instructions, that are converted into constrained
36// intrinsics.
37//
38INSTRUCTION(FAdd,         2, 1, experimental_constrained_fadd,       FADD)
39INSTRUCTION(FSub,         2, 1, experimental_constrained_fsub,       FSUB)
40INSTRUCTION(FMul,         2, 1, experimental_constrained_fmul,       FMUL)
41INSTRUCTION(FDiv,         2, 1, experimental_constrained_fdiv,       FDIV)
42INSTRUCTION(FRem,         2, 1, experimental_constrained_frem,       FREM)
43INSTRUCTION(FPExt,        1, 0, experimental_constrained_fpext,      FP_EXTEND)
44INSTRUCTION(SIToFP,       1, 1, experimental_constrained_sitofp,     SINT_TO_FP)
45INSTRUCTION(UIToFP,       1, 1, experimental_constrained_uitofp,     UINT_TO_FP)
46INSTRUCTION(FPToSI,       1, 0, experimental_constrained_fptosi,     FP_TO_SINT)
47INSTRUCTION(FPToUI,       1, 0, experimental_constrained_fptoui,     FP_TO_UINT)
48INSTRUCTION(FPTrunc,      1, 1, experimental_constrained_fptrunc,    FP_ROUND)
49
50// These are definitions for compare instructions (signaling and quiet version).
51// Both of these match to FCmp / SETCC.
52CMP_INSTRUCTION(FCmp,     2, 0, experimental_constrained_fcmp,       FSETCC)
53CMP_INSTRUCTION(FCmp,     2, 0, experimental_constrained_fcmps,      FSETCCS)
54
55// Theses are definitions for intrinsic functions, that are converted into
56// constrained intrinsics.
57//
58FUNCTION(ceil,            1, 0, experimental_constrained_ceil,       FCEIL)
59FUNCTION(cos,             1, 1, experimental_constrained_cos,        FCOS)
60FUNCTION(exp,             1, 1, experimental_constrained_exp,        FEXP)
61FUNCTION(exp2,            1, 1, experimental_constrained_exp2,       FEXP2)
62FUNCTION(floor,           1, 0, experimental_constrained_floor,      FFLOOR)
63FUNCTION(fma,             3, 1, experimental_constrained_fma,        FMA)
64FUNCTION(log,             1, 1, experimental_constrained_log,        FLOG)
65FUNCTION(log10,           1, 1, experimental_constrained_log10,      FLOG10)
66FUNCTION(log2,            1, 1, experimental_constrained_log2,       FLOG2)
67FUNCTION(lrint,           1, 1, experimental_constrained_lrint,      LRINT)
68FUNCTION(llrint,          1, 1, experimental_constrained_llrint,     LLRINT)
69FUNCTION(lround,          1, 0, experimental_constrained_lround,     LROUND)
70FUNCTION(llround,         1, 0, experimental_constrained_llround,    LLROUND)
71FUNCTION(maxnum,          2, 0, experimental_constrained_maxnum,     FMAXNUM)
72FUNCTION(minnum,          2, 0, experimental_constrained_minnum,     FMINNUM)
73FUNCTION(maximum,         2, 0, experimental_constrained_maximum,    FMAXIMUM)
74FUNCTION(minimum,         2, 0, experimental_constrained_minimum,    FMINIMUM)
75FUNCTION(nearbyint,       1, 1, experimental_constrained_nearbyint,  FNEARBYINT)
76FUNCTION(pow,             2, 1, experimental_constrained_pow,        FPOW)
77FUNCTION(powi,            2, 1, experimental_constrained_powi,       FPOWI)
78FUNCTION(rint,            1, 1, experimental_constrained_rint,       FRINT)
79FUNCTION(round,           1, 0, experimental_constrained_round,      FROUND)
80FUNCTION(sin,             1, 1, experimental_constrained_sin,        FSIN)
81FUNCTION(sqrt,            1, 1, experimental_constrained_sqrt,       FSQRT)
82FUNCTION(trunc,           1, 0, experimental_constrained_trunc,      FTRUNC)
83
84#undef INSTRUCTION
85#undef FUNCTION
86#undef CMP_INSTRUCTION
87