• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- subzero/src/IceInst.def - X-macros for ICE instructions  -*- C++ -*-===//
2//
3//                        The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines properties of ICE instructions in the form of x-macros.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SUBZERO_SRC_ICEINST_DEF
15#define SUBZERO_SRC_ICEINST_DEF
16
17// Floating point addition and multiplication are commutative.
18// 1) non-special values and infinities are required to commute.
19// 2) signed zeroes are handled by:
20//    From IEEE standard 754-2008:
21//      When the sum of two operands with opposite signs (or the difference of
22//      two operands with like signs) is exactly zero, the sign of that sum
23//      (or difference) shall be +0 in all rounding-direction attributes
24//      except roundTowardNegative; under that attribute, the sign of an exact
25//      zero sum (or difference) shall be −0.
26// 3) NaNs are handled by:
27//    http://grouper.ieee.org/groups/1788/email/msg03558.html
28//      clause of 754 at work is 6.2.3 NaN propagation:
29//      "If two or more inputs are NaN, then the payload of the resulting NaN
30//      should be identical to the payload of one of the input NaNs if
31//      representable in the destination format. This standard does not
32//      specify which of the input NaNs will provide the payload."
33
34#define ICEINSTARITHMETIC_TABLE                                                \
35  /* enum value, printable string, commutative */                              \
36  X(Add,         "add",            1)                                          \
37  X(Fadd,        "fadd",           1)                                          \
38  X(Sub,         "sub",            0)                                          \
39  X(Fsub,        "fsub",           0)                                          \
40  X(Mul,         "mul",            1)                                          \
41  X(Fmul,        "fmul",           1)                                          \
42  X(Udiv,        "udiv",           0)                                          \
43  X(Sdiv,        "sdiv",           0)                                          \
44  X(Fdiv,        "fdiv",           0)                                          \
45  X(Urem,        "urem",           0)                                          \
46  X(Srem,        "srem",           0)                                          \
47  X(Frem,        "frem",           0)                                          \
48  X(Shl,         "shl",            0)                                          \
49  X(Lshr,        "lshr",           0)                                          \
50  X(Ashr,        "ashr",           0)                                          \
51  X(And,         "and",            1)                                          \
52  X(Or,          "or",             1)                                          \
53  X(Xor,         "xor",            1)
54//#define X(tag, str, commutative)
55
56#define ICEINSTCAST_TABLE                                                      \
57  /* enum value, printable string */                                           \
58  X(Trunc,       "trunc")                                                      \
59  X(Zext,        "zext")                                                       \
60  X(Sext,        "sext")                                                       \
61  X(Fptrunc,     "fptrunc")                                                    \
62  X(Fpext,       "fpext")                                                      \
63  X(Fptoui,      "fptoui")                                                     \
64  X(Fptosi,      "fptosi")                                                     \
65  X(Uitofp,      "uitofp")                                                     \
66  X(Sitofp,      "sitofp")                                                     \
67  X(Bitcast,     "bitcast")
68//#define X(tag, str)
69
70#define ICEINSTFCMP_TABLE                                                      \
71  /* enum value, printable string */                                           \
72  X(False,       "false")                                                      \
73  X(Oeq,         "oeq")                                                        \
74  X(Ogt,         "ogt")                                                        \
75  X(Oge,         "oge")                                                        \
76  X(Olt,         "olt")                                                        \
77  X(Ole,         "ole")                                                        \
78  X(One,         "one")                                                        \
79  X(Ord,         "ord")                                                        \
80  X(Ueq,         "ueq")                                                        \
81  X(Ugt,         "ugt")                                                        \
82  X(Uge,         "uge")                                                        \
83  X(Ult,         "ult")                                                        \
84  X(Ule,         "ule")                                                        \
85  X(Une,         "une")                                                        \
86  X(Uno,         "uno")                                                        \
87  X(True,        "true")
88//#define X(tag, str)
89
90#define ICEINSTICMP_TABLE                                                      \
91  /* enum value, reverse, printable string */                                  \
92  X(Eq,          Eq,      "eq")                                                \
93  X(Ne,          Ne,      "ne")                                                \
94  X(Ugt,         Ult,     "ugt")                                               \
95  X(Uge,         Ule,     "uge")                                               \
96  X(Ult,         Ugt,     "ult")                                               \
97  X(Ule,         Uge,     "ule")                                               \
98  X(Sgt,         Slt,     "sgt")                                               \
99  X(Sge,         Sle,     "sge")                                               \
100  X(Slt,         Sgt,     "slt")                                               \
101  X(Sle,         Sge,     "sle")
102//#define X(tag, reverse, str)
103
104#endif // SUBZERO_SRC_ICEINST_DEF
105