Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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 | // DAG_FUNCTION defers to DAG_INSTRUCTION if its defined, otherwise FUNCTION. |
||
15 | #ifndef DAG_FUNCTION |
||
16 | #ifdef DAG_INSTRUCTION |
||
17 | #define DAG_FUNCTION(N,A,R,I,D) DAG_INSTRUCTION(N,A,R,I,D) |
||
18 | #else |
||
19 | #define DAG_FUNCTION(N,A,R,I,D) FUNCTION(N,A,R,I) |
||
20 | #endif |
||
21 | #endif |
||
22 | |||
23 | #ifndef INSTRUCTION |
||
24 | #define INSTRUCTION(N,A,R,I) |
||
25 | #endif |
||
26 | |||
27 | // DAG_INSTRUCTION is treated like an INSTRUCTION if the DAG node isn't used. |
||
28 | #ifndef DAG_INSTRUCTION |
||
29 | #define DAG_INSTRUCTION(N,A,R,I,D) INSTRUCTION(N,A,R,I) |
||
30 | #endif |
||
31 | |||
32 | // In most cases intrinsic function is handled similar to instruction. |
||
33 | #ifndef FUNCTION |
||
34 | #define FUNCTION(N,A,R,I) INSTRUCTION(N,A,R,I) |
||
35 | #endif |
||
36 | |||
37 | // Compare instruction have a DAG node so they are treated like DAG_INSTRUCTION. |
||
38 | #ifndef CMP_INSTRUCTION |
||
39 | #define CMP_INSTRUCTION(N,A,R,I,D) DAG_INSTRUCTION(N,A,R,I,D) |
||
40 | #endif |
||
41 | |||
42 | // Arguments of the entries are: |
||
43 | // - instruction or intrinsic function name. |
||
44 | // - Number of original instruction/intrinsic arguments. |
||
45 | // - 1 if the corresponding constrained intrinsic has rounding mode argument. |
||
46 | // - name of the constrained intrinsic to represent this instruction/function. |
||
47 | // - DAG node corresponding to the constrained intrinsic without prefix STRICT_. |
||
48 | |||
49 | // These are definitions for instructions, that are converted into constrained |
||
50 | // intrinsics. |
||
51 | // |
||
52 | DAG_INSTRUCTION(FAdd, 2, 1, experimental_constrained_fadd, FADD) |
||
53 | DAG_INSTRUCTION(FSub, 2, 1, experimental_constrained_fsub, FSUB) |
||
54 | DAG_INSTRUCTION(FMul, 2, 1, experimental_constrained_fmul, FMUL) |
||
55 | DAG_INSTRUCTION(FDiv, 2, 1, experimental_constrained_fdiv, FDIV) |
||
56 | DAG_INSTRUCTION(FRem, 2, 1, experimental_constrained_frem, FREM) |
||
57 | DAG_INSTRUCTION(FPExt, 1, 0, experimental_constrained_fpext, FP_EXTEND) |
||
58 | DAG_INSTRUCTION(SIToFP, 1, 1, experimental_constrained_sitofp, SINT_TO_FP) |
||
59 | DAG_INSTRUCTION(UIToFP, 1, 1, experimental_constrained_uitofp, UINT_TO_FP) |
||
60 | DAG_INSTRUCTION(FPToSI, 1, 0, experimental_constrained_fptosi, FP_TO_SINT) |
||
61 | DAG_INSTRUCTION(FPToUI, 1, 0, experimental_constrained_fptoui, FP_TO_UINT) |
||
62 | DAG_INSTRUCTION(FPTrunc, 1, 1, experimental_constrained_fptrunc, FP_ROUND) |
||
63 | |||
64 | // These are definitions for compare instructions (signaling and quiet version). |
||
65 | // Both of these match to FCmp / SETCC. |
||
66 | CMP_INSTRUCTION(FCmp, 2, 0, experimental_constrained_fcmp, FSETCC) |
||
67 | CMP_INSTRUCTION(FCmp, 2, 0, experimental_constrained_fcmps, FSETCCS) |
||
68 | |||
69 | // Theses are definitions for intrinsic functions, that are converted into |
||
70 | // constrained intrinsics. |
||
71 | // |
||
72 | DAG_FUNCTION(ceil, 1, 0, experimental_constrained_ceil, FCEIL) |
||
73 | DAG_FUNCTION(cos, 1, 1, experimental_constrained_cos, FCOS) |
||
74 | DAG_FUNCTION(exp, 1, 1, experimental_constrained_exp, FEXP) |
||
75 | DAG_FUNCTION(exp2, 1, 1, experimental_constrained_exp2, FEXP2) |
||
76 | DAG_FUNCTION(floor, 1, 0, experimental_constrained_floor, FFLOOR) |
||
77 | DAG_FUNCTION(fma, 3, 1, experimental_constrained_fma, FMA) |
||
78 | DAG_FUNCTION(log, 1, 1, experimental_constrained_log, FLOG) |
||
79 | DAG_FUNCTION(log10, 1, 1, experimental_constrained_log10, FLOG10) |
||
80 | DAG_FUNCTION(log2, 1, 1, experimental_constrained_log2, FLOG2) |
||
81 | DAG_FUNCTION(lrint, 1, 1, experimental_constrained_lrint, LRINT) |
||
82 | DAG_FUNCTION(llrint, 1, 1, experimental_constrained_llrint, LLRINT) |
||
83 | DAG_FUNCTION(lround, 1, 0, experimental_constrained_lround, LROUND) |
||
84 | DAG_FUNCTION(llround, 1, 0, experimental_constrained_llround, LLROUND) |
||
85 | DAG_FUNCTION(maxnum, 2, 0, experimental_constrained_maxnum, FMAXNUM) |
||
86 | DAG_FUNCTION(minnum, 2, 0, experimental_constrained_minnum, FMINNUM) |
||
87 | DAG_FUNCTION(maximum, 2, 0, experimental_constrained_maximum, FMAXIMUM) |
||
88 | DAG_FUNCTION(minimum, 2, 0, experimental_constrained_minimum, FMINIMUM) |
||
89 | DAG_FUNCTION(nearbyint, 1, 1, experimental_constrained_nearbyint, FNEARBYINT) |
||
90 | DAG_FUNCTION(pow, 2, 1, experimental_constrained_pow, FPOW) |
||
91 | DAG_FUNCTION(powi, 2, 1, experimental_constrained_powi, FPOWI) |
||
92 | DAG_FUNCTION(rint, 1, 1, experimental_constrained_rint, FRINT) |
||
93 | DAG_FUNCTION(round, 1, 0, experimental_constrained_round, FROUND) |
||
94 | DAG_FUNCTION(roundeven, 1, 0, experimental_constrained_roundeven, FROUNDEVEN) |
||
95 | DAG_FUNCTION(sin, 1, 1, experimental_constrained_sin, FSIN) |
||
96 | DAG_FUNCTION(sqrt, 1, 1, experimental_constrained_sqrt, FSQRT) |
||
97 | DAG_FUNCTION(trunc, 1, 0, experimental_constrained_trunc, FTRUNC) |
||
98 | |||
99 | // This is definition for fmuladd intrinsic function, that is converted into |
||
100 | // constrained FMA or FMUL + FADD intrinsics. |
||
101 | FUNCTION(fmuladd, 3, 1, experimental_constrained_fmuladd) |
||
102 | |||
103 | #undef INSTRUCTION |
||
104 | #undef FUNCTION |
||
105 | #undef CMP_INSTRUCTION |
||
106 | #undef DAG_INSTRUCTION |
||
107 | #undef DAG_FUNCTION |