Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Nicolas Capens | 4846150 | 2018-08-06 14:20:45 -0400 | [diff] [blame] | 15 | #ifndef rr_Reactor_hpp |
| 16 | #define rr_Reactor_hpp |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 17 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 18 | #include "Nucleus.hpp" |
| 19 | #include "Routine.hpp" |
Ben Clayton | 351be42 | 2019-04-30 12:26:57 +0100 | [diff] [blame] | 20 | #include "Traits.hpp" |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 21 | |
Nicolas Capens | 4dd1eff | 2017-08-04 09:33:04 -0400 | [diff] [blame] | 22 | #include <cassert> |
Nicolas Capens | 3bbc5e1 | 2016-09-27 10:49:52 -0400 | [diff] [blame] | 23 | #include <cstddef> |
Chris Forbes | 878d4b0 | 2019-01-21 10:48:35 -0800 | [diff] [blame] | 24 | #include <cstdio> |
Nicolas Capens | e572088 | 2020-01-13 14:10:04 -0500 | [diff] [blame] | 25 | #include <limits> |
Ben Clayton | 169872e | 2019-02-27 23:58:35 +0000 | [diff] [blame] | 26 | #include <tuple> |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 27 | #include <unordered_set> |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 28 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 29 | #undef Bool // b/127920555 |
Nicolas Capens | 3bbc5e1 | 2016-09-27 10:49:52 -0400 | [diff] [blame] | 30 | |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 31 | #ifdef ENABLE_RR_DEBUG_INFO |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 32 | // Functions used for generating JIT debug info. |
| 33 | // See docs/ReactorDebugInfo.md for more information. |
| 34 | namespace rr { |
| 35 | // Update the current source location for debug. |
| 36 | void EmitDebugLocation(); |
| 37 | // Bind value to its symbolic name taken from the backtrace. |
| 38 | void EmitDebugVariable(class Value *value); |
| 39 | // Flush any pending variable bindings before the line ends. |
| 40 | void FlushDebug(); |
| 41 | } // namespace rr |
| 42 | # define RR_DEBUG_INFO_UPDATE_LOC() rr::EmitDebugLocation() |
| 43 | # define RR_DEBUG_INFO_EMIT_VAR(value) rr::EmitDebugVariable(value) |
| 44 | # define RR_DEBUG_INFO_FLUSH() rr::FlushDebug() |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 45 | #else |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 46 | # define RR_DEBUG_INFO_UPDATE_LOC() |
| 47 | # define RR_DEBUG_INFO_EMIT_VAR(value) |
| 48 | # define RR_DEBUG_INFO_FLUSH() |
| 49 | #endif // ENABLE_RR_DEBUG_INFO |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 50 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 51 | namespace rr { |
| 52 | |
Antonio Maiorano | ab210f9 | 2019-12-13 16:26:24 -0500 | [diff] [blame] | 53 | std::string BackendName(); |
| 54 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 55 | struct Capabilities |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 56 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 57 | bool CoroutinesSupported; // Support for rr::Coroutine<F> |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 58 | }; |
| 59 | extern const Capabilities Caps; |
| 60 | |
| 61 | class Bool; |
| 62 | class Byte; |
| 63 | class SByte; |
| 64 | class Byte4; |
| 65 | class SByte4; |
| 66 | class Byte8; |
| 67 | class SByte8; |
| 68 | class Byte16; |
| 69 | class SByte16; |
| 70 | class Short; |
| 71 | class UShort; |
| 72 | class Short2; |
| 73 | class UShort2; |
| 74 | class Short4; |
| 75 | class UShort4; |
| 76 | class Short8; |
| 77 | class UShort8; |
| 78 | class Int; |
| 79 | class UInt; |
| 80 | class Int2; |
| 81 | class UInt2; |
| 82 | class Int4; |
| 83 | class UInt4; |
| 84 | class Long; |
| 85 | class Half; |
| 86 | class Float; |
| 87 | class Float2; |
| 88 | class Float4; |
| 89 | |
| 90 | class Void |
| 91 | { |
| 92 | public: |
| 93 | static Type *getType(); |
| 94 | |
| 95 | static bool isVoid() |
Ben Clayton | c790416 | 2019-04-17 17:35:48 -0400 | [diff] [blame] | 96 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 97 | return true; |
| 98 | } |
| 99 | }; |
Ben Clayton | c790416 | 2019-04-17 17:35:48 -0400 | [diff] [blame] | 100 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 101 | template<class T> |
| 102 | class RValue; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 103 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 104 | template<class T> |
| 105 | class Pointer; |
| 106 | |
| 107 | class Variable |
| 108 | { |
| 109 | friend class Nucleus; |
| 110 | friend class PrintValue; |
| 111 | |
| 112 | Variable() = delete; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 113 | Variable &operator=(const Variable &) = delete; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 114 | |
| 115 | public: |
| 116 | void materialize() const; |
| 117 | |
| 118 | Value *loadValue() const; |
| 119 | Value *storeValue(Value *value) const; |
| 120 | |
| 121 | Value *getBaseAddress() const; |
| 122 | Value *getElementPointer(Value *index, bool unsignedIndex) const; |
| 123 | |
| 124 | protected: |
| 125 | Variable(Type *type, int arraySize); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 126 | Variable(const Variable &) = default; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 127 | |
| 128 | ~Variable(); |
| 129 | |
| 130 | const int arraySize; |
| 131 | |
| 132 | private: |
| 133 | static void materializeAll(); |
| 134 | static void killUnmaterialized(); |
| 135 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 136 | static std::unordered_set<Variable *> unmaterializedVariables; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 137 | |
| 138 | Type *const type; |
| 139 | mutable Value *rvalue = nullptr; |
| 140 | mutable Value *address = nullptr; |
| 141 | }; |
| 142 | |
| 143 | template<class T> |
| 144 | class LValue : public Variable |
| 145 | { |
| 146 | public: |
| 147 | LValue(int arraySize = 0); |
| 148 | |
| 149 | RValue<Pointer<T>> operator&(); |
| 150 | |
| 151 | static bool isVoid() |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 152 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 153 | return false; |
| 154 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 155 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 156 | // self() returns the this pointer to this LValue<T> object. |
| 157 | // This function exists because operator&() is overloaded. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 158 | inline LValue<T> *self() { return this; } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 159 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 160 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 161 | template<class T> |
| 162 | class Reference |
| 163 | { |
| 164 | public: |
| 165 | using reference_underlying_type = T; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 166 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 167 | explicit Reference(Value *pointer, int alignment = 1); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 168 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 169 | RValue<T> operator=(RValue<T> rhs) const; |
| 170 | RValue<T> operator=(const Reference<T> &ref) const; |
Nicolas Capens | 5da8d8d | 2019-03-27 14:45:34 -0400 | [diff] [blame] | 171 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 172 | RValue<T> operator+=(RValue<T> rhs) const; |
Nicolas Capens | 5da8d8d | 2019-03-27 14:45:34 -0400 | [diff] [blame] | 173 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 174 | RValue<Pointer<T>> operator&() const { return RValue<Pointer<T>>(address); } |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 175 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 176 | Value *loadValue() const; |
| 177 | int getAlignment() const; |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 178 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 179 | private: |
| 180 | Value *address; |
Nicolas Capens | 5da8d8d | 2019-03-27 14:45:34 -0400 | [diff] [blame] | 181 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 182 | const int alignment; |
| 183 | }; |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 184 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 185 | template<class T> |
| 186 | struct BoolLiteral |
| 187 | { |
| 188 | struct type; |
| 189 | }; |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 190 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 191 | template<> |
| 192 | struct BoolLiteral<Bool> |
| 193 | { |
| 194 | typedef bool type; |
| 195 | }; |
Ben Clayton | 83dd452 | 2019-06-27 10:37:00 +0100 | [diff] [blame] | 196 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 197 | template<class T> |
| 198 | struct IntLiteral |
| 199 | { |
| 200 | struct type; |
| 201 | }; |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 202 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 203 | template<> |
| 204 | struct IntLiteral<Int> |
| 205 | { |
| 206 | typedef int type; |
| 207 | }; |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 208 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 209 | template<> |
| 210 | struct IntLiteral<UInt> |
| 211 | { |
| 212 | typedef unsigned int type; |
| 213 | }; |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 214 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 215 | template<> |
| 216 | struct IntLiteral<Long> |
| 217 | { |
| 218 | typedef int64_t type; |
| 219 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 220 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 221 | template<class T> |
| 222 | struct FloatLiteral |
| 223 | { |
| 224 | struct type; |
| 225 | }; |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 226 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 227 | template<> |
| 228 | struct FloatLiteral<Float> |
| 229 | { |
| 230 | typedef float type; |
| 231 | }; |
Ben Clayton | 0953d9b | 2019-06-25 20:57:06 +0100 | [diff] [blame] | 232 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 233 | template<class T> |
| 234 | class RValue |
| 235 | { |
| 236 | public: |
| 237 | using rvalue_underlying_type = T; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 238 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 239 | explicit RValue(Value *rvalue); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 240 | |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 241 | #ifdef ENABLE_RR_DEBUG_INFO |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 242 | RValue(const RValue<T> &rvalue); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 243 | #endif // ENABLE_RR_DEBUG_INFO |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 244 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 245 | RValue(const T &lvalue); |
| 246 | RValue(typename BoolLiteral<T>::type i); |
| 247 | RValue(typename IntLiteral<T>::type i); |
| 248 | RValue(typename FloatLiteral<T>::type f); |
| 249 | RValue(const Reference<T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 250 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 251 | RValue<T> &operator=(const RValue<T> &) = delete; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 252 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 253 | Value *value; // FIXME: Make private |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 254 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 255 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 256 | template<typename T> |
| 257 | struct Argument |
| 258 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 259 | explicit Argument(Value *value) |
| 260 | : value(value) |
| 261 | {} |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 262 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 263 | Value *value; |
| 264 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 265 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 266 | class Bool : public LValue<Bool> |
| 267 | { |
| 268 | public: |
| 269 | Bool(Argument<Bool> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 270 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 271 | Bool() = default; |
| 272 | Bool(bool x); |
| 273 | Bool(RValue<Bool> rhs); |
| 274 | Bool(const Bool &rhs); |
| 275 | Bool(const Reference<Bool> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 276 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 277 | // RValue<Bool> operator=(bool rhs); // FIXME: Implement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 278 | RValue<Bool> operator=(RValue<Bool> rhs); |
| 279 | RValue<Bool> operator=(const Bool &rhs); |
| 280 | RValue<Bool> operator=(const Reference<Bool> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 281 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 282 | static Type *getType(); |
| 283 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 284 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 285 | RValue<Bool> operator!(RValue<Bool> val); |
| 286 | RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs); |
| 287 | RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs); |
| 288 | RValue<Bool> operator!=(RValue<Bool> lhs, RValue<Bool> rhs); |
| 289 | RValue<Bool> operator==(RValue<Bool> lhs, RValue<Bool> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 290 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 291 | class Byte : public LValue<Byte> |
| 292 | { |
| 293 | public: |
| 294 | Byte(Argument<Byte> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 295 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 296 | explicit Byte(RValue<Int> cast); |
| 297 | explicit Byte(RValue<UInt> cast); |
| 298 | explicit Byte(RValue<UShort> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 299 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 300 | Byte() = default; |
| 301 | Byte(int x); |
| 302 | Byte(unsigned char x); |
| 303 | Byte(RValue<Byte> rhs); |
| 304 | Byte(const Byte &rhs); |
| 305 | Byte(const Reference<Byte> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 306 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 307 | // RValue<Byte> operator=(unsigned char rhs); // FIXME: Implement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 308 | RValue<Byte> operator=(RValue<Byte> rhs); |
| 309 | RValue<Byte> operator=(const Byte &rhs); |
| 310 | RValue<Byte> operator=(const Reference<Byte> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 311 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 312 | static Type *getType(); |
| 313 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 314 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 315 | RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs); |
| 316 | RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs); |
| 317 | RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs); |
| 318 | RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs); |
| 319 | RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs); |
| 320 | RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs); |
| 321 | RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs); |
| 322 | RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs); |
| 323 | RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs); |
| 324 | RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs); |
| 325 | RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs); |
| 326 | RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs); |
| 327 | RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs); |
| 328 | RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs); |
| 329 | RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs); |
| 330 | RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs); |
| 331 | RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs); |
| 332 | RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs); |
| 333 | RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs); |
| 334 | RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs); |
| 335 | RValue<Byte> operator+(RValue<Byte> val); |
| 336 | RValue<Byte> operator-(RValue<Byte> val); |
| 337 | RValue<Byte> operator~(RValue<Byte> val); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 338 | RValue<Byte> operator++(Byte &val, int); // Post-increment |
| 339 | const Byte &operator++(Byte &val); // Pre-increment |
| 340 | RValue<Byte> operator--(Byte &val, int); // Post-decrement |
| 341 | const Byte &operator--(Byte &val); // Pre-decrement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 342 | RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs); |
| 343 | RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs); |
| 344 | RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs); |
| 345 | RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs); |
| 346 | RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs); |
| 347 | RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 348 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 349 | class SByte : public LValue<SByte> |
| 350 | { |
| 351 | public: |
| 352 | SByte(Argument<SByte> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 353 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 354 | explicit SByte(RValue<Int> cast); |
| 355 | explicit SByte(RValue<Short> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 356 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 357 | SByte() = default; |
| 358 | SByte(signed char x); |
| 359 | SByte(RValue<SByte> rhs); |
| 360 | SByte(const SByte &rhs); |
| 361 | SByte(const Reference<SByte> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 362 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 363 | // RValue<SByte> operator=(signed char rhs); // FIXME: Implement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 364 | RValue<SByte> operator=(RValue<SByte> rhs); |
| 365 | RValue<SByte> operator=(const SByte &rhs); |
| 366 | RValue<SByte> operator=(const Reference<SByte> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 367 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 368 | static Type *getType(); |
| 369 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 370 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 371 | RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs); |
| 372 | RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs); |
| 373 | RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs); |
| 374 | RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs); |
| 375 | RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs); |
| 376 | RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs); |
| 377 | RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs); |
| 378 | RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs); |
| 379 | RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs); |
| 380 | RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs); |
| 381 | RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs); |
| 382 | RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs); |
| 383 | RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs); |
| 384 | RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs); |
| 385 | RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs); |
| 386 | RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs); |
| 387 | RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs); |
| 388 | RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs); |
| 389 | RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs); |
| 390 | RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs); |
| 391 | RValue<SByte> operator+(RValue<SByte> val); |
| 392 | RValue<SByte> operator-(RValue<SByte> val); |
| 393 | RValue<SByte> operator~(RValue<SByte> val); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 394 | RValue<SByte> operator++(SByte &val, int); // Post-increment |
| 395 | const SByte &operator++(SByte &val); // Pre-increment |
| 396 | RValue<SByte> operator--(SByte &val, int); // Post-decrement |
| 397 | const SByte &operator--(SByte &val); // Pre-decrement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 398 | RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs); |
| 399 | RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs); |
| 400 | RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs); |
| 401 | RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs); |
| 402 | RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs); |
| 403 | RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 404 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 405 | class Short : public LValue<Short> |
| 406 | { |
| 407 | public: |
| 408 | Short(Argument<Short> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 409 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 410 | explicit Short(RValue<Int> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 411 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 412 | Short() = default; |
| 413 | Short(short x); |
| 414 | Short(RValue<Short> rhs); |
| 415 | Short(const Short &rhs); |
| 416 | Short(const Reference<Short> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 417 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 418 | // RValue<Short> operator=(short rhs); // FIXME: Implement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 419 | RValue<Short> operator=(RValue<Short> rhs); |
| 420 | RValue<Short> operator=(const Short &rhs); |
| 421 | RValue<Short> operator=(const Reference<Short> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 422 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 423 | static Type *getType(); |
| 424 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 425 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 426 | RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs); |
| 427 | RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs); |
| 428 | RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs); |
| 429 | RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs); |
| 430 | RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs); |
| 431 | RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs); |
| 432 | RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs); |
| 433 | RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs); |
| 434 | RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs); |
| 435 | RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs); |
| 436 | RValue<Short> operator+=(Short &lhs, RValue<Short> rhs); |
| 437 | RValue<Short> operator-=(Short &lhs, RValue<Short> rhs); |
| 438 | RValue<Short> operator*=(Short &lhs, RValue<Short> rhs); |
| 439 | RValue<Short> operator/=(Short &lhs, RValue<Short> rhs); |
| 440 | RValue<Short> operator%=(Short &lhs, RValue<Short> rhs); |
| 441 | RValue<Short> operator&=(Short &lhs, RValue<Short> rhs); |
| 442 | RValue<Short> operator|=(Short &lhs, RValue<Short> rhs); |
| 443 | RValue<Short> operator^=(Short &lhs, RValue<Short> rhs); |
| 444 | RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs); |
| 445 | RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs); |
| 446 | RValue<Short> operator+(RValue<Short> val); |
| 447 | RValue<Short> operator-(RValue<Short> val); |
| 448 | RValue<Short> operator~(RValue<Short> val); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 449 | RValue<Short> operator++(Short &val, int); // Post-increment |
| 450 | const Short &operator++(Short &val); // Pre-increment |
| 451 | RValue<Short> operator--(Short &val, int); // Post-decrement |
| 452 | const Short &operator--(Short &val); // Pre-decrement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 453 | RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs); |
| 454 | RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs); |
| 455 | RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs); |
| 456 | RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs); |
| 457 | RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs); |
| 458 | RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 459 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 460 | class UShort : public LValue<UShort> |
| 461 | { |
| 462 | public: |
| 463 | UShort(Argument<UShort> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 464 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 465 | explicit UShort(RValue<UInt> cast); |
| 466 | explicit UShort(RValue<Int> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 467 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 468 | UShort() = default; |
| 469 | UShort(unsigned short x); |
| 470 | UShort(RValue<UShort> rhs); |
| 471 | UShort(const UShort &rhs); |
| 472 | UShort(const Reference<UShort> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 473 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 474 | // RValue<UShort> operator=(unsigned short rhs); // FIXME: Implement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 475 | RValue<UShort> operator=(RValue<UShort> rhs); |
| 476 | RValue<UShort> operator=(const UShort &rhs); |
| 477 | RValue<UShort> operator=(const Reference<UShort> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 478 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 479 | static Type *getType(); |
| 480 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 481 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 482 | RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs); |
| 483 | RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs); |
| 484 | RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs); |
| 485 | RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs); |
| 486 | RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs); |
| 487 | RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs); |
| 488 | RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs); |
| 489 | RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs); |
| 490 | RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs); |
| 491 | RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs); |
| 492 | RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs); |
| 493 | RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs); |
| 494 | RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs); |
| 495 | RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs); |
| 496 | RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs); |
| 497 | RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs); |
| 498 | RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs); |
| 499 | RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs); |
| 500 | RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs); |
| 501 | RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs); |
| 502 | RValue<UShort> operator+(RValue<UShort> val); |
| 503 | RValue<UShort> operator-(RValue<UShort> val); |
| 504 | RValue<UShort> operator~(RValue<UShort> val); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 505 | RValue<UShort> operator++(UShort &val, int); // Post-increment |
| 506 | const UShort &operator++(UShort &val); // Pre-increment |
| 507 | RValue<UShort> operator--(UShort &val, int); // Post-decrement |
| 508 | const UShort &operator--(UShort &val); // Pre-decrement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 509 | RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs); |
| 510 | RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs); |
| 511 | RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs); |
| 512 | RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs); |
| 513 | RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs); |
| 514 | RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 515 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 516 | class Byte4 : public LValue<Byte4> |
| 517 | { |
| 518 | public: |
| 519 | explicit Byte4(RValue<Byte8> cast); |
Nicolas Capens | 133b87d | 2020-01-25 16:26:28 -0500 | [diff] [blame] | 520 | explicit Byte4(RValue<UShort4> cast); |
| 521 | explicit Byte4(RValue<Short4> cast); |
| 522 | explicit Byte4(RValue<UInt4> cast); |
| 523 | explicit Byte4(RValue<Int4> cast); |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 524 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 525 | Byte4() = default; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 526 | // Byte4(int x, int y, int z, int w); |
Nicolas Capens | 133b87d | 2020-01-25 16:26:28 -0500 | [diff] [blame] | 527 | Byte4(RValue<Byte4> rhs); |
| 528 | Byte4(const Byte4 &rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 529 | Byte4(const Reference<Byte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 530 | |
Nicolas Capens | 133b87d | 2020-01-25 16:26:28 -0500 | [diff] [blame] | 531 | RValue<Byte4> operator=(RValue<Byte4> rhs); |
| 532 | RValue<Byte4> operator=(const Byte4 &rhs); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 533 | // RValue<Byte4> operator=(const Reference<Byte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 534 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 535 | static Type *getType(); |
| 536 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 537 | |
| 538 | // RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 539 | // RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 540 | // RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 541 | // RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 542 | // RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 543 | // RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 544 | // RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 545 | // RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 546 | // RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 547 | // RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 548 | // RValue<Byte4> operator+=(Byte4 &lhs, RValue<Byte4> rhs); |
| 549 | // RValue<Byte4> operator-=(Byte4 &lhs, RValue<Byte4> rhs); |
| 550 | // RValue<Byte4> operator*=(Byte4 &lhs, RValue<Byte4> rhs); |
| 551 | // RValue<Byte4> operator/=(Byte4 &lhs, RValue<Byte4> rhs); |
| 552 | // RValue<Byte4> operator%=(Byte4 &lhs, RValue<Byte4> rhs); |
| 553 | // RValue<Byte4> operator&=(Byte4 &lhs, RValue<Byte4> rhs); |
| 554 | // RValue<Byte4> operator|=(Byte4 &lhs, RValue<Byte4> rhs); |
| 555 | // RValue<Byte4> operator^=(Byte4 &lhs, RValue<Byte4> rhs); |
| 556 | // RValue<Byte4> operator<<=(Byte4 &lhs, RValue<Byte4> rhs); |
| 557 | // RValue<Byte4> operator>>=(Byte4 &lhs, RValue<Byte4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 558 | // RValue<Byte4> operator+(RValue<Byte4> val); |
| 559 | // RValue<Byte4> operator-(RValue<Byte4> val); |
| 560 | // RValue<Byte4> operator~(RValue<Byte4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 561 | // RValue<Byte4> operator++(Byte4 &val, int); // Post-increment |
| 562 | // const Byte4 &operator++(Byte4 &val); // Pre-increment |
| 563 | // RValue<Byte4> operator--(Byte4 &val, int); // Post-decrement |
| 564 | // const Byte4 &operator--(Byte4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 565 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 566 | class SByte4 : public LValue<SByte4> |
| 567 | { |
| 568 | public: |
| 569 | SByte4() = default; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 570 | // SByte4(int x, int y, int z, int w); |
| 571 | // SByte4(RValue<SByte4> rhs); |
| 572 | // SByte4(const SByte4 &rhs); |
| 573 | // SByte4(const Reference<SByte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 574 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 575 | // RValue<SByte4> operator=(RValue<SByte4> rhs); |
| 576 | // RValue<SByte4> operator=(const SByte4 &rhs); |
| 577 | // RValue<SByte4> operator=(const Reference<SByte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 578 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 579 | static Type *getType(); |
| 580 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 581 | |
| 582 | // RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 583 | // RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 584 | // RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 585 | // RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 586 | // RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 587 | // RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 588 | // RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 589 | // RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 590 | // RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 591 | // RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 592 | // RValue<SByte4> operator+=(SByte4 &lhs, RValue<SByte4> rhs); |
| 593 | // RValue<SByte4> operator-=(SByte4 &lhs, RValue<SByte4> rhs); |
| 594 | // RValue<SByte4> operator*=(SByte4 &lhs, RValue<SByte4> rhs); |
| 595 | // RValue<SByte4> operator/=(SByte4 &lhs, RValue<SByte4> rhs); |
| 596 | // RValue<SByte4> operator%=(SByte4 &lhs, RValue<SByte4> rhs); |
| 597 | // RValue<SByte4> operator&=(SByte4 &lhs, RValue<SByte4> rhs); |
| 598 | // RValue<SByte4> operator|=(SByte4 &lhs, RValue<SByte4> rhs); |
| 599 | // RValue<SByte4> operator^=(SByte4 &lhs, RValue<SByte4> rhs); |
| 600 | // RValue<SByte4> operator<<=(SByte4 &lhs, RValue<SByte4> rhs); |
| 601 | // RValue<SByte4> operator>>=(SByte4 &lhs, RValue<SByte4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 602 | // RValue<SByte4> operator+(RValue<SByte4> val); |
| 603 | // RValue<SByte4> operator-(RValue<SByte4> val); |
| 604 | // RValue<SByte4> operator~(RValue<SByte4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 605 | // RValue<SByte4> operator++(SByte4 &val, int); // Post-increment |
| 606 | // const SByte4 &operator++(SByte4 &val); // Pre-increment |
| 607 | // RValue<SByte4> operator--(SByte4 &val, int); // Post-decrement |
| 608 | // const SByte4 &operator--(SByte4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 609 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 610 | class Byte8 : public LValue<Byte8> |
| 611 | { |
| 612 | public: |
| 613 | Byte8() = default; |
| 614 | Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7); |
| 615 | Byte8(RValue<Byte8> rhs); |
| 616 | Byte8(const Byte8 &rhs); |
| 617 | Byte8(const Reference<Byte8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 618 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 619 | RValue<Byte8> operator=(RValue<Byte8> rhs); |
| 620 | RValue<Byte8> operator=(const Byte8 &rhs); |
| 621 | RValue<Byte8> operator=(const Reference<Byte8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 622 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 623 | static Type *getType(); |
| 624 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 625 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 626 | RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 627 | RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 628 | // RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 629 | // RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 630 | // RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 631 | RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 632 | RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 633 | RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 634 | // RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 635 | // RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 636 | RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs); |
| 637 | RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 638 | // RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs); |
| 639 | // RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs); |
| 640 | // RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 641 | RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs); |
| 642 | RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs); |
| 643 | RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 644 | // RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs); |
| 645 | // RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 646 | // RValue<Byte8> operator+(RValue<Byte8> val); |
| 647 | // RValue<Byte8> operator-(RValue<Byte8> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 648 | RValue<Byte8> operator~(RValue<Byte8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 649 | // RValue<Byte8> operator++(Byte8 &val, int); // Post-increment |
| 650 | // const Byte8 &operator++(Byte8 &val); // Pre-increment |
| 651 | // RValue<Byte8> operator--(Byte8 &val, int); // Post-decrement |
| 652 | // const Byte8 &operator--(Byte8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 653 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 654 | RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y); |
| 655 | RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y); |
| 656 | RValue<Short4> Unpack(RValue<Byte4> x); |
| 657 | RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y); |
| 658 | RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y); |
| 659 | RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y); |
| 660 | RValue<Int> SignMask(RValue<Byte8> x); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 661 | // RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 662 | RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y); |
Nicolas Capens | 133b87d | 2020-01-25 16:26:28 -0500 | [diff] [blame] | 663 | RValue<Byte8> Swizzle(RValue<Byte8> x, uint32_t select); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 664 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 665 | class SByte8 : public LValue<SByte8> |
| 666 | { |
| 667 | public: |
| 668 | SByte8() = default; |
| 669 | SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7); |
| 670 | SByte8(RValue<SByte8> rhs); |
| 671 | SByte8(const SByte8 &rhs); |
| 672 | SByte8(const Reference<SByte8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 673 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 674 | RValue<SByte8> operator=(RValue<SByte8> rhs); |
| 675 | RValue<SByte8> operator=(const SByte8 &rhs); |
| 676 | RValue<SByte8> operator=(const Reference<SByte8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 677 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 678 | static Type *getType(); |
| 679 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 680 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 681 | RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 682 | RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 683 | // RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 684 | // RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 685 | // RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 686 | RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 687 | RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 688 | RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 689 | // RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 690 | // RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 691 | RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs); |
| 692 | RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 693 | // RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs); |
| 694 | // RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs); |
| 695 | // RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 696 | RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs); |
| 697 | RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs); |
| 698 | RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 699 | // RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs); |
| 700 | // RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 701 | // RValue<SByte8> operator+(RValue<SByte8> val); |
| 702 | // RValue<SByte8> operator-(RValue<SByte8> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 703 | RValue<SByte8> operator~(RValue<SByte8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 704 | // RValue<SByte8> operator++(SByte8 &val, int); // Post-increment |
| 705 | // const SByte8 &operator++(SByte8 &val); // Pre-increment |
| 706 | // RValue<SByte8> operator--(SByte8 &val, int); // Post-decrement |
| 707 | // const SByte8 &operator--(SByte8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 708 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 709 | RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y); |
| 710 | RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y); |
| 711 | RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y); |
| 712 | RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y); |
| 713 | RValue<Int> SignMask(RValue<SByte8> x); |
| 714 | RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y); |
| 715 | RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 716 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 717 | class Byte16 : public LValue<Byte16> |
| 718 | { |
| 719 | public: |
| 720 | Byte16() = default; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 721 | Byte16(RValue<Byte16> rhs); |
| 722 | Byte16(const Byte16 &rhs); |
| 723 | Byte16(const Reference<Byte16> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 724 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 725 | RValue<Byte16> operator=(RValue<Byte16> rhs); |
| 726 | RValue<Byte16> operator=(const Byte16 &rhs); |
| 727 | RValue<Byte16> operator=(const Reference<Byte16> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 728 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 729 | static Type *getType(); |
| 730 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 731 | |
| 732 | // RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 733 | // RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 734 | // RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 735 | // RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 736 | // RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 737 | // RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 738 | // RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 739 | // RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 740 | // RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 741 | // RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 742 | // RValue<Byte16> operator+=(Byte16 &lhs, RValue<Byte16> rhs); |
| 743 | // RValue<Byte16> operator-=(Byte16 &lhs, RValue<Byte16> rhs); |
| 744 | // RValue<Byte16> operator*=(Byte16 &lhs, RValue<Byte16> rhs); |
| 745 | // RValue<Byte16> operator/=(Byte16 &lhs, RValue<Byte16> rhs); |
| 746 | // RValue<Byte16> operator%=(Byte16 &lhs, RValue<Byte16> rhs); |
| 747 | // RValue<Byte16> operator&=(Byte16 &lhs, RValue<Byte16> rhs); |
| 748 | // RValue<Byte16> operator|=(Byte16 &lhs, RValue<Byte16> rhs); |
| 749 | // RValue<Byte16> operator^=(Byte16 &lhs, RValue<Byte16> rhs); |
| 750 | // RValue<Byte16> operator<<=(Byte16 &lhs, RValue<Byte16> rhs); |
| 751 | // RValue<Byte16> operator>>=(Byte16 &lhs, RValue<Byte16> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 752 | // RValue<Byte16> operator+(RValue<Byte16> val); |
| 753 | // RValue<Byte16> operator-(RValue<Byte16> val); |
| 754 | // RValue<Byte16> operator~(RValue<Byte16> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 755 | // RValue<Byte16> operator++(Byte16 &val, int); // Post-increment |
| 756 | // const Byte16 &operator++(Byte16 &val); // Pre-increment |
| 757 | // RValue<Byte16> operator--(Byte16 &val, int); // Post-decrement |
| 758 | // const Byte16 &operator--(Byte16 &val); // Pre-decrement |
Nicolas Capens | 133b87d | 2020-01-25 16:26:28 -0500 | [diff] [blame] | 759 | RValue<Byte16> Swizzle(RValue<Byte16> x, uint64_t select); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 760 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 761 | class SByte16 : public LValue<SByte16> |
| 762 | { |
| 763 | public: |
| 764 | SByte16() = default; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 765 | // SByte16(int x, int y, int z, int w); |
| 766 | // SByte16(RValue<SByte16> rhs); |
| 767 | // SByte16(const SByte16 &rhs); |
| 768 | // SByte16(const Reference<SByte16> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 769 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 770 | // RValue<SByte16> operator=(RValue<SByte16> rhs); |
| 771 | // RValue<SByte16> operator=(const SByte16 &rhs); |
| 772 | // RValue<SByte16> operator=(const Reference<SByte16> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 773 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 774 | static Type *getType(); |
| 775 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 776 | |
| 777 | // RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 778 | // RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 779 | // RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 780 | // RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 781 | // RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 782 | // RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 783 | // RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 784 | // RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 785 | // RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 786 | // RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 787 | // RValue<SByte16> operator+=(SByte16 &lhs, RValue<SByte16> rhs); |
| 788 | // RValue<SByte16> operator-=(SByte16 &lhs, RValue<SByte16> rhs); |
| 789 | // RValue<SByte16> operator*=(SByte16 &lhs, RValue<SByte16> rhs); |
| 790 | // RValue<SByte16> operator/=(SByte16 &lhs, RValue<SByte16> rhs); |
| 791 | // RValue<SByte16> operator%=(SByte16 &lhs, RValue<SByte16> rhs); |
| 792 | // RValue<SByte16> operator&=(SByte16 &lhs, RValue<SByte16> rhs); |
| 793 | // RValue<SByte16> operator|=(SByte16 &lhs, RValue<SByte16> rhs); |
| 794 | // RValue<SByte16> operator^=(SByte16 &lhs, RValue<SByte16> rhs); |
| 795 | // RValue<SByte16> operator<<=(SByte16 &lhs, RValue<SByte16> rhs); |
| 796 | // RValue<SByte16> operator>>=(SByte16 &lhs, RValue<SByte16> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 797 | // RValue<SByte16> operator+(RValue<SByte16> val); |
| 798 | // RValue<SByte16> operator-(RValue<SByte16> val); |
| 799 | // RValue<SByte16> operator~(RValue<SByte16> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 800 | // RValue<SByte16> operator++(SByte16 &val, int); // Post-increment |
| 801 | // const SByte16 &operator++(SByte16 &val); // Pre-increment |
| 802 | // RValue<SByte16> operator--(SByte16 &val, int); // Post-decrement |
| 803 | // const SByte16 &operator--(SByte16 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 804 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 805 | class Short2 : public LValue<Short2> |
| 806 | { |
| 807 | public: |
| 808 | explicit Short2(RValue<Short4> cast); |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 809 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 810 | static Type *getType(); |
| 811 | }; |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 812 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 813 | class UShort2 : public LValue<UShort2> |
| 814 | { |
| 815 | public: |
| 816 | explicit UShort2(RValue<UShort4> cast); |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 817 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 818 | static Type *getType(); |
| 819 | }; |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 820 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 821 | class Short4 : public LValue<Short4> |
| 822 | { |
| 823 | public: |
| 824 | explicit Short4(RValue<Int> cast); |
| 825 | explicit Short4(RValue<Int4> cast); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 826 | // explicit Short4(RValue<Float> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 827 | explicit Short4(RValue<Float4> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 828 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 829 | Short4() = default; |
| 830 | Short4(short xyzw); |
| 831 | Short4(short x, short y, short z, short w); |
| 832 | Short4(RValue<Short4> rhs); |
| 833 | Short4(const Short4 &rhs); |
| 834 | Short4(const Reference<Short4> &rhs); |
| 835 | Short4(RValue<UShort4> rhs); |
| 836 | Short4(const UShort4 &rhs); |
| 837 | Short4(const Reference<UShort4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 838 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 839 | RValue<Short4> operator=(RValue<Short4> rhs); |
| 840 | RValue<Short4> operator=(const Short4 &rhs); |
| 841 | RValue<Short4> operator=(const Reference<Short4> &rhs); |
| 842 | RValue<Short4> operator=(RValue<UShort4> rhs); |
| 843 | RValue<Short4> operator=(const UShort4 &rhs); |
| 844 | RValue<Short4> operator=(const Reference<UShort4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 845 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 846 | static Type *getType(); |
| 847 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 848 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 849 | RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs); |
| 850 | RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs); |
| 851 | RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 852 | // RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs); |
| 853 | // RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 854 | RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs); |
| 855 | RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs); |
| 856 | RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs); |
| 857 | RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs); |
| 858 | RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs); |
| 859 | RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs); |
| 860 | RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs); |
| 861 | RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 862 | // RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs); |
| 863 | // RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 864 | RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs); |
| 865 | RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs); |
| 866 | RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs); |
| 867 | RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs); |
| 868 | RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 869 | // RValue<Short4> operator+(RValue<Short4> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 870 | RValue<Short4> operator-(RValue<Short4> val); |
| 871 | RValue<Short4> operator~(RValue<Short4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 872 | // RValue<Short4> operator++(Short4 &val, int); // Post-increment |
| 873 | // const Short4 &operator++(Short4 &val); // Pre-increment |
| 874 | // RValue<Short4> operator--(Short4 &val, int); // Post-decrement |
| 875 | // const Short4 &operator--(Short4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 876 | // RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs); |
| 877 | // RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs); |
| 878 | // RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs); |
| 879 | // RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs); |
| 880 | // RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs); |
| 881 | // RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs); |
| 882 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 883 | RValue<Short4> RoundShort4(RValue<Float4> cast); |
| 884 | RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y); |
| 885 | RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y); |
| 886 | RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y); |
| 887 | RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y); |
| 888 | RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y); |
| 889 | RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y); |
| 890 | RValue<SByte8> PackSigned(RValue<Short4> x, RValue<Short4> y); |
| 891 | RValue<Byte8> PackUnsigned(RValue<Short4> x, RValue<Short4> y); |
| 892 | RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y); |
| 893 | RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y); |
| 894 | RValue<Short4> Swizzle(RValue<Short4> x, uint16_t select); |
| 895 | RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i); |
| 896 | RValue<Short> Extract(RValue<Short4> val, int i); |
| 897 | RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y); |
| 898 | RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 899 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 900 | class UShort4 : public LValue<UShort4> |
| 901 | { |
| 902 | public: |
| 903 | explicit UShort4(RValue<Int4> cast); |
| 904 | explicit UShort4(RValue<Float4> cast, bool saturate = false); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 905 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 906 | UShort4() = default; |
| 907 | UShort4(unsigned short xyzw); |
| 908 | UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w); |
| 909 | UShort4(RValue<UShort4> rhs); |
| 910 | UShort4(const UShort4 &rhs); |
| 911 | UShort4(const Reference<UShort4> &rhs); |
| 912 | UShort4(RValue<Short4> rhs); |
| 913 | UShort4(const Short4 &rhs); |
| 914 | UShort4(const Reference<Short4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 915 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 916 | RValue<UShort4> operator=(RValue<UShort4> rhs); |
| 917 | RValue<UShort4> operator=(const UShort4 &rhs); |
| 918 | RValue<UShort4> operator=(const Reference<UShort4> &rhs); |
| 919 | RValue<UShort4> operator=(RValue<Short4> rhs); |
| 920 | RValue<UShort4> operator=(const Short4 &rhs); |
| 921 | RValue<UShort4> operator=(const Reference<Short4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 922 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 923 | static Type *getType(); |
| 924 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 925 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 926 | RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 927 | RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 928 | RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 929 | // RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 930 | // RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 931 | RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 932 | RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 933 | RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 934 | RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs); |
| 935 | RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 936 | // RValue<UShort4> operator+=(UShort4 &lhs, RValue<UShort4> rhs); |
| 937 | // RValue<UShort4> operator-=(UShort4 &lhs, RValue<UShort4> rhs); |
| 938 | // RValue<UShort4> operator*=(UShort4 &lhs, RValue<UShort4> rhs); |
| 939 | // RValue<UShort4> operator/=(UShort4 &lhs, RValue<UShort4> rhs); |
| 940 | // RValue<UShort4> operator%=(UShort4 &lhs, RValue<UShort4> rhs); |
| 941 | // RValue<UShort4> operator&=(UShort4 &lhs, RValue<UShort4> rhs); |
| 942 | // RValue<UShort4> operator|=(UShort4 &lhs, RValue<UShort4> rhs); |
| 943 | // RValue<UShort4> operator^=(UShort4 &lhs, RValue<UShort4> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 944 | RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs); |
| 945 | RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 946 | // RValue<UShort4> operator+(RValue<UShort4> val); |
| 947 | // RValue<UShort4> operator-(RValue<UShort4> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 948 | RValue<UShort4> operator~(RValue<UShort4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 949 | // RValue<UShort4> operator++(UShort4 &val, int); // Post-increment |
| 950 | // const UShort4 &operator++(UShort4 &val); // Pre-increment |
| 951 | // RValue<UShort4> operator--(UShort4 &val, int); // Post-decrement |
| 952 | // const UShort4 &operator--(UShort4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 953 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 954 | RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y); |
| 955 | RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y); |
| 956 | RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y); |
| 957 | RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y); |
| 958 | RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y); |
| 959 | RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 960 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 961 | class Short8 : public LValue<Short8> |
| 962 | { |
| 963 | public: |
| 964 | Short8() = default; |
| 965 | Short8(short c); |
| 966 | Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7); |
| 967 | Short8(RValue<Short8> rhs); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 968 | // Short8(const Short8 &rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 969 | Short8(const Reference<Short8> &rhs); |
| 970 | Short8(RValue<Short4> lo, RValue<Short4> hi); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 971 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 972 | RValue<Short8> operator=(RValue<Short8> rhs); |
| 973 | RValue<Short8> operator=(const Short8 &rhs); |
| 974 | RValue<Short8> operator=(const Reference<Short8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 975 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 976 | static Type *getType(); |
| 977 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 978 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 979 | RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 980 | // RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs); |
| 981 | // RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs); |
| 982 | // RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs); |
| 983 | // RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 984 | RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 985 | // RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs); |
| 986 | // RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 987 | RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs); |
| 988 | RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 989 | // RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs); |
| 990 | // RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 991 | // RValue<Short8> operator+=(Short8 &lhs, RValue<Short8> rhs); |
| 992 | // RValue<Short8> operator-=(Short8 &lhs, RValue<Short8> rhs); |
| 993 | // RValue<Short8> operator*=(Short8 &lhs, RValue<Short8> rhs); |
| 994 | // RValue<Short8> operator/=(Short8 &lhs, RValue<Short8> rhs); |
| 995 | // RValue<Short8> operator%=(Short8 &lhs, RValue<Short8> rhs); |
| 996 | // RValue<Short8> operator&=(Short8 &lhs, RValue<Short8> rhs); |
| 997 | // RValue<Short8> operator|=(Short8 &lhs, RValue<Short8> rhs); |
| 998 | // RValue<Short8> operator^=(Short8 &lhs, RValue<Short8> rhs); |
| 999 | // RValue<Short8> operator<<=(Short8 &lhs, RValue<Short8> rhs); |
| 1000 | // RValue<Short8> operator>>=(Short8 &lhs, RValue<Short8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1001 | // RValue<Short8> operator+(RValue<Short8> val); |
| 1002 | // RValue<Short8> operator-(RValue<Short8> val); |
| 1003 | // RValue<Short8> operator~(RValue<Short8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1004 | // RValue<Short8> operator++(Short8 &val, int); // Post-increment |
| 1005 | // const Short8 &operator++(Short8 &val); // Pre-increment |
| 1006 | // RValue<Short8> operator--(Short8 &val, int); // Post-decrement |
| 1007 | // const Short8 &operator--(Short8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1008 | // RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs); |
| 1009 | // RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs); |
| 1010 | // RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs); |
| 1011 | // RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs); |
| 1012 | // RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs); |
| 1013 | // RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs); |
| 1014 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1015 | RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y); |
| 1016 | RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y); |
| 1017 | RValue<Int4> Abs(RValue<Int4> x); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1018 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1019 | class UShort8 : public LValue<UShort8> |
| 1020 | { |
| 1021 | public: |
| 1022 | UShort8() = default; |
| 1023 | UShort8(unsigned short c); |
| 1024 | UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7); |
| 1025 | UShort8(RValue<UShort8> rhs); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1026 | // UShort8(const UShort8 &rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1027 | UShort8(const Reference<UShort8> &rhs); |
| 1028 | UShort8(RValue<UShort4> lo, RValue<UShort4> hi); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1029 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1030 | RValue<UShort8> operator=(RValue<UShort8> rhs); |
| 1031 | RValue<UShort8> operator=(const UShort8 &rhs); |
| 1032 | RValue<UShort8> operator=(const Reference<UShort8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1033 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1034 | static Type *getType(); |
| 1035 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1036 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1037 | RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1038 | // RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1039 | RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1040 | // RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1041 | // RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1042 | RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1043 | // RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1044 | // RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1045 | RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs); |
| 1046 | RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1047 | // RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1048 | // RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1049 | RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1050 | // RValue<UShort8> operator-=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1051 | // RValue<UShort8> operator*=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1052 | // RValue<UShort8> operator/=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1053 | // RValue<UShort8> operator%=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1054 | // RValue<UShort8> operator&=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1055 | // RValue<UShort8> operator|=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1056 | // RValue<UShort8> operator^=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1057 | // RValue<UShort8> operator<<=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1058 | // RValue<UShort8> operator>>=(UShort8 &lhs, RValue<UShort8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1059 | // RValue<UShort8> operator+(RValue<UShort8> val); |
| 1060 | // RValue<UShort8> operator-(RValue<UShort8> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1061 | RValue<UShort8> operator~(RValue<UShort8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1062 | // RValue<UShort8> operator++(UShort8 &val, int); // Post-increment |
| 1063 | // const UShort8 &operator++(UShort8 &val); // Pre-increment |
| 1064 | // RValue<UShort8> operator--(UShort8 &val, int); // Post-decrement |
| 1065 | // const UShort8 &operator--(UShort8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1066 | // RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1067 | // RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1068 | // RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1069 | // RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1070 | // RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1071 | // RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1072 | |
Nicolas Capens | 133b87d | 2020-01-25 16:26:28 -0500 | [diff] [blame] | 1073 | RValue<UShort8> Swizzle(RValue<UShort8> x, uint32_t select); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1074 | RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1075 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1076 | class Int : public LValue<Int> |
| 1077 | { |
| 1078 | public: |
| 1079 | Int(Argument<Int> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1080 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1081 | explicit Int(RValue<Byte> cast); |
| 1082 | explicit Int(RValue<SByte> cast); |
| 1083 | explicit Int(RValue<Short> cast); |
| 1084 | explicit Int(RValue<UShort> cast); |
| 1085 | explicit Int(RValue<Int2> cast); |
| 1086 | explicit Int(RValue<Long> cast); |
| 1087 | explicit Int(RValue<Float> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1088 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1089 | Int() = default; |
| 1090 | Int(int x); |
| 1091 | Int(RValue<Int> rhs); |
| 1092 | Int(RValue<UInt> rhs); |
| 1093 | Int(const Int &rhs); |
| 1094 | Int(const UInt &rhs); |
| 1095 | Int(const Reference<Int> &rhs); |
| 1096 | Int(const Reference<UInt> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1097 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1098 | RValue<Int> operator=(int rhs); |
| 1099 | RValue<Int> operator=(RValue<Int> rhs); |
| 1100 | RValue<Int> operator=(RValue<UInt> rhs); |
| 1101 | RValue<Int> operator=(const Int &rhs); |
| 1102 | RValue<Int> operator=(const UInt &rhs); |
| 1103 | RValue<Int> operator=(const Reference<Int> &rhs); |
| 1104 | RValue<Int> operator=(const Reference<UInt> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1105 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1106 | static Type *getType(); |
| 1107 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1108 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1109 | RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs); |
| 1110 | RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs); |
| 1111 | RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs); |
| 1112 | RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs); |
| 1113 | RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs); |
| 1114 | RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs); |
| 1115 | RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs); |
| 1116 | RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs); |
| 1117 | RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs); |
| 1118 | RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs); |
| 1119 | RValue<Int> operator+=(Int &lhs, RValue<Int> rhs); |
| 1120 | RValue<Int> operator-=(Int &lhs, RValue<Int> rhs); |
| 1121 | RValue<Int> operator*=(Int &lhs, RValue<Int> rhs); |
| 1122 | RValue<Int> operator/=(Int &lhs, RValue<Int> rhs); |
| 1123 | RValue<Int> operator%=(Int &lhs, RValue<Int> rhs); |
| 1124 | RValue<Int> operator&=(Int &lhs, RValue<Int> rhs); |
| 1125 | RValue<Int> operator|=(Int &lhs, RValue<Int> rhs); |
| 1126 | RValue<Int> operator^=(Int &lhs, RValue<Int> rhs); |
| 1127 | RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs); |
| 1128 | RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs); |
| 1129 | RValue<Int> operator+(RValue<Int> val); |
| 1130 | RValue<Int> operator-(RValue<Int> val); |
| 1131 | RValue<Int> operator~(RValue<Int> val); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1132 | RValue<Int> operator++(Int &val, int); // Post-increment |
| 1133 | const Int &operator++(Int &val); // Pre-increment |
| 1134 | RValue<Int> operator--(Int &val, int); // Post-decrement |
| 1135 | const Int &operator--(Int &val); // Pre-decrement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1136 | RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs); |
| 1137 | RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs); |
| 1138 | RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs); |
| 1139 | RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs); |
| 1140 | RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs); |
| 1141 | RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1142 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1143 | RValue<Int> Max(RValue<Int> x, RValue<Int> y); |
| 1144 | RValue<Int> Min(RValue<Int> x, RValue<Int> y); |
| 1145 | RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max); |
| 1146 | RValue<Int> RoundInt(RValue<Float> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1147 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1148 | class Long : public LValue<Long> |
| 1149 | { |
| 1150 | public: |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1151 | // Long(Argument<Long> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1152 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1153 | // explicit Long(RValue<Short> cast); |
| 1154 | // explicit Long(RValue<UShort> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1155 | explicit Long(RValue<Int> cast); |
| 1156 | explicit Long(RValue<UInt> cast); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1157 | // explicit Long(RValue<Float> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1158 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1159 | Long() = default; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1160 | // Long(qword x); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1161 | Long(RValue<Long> rhs); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1162 | // Long(RValue<ULong> rhs); |
| 1163 | // Long(const Long &rhs); |
| 1164 | // Long(const Reference<Long> &rhs); |
| 1165 | // Long(const ULong &rhs); |
| 1166 | // Long(const Reference<ULong> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1167 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1168 | RValue<Long> operator=(int64_t rhs); |
| 1169 | RValue<Long> operator=(RValue<Long> rhs); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1170 | // RValue<Long> operator=(RValue<ULong> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1171 | RValue<Long> operator=(const Long &rhs); |
| 1172 | RValue<Long> operator=(const Reference<Long> &rhs); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1173 | // RValue<Long> operator=(const ULong &rhs); |
| 1174 | // RValue<Long> operator=(const Reference<ULong> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1175 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1176 | static Type *getType(); |
| 1177 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1178 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1179 | RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs); |
| 1180 | RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs); |
| 1181 | RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1182 | // RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs); |
| 1183 | // RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs); |
| 1184 | // RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs); |
| 1185 | // RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs); |
| 1186 | // RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs); |
| 1187 | // RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1188 | RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs); |
| 1189 | RValue<Long> operator+=(Long &lhs, RValue<Long> rhs); |
| 1190 | RValue<Long> operator-=(Long &lhs, RValue<Long> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1191 | // RValue<Long> operator*=(Long &lhs, RValue<Long> rhs); |
| 1192 | // RValue<Long> operator/=(Long &lhs, RValue<Long> rhs); |
| 1193 | // RValue<Long> operator%=(Long &lhs, RValue<Long> rhs); |
| 1194 | // RValue<Long> operator&=(Long &lhs, RValue<Long> rhs); |
| 1195 | // RValue<Long> operator|=(Long &lhs, RValue<Long> rhs); |
| 1196 | // RValue<Long> operator^=(Long &lhs, RValue<Long> rhs); |
| 1197 | // RValue<Long> operator<<=(Long &lhs, RValue<Long> rhs); |
| 1198 | // RValue<Long> operator>>=(Long &lhs, RValue<Long> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1199 | // RValue<Long> operator+(RValue<Long> val); |
| 1200 | // RValue<Long> operator-(RValue<Long> val); |
| 1201 | // RValue<Long> operator~(RValue<Long> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1202 | // RValue<Long> operator++(Long &val, int); // Post-increment |
| 1203 | // const Long &operator++(Long &val); // Pre-increment |
| 1204 | // RValue<Long> operator--(Long &val, int); // Post-decrement |
| 1205 | // const Long &operator--(Long &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1206 | // RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs); |
| 1207 | // RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs); |
| 1208 | // RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs); |
| 1209 | // RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs); |
| 1210 | // RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs); |
| 1211 | // RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs); |
| 1212 | |
| 1213 | // RValue<Long> RoundLong(RValue<Float> cast); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1214 | RValue<Long> AddAtomic(RValue<Pointer<Long>> x, RValue<Long> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1215 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1216 | class UInt : public LValue<UInt> |
| 1217 | { |
| 1218 | public: |
| 1219 | UInt(Argument<UInt> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1220 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1221 | explicit UInt(RValue<UShort> cast); |
| 1222 | explicit UInt(RValue<Long> cast); |
| 1223 | explicit UInt(RValue<Float> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1224 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1225 | UInt() = default; |
| 1226 | UInt(int x); |
| 1227 | UInt(unsigned int x); |
| 1228 | UInt(RValue<UInt> rhs); |
| 1229 | UInt(RValue<Int> rhs); |
| 1230 | UInt(const UInt &rhs); |
| 1231 | UInt(const Int &rhs); |
| 1232 | UInt(const Reference<UInt> &rhs); |
| 1233 | UInt(const Reference<Int> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1234 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1235 | RValue<UInt> operator=(unsigned int rhs); |
| 1236 | RValue<UInt> operator=(RValue<UInt> rhs); |
| 1237 | RValue<UInt> operator=(RValue<Int> rhs); |
| 1238 | RValue<UInt> operator=(const UInt &rhs); |
| 1239 | RValue<UInt> operator=(const Int &rhs); |
| 1240 | RValue<UInt> operator=(const Reference<UInt> &rhs); |
| 1241 | RValue<UInt> operator=(const Reference<Int> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1242 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1243 | static Type *getType(); |
| 1244 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1245 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1246 | RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1247 | RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1248 | RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1249 | RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1250 | RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1251 | RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1252 | RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1253 | RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1254 | RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1255 | RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1256 | RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs); |
| 1257 | RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs); |
| 1258 | RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs); |
| 1259 | RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs); |
| 1260 | RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs); |
| 1261 | RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs); |
| 1262 | RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs); |
| 1263 | RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs); |
| 1264 | RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs); |
| 1265 | RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs); |
| 1266 | RValue<UInt> operator+(RValue<UInt> val); |
| 1267 | RValue<UInt> operator-(RValue<UInt> val); |
| 1268 | RValue<UInt> operator~(RValue<UInt> val); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1269 | RValue<UInt> operator++(UInt &val, int); // Post-increment |
| 1270 | const UInt &operator++(UInt &val); // Pre-increment |
| 1271 | RValue<UInt> operator--(UInt &val, int); // Post-decrement |
| 1272 | const UInt &operator--(UInt &val); // Pre-decrement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1273 | RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1274 | RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1275 | RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1276 | RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1277 | RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1278 | RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1279 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1280 | RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y); |
| 1281 | RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y); |
| 1282 | RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max); |
Chris Forbes | 1781393 | 2019-04-18 11:45:54 -0700 | [diff] [blame] | 1283 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1284 | RValue<UInt> AddAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1285 | RValue<UInt> SubAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1286 | RValue<UInt> AndAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1287 | RValue<UInt> OrAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1288 | RValue<UInt> XorAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1289 | RValue<Int> MinAtomic(RValue<Pointer<Int>> x, RValue<Int> y, std::memory_order memoryOrder); |
| 1290 | RValue<Int> MaxAtomic(RValue<Pointer<Int>> x, RValue<Int> y, std::memory_order memoryOrder); |
| 1291 | RValue<UInt> MinAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1292 | RValue<UInt> MaxAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1293 | RValue<UInt> ExchangeAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder); |
| 1294 | RValue<UInt> CompareExchangeAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, RValue<UInt> compare, std::memory_order memoryOrderEqual, std::memory_order memoryOrderUnequal); |
Chris Forbes | 1781393 | 2019-04-18 11:45:54 -0700 | [diff] [blame] | 1295 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1296 | // RValue<UInt> RoundUInt(RValue<Float> cast); |
| 1297 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1298 | class Int2 : public LValue<Int2> |
| 1299 | { |
| 1300 | public: |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1301 | // explicit Int2(RValue<Int> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1302 | explicit Int2(RValue<Int4> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1303 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1304 | Int2() = default; |
| 1305 | Int2(int x, int y); |
| 1306 | Int2(RValue<Int2> rhs); |
| 1307 | Int2(const Int2 &rhs); |
| 1308 | Int2(const Reference<Int2> &rhs); |
| 1309 | Int2(RValue<Int> lo, RValue<Int> hi); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1310 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1311 | RValue<Int2> operator=(RValue<Int2> rhs); |
| 1312 | RValue<Int2> operator=(const Int2 &rhs); |
| 1313 | RValue<Int2> operator=(const Reference<Int2> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1314 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1315 | static Type *getType(); |
| 1316 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1317 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1318 | RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1319 | RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1320 | // RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1321 | // RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1322 | // RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1323 | RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1324 | RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1325 | RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1326 | RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs); |
| 1327 | RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs); |
| 1328 | RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs); |
| 1329 | RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1330 | // RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs); |
| 1331 | // RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs); |
| 1332 | // RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1333 | RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs); |
| 1334 | RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs); |
| 1335 | RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs); |
| 1336 | RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs); |
| 1337 | RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1338 | // RValue<Int2> operator+(RValue<Int2> val); |
| 1339 | // RValue<Int2> operator-(RValue<Int2> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1340 | RValue<Int2> operator~(RValue<Int2> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1341 | // RValue<Int2> operator++(Int2 &val, int); // Post-increment |
| 1342 | // const Int2 &operator++(Int2 &val); // Pre-increment |
| 1343 | // RValue<Int2> operator--(Int2 &val, int); // Post-decrement |
| 1344 | // const Int2 &operator--(Int2 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1345 | // RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1346 | // RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1347 | // RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1348 | // RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1349 | // RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1350 | // RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1351 | |
| 1352 | // RValue<Int2> RoundInt(RValue<Float4> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1353 | RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y); |
| 1354 | RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y); |
| 1355 | RValue<Int> Extract(RValue<Int2> val, int i); |
| 1356 | RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1357 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1358 | class UInt2 : public LValue<UInt2> |
| 1359 | { |
| 1360 | public: |
| 1361 | UInt2() = default; |
| 1362 | UInt2(unsigned int x, unsigned int y); |
| 1363 | UInt2(RValue<UInt2> rhs); |
| 1364 | UInt2(const UInt2 &rhs); |
| 1365 | UInt2(const Reference<UInt2> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1366 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1367 | RValue<UInt2> operator=(RValue<UInt2> rhs); |
| 1368 | RValue<UInt2> operator=(const UInt2 &rhs); |
| 1369 | RValue<UInt2> operator=(const Reference<UInt2> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1370 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1371 | static Type *getType(); |
| 1372 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1373 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1374 | RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1375 | RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1376 | // RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1377 | // RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1378 | // RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1379 | RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1380 | RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1381 | RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1382 | RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs); |
| 1383 | RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs); |
| 1384 | RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1385 | RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1386 | // RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1387 | // RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1388 | // RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1389 | RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1390 | RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1391 | RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1392 | RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs); |
| 1393 | RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1394 | // RValue<UInt2> operator+(RValue<UInt2> val); |
| 1395 | // RValue<UInt2> operator-(RValue<UInt2> val); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1396 | RValue<UInt2> operator~(RValue<UInt2> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1397 | // RValue<UInt2> operator++(UInt2 &val, int); // Post-increment |
| 1398 | // const UInt2 &operator++(UInt2 &val); // Pre-increment |
| 1399 | // RValue<UInt2> operator--(UInt2 &val, int); // Post-decrement |
| 1400 | // const UInt2 &operator--(UInt2 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1401 | // RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1402 | // RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1403 | // RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1404 | // RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1405 | // RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1406 | // RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1407 | |
| 1408 | // RValue<UInt2> RoundInt(RValue<Float4> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1409 | RValue<UInt> Extract(RValue<UInt2> val, int i); |
| 1410 | RValue<UInt2> Insert(RValue<UInt2> val, RValue<UInt> element, int i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1411 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1412 | template<class T> |
| 1413 | struct Scalar; |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1414 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1415 | template<class Vector4> |
| 1416 | struct XYZW; |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1417 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1418 | template<class Vector4, int T> |
| 1419 | class Swizzle2 |
| 1420 | { |
| 1421 | friend Vector4; |
| 1422 | |
| 1423 | public: |
| 1424 | operator RValue<Vector4>() const; |
| 1425 | |
| 1426 | private: |
| 1427 | Vector4 *parent; |
| 1428 | }; |
| 1429 | |
| 1430 | template<class Vector4, int T> |
| 1431 | class Swizzle4 |
| 1432 | { |
| 1433 | public: |
| 1434 | operator RValue<Vector4>() const; |
| 1435 | |
| 1436 | private: |
| 1437 | Vector4 *parent; |
| 1438 | }; |
| 1439 | |
| 1440 | template<class Vector4, int T> |
| 1441 | class SwizzleMask4 |
| 1442 | { |
| 1443 | friend XYZW<Vector4>; |
| 1444 | |
| 1445 | public: |
| 1446 | operator RValue<Vector4>() const; |
| 1447 | |
| 1448 | RValue<Vector4> operator=(RValue<Vector4> rhs); |
| 1449 | RValue<Vector4> operator=(RValue<typename Scalar<Vector4>::Type> rhs); |
| 1450 | |
| 1451 | private: |
| 1452 | Vector4 *parent; |
| 1453 | }; |
| 1454 | |
| 1455 | template<> |
| 1456 | struct Scalar<Float4> |
| 1457 | { |
| 1458 | using Type = Float; |
| 1459 | }; |
| 1460 | |
| 1461 | template<> |
| 1462 | struct Scalar<Int4> |
| 1463 | { |
| 1464 | using Type = Int; |
| 1465 | }; |
| 1466 | |
| 1467 | template<> |
| 1468 | struct Scalar<UInt4> |
| 1469 | { |
| 1470 | using Type = UInt; |
| 1471 | }; |
| 1472 | |
| 1473 | template<class Vector4, int T> |
| 1474 | class SwizzleMask1 |
| 1475 | { |
| 1476 | public: |
| 1477 | operator RValue<typename Scalar<Vector4>::Type>() const; |
| 1478 | operator RValue<Vector4>() const; |
| 1479 | |
| 1480 | RValue<Vector4> operator=(float x); |
| 1481 | RValue<Vector4> operator=(RValue<Vector4> rhs); |
| 1482 | RValue<Vector4> operator=(RValue<typename Scalar<Vector4>::Type> rhs); |
| 1483 | |
| 1484 | private: |
| 1485 | Vector4 *parent; |
| 1486 | }; |
| 1487 | |
| 1488 | template<class Vector4, int T> |
| 1489 | class SwizzleMask2 |
| 1490 | { |
| 1491 | friend class Float4; |
| 1492 | |
| 1493 | public: |
| 1494 | operator RValue<Vector4>() const; |
| 1495 | |
| 1496 | RValue<Vector4> operator=(RValue<Vector4> rhs); |
| 1497 | |
| 1498 | private: |
| 1499 | Float4 *parent; |
| 1500 | }; |
| 1501 | |
| 1502 | template<class Vector4> |
| 1503 | struct XYZW |
| 1504 | { |
| 1505 | friend Vector4; |
| 1506 | |
| 1507 | private: |
| 1508 | XYZW(Vector4 *parent) |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1509 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1510 | xyzw.parent = parent; |
| 1511 | } |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1512 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1513 | public: |
| 1514 | union |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1515 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1516 | SwizzleMask1<Vector4, 0x0000> x; |
| 1517 | SwizzleMask1<Vector4, 0x1111> y; |
| 1518 | SwizzleMask1<Vector4, 0x2222> z; |
| 1519 | SwizzleMask1<Vector4, 0x3333> w; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1520 | Swizzle2<Vector4, 0x0000> xx; |
| 1521 | Swizzle2<Vector4, 0x1000> yx; |
| 1522 | Swizzle2<Vector4, 0x2000> zx; |
| 1523 | Swizzle2<Vector4, 0x3000> wx; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1524 | SwizzleMask2<Vector4, 0x0111> xy; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1525 | Swizzle2<Vector4, 0x1111> yy; |
| 1526 | Swizzle2<Vector4, 0x2111> zy; |
| 1527 | Swizzle2<Vector4, 0x3111> wy; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1528 | SwizzleMask2<Vector4, 0x0222> xz; |
| 1529 | SwizzleMask2<Vector4, 0x1222> yz; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1530 | Swizzle2<Vector4, 0x2222> zz; |
| 1531 | Swizzle2<Vector4, 0x3222> wz; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1532 | SwizzleMask2<Vector4, 0x0333> xw; |
| 1533 | SwizzleMask2<Vector4, 0x1333> yw; |
| 1534 | SwizzleMask2<Vector4, 0x2333> zw; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1535 | Swizzle2<Vector4, 0x3333> ww; |
| 1536 | Swizzle4<Vector4, 0x0000> xxx; |
| 1537 | Swizzle4<Vector4, 0x1000> yxx; |
| 1538 | Swizzle4<Vector4, 0x2000> zxx; |
| 1539 | Swizzle4<Vector4, 0x3000> wxx; |
| 1540 | Swizzle4<Vector4, 0x0100> xyx; |
| 1541 | Swizzle4<Vector4, 0x1100> yyx; |
| 1542 | Swizzle4<Vector4, 0x2100> zyx; |
| 1543 | Swizzle4<Vector4, 0x3100> wyx; |
| 1544 | Swizzle4<Vector4, 0x0200> xzx; |
| 1545 | Swizzle4<Vector4, 0x1200> yzx; |
| 1546 | Swizzle4<Vector4, 0x2200> zzx; |
| 1547 | Swizzle4<Vector4, 0x3200> wzx; |
| 1548 | Swizzle4<Vector4, 0x0300> xwx; |
| 1549 | Swizzle4<Vector4, 0x1300> ywx; |
| 1550 | Swizzle4<Vector4, 0x2300> zwx; |
| 1551 | Swizzle4<Vector4, 0x3300> wwx; |
| 1552 | Swizzle4<Vector4, 0x0011> xxy; |
| 1553 | Swizzle4<Vector4, 0x1011> yxy; |
| 1554 | Swizzle4<Vector4, 0x2011> zxy; |
| 1555 | Swizzle4<Vector4, 0x3011> wxy; |
| 1556 | Swizzle4<Vector4, 0x0111> xyy; |
| 1557 | Swizzle4<Vector4, 0x1111> yyy; |
| 1558 | Swizzle4<Vector4, 0x2111> zyy; |
| 1559 | Swizzle4<Vector4, 0x3111> wyy; |
| 1560 | Swizzle4<Vector4, 0x0211> xzy; |
| 1561 | Swizzle4<Vector4, 0x1211> yzy; |
| 1562 | Swizzle4<Vector4, 0x2211> zzy; |
| 1563 | Swizzle4<Vector4, 0x3211> wzy; |
| 1564 | Swizzle4<Vector4, 0x0311> xwy; |
| 1565 | Swizzle4<Vector4, 0x1311> ywy; |
| 1566 | Swizzle4<Vector4, 0x2311> zwy; |
| 1567 | Swizzle4<Vector4, 0x3311> wwy; |
| 1568 | Swizzle4<Vector4, 0x0022> xxz; |
| 1569 | Swizzle4<Vector4, 0x1022> yxz; |
| 1570 | Swizzle4<Vector4, 0x2022> zxz; |
| 1571 | Swizzle4<Vector4, 0x3022> wxz; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1572 | SwizzleMask4<Vector4, 0x0122> xyz; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1573 | Swizzle4<Vector4, 0x1122> yyz; |
| 1574 | Swizzle4<Vector4, 0x2122> zyz; |
| 1575 | Swizzle4<Vector4, 0x3122> wyz; |
| 1576 | Swizzle4<Vector4, 0x0222> xzz; |
| 1577 | Swizzle4<Vector4, 0x1222> yzz; |
| 1578 | Swizzle4<Vector4, 0x2222> zzz; |
| 1579 | Swizzle4<Vector4, 0x3222> wzz; |
| 1580 | Swizzle4<Vector4, 0x0322> xwz; |
| 1581 | Swizzle4<Vector4, 0x1322> ywz; |
| 1582 | Swizzle4<Vector4, 0x2322> zwz; |
| 1583 | Swizzle4<Vector4, 0x3322> wwz; |
| 1584 | Swizzle4<Vector4, 0x0033> xxw; |
| 1585 | Swizzle4<Vector4, 0x1033> yxw; |
| 1586 | Swizzle4<Vector4, 0x2033> zxw; |
| 1587 | Swizzle4<Vector4, 0x3033> wxw; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1588 | SwizzleMask4<Vector4, 0x0133> xyw; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1589 | Swizzle4<Vector4, 0x1133> yyw; |
| 1590 | Swizzle4<Vector4, 0x2133> zyw; |
| 1591 | Swizzle4<Vector4, 0x3133> wyw; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1592 | SwizzleMask4<Vector4, 0x0233> xzw; |
| 1593 | SwizzleMask4<Vector4, 0x1233> yzw; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1594 | Swizzle4<Vector4, 0x2233> zzw; |
| 1595 | Swizzle4<Vector4, 0x3233> wzw; |
| 1596 | Swizzle4<Vector4, 0x0333> xww; |
| 1597 | Swizzle4<Vector4, 0x1333> yww; |
| 1598 | Swizzle4<Vector4, 0x2333> zww; |
| 1599 | Swizzle4<Vector4, 0x3333> www; |
| 1600 | Swizzle4<Vector4, 0x0000> xxxx; |
| 1601 | Swizzle4<Vector4, 0x1000> yxxx; |
| 1602 | Swizzle4<Vector4, 0x2000> zxxx; |
| 1603 | Swizzle4<Vector4, 0x3000> wxxx; |
| 1604 | Swizzle4<Vector4, 0x0100> xyxx; |
| 1605 | Swizzle4<Vector4, 0x1100> yyxx; |
| 1606 | Swizzle4<Vector4, 0x2100> zyxx; |
| 1607 | Swizzle4<Vector4, 0x3100> wyxx; |
| 1608 | Swizzle4<Vector4, 0x0200> xzxx; |
| 1609 | Swizzle4<Vector4, 0x1200> yzxx; |
| 1610 | Swizzle4<Vector4, 0x2200> zzxx; |
| 1611 | Swizzle4<Vector4, 0x3200> wzxx; |
| 1612 | Swizzle4<Vector4, 0x0300> xwxx; |
| 1613 | Swizzle4<Vector4, 0x1300> ywxx; |
| 1614 | Swizzle4<Vector4, 0x2300> zwxx; |
| 1615 | Swizzle4<Vector4, 0x3300> wwxx; |
| 1616 | Swizzle4<Vector4, 0x0010> xxyx; |
| 1617 | Swizzle4<Vector4, 0x1010> yxyx; |
| 1618 | Swizzle4<Vector4, 0x2010> zxyx; |
| 1619 | Swizzle4<Vector4, 0x3010> wxyx; |
| 1620 | Swizzle4<Vector4, 0x0110> xyyx; |
| 1621 | Swizzle4<Vector4, 0x1110> yyyx; |
| 1622 | Swizzle4<Vector4, 0x2110> zyyx; |
| 1623 | Swizzle4<Vector4, 0x3110> wyyx; |
| 1624 | Swizzle4<Vector4, 0x0210> xzyx; |
| 1625 | Swizzle4<Vector4, 0x1210> yzyx; |
| 1626 | Swizzle4<Vector4, 0x2210> zzyx; |
| 1627 | Swizzle4<Vector4, 0x3210> wzyx; |
| 1628 | Swizzle4<Vector4, 0x0310> xwyx; |
| 1629 | Swizzle4<Vector4, 0x1310> ywyx; |
| 1630 | Swizzle4<Vector4, 0x2310> zwyx; |
| 1631 | Swizzle4<Vector4, 0x3310> wwyx; |
| 1632 | Swizzle4<Vector4, 0x0020> xxzx; |
| 1633 | Swizzle4<Vector4, 0x1020> yxzx; |
| 1634 | Swizzle4<Vector4, 0x2020> zxzx; |
| 1635 | Swizzle4<Vector4, 0x3020> wxzx; |
| 1636 | Swizzle4<Vector4, 0x0120> xyzx; |
| 1637 | Swizzle4<Vector4, 0x1120> yyzx; |
| 1638 | Swizzle4<Vector4, 0x2120> zyzx; |
| 1639 | Swizzle4<Vector4, 0x3120> wyzx; |
| 1640 | Swizzle4<Vector4, 0x0220> xzzx; |
| 1641 | Swizzle4<Vector4, 0x1220> yzzx; |
| 1642 | Swizzle4<Vector4, 0x2220> zzzx; |
| 1643 | Swizzle4<Vector4, 0x3220> wzzx; |
| 1644 | Swizzle4<Vector4, 0x0320> xwzx; |
| 1645 | Swizzle4<Vector4, 0x1320> ywzx; |
| 1646 | Swizzle4<Vector4, 0x2320> zwzx; |
| 1647 | Swizzle4<Vector4, 0x3320> wwzx; |
| 1648 | Swizzle4<Vector4, 0x0030> xxwx; |
| 1649 | Swizzle4<Vector4, 0x1030> yxwx; |
| 1650 | Swizzle4<Vector4, 0x2030> zxwx; |
| 1651 | Swizzle4<Vector4, 0x3030> wxwx; |
| 1652 | Swizzle4<Vector4, 0x0130> xywx; |
| 1653 | Swizzle4<Vector4, 0x1130> yywx; |
| 1654 | Swizzle4<Vector4, 0x2130> zywx; |
| 1655 | Swizzle4<Vector4, 0x3130> wywx; |
| 1656 | Swizzle4<Vector4, 0x0230> xzwx; |
| 1657 | Swizzle4<Vector4, 0x1230> yzwx; |
| 1658 | Swizzle4<Vector4, 0x2230> zzwx; |
| 1659 | Swizzle4<Vector4, 0x3230> wzwx; |
| 1660 | Swizzle4<Vector4, 0x0330> xwwx; |
| 1661 | Swizzle4<Vector4, 0x1330> ywwx; |
| 1662 | Swizzle4<Vector4, 0x2330> zwwx; |
| 1663 | Swizzle4<Vector4, 0x3330> wwwx; |
| 1664 | Swizzle4<Vector4, 0x0001> xxxy; |
| 1665 | Swizzle4<Vector4, 0x1001> yxxy; |
| 1666 | Swizzle4<Vector4, 0x2001> zxxy; |
| 1667 | Swizzle4<Vector4, 0x3001> wxxy; |
| 1668 | Swizzle4<Vector4, 0x0101> xyxy; |
| 1669 | Swizzle4<Vector4, 0x1101> yyxy; |
| 1670 | Swizzle4<Vector4, 0x2101> zyxy; |
| 1671 | Swizzle4<Vector4, 0x3101> wyxy; |
| 1672 | Swizzle4<Vector4, 0x0201> xzxy; |
| 1673 | Swizzle4<Vector4, 0x1201> yzxy; |
| 1674 | Swizzle4<Vector4, 0x2201> zzxy; |
| 1675 | Swizzle4<Vector4, 0x3201> wzxy; |
| 1676 | Swizzle4<Vector4, 0x0301> xwxy; |
| 1677 | Swizzle4<Vector4, 0x1301> ywxy; |
| 1678 | Swizzle4<Vector4, 0x2301> zwxy; |
| 1679 | Swizzle4<Vector4, 0x3301> wwxy; |
| 1680 | Swizzle4<Vector4, 0x0011> xxyy; |
| 1681 | Swizzle4<Vector4, 0x1011> yxyy; |
| 1682 | Swizzle4<Vector4, 0x2011> zxyy; |
| 1683 | Swizzle4<Vector4, 0x3011> wxyy; |
| 1684 | Swizzle4<Vector4, 0x0111> xyyy; |
| 1685 | Swizzle4<Vector4, 0x1111> yyyy; |
| 1686 | Swizzle4<Vector4, 0x2111> zyyy; |
| 1687 | Swizzle4<Vector4, 0x3111> wyyy; |
| 1688 | Swizzle4<Vector4, 0x0211> xzyy; |
| 1689 | Swizzle4<Vector4, 0x1211> yzyy; |
| 1690 | Swizzle4<Vector4, 0x2211> zzyy; |
| 1691 | Swizzle4<Vector4, 0x3211> wzyy; |
| 1692 | Swizzle4<Vector4, 0x0311> xwyy; |
| 1693 | Swizzle4<Vector4, 0x1311> ywyy; |
| 1694 | Swizzle4<Vector4, 0x2311> zwyy; |
| 1695 | Swizzle4<Vector4, 0x3311> wwyy; |
| 1696 | Swizzle4<Vector4, 0x0021> xxzy; |
| 1697 | Swizzle4<Vector4, 0x1021> yxzy; |
| 1698 | Swizzle4<Vector4, 0x2021> zxzy; |
| 1699 | Swizzle4<Vector4, 0x3021> wxzy; |
| 1700 | Swizzle4<Vector4, 0x0121> xyzy; |
| 1701 | Swizzle4<Vector4, 0x1121> yyzy; |
| 1702 | Swizzle4<Vector4, 0x2121> zyzy; |
| 1703 | Swizzle4<Vector4, 0x3121> wyzy; |
| 1704 | Swizzle4<Vector4, 0x0221> xzzy; |
| 1705 | Swizzle4<Vector4, 0x1221> yzzy; |
| 1706 | Swizzle4<Vector4, 0x2221> zzzy; |
| 1707 | Swizzle4<Vector4, 0x3221> wzzy; |
| 1708 | Swizzle4<Vector4, 0x0321> xwzy; |
| 1709 | Swizzle4<Vector4, 0x1321> ywzy; |
| 1710 | Swizzle4<Vector4, 0x2321> zwzy; |
| 1711 | Swizzle4<Vector4, 0x3321> wwzy; |
| 1712 | Swizzle4<Vector4, 0x0031> xxwy; |
| 1713 | Swizzle4<Vector4, 0x1031> yxwy; |
| 1714 | Swizzle4<Vector4, 0x2031> zxwy; |
| 1715 | Swizzle4<Vector4, 0x3031> wxwy; |
| 1716 | Swizzle4<Vector4, 0x0131> xywy; |
| 1717 | Swizzle4<Vector4, 0x1131> yywy; |
| 1718 | Swizzle4<Vector4, 0x2131> zywy; |
| 1719 | Swizzle4<Vector4, 0x3131> wywy; |
| 1720 | Swizzle4<Vector4, 0x0231> xzwy; |
| 1721 | Swizzle4<Vector4, 0x1231> yzwy; |
| 1722 | Swizzle4<Vector4, 0x2231> zzwy; |
| 1723 | Swizzle4<Vector4, 0x3231> wzwy; |
| 1724 | Swizzle4<Vector4, 0x0331> xwwy; |
| 1725 | Swizzle4<Vector4, 0x1331> ywwy; |
| 1726 | Swizzle4<Vector4, 0x2331> zwwy; |
| 1727 | Swizzle4<Vector4, 0x3331> wwwy; |
| 1728 | Swizzle4<Vector4, 0x0002> xxxz; |
| 1729 | Swizzle4<Vector4, 0x1002> yxxz; |
| 1730 | Swizzle4<Vector4, 0x2002> zxxz; |
| 1731 | Swizzle4<Vector4, 0x3002> wxxz; |
| 1732 | Swizzle4<Vector4, 0x0102> xyxz; |
| 1733 | Swizzle4<Vector4, 0x1102> yyxz; |
| 1734 | Swizzle4<Vector4, 0x2102> zyxz; |
| 1735 | Swizzle4<Vector4, 0x3102> wyxz; |
| 1736 | Swizzle4<Vector4, 0x0202> xzxz; |
| 1737 | Swizzle4<Vector4, 0x1202> yzxz; |
| 1738 | Swizzle4<Vector4, 0x2202> zzxz; |
| 1739 | Swizzle4<Vector4, 0x3202> wzxz; |
| 1740 | Swizzle4<Vector4, 0x0302> xwxz; |
| 1741 | Swizzle4<Vector4, 0x1302> ywxz; |
| 1742 | Swizzle4<Vector4, 0x2302> zwxz; |
| 1743 | Swizzle4<Vector4, 0x3302> wwxz; |
| 1744 | Swizzle4<Vector4, 0x0012> xxyz; |
| 1745 | Swizzle4<Vector4, 0x1012> yxyz; |
| 1746 | Swizzle4<Vector4, 0x2012> zxyz; |
| 1747 | Swizzle4<Vector4, 0x3012> wxyz; |
| 1748 | Swizzle4<Vector4, 0x0112> xyyz; |
| 1749 | Swizzle4<Vector4, 0x1112> yyyz; |
| 1750 | Swizzle4<Vector4, 0x2112> zyyz; |
| 1751 | Swizzle4<Vector4, 0x3112> wyyz; |
| 1752 | Swizzle4<Vector4, 0x0212> xzyz; |
| 1753 | Swizzle4<Vector4, 0x1212> yzyz; |
| 1754 | Swizzle4<Vector4, 0x2212> zzyz; |
| 1755 | Swizzle4<Vector4, 0x3212> wzyz; |
| 1756 | Swizzle4<Vector4, 0x0312> xwyz; |
| 1757 | Swizzle4<Vector4, 0x1312> ywyz; |
| 1758 | Swizzle4<Vector4, 0x2312> zwyz; |
| 1759 | Swizzle4<Vector4, 0x3312> wwyz; |
| 1760 | Swizzle4<Vector4, 0x0022> xxzz; |
| 1761 | Swizzle4<Vector4, 0x1022> yxzz; |
| 1762 | Swizzle4<Vector4, 0x2022> zxzz; |
| 1763 | Swizzle4<Vector4, 0x3022> wxzz; |
| 1764 | Swizzle4<Vector4, 0x0122> xyzz; |
| 1765 | Swizzle4<Vector4, 0x1122> yyzz; |
| 1766 | Swizzle4<Vector4, 0x2122> zyzz; |
| 1767 | Swizzle4<Vector4, 0x3122> wyzz; |
| 1768 | Swizzle4<Vector4, 0x0222> xzzz; |
| 1769 | Swizzle4<Vector4, 0x1222> yzzz; |
| 1770 | Swizzle4<Vector4, 0x2222> zzzz; |
| 1771 | Swizzle4<Vector4, 0x3222> wzzz; |
| 1772 | Swizzle4<Vector4, 0x0322> xwzz; |
| 1773 | Swizzle4<Vector4, 0x1322> ywzz; |
| 1774 | Swizzle4<Vector4, 0x2322> zwzz; |
| 1775 | Swizzle4<Vector4, 0x3322> wwzz; |
| 1776 | Swizzle4<Vector4, 0x0032> xxwz; |
| 1777 | Swizzle4<Vector4, 0x1032> yxwz; |
| 1778 | Swizzle4<Vector4, 0x2032> zxwz; |
| 1779 | Swizzle4<Vector4, 0x3032> wxwz; |
| 1780 | Swizzle4<Vector4, 0x0132> xywz; |
| 1781 | Swizzle4<Vector4, 0x1132> yywz; |
| 1782 | Swizzle4<Vector4, 0x2132> zywz; |
| 1783 | Swizzle4<Vector4, 0x3132> wywz; |
| 1784 | Swizzle4<Vector4, 0x0232> xzwz; |
| 1785 | Swizzle4<Vector4, 0x1232> yzwz; |
| 1786 | Swizzle4<Vector4, 0x2232> zzwz; |
| 1787 | Swizzle4<Vector4, 0x3232> wzwz; |
| 1788 | Swizzle4<Vector4, 0x0332> xwwz; |
| 1789 | Swizzle4<Vector4, 0x1332> ywwz; |
| 1790 | Swizzle4<Vector4, 0x2332> zwwz; |
| 1791 | Swizzle4<Vector4, 0x3332> wwwz; |
| 1792 | Swizzle4<Vector4, 0x0003> xxxw; |
| 1793 | Swizzle4<Vector4, 0x1003> yxxw; |
| 1794 | Swizzle4<Vector4, 0x2003> zxxw; |
| 1795 | Swizzle4<Vector4, 0x3003> wxxw; |
| 1796 | Swizzle4<Vector4, 0x0103> xyxw; |
| 1797 | Swizzle4<Vector4, 0x1103> yyxw; |
| 1798 | Swizzle4<Vector4, 0x2103> zyxw; |
| 1799 | Swizzle4<Vector4, 0x3103> wyxw; |
| 1800 | Swizzle4<Vector4, 0x0203> xzxw; |
| 1801 | Swizzle4<Vector4, 0x1203> yzxw; |
| 1802 | Swizzle4<Vector4, 0x2203> zzxw; |
| 1803 | Swizzle4<Vector4, 0x3203> wzxw; |
| 1804 | Swizzle4<Vector4, 0x0303> xwxw; |
| 1805 | Swizzle4<Vector4, 0x1303> ywxw; |
| 1806 | Swizzle4<Vector4, 0x2303> zwxw; |
| 1807 | Swizzle4<Vector4, 0x3303> wwxw; |
| 1808 | Swizzle4<Vector4, 0x0013> xxyw; |
| 1809 | Swizzle4<Vector4, 0x1013> yxyw; |
| 1810 | Swizzle4<Vector4, 0x2013> zxyw; |
| 1811 | Swizzle4<Vector4, 0x3013> wxyw; |
| 1812 | Swizzle4<Vector4, 0x0113> xyyw; |
| 1813 | Swizzle4<Vector4, 0x1113> yyyw; |
| 1814 | Swizzle4<Vector4, 0x2113> zyyw; |
| 1815 | Swizzle4<Vector4, 0x3113> wyyw; |
| 1816 | Swizzle4<Vector4, 0x0213> xzyw; |
| 1817 | Swizzle4<Vector4, 0x1213> yzyw; |
| 1818 | Swizzle4<Vector4, 0x2213> zzyw; |
| 1819 | Swizzle4<Vector4, 0x3213> wzyw; |
| 1820 | Swizzle4<Vector4, 0x0313> xwyw; |
| 1821 | Swizzle4<Vector4, 0x1313> ywyw; |
| 1822 | Swizzle4<Vector4, 0x2313> zwyw; |
| 1823 | Swizzle4<Vector4, 0x3313> wwyw; |
| 1824 | Swizzle4<Vector4, 0x0023> xxzw; |
| 1825 | Swizzle4<Vector4, 0x1023> yxzw; |
| 1826 | Swizzle4<Vector4, 0x2023> zxzw; |
| 1827 | Swizzle4<Vector4, 0x3023> wxzw; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1828 | SwizzleMask4<Vector4, 0x0123> xyzw; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1829 | Swizzle4<Vector4, 0x1123> yyzw; |
| 1830 | Swizzle4<Vector4, 0x2123> zyzw; |
| 1831 | Swizzle4<Vector4, 0x3123> wyzw; |
| 1832 | Swizzle4<Vector4, 0x0223> xzzw; |
| 1833 | Swizzle4<Vector4, 0x1223> yzzw; |
| 1834 | Swizzle4<Vector4, 0x2223> zzzw; |
| 1835 | Swizzle4<Vector4, 0x3223> wzzw; |
| 1836 | Swizzle4<Vector4, 0x0323> xwzw; |
| 1837 | Swizzle4<Vector4, 0x1323> ywzw; |
| 1838 | Swizzle4<Vector4, 0x2323> zwzw; |
| 1839 | Swizzle4<Vector4, 0x3323> wwzw; |
| 1840 | Swizzle4<Vector4, 0x0033> xxww; |
| 1841 | Swizzle4<Vector4, 0x1033> yxww; |
| 1842 | Swizzle4<Vector4, 0x2033> zxww; |
| 1843 | Swizzle4<Vector4, 0x3033> wxww; |
| 1844 | Swizzle4<Vector4, 0x0133> xyww; |
| 1845 | Swizzle4<Vector4, 0x1133> yyww; |
| 1846 | Swizzle4<Vector4, 0x2133> zyww; |
| 1847 | Swizzle4<Vector4, 0x3133> wyww; |
| 1848 | Swizzle4<Vector4, 0x0233> xzww; |
| 1849 | Swizzle4<Vector4, 0x1233> yzww; |
| 1850 | Swizzle4<Vector4, 0x2233> zzww; |
| 1851 | Swizzle4<Vector4, 0x3233> wzww; |
| 1852 | Swizzle4<Vector4, 0x0333> xwww; |
| 1853 | Swizzle4<Vector4, 0x1333> ywww; |
| 1854 | Swizzle4<Vector4, 0x2333> zwww; |
| 1855 | Swizzle4<Vector4, 0x3333> wwww; |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1856 | }; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1857 | }; |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1858 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1859 | class Int4 : public LValue<Int4>, public XYZW<Int4> |
| 1860 | { |
| 1861 | public: |
| 1862 | explicit Int4(RValue<Byte4> cast); |
| 1863 | explicit Int4(RValue<SByte4> cast); |
| 1864 | explicit Int4(RValue<Float4> cast); |
| 1865 | explicit Int4(RValue<Short4> cast); |
| 1866 | explicit Int4(RValue<UShort4> cast); |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1867 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1868 | Int4(); |
| 1869 | Int4(int xyzw); |
| 1870 | Int4(int x, int yzw); |
| 1871 | Int4(int x, int y, int zw); |
| 1872 | Int4(int x, int y, int z, int w); |
| 1873 | Int4(RValue<Int4> rhs); |
| 1874 | Int4(const Int4 &rhs); |
| 1875 | Int4(const Reference<Int4> &rhs); |
| 1876 | Int4(RValue<UInt4> rhs); |
| 1877 | Int4(const UInt4 &rhs); |
| 1878 | Int4(const Reference<UInt4> &rhs); |
| 1879 | Int4(RValue<Int2> lo, RValue<Int2> hi); |
| 1880 | Int4(RValue<Int> rhs); |
| 1881 | Int4(const Int &rhs); |
| 1882 | Int4(const Reference<Int> &rhs); |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1883 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1884 | RValue<Int4> operator=(RValue<Int4> rhs); |
| 1885 | RValue<Int4> operator=(const Int4 &rhs); |
| 1886 | RValue<Int4> operator=(const Reference<Int4> &rhs); |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1887 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1888 | static Type *getType(); |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1889 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1890 | private: |
| 1891 | void constant(int x, int y, int z, int w); |
| 1892 | }; |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1893 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1894 | RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1895 | RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1896 | RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1897 | RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1898 | RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1899 | RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1900 | RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1901 | RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1902 | RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs); |
| 1903 | RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs); |
| 1904 | RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1905 | RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1906 | RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs); |
| 1907 | RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs); |
| 1908 | RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1909 | // RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs); |
| 1910 | // RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1911 | RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs); |
| 1912 | RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs); |
| 1913 | RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs); |
| 1914 | RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs); |
| 1915 | RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs); |
| 1916 | RValue<Int4> operator+(RValue<Int4> val); |
| 1917 | RValue<Int4> operator-(RValue<Int4> val); |
| 1918 | RValue<Int4> operator~(RValue<Int4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1919 | // RValue<Int4> operator++(Int4 &val, int); // Post-increment |
| 1920 | // const Int4 &operator++(Int4 &val); // Pre-increment |
| 1921 | // RValue<Int4> operator--(Int4 &val, int); // Post-decrement |
| 1922 | // const Int4 &operator--(Int4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1923 | // RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1924 | // RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1925 | // RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1926 | // RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1927 | // RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1928 | // RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1929 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1930 | inline RValue<Int4> operator+(RValue<Int> lhs, RValue<Int4> rhs) |
| 1931 | { |
| 1932 | return Int4(lhs) + rhs; |
| 1933 | } |
Nicolas Capens | 4b74373 | 2018-05-28 13:22:07 -0400 | [diff] [blame] | 1934 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1935 | inline RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int> rhs) |
| 1936 | { |
| 1937 | return lhs + Int4(rhs); |
| 1938 | } |
Nicolas Capens | 4b74373 | 2018-05-28 13:22:07 -0400 | [diff] [blame] | 1939 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1940 | RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y); |
| 1941 | RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y); |
| 1942 | RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y); |
| 1943 | RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y); |
| 1944 | RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y); |
| 1945 | RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 1946 | inline RValue<Int4> CmpGT(RValue<Int4> x, RValue<Int4> y) |
| 1947 | { |
| 1948 | return CmpNLE(x, y); |
| 1949 | } |
| 1950 | inline RValue<Int4> CmpGE(RValue<Int4> x, RValue<Int4> y) |
| 1951 | { |
| 1952 | return CmpNLT(x, y); |
| 1953 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1954 | RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y); |
| 1955 | RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y); |
| 1956 | RValue<Int4> RoundInt(RValue<Float4> cast); |
| 1957 | RValue<Short8> PackSigned(RValue<Int4> x, RValue<Int4> y); |
| 1958 | RValue<UShort8> PackUnsigned(RValue<Int4> x, RValue<Int4> y); |
| 1959 | RValue<Int> Extract(RValue<Int4> val, int i); |
| 1960 | RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i); |
| 1961 | RValue<Int> SignMask(RValue<Int4> x); |
| 1962 | RValue<Int4> Swizzle(RValue<Int4> x, uint16_t select); |
| 1963 | RValue<Int4> Shuffle(RValue<Int4> x, RValue<Int4> y, uint16_t select); |
| 1964 | RValue<Int4> MulHigh(RValue<Int4> x, RValue<Int4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1965 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1966 | class UInt4 : public LValue<UInt4>, public XYZW<UInt4> |
| 1967 | { |
| 1968 | public: |
| 1969 | explicit UInt4(RValue<Float4> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1970 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1971 | UInt4(); |
| 1972 | UInt4(int xyzw); |
| 1973 | UInt4(int x, int yzw); |
| 1974 | UInt4(int x, int y, int zw); |
| 1975 | UInt4(int x, int y, int z, int w); |
| 1976 | UInt4(RValue<UInt4> rhs); |
| 1977 | UInt4(const UInt4 &rhs); |
| 1978 | UInt4(const Reference<UInt4> &rhs); |
| 1979 | UInt4(RValue<Int4> rhs); |
| 1980 | UInt4(const Int4 &rhs); |
| 1981 | UInt4(const Reference<Int4> &rhs); |
| 1982 | UInt4(RValue<UInt2> lo, RValue<UInt2> hi); |
| 1983 | UInt4(RValue<UInt> rhs); |
| 1984 | UInt4(const UInt &rhs); |
| 1985 | UInt4(const Reference<UInt> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1986 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1987 | RValue<UInt4> operator=(RValue<UInt4> rhs); |
| 1988 | RValue<UInt4> operator=(const UInt4 &rhs); |
| 1989 | RValue<UInt4> operator=(const Reference<UInt4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1990 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1991 | static Type *getType(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1992 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1993 | private: |
| 1994 | void constant(int x, int y, int z, int w); |
| 1995 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1996 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 1997 | RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1998 | RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1999 | RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2000 | RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2001 | RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2002 | RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2003 | RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2004 | RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2005 | RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs); |
| 2006 | RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs); |
| 2007 | RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2008 | RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2009 | RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs); |
| 2010 | RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs); |
| 2011 | RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2012 | // RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs); |
| 2013 | // RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2014 | RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs); |
| 2015 | RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs); |
| 2016 | RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs); |
| 2017 | RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs); |
| 2018 | RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs); |
| 2019 | RValue<UInt4> operator+(RValue<UInt4> val); |
| 2020 | RValue<UInt4> operator-(RValue<UInt4> val); |
| 2021 | RValue<UInt4> operator~(RValue<UInt4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2022 | // RValue<UInt4> operator++(UInt4 &val, int); // Post-increment |
| 2023 | // const UInt4 &operator++(UInt4 &val); // Pre-increment |
| 2024 | // RValue<UInt4> operator--(UInt4 &val, int); // Post-decrement |
| 2025 | // const UInt4 &operator--(UInt4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2026 | // RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2027 | // RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2028 | // RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2029 | // RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2030 | // RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2031 | // RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 2032 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2033 | RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y); |
| 2034 | RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y); |
| 2035 | RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y); |
| 2036 | RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y); |
| 2037 | RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y); |
| 2038 | RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2039 | inline RValue<UInt4> CmpGT(RValue<UInt4> x, RValue<UInt4> y) |
| 2040 | { |
| 2041 | return CmpNLE(x, y); |
| 2042 | } |
| 2043 | inline RValue<UInt4> CmpGE(RValue<UInt4> x, RValue<UInt4> y) |
| 2044 | { |
| 2045 | return CmpNLT(x, y); |
| 2046 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2047 | RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y); |
| 2048 | RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y); |
| 2049 | RValue<UInt4> MulHigh(RValue<UInt4> x, RValue<UInt4> y); |
| 2050 | RValue<UInt> Extract(RValue<UInt4> val, int i); |
| 2051 | RValue<UInt4> Insert(RValue<UInt4> val, RValue<UInt> element, int i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2052 | // RValue<UInt4> RoundInt(RValue<Float4> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2053 | RValue<UInt4> Swizzle(RValue<UInt4> x, uint16_t select); |
| 2054 | RValue<UInt4> Shuffle(RValue<UInt4> x, RValue<UInt4> y, uint16_t select); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2055 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2056 | class Half : public LValue<Half> |
| 2057 | { |
| 2058 | public: |
| 2059 | explicit Half(RValue<Float> cast); |
Alexis Hetu | 734e257 | 2018-12-20 14:00:49 -0500 | [diff] [blame] | 2060 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2061 | static Type *getType(); |
| 2062 | }; |
Alexis Hetu | 734e257 | 2018-12-20 14:00:49 -0500 | [diff] [blame] | 2063 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2064 | class Float : public LValue<Float> |
| 2065 | { |
| 2066 | public: |
| 2067 | explicit Float(RValue<Int> cast); |
| 2068 | explicit Float(RValue<UInt> cast); |
| 2069 | explicit Float(RValue<Half> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2070 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2071 | Float() = default; |
| 2072 | Float(float x); |
| 2073 | Float(RValue<Float> rhs); |
| 2074 | Float(const Float &rhs); |
| 2075 | Float(const Reference<Float> &rhs); |
| 2076 | Float(Argument<Float> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2077 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2078 | template<int T> |
| 2079 | Float(const SwizzleMask1<Float4, T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2080 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2081 | // RValue<Float> operator=(float rhs); // FIXME: Implement |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2082 | RValue<Float> operator=(RValue<Float> rhs); |
| 2083 | RValue<Float> operator=(const Float &rhs); |
| 2084 | RValue<Float> operator=(const Reference<Float> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2085 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2086 | template<int T> |
| 2087 | RValue<Float> operator=(const SwizzleMask1<Float4, T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2088 | |
Nicolas Capens | e572088 | 2020-01-13 14:10:04 -0500 | [diff] [blame] | 2089 | static Float infinity(); |
| 2090 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2091 | static Type *getType(); |
| 2092 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2093 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2094 | RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs); |
| 2095 | RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs); |
| 2096 | RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs); |
| 2097 | RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs); |
| 2098 | RValue<Float> operator+=(Float &lhs, RValue<Float> rhs); |
| 2099 | RValue<Float> operator-=(Float &lhs, RValue<Float> rhs); |
| 2100 | RValue<Float> operator*=(Float &lhs, RValue<Float> rhs); |
| 2101 | RValue<Float> operator/=(Float &lhs, RValue<Float> rhs); |
| 2102 | RValue<Float> operator+(RValue<Float> val); |
| 2103 | RValue<Float> operator-(RValue<Float> val); |
| 2104 | RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs); |
| 2105 | RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs); |
| 2106 | RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs); |
| 2107 | RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs); |
| 2108 | RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs); |
| 2109 | RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2110 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2111 | RValue<Float> Abs(RValue<Float> x); |
| 2112 | RValue<Float> Max(RValue<Float> x, RValue<Float> y); |
| 2113 | RValue<Float> Min(RValue<Float> x, RValue<Float> y); |
| 2114 | RValue<Float> Rcp_pp(RValue<Float> val, bool exactAtPow2 = false); |
| 2115 | RValue<Float> RcpSqrt_pp(RValue<Float> val); |
| 2116 | RValue<Float> Sqrt(RValue<Float> x); |
Nicolas Capens | 88ac367 | 2019-08-01 13:22:34 -0400 | [diff] [blame] | 2117 | |
| 2118 | // RValue<Int4> IsInf(RValue<Float> x); |
| 2119 | // RValue<Int4> IsNan(RValue<Float> x); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2120 | RValue<Float> Round(RValue<Float> x); |
| 2121 | RValue<Float> Trunc(RValue<Float> x); |
| 2122 | RValue<Float> Frac(RValue<Float> x); |
| 2123 | RValue<Float> Floor(RValue<Float> x); |
| 2124 | RValue<Float> Ceil(RValue<Float> x); |
Nicolas Capens | 88ac367 | 2019-08-01 13:22:34 -0400 | [diff] [blame] | 2125 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2126 | // Trigonometric functions |
| 2127 | // TODO: Currently unimplemented for Subzero. |
Nicolas Capens | 88ac367 | 2019-08-01 13:22:34 -0400 | [diff] [blame] | 2128 | // RValue<Float> Sin(RValue<Float> x); |
| 2129 | // RValue<Float> Cos(RValue<Float> x); |
| 2130 | // RValue<Float> Tan(RValue<Float> x); |
| 2131 | // RValue<Float> Asin(RValue<Float> x); |
| 2132 | // RValue<Float> Acos(RValue<Float> x); |
| 2133 | // RValue<Float> Atan(RValue<Float> x); |
| 2134 | // RValue<Float> Sinh(RValue<Float> x); |
| 2135 | // RValue<Float> Cosh(RValue<Float> x); |
| 2136 | // RValue<Float> Tanh(RValue<Float> x); |
| 2137 | // RValue<Float> Asinh(RValue<Float> x); |
| 2138 | // RValue<Float> Acosh(RValue<Float> x); |
| 2139 | // RValue<Float> Atanh(RValue<Float> x); |
| 2140 | // RValue<Float> Atan2(RValue<Float> x, RValue<Float> y); |
| 2141 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2142 | // Exponential functions |
| 2143 | // TODO: Currently unimplemented for Subzero. |
Nicolas Capens | 88ac367 | 2019-08-01 13:22:34 -0400 | [diff] [blame] | 2144 | // RValue<Float> Pow(RValue<Float> x, RValue<Float> y); |
| 2145 | // RValue<Float> Exp(RValue<Float> x); |
| 2146 | // RValue<Float> Log(RValue<Float> x); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2147 | RValue<Float> Exp2(RValue<Float> x); |
| 2148 | RValue<Float> Log2(RValue<Float> x); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2149 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2150 | class Float2 : public LValue<Float2> |
| 2151 | { |
| 2152 | public: |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2153 | // explicit Float2(RValue<Byte2> cast); |
| 2154 | // explicit Float2(RValue<Short2> cast); |
| 2155 | // explicit Float2(RValue<UShort2> cast); |
| 2156 | // explicit Float2(RValue<Int2> cast); |
| 2157 | // explicit Float2(RValue<UInt2> cast); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2158 | explicit Float2(RValue<Float4> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2159 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2160 | Float2() = default; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2161 | // Float2(float x, float y); |
| 2162 | // Float2(RValue<Float2> rhs); |
| 2163 | // Float2(const Float2 &rhs); |
| 2164 | // Float2(const Reference<Float2> &rhs); |
| 2165 | // Float2(RValue<Float> rhs); |
| 2166 | // Float2(const Float &rhs); |
| 2167 | // Float2(const Reference<Float> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2168 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2169 | // template<int T> |
| 2170 | // Float2(const SwizzleMask1<T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2171 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2172 | // RValue<Float2> operator=(float replicate); |
| 2173 | // RValue<Float2> operator=(RValue<Float2> rhs); |
| 2174 | // RValue<Float2> operator=(const Float2 &rhs); |
| 2175 | // RValue<Float2> operator=(const Reference<Float2> &rhs); |
| 2176 | // RValue<Float2> operator=(RValue<Float> rhs); |
| 2177 | // RValue<Float2> operator=(const Float &rhs); |
| 2178 | // RValue<Float2> operator=(const Reference<Float> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2179 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2180 | // template<int T> |
| 2181 | // RValue<Float2> operator=(const SwizzleMask1<T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2182 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2183 | static Type *getType(); |
| 2184 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2185 | |
| 2186 | // RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2187 | // RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2188 | // RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2189 | // RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2190 | // RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2191 | // RValue<Float2> operator+=(Float2 &lhs, RValue<Float2> rhs); |
| 2192 | // RValue<Float2> operator-=(Float2 &lhs, RValue<Float2> rhs); |
| 2193 | // RValue<Float2> operator*=(Float2 &lhs, RValue<Float2> rhs); |
| 2194 | // RValue<Float2> operator/=(Float2 &lhs, RValue<Float2> rhs); |
| 2195 | // RValue<Float2> operator%=(Float2 &lhs, RValue<Float2> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2196 | // RValue<Float2> operator+(RValue<Float2> val); |
| 2197 | // RValue<Float2> operator-(RValue<Float2> val); |
| 2198 | |
| 2199 | // RValue<Float2> Abs(RValue<Float2> x); |
| 2200 | // RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y); |
| 2201 | // RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y); |
Ben Clayton | 8701dc4 | 2019-12-05 21:27:03 +0000 | [diff] [blame] | 2202 | // RValue<Float2> Swizzle(RValue<Float2> x, uint16_t select); |
| 2203 | // RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, uint16_t select); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2204 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2205 | class Float4 : public LValue<Float4>, public XYZW<Float4> |
| 2206 | { |
| 2207 | public: |
| 2208 | explicit Float4(RValue<Byte4> cast); |
| 2209 | explicit Float4(RValue<SByte4> cast); |
| 2210 | explicit Float4(RValue<Short4> cast); |
| 2211 | explicit Float4(RValue<UShort4> cast); |
| 2212 | explicit Float4(RValue<Int4> cast); |
| 2213 | explicit Float4(RValue<UInt4> cast); |
| 2214 | |
| 2215 | Float4(); |
| 2216 | Float4(float xyzw); |
| 2217 | Float4(float x, float yzw); |
| 2218 | Float4(float x, float y, float zw); |
| 2219 | Float4(float x, float y, float z, float w); |
| 2220 | Float4(RValue<Float4> rhs); |
| 2221 | Float4(const Float4 &rhs); |
| 2222 | Float4(const Reference<Float4> &rhs); |
| 2223 | Float4(RValue<Float> rhs); |
| 2224 | Float4(const Float &rhs); |
| 2225 | Float4(const Reference<Float> &rhs); |
| 2226 | |
| 2227 | template<int T> |
| 2228 | Float4(const SwizzleMask1<Float4, T> &rhs); |
| 2229 | template<int T> |
| 2230 | Float4(const Swizzle4<Float4, T> &rhs); |
| 2231 | template<int X, int Y> |
| 2232 | Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y); |
| 2233 | template<int X, int Y> |
| 2234 | Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y); |
| 2235 | template<int X, int Y> |
| 2236 | Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y); |
| 2237 | template<int X, int Y> |
| 2238 | Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y); |
| 2239 | |
| 2240 | RValue<Float4> operator=(float replicate); |
| 2241 | RValue<Float4> operator=(RValue<Float4> rhs); |
| 2242 | RValue<Float4> operator=(const Float4 &rhs); |
| 2243 | RValue<Float4> operator=(const Reference<Float4> &rhs); |
| 2244 | RValue<Float4> operator=(RValue<Float> rhs); |
| 2245 | RValue<Float4> operator=(const Float &rhs); |
| 2246 | RValue<Float4> operator=(const Reference<Float> &rhs); |
| 2247 | |
| 2248 | template<int T> |
| 2249 | RValue<Float4> operator=(const SwizzleMask1<Float4, T> &rhs); |
| 2250 | template<int T> |
| 2251 | RValue<Float4> operator=(const Swizzle4<Float4, T> &rhs); |
| 2252 | |
Nicolas Capens | e572088 | 2020-01-13 14:10:04 -0500 | [diff] [blame] | 2253 | static Float4 infinity(); |
| 2254 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2255 | static Type *getType(); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2256 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2257 | private: |
| 2258 | void constant(float x, float y, float z, float w); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2259 | }; |
| 2260 | |
| 2261 | RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2262 | RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2263 | RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2264 | RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2265 | RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2266 | RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs); |
| 2267 | RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs); |
| 2268 | RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs); |
| 2269 | RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs); |
| 2270 | RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs); |
| 2271 | RValue<Float4> operator+(RValue<Float4> val); |
| 2272 | RValue<Float4> operator-(RValue<Float4> val); |
| 2273 | |
| 2274 | RValue<Float4> Abs(RValue<Float4> x); |
| 2275 | RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y); |
| 2276 | RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y); |
| 2277 | RValue<Float4> Rcp_pp(RValue<Float4> val, bool exactAtPow2 = false); |
| 2278 | RValue<Float4> RcpSqrt_pp(RValue<Float4> val); |
| 2279 | RValue<Float4> Sqrt(RValue<Float4> x); |
| 2280 | RValue<Float4> Insert(RValue<Float4> val, RValue<Float> element, int i); |
| 2281 | RValue<Float> Extract(RValue<Float4> x, int i); |
| 2282 | RValue<Float4> Swizzle(RValue<Float4> x, uint16_t select); |
| 2283 | RValue<Float4> Shuffle(RValue<Float4> x, RValue<Float4> y, uint16_t select); |
| 2284 | RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, uint16_t imm); |
| 2285 | RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y); |
| 2286 | RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y); |
| 2287 | RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, uint16_t select); |
| 2288 | RValue<Int> SignMask(RValue<Float4> x); |
| 2289 | |
| 2290 | // Ordered comparison functions |
| 2291 | RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y); |
| 2292 | RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y); |
| 2293 | RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y); |
| 2294 | RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y); |
| 2295 | RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y); |
| 2296 | RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2297 | inline RValue<Int4> CmpGT(RValue<Float4> x, RValue<Float4> y) |
| 2298 | { |
| 2299 | return CmpNLE(x, y); |
| 2300 | } |
| 2301 | inline RValue<Int4> CmpGE(RValue<Float4> x, RValue<Float4> y) |
| 2302 | { |
| 2303 | return CmpNLT(x, y); |
| 2304 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2305 | |
| 2306 | // Unordered comparison functions |
| 2307 | RValue<Int4> CmpUEQ(RValue<Float4> x, RValue<Float4> y); |
| 2308 | RValue<Int4> CmpULT(RValue<Float4> x, RValue<Float4> y); |
| 2309 | RValue<Int4> CmpULE(RValue<Float4> x, RValue<Float4> y); |
| 2310 | RValue<Int4> CmpUNEQ(RValue<Float4> x, RValue<Float4> y); |
| 2311 | RValue<Int4> CmpUNLT(RValue<Float4> x, RValue<Float4> y); |
| 2312 | RValue<Int4> CmpUNLE(RValue<Float4> x, RValue<Float4> y); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2313 | inline RValue<Int4> CmpUGT(RValue<Float4> x, RValue<Float4> y) |
| 2314 | { |
| 2315 | return CmpUNLE(x, y); |
| 2316 | } |
| 2317 | inline RValue<Int4> CmpUGE(RValue<Float4> x, RValue<Float4> y) |
| 2318 | { |
| 2319 | return CmpUNLT(x, y); |
| 2320 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2321 | |
| 2322 | RValue<Int4> IsInf(RValue<Float4> x); |
| 2323 | RValue<Int4> IsNan(RValue<Float4> x); |
| 2324 | RValue<Float4> Round(RValue<Float4> x); |
| 2325 | RValue<Float4> Trunc(RValue<Float4> x); |
| 2326 | RValue<Float4> Frac(RValue<Float4> x); |
| 2327 | RValue<Float4> Floor(RValue<Float4> x); |
| 2328 | RValue<Float4> Ceil(RValue<Float4> x); |
| 2329 | |
| 2330 | // Trigonometric functions |
| 2331 | // TODO: Currently unimplemented for Subzero. |
| 2332 | RValue<Float4> Sin(RValue<Float4> x); |
| 2333 | RValue<Float4> Cos(RValue<Float4> x); |
| 2334 | RValue<Float4> Tan(RValue<Float4> x); |
| 2335 | RValue<Float4> Asin(RValue<Float4> x); |
| 2336 | RValue<Float4> Acos(RValue<Float4> x); |
| 2337 | RValue<Float4> Atan(RValue<Float4> x); |
| 2338 | RValue<Float4> Sinh(RValue<Float4> x); |
| 2339 | RValue<Float4> Cosh(RValue<Float4> x); |
| 2340 | RValue<Float4> Tanh(RValue<Float4> x); |
| 2341 | RValue<Float4> Asinh(RValue<Float4> x); |
| 2342 | RValue<Float4> Acosh(RValue<Float4> x); |
| 2343 | RValue<Float4> Atanh(RValue<Float4> x); |
| 2344 | RValue<Float4> Atan2(RValue<Float4> x, RValue<Float4> y); |
| 2345 | |
| 2346 | // Exponential functions |
| 2347 | // TODO: Currently unimplemented for Subzero. |
| 2348 | RValue<Float4> Pow(RValue<Float4> x, RValue<Float4> y); |
| 2349 | RValue<Float4> Exp(RValue<Float4> x); |
| 2350 | RValue<Float4> Log(RValue<Float4> x); |
| 2351 | RValue<Float4> Exp2(RValue<Float4> x); |
| 2352 | RValue<Float4> Log2(RValue<Float4> x); |
| 2353 | |
| 2354 | // Bit Manipulation functions. |
| 2355 | // TODO: Currently unimplemented for Subzero. |
| 2356 | |
| 2357 | // Count leading zeros. |
| 2358 | // Returns 32 when: !isZeroUndef && x == 0. |
| 2359 | // Returns an undefined value when: isZeroUndef && x == 0. |
| 2360 | RValue<UInt> Ctlz(RValue<UInt> x, bool isZeroUndef); |
| 2361 | RValue<UInt4> Ctlz(RValue<UInt4> x, bool isZeroUndef); |
| 2362 | |
| 2363 | // Count trailing zeros. |
| 2364 | // Returns 32 when: !isZeroUndef && x == 0. |
| 2365 | // Returns an undefined value when: isZeroUndef && x == 0. |
| 2366 | RValue<UInt> Cttz(RValue<UInt> x, bool isZeroUndef); |
| 2367 | RValue<UInt4> Cttz(RValue<UInt4> x, bool isZeroUndef); |
| 2368 | |
| 2369 | template<class T> |
| 2370 | class Pointer : public LValue<Pointer<T>> |
| 2371 | { |
| 2372 | public: |
| 2373 | template<class S> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2374 | Pointer(RValue<Pointer<S>> pointerS, int alignment = 1) |
| 2375 | : alignment(alignment) |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2376 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2377 | Value *pointerT = Nucleus::createBitCast(pointerS.value, Nucleus::getPointerType(T::getType())); |
| 2378 | LValue<Pointer<T>>::storeValue(pointerT); |
Ben Clayton | 204a410 | 2019-07-31 13:17:47 +0100 | [diff] [blame] | 2379 | } |
| 2380 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2381 | template<class S> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2382 | Pointer(const Pointer<S> &pointer, int alignment = 1) |
| 2383 | : alignment(alignment) |
Nicolas Capens | 86509d9 | 2019-03-21 13:23:50 -0400 | [diff] [blame] | 2384 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2385 | Value *pointerS = pointer.loadValue(); |
| 2386 | Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType())); |
| 2387 | LValue<Pointer<T>>::storeValue(pointerT); |
Nicolas Capens | 86509d9 | 2019-03-21 13:23:50 -0400 | [diff] [blame] | 2388 | } |
| 2389 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2390 | Pointer(Argument<Pointer<T>> argument); |
Ben Clayton | 97035bd | 2019-04-16 11:35:38 -0400 | [diff] [blame] | 2391 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2392 | Pointer(); |
| 2393 | Pointer(RValue<Pointer<T>> rhs); |
| 2394 | Pointer(const Pointer<T> &rhs); |
| 2395 | Pointer(const Reference<Pointer<T>> &rhs); |
| 2396 | Pointer(std::nullptr_t); |
Ben Clayton | cb2ebc9 | 2019-06-20 00:18:03 +0100 | [diff] [blame] | 2397 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2398 | RValue<Pointer<T>> operator=(RValue<Pointer<T>> rhs); |
| 2399 | RValue<Pointer<T>> operator=(const Pointer<T> &rhs); |
| 2400 | RValue<Pointer<T>> operator=(const Reference<Pointer<T>> &rhs); |
| 2401 | RValue<Pointer<T>> operator=(std::nullptr_t); |
Ben Clayton | 0fc611f | 2019-04-18 11:23:27 -0400 | [diff] [blame] | 2402 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2403 | Reference<T> operator*(); |
| 2404 | Reference<T> operator[](int index); |
| 2405 | Reference<T> operator[](unsigned int index); |
| 2406 | Reference<T> operator[](RValue<Int> index); |
| 2407 | Reference<T> operator[](RValue<UInt> index); |
Nicolas Capens | 86509d9 | 2019-03-21 13:23:50 -0400 | [diff] [blame] | 2408 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2409 | static Type *getType(); |
Ben Clayton | 97035bd | 2019-04-16 11:35:38 -0400 | [diff] [blame] | 2410 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2411 | private: |
| 2412 | const int alignment; |
| 2413 | }; |
Ben Clayton | 97035bd | 2019-04-16 11:35:38 -0400 | [diff] [blame] | 2414 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2415 | RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset); |
| 2416 | RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset); |
| 2417 | RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset); |
| 2418 | RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset); |
| 2419 | RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset); |
| 2420 | RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset); |
Ben Clayton | 97035bd | 2019-04-16 11:35:38 -0400 | [diff] [blame] | 2421 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2422 | RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset); |
| 2423 | RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset); |
| 2424 | RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset); |
| 2425 | RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset); |
| 2426 | RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset); |
| 2427 | RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2428 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2429 | template<typename T> |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2430 | RValue<Bool> operator==(const Pointer<T> &lhs, const Pointer<T> &rhs) |
| 2431 | { |
| 2432 | return RValue<Bool>(Nucleus::createPtrEQ(lhs.loadValue(), rhs.loadValue())); |
| 2433 | } |
Ben Clayton | 0953d9b | 2019-06-25 20:57:06 +0100 | [diff] [blame] | 2434 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2435 | template<typename T> |
| 2436 | RValue<T> Load(RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2437 | { |
| 2438 | return RValue<T>(Nucleus::createLoad(pointer.value, T::getType(), false, alignment, atomic, memoryOrder)); |
| 2439 | } |
| 2440 | |
| 2441 | template<typename T> |
| 2442 | RValue<T> Load(Pointer<T> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2443 | { |
| 2444 | return Load(RValue<Pointer<T>>(pointer), alignment, atomic, memoryOrder); |
| 2445 | } |
| 2446 | |
| 2447 | // TODO: Use SIMD to template these. |
| 2448 | RValue<Float4> MaskedLoad(RValue<Pointer<Float4>> base, RValue<Int4> mask, unsigned int alignment, bool zeroMaskedLanes = false); |
| 2449 | RValue<Int4> MaskedLoad(RValue<Pointer<Int4>> base, RValue<Int4> mask, unsigned int alignment, bool zeroMaskedLanes = false); |
| 2450 | void MaskedStore(RValue<Pointer<Float4>> base, RValue<Float4> val, RValue<Int4> mask, unsigned int alignment); |
| 2451 | void MaskedStore(RValue<Pointer<Int4>> base, RValue<Int4> val, RValue<Int4> mask, unsigned int alignment); |
| 2452 | |
| 2453 | RValue<Float4> Gather(RValue<Pointer<Float>> base, RValue<Int4> offsets, RValue<Int4> mask, unsigned int alignment, bool zeroMaskedLanes = false); |
| 2454 | RValue<Int4> Gather(RValue<Pointer<Int>> base, RValue<Int4> offsets, RValue<Int4> mask, unsigned int alignment, bool zeroMaskedLanes = false); |
| 2455 | void Scatter(RValue<Pointer<Float>> base, RValue<Float4> val, RValue<Int4> offsets, RValue<Int4> mask, unsigned int alignment); |
| 2456 | void Scatter(RValue<Pointer<Int>> base, RValue<Int4> val, RValue<Int4> offsets, RValue<Int4> mask, unsigned int alignment); |
| 2457 | |
| 2458 | template<typename T> |
| 2459 | void Store(RValue<T> value, RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2460 | { |
| 2461 | Nucleus::createStore(value.value, pointer.value, T::getType(), false, alignment, atomic, memoryOrder); |
| 2462 | } |
| 2463 | |
| 2464 | template<typename T> |
| 2465 | void Store(RValue<T> value, Pointer<T> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2466 | { |
| 2467 | Store(value, RValue<Pointer<T>>(pointer), alignment, atomic, memoryOrder); |
| 2468 | } |
| 2469 | |
| 2470 | template<typename T> |
| 2471 | void Store(T value, Pointer<T> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2472 | { |
| 2473 | Store(RValue<T>(value), RValue<Pointer<T>>(pointer), alignment, atomic, memoryOrder); |
| 2474 | } |
| 2475 | |
| 2476 | // Fence adds a memory barrier that enforces ordering constraints on memory |
| 2477 | // operations. memoryOrder can only be one of: |
| 2478 | // std::memory_order_acquire, std::memory_order_release, |
| 2479 | // std::memory_order_acq_rel, or std::memory_order_seq_cst. |
| 2480 | void Fence(std::memory_order memoryOrder); |
| 2481 | |
| 2482 | template<class T, int S = 1> |
| 2483 | class Array : public LValue<T> |
| 2484 | { |
| 2485 | public: |
| 2486 | Array(int size = S); |
| 2487 | |
| 2488 | Reference<T> operator[](int index); |
| 2489 | Reference<T> operator[](unsigned int index); |
| 2490 | Reference<T> operator[](RValue<Int> index); |
| 2491 | Reference<T> operator[](RValue<UInt> index); |
| 2492 | |
| 2493 | // self() returns the this pointer to this Array object. |
| 2494 | // This function exists because operator&() is overloaded by LValue<T>. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2495 | inline Array *self() { return this; } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2496 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2497 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2498 | // RValue<Array<T>> operator++(Array<T> &val, int); // Post-increment |
| 2499 | // const Array<T> &operator++(Array<T> &val); // Pre-increment |
| 2500 | // RValue<Array<T>> operator--(Array<T> &val, int); // Post-decrement |
| 2501 | // const Array<T> &operator--(Array<T> &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2502 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2503 | void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2504 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2505 | // ValueOf returns a rr::Value* for the given C-type, RValue<T>, LValue<T> |
| 2506 | // or Reference<T>. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2507 | template<typename T> |
| 2508 | inline Value *ValueOf(const T &v) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2509 | { |
| 2510 | return ReactorType<T>::cast(v).loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2511 | } |
| 2512 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2513 | void Return(); |
| 2514 | |
| 2515 | template<class T> |
| 2516 | void Return(const T &ret) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2517 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2518 | static_assert(CanBeUsedAsReturn<ReactorTypeT<T>>::value, "Unsupported type for Return()"); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2519 | Nucleus::createRet(ValueOf<T>(ret)); |
| 2520 | // Place any unreachable instructions in an unreferenced block. |
| 2521 | Nucleus::setInsertBlock(Nucleus::createBasicBlock()); |
| 2522 | } |
| 2523 | |
| 2524 | // Generic template, leave undefined! |
| 2525 | template<typename FunctionType> |
| 2526 | class Function; |
| 2527 | |
| 2528 | // Specialized for function types |
| 2529 | template<typename Return, typename... Arguments> |
| 2530 | class Function<Return(Arguments...)> |
| 2531 | { |
| 2532 | // Static assert that the function signature is valid. |
| 2533 | static_assert(sizeof(AssertFunctionSignatureIsValid<Return(Arguments...)>) >= 0, "Invalid function signature"); |
| 2534 | |
| 2535 | public: |
| 2536 | Function(); |
| 2537 | |
| 2538 | virtual ~Function(); |
| 2539 | |
| 2540 | template<int index> |
| 2541 | Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type> Arg() const |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2542 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2543 | Value *arg = Nucleus::getArgument(index); |
| 2544 | return Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type>(arg); |
| 2545 | } |
| 2546 | |
| 2547 | std::shared_ptr<Routine> operator()(const char *name, ...); |
| 2548 | std::shared_ptr<Routine> operator()(const Config::Edit &cfg, const char *name, ...); |
| 2549 | |
| 2550 | protected: |
| 2551 | Nucleus *core; |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2552 | std::vector<Type *> arguments; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2553 | }; |
| 2554 | |
| 2555 | template<typename Return> |
| 2556 | class Function<Return()> : public Function<Return(Void)> |
| 2557 | { |
| 2558 | }; |
| 2559 | |
| 2560 | // FunctionT accepts a C-style function type template argument, allowing it to return a type-safe RoutineT wrapper |
| 2561 | template<typename FunctionType> |
| 2562 | class FunctionT; |
| 2563 | |
| 2564 | template<typename Return, typename... Arguments> |
| 2565 | class FunctionT<Return(Arguments...)> : public Function<CToReactorT<Return>(CToReactorT<Arguments>...)> |
| 2566 | { |
| 2567 | public: |
| 2568 | // Type of base class |
| 2569 | using BaseType = Function<CToReactorT<Return>(CToReactorT<Arguments>...)>; |
| 2570 | |
| 2571 | // Function type, e.g. void(int,float) |
| 2572 | using CFunctionType = Return(Arguments...); |
| 2573 | |
| 2574 | // Reactor function type, e.g. Void(Int, Float) |
| 2575 | using ReactorFunctionType = CToReactorT<Return>(CToReactorT<Arguments>...); |
| 2576 | |
| 2577 | // Returned RoutineT type |
| 2578 | using RoutineType = RoutineT<CFunctionType>; |
| 2579 | |
| 2580 | // Hide base implementations of operator() |
| 2581 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2582 | RoutineType operator()(const char *name, ...) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2583 | { |
| 2584 | return RoutineType(BaseType::operator()(name)); |
| 2585 | } |
| 2586 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2587 | RoutineType operator()(const Config::Edit &cfg, const char *name, ...) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2588 | { |
| 2589 | return RoutineType(BaseType::operator()(cfg, name)); |
| 2590 | } |
| 2591 | }; |
| 2592 | |
| 2593 | RValue<Long> Ticks(); |
| 2594 | |
| 2595 | } // namespace rr |
| 2596 | |
| 2597 | /* Inline implementations */ |
| 2598 | |
| 2599 | namespace rr { |
| 2600 | |
| 2601 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2602 | LValue<T>::LValue(int arraySize) |
| 2603 | : Variable(T::getType(), arraySize) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2604 | { |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 2605 | #ifdef ENABLE_RR_DEBUG_INFO |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2606 | materialize(); |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2607 | #endif // ENABLE_RR_DEBUG_INFO |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2608 | } |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2609 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2610 | inline void Variable::materialize() const |
| 2611 | { |
| 2612 | if(!address) |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2613 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2614 | address = Nucleus::allocateStackVariable(type, arraySize); |
| 2615 | RR_DEBUG_INFO_EMIT_VAR(address); |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2616 | |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2617 | if(rvalue) |
| 2618 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2619 | storeValue(rvalue); |
| 2620 | rvalue = nullptr; |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2621 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2622 | } |
| 2623 | } |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2624 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2625 | inline Value *Variable::loadValue() const |
| 2626 | { |
| 2627 | if(rvalue) |
| 2628 | { |
| 2629 | return rvalue; |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2630 | } |
| 2631 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2632 | if(!address) |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2633 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2634 | // TODO: Return undef instead. |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2635 | materialize(); |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2636 | } |
| 2637 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2638 | return Nucleus::createLoad(address, type, false, 0); |
| 2639 | } |
| 2640 | |
| 2641 | inline Value *Variable::storeValue(Value *value) const |
| 2642 | { |
| 2643 | if(address) |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2644 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2645 | return Nucleus::createStore(value, address, type, false, 0); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2646 | } |
| 2647 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2648 | rvalue = value; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2649 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2650 | return value; |
| 2651 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2652 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2653 | inline Value *Variable::getBaseAddress() const |
| 2654 | { |
| 2655 | materialize(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2656 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2657 | return address; |
| 2658 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2659 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2660 | inline Value *Variable::getElementPointer(Value *index, bool unsignedIndex) const |
| 2661 | { |
| 2662 | return Nucleus::createGEP(getBaseAddress(), type, index, unsignedIndex); |
| 2663 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2664 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2665 | template<class T> |
| 2666 | RValue<Pointer<T>> LValue<T>::operator&() |
| 2667 | { |
| 2668 | return RValue<Pointer<T>>(getBaseAddress()); |
| 2669 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2670 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2671 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2672 | Reference<T>::Reference(Value *pointer, int alignment) |
| 2673 | : alignment(alignment) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2674 | { |
| 2675 | address = pointer; |
| 2676 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2677 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2678 | template<class T> |
| 2679 | RValue<T> Reference<T>::operator=(RValue<T> rhs) const |
| 2680 | { |
| 2681 | Nucleus::createStore(rhs.value, address, T::getType(), false, alignment); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2682 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2683 | return rhs; |
| 2684 | } |
| 2685 | |
| 2686 | template<class T> |
| 2687 | RValue<T> Reference<T>::operator=(const Reference<T> &ref) const |
| 2688 | { |
| 2689 | Value *tmp = Nucleus::createLoad(ref.address, T::getType(), false, ref.alignment); |
| 2690 | Nucleus::createStore(tmp, address, T::getType(), false, alignment); |
| 2691 | |
| 2692 | return RValue<T>(tmp); |
| 2693 | } |
| 2694 | |
| 2695 | template<class T> |
| 2696 | RValue<T> Reference<T>::operator+=(RValue<T> rhs) const |
| 2697 | { |
| 2698 | return *this = *this + rhs; |
| 2699 | } |
| 2700 | |
| 2701 | template<class T> |
| 2702 | Value *Reference<T>::loadValue() const |
| 2703 | { |
| 2704 | return Nucleus::createLoad(address, T::getType(), false, alignment); |
| 2705 | } |
| 2706 | |
| 2707 | template<class T> |
| 2708 | int Reference<T>::getAlignment() const |
| 2709 | { |
| 2710 | return alignment; |
| 2711 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2712 | |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 2713 | #ifdef ENABLE_RR_DEBUG_INFO |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2714 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2715 | RValue<T>::RValue(const RValue<T> &rvalue) |
| 2716 | : value(rvalue.value) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2717 | { |
| 2718 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2719 | } |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2720 | #endif // ENABLE_RR_DEBUG_INFO |
Ben Clayton | ac07ed8 | 2019-03-26 14:17:41 +0000 | [diff] [blame] | 2721 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2722 | template<class T> |
| 2723 | RValue<T>::RValue(Value *rvalue) |
| 2724 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2725 | assert(Nucleus::createBitCast(rvalue, T::getType()) == rvalue); // Run-time type should match T, so bitcast is no-op. |
Nicolas Capens | bea4dce | 2017-07-24 16:54:44 -0400 | [diff] [blame] | 2726 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2727 | value = rvalue; |
| 2728 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2729 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2730 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2731 | template<class T> |
| 2732 | RValue<T>::RValue(const T &lvalue) |
| 2733 | { |
| 2734 | value = lvalue.loadValue(); |
| 2735 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2736 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2737 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2738 | template<class T> |
| 2739 | RValue<T>::RValue(typename BoolLiteral<T>::type i) |
| 2740 | { |
| 2741 | value = Nucleus::createConstantBool(i); |
| 2742 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2743 | } |
Ben Clayton | 35e90e2 | 2019-03-15 10:06:06 +0000 | [diff] [blame] | 2744 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2745 | template<class T> |
| 2746 | RValue<T>::RValue(typename IntLiteral<T>::type i) |
| 2747 | { |
| 2748 | value = Nucleus::createConstantInt(i); |
| 2749 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2750 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2751 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2752 | template<class T> |
| 2753 | RValue<T>::RValue(typename FloatLiteral<T>::type f) |
| 2754 | { |
| 2755 | value = Nucleus::createConstantFloat(f); |
| 2756 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2757 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2758 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2759 | template<class T> |
| 2760 | RValue<T>::RValue(const Reference<T> &ref) |
| 2761 | { |
| 2762 | value = ref.loadValue(); |
| 2763 | RR_DEBUG_INFO_EMIT_VAR(value); |
| 2764 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2765 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2766 | template<class Vector4, int T> |
| 2767 | Swizzle2<Vector4, T>::operator RValue<Vector4>() const |
| 2768 | { |
| 2769 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2770 | Value *vector = parent->loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2771 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2772 | return Swizzle(RValue<Vector4>(vector), T); |
| 2773 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2774 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2775 | template<class Vector4, int T> |
| 2776 | Swizzle4<Vector4, T>::operator RValue<Vector4>() const |
| 2777 | { |
| 2778 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2779 | Value *vector = parent->loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2780 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2781 | return Swizzle(RValue<Vector4>(vector), T); |
| 2782 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2783 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2784 | template<class Vector4, int T> |
| 2785 | SwizzleMask4<Vector4, T>::operator RValue<Vector4>() const |
| 2786 | { |
| 2787 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2788 | Value *vector = parent->loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2789 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2790 | return Swizzle(RValue<Vector4>(vector), T); |
| 2791 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2792 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2793 | template<class Vector4, int T> |
| 2794 | RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<Vector4> rhs) |
| 2795 | { |
| 2796 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2797 | return Mask(*parent, rhs, T); |
| 2798 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2799 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2800 | template<class Vector4, int T> |
| 2801 | RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs) |
| 2802 | { |
| 2803 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2804 | return Mask(*parent, Vector4(rhs), T); |
| 2805 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2806 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2807 | template<class Vector4, int T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2808 | SwizzleMask1<Vector4, T>::operator RValue<typename Scalar<Vector4>::Type>() const // FIXME: Call a non-template function |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2809 | { |
| 2810 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2811 | return Extract(*parent, T & 0x3); |
| 2812 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2813 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2814 | template<class Vector4, int T> |
| 2815 | SwizzleMask1<Vector4, T>::operator RValue<Vector4>() const |
| 2816 | { |
| 2817 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2818 | Value *vector = parent->loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2819 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2820 | return Swizzle(RValue<Vector4>(vector), T); |
| 2821 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2822 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2823 | template<class Vector4, int T> |
| 2824 | RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(float x) |
| 2825 | { |
| 2826 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2827 | return *parent = Insert(*parent, Float(x), T & 0x3); |
| 2828 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2829 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2830 | template<class Vector4, int T> |
| 2831 | RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<Vector4> rhs) |
| 2832 | { |
| 2833 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2834 | return Mask(*parent, Float4(rhs), T); |
| 2835 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2836 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2837 | template<class Vector4, int T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2838 | RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs) // FIXME: Call a non-template function |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2839 | { |
| 2840 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2841 | return *parent = Insert(*parent, rhs, T & 0x3); |
| 2842 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2843 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2844 | template<class Vector4, int T> |
| 2845 | SwizzleMask2<Vector4, T>::operator RValue<Vector4>() const |
| 2846 | { |
| 2847 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2848 | Value *vector = parent->loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2849 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2850 | return Swizzle(RValue<Float4>(vector), T); |
| 2851 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2852 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2853 | template<class Vector4, int T> |
| 2854 | RValue<Vector4> SwizzleMask2<Vector4, T>::operator=(RValue<Vector4> rhs) |
| 2855 | { |
| 2856 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2857 | return Mask(*parent, Float4(rhs), T); |
| 2858 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2859 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2860 | template<int T> |
| 2861 | Float::Float(const SwizzleMask1<Float4, T> &rhs) |
| 2862 | { |
| 2863 | *this = rhs.operator RValue<Float>(); |
| 2864 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2865 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2866 | template<int T> |
| 2867 | RValue<Float> Float::operator=(const SwizzleMask1<Float4, T> &rhs) |
| 2868 | { |
| 2869 | return *this = rhs.operator RValue<Float>(); |
| 2870 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2871 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2872 | template<int T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2873 | Float4::Float4(const SwizzleMask1<Float4, T> &rhs) |
| 2874 | : XYZW(this) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2875 | { |
| 2876 | *this = rhs.operator RValue<Float4>(); |
| 2877 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2878 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2879 | template<int T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2880 | Float4::Float4(const Swizzle4<Float4, T> &rhs) |
| 2881 | : XYZW(this) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2882 | { |
| 2883 | *this = rhs.operator RValue<Float4>(); |
| 2884 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2885 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2886 | template<int X, int Y> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2887 | Float4::Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y) |
| 2888 | : XYZW(this) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2889 | { |
| 2890 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2891 | *this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu)); |
| 2892 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2893 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2894 | template<int X, int Y> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2895 | Float4::Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y) |
| 2896 | : XYZW(this) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2897 | { |
| 2898 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2899 | *this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu)); |
| 2900 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2901 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2902 | template<int X, int Y> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2903 | Float4::Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y) |
| 2904 | : XYZW(this) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2905 | { |
| 2906 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2907 | *this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu)); |
| 2908 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2909 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2910 | template<int X, int Y> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2911 | Float4::Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y) |
| 2912 | : XYZW(this) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2913 | { |
| 2914 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 2915 | *this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu)); |
| 2916 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2917 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2918 | template<int T> |
| 2919 | RValue<Float4> Float4::operator=(const SwizzleMask1<Float4, T> &rhs) |
| 2920 | { |
| 2921 | return *this = rhs.operator RValue<Float4>(); |
| 2922 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2923 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2924 | template<int T> |
| 2925 | RValue<Float4> Float4::operator=(const Swizzle4<Float4, T> &rhs) |
| 2926 | { |
| 2927 | return *this = rhs.operator RValue<Float4>(); |
| 2928 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2929 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2930 | // Returns a reactor pointer to the fixed-address ptr. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2931 | RValue<Pointer<Byte>> ConstantPointer(void const *ptr); |
Ben Clayton | b7eb3a8 | 2019-11-19 00:43:50 +0000 | [diff] [blame] | 2932 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2933 | // Returns a reactor pointer to an immutable copy of the data of size bytes. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2934 | RValue<Pointer<Byte>> ConstantData(void const *data, size_t size); |
Ben Clayton | b7eb3a8 | 2019-11-19 00:43:50 +0000 | [diff] [blame] | 2935 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2936 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2937 | Pointer<T>::Pointer(Argument<Pointer<T>> argument) |
| 2938 | : alignment(1) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2939 | { |
| 2940 | LValue<Pointer<T>>::storeValue(argument.value); |
| 2941 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2942 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2943 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2944 | Pointer<T>::Pointer() |
| 2945 | : alignment(1) |
| 2946 | {} |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2947 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2948 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2949 | Pointer<T>::Pointer(RValue<Pointer<T>> rhs) |
| 2950 | : alignment(1) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2951 | { |
| 2952 | LValue<Pointer<T>>::storeValue(rhs.value); |
| 2953 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2954 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2955 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2956 | Pointer<T>::Pointer(const Pointer<T> &rhs) |
| 2957 | : alignment(rhs.alignment) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2958 | { |
| 2959 | Value *value = rhs.loadValue(); |
| 2960 | LValue<Pointer<T>>::storeValue(value); |
| 2961 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2962 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2963 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2964 | Pointer<T>::Pointer(const Reference<Pointer<T>> &rhs) |
| 2965 | : alignment(rhs.getAlignment()) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2966 | { |
| 2967 | Value *value = rhs.loadValue(); |
| 2968 | LValue<Pointer<T>>::storeValue(value); |
| 2969 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2970 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2971 | template<class T> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 2972 | Pointer<T>::Pointer(std::nullptr_t) |
| 2973 | : alignment(1) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2974 | { |
| 2975 | Value *value = Nucleus::createNullPointer(T::getType()); |
| 2976 | LValue<Pointer<T>>::storeValue(value); |
| 2977 | } |
Ben Clayton | 0697da0 | 2019-08-01 13:35:48 +0100 | [diff] [blame] | 2978 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2979 | template<class T> |
| 2980 | RValue<Pointer<T>> Pointer<T>::operator=(RValue<Pointer<T>> rhs) |
| 2981 | { |
| 2982 | LValue<Pointer<T>>::storeValue(rhs.value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2983 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2984 | return rhs; |
| 2985 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2986 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2987 | template<class T> |
| 2988 | RValue<Pointer<T>> Pointer<T>::operator=(const Pointer<T> &rhs) |
| 2989 | { |
| 2990 | Value *value = rhs.loadValue(); |
| 2991 | LValue<Pointer<T>>::storeValue(value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2992 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2993 | return RValue<Pointer<T>>(value); |
| 2994 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2995 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 2996 | template<class T> |
| 2997 | RValue<Pointer<T>> Pointer<T>::operator=(const Reference<Pointer<T>> &rhs) |
| 2998 | { |
| 2999 | Value *value = rhs.loadValue(); |
| 3000 | LValue<Pointer<T>>::storeValue(value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3001 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3002 | return RValue<Pointer<T>>(value); |
| 3003 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3004 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3005 | template<class T> |
| 3006 | RValue<Pointer<T>> Pointer<T>::operator=(std::nullptr_t) |
| 3007 | { |
| 3008 | Value *value = Nucleus::createNullPointer(T::getType()); |
| 3009 | LValue<Pointer<T>>::storeValue(value); |
Ben Clayton | 0697da0 | 2019-08-01 13:35:48 +0100 | [diff] [blame] | 3010 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3011 | return RValue<Pointer<T>>(this); |
| 3012 | } |
Ben Clayton | 0697da0 | 2019-08-01 13:35:48 +0100 | [diff] [blame] | 3013 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3014 | template<class T> |
| 3015 | Reference<T> Pointer<T>::operator*() |
| 3016 | { |
| 3017 | return Reference<T>(LValue<Pointer<T>>::loadValue(), alignment); |
| 3018 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3019 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3020 | template<class T> |
| 3021 | Reference<T> Pointer<T>::operator[](int index) |
| 3022 | { |
| 3023 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3024 | Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), Nucleus::createConstantInt(index), false); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3025 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3026 | return Reference<T>(element, alignment); |
| 3027 | } |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3028 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3029 | template<class T> |
| 3030 | Reference<T> Pointer<T>::operator[](unsigned int index) |
| 3031 | { |
| 3032 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3033 | Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), Nucleus::createConstantInt(index), true); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3034 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3035 | return Reference<T>(element, alignment); |
| 3036 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3037 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3038 | template<class T> |
| 3039 | Reference<T> Pointer<T>::operator[](RValue<Int> index) |
| 3040 | { |
| 3041 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3042 | Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), index.value, false); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3043 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3044 | return Reference<T>(element, alignment); |
| 3045 | } |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3046 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3047 | template<class T> |
| 3048 | Reference<T> Pointer<T>::operator[](RValue<UInt> index) |
| 3049 | { |
| 3050 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3051 | Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), index.value, true); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3052 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3053 | return Reference<T>(element, alignment); |
| 3054 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3055 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3056 | template<class T> |
| 3057 | Type *Pointer<T>::getType() |
| 3058 | { |
| 3059 | return Nucleus::getPointerType(T::getType()); |
| 3060 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3061 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3062 | template<class T, int S> |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3063 | Array<T, S>::Array(int size) |
| 3064 | : LValue<T>(size) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3065 | { |
| 3066 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3067 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3068 | template<class T, int S> |
| 3069 | Reference<T> Array<T, S>::operator[](int index) |
| 3070 | { |
| 3071 | assert(index < this->arraySize); |
| 3072 | Value *element = LValue<T>::getElementPointer(Nucleus::createConstantInt(index), false); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3073 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3074 | return Reference<T>(element); |
| 3075 | } |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3076 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3077 | template<class T, int S> |
| 3078 | Reference<T> Array<T, S>::operator[](unsigned int index) |
| 3079 | { |
| 3080 | assert(index < static_cast<unsigned int>(this->arraySize)); |
| 3081 | Value *element = LValue<T>::getElementPointer(Nucleus::createConstantInt(index), true); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3082 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3083 | return Reference<T>(element); |
| 3084 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3085 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3086 | template<class T, int S> |
| 3087 | Reference<T> Array<T, S>::operator[](RValue<Int> index) |
| 3088 | { |
| 3089 | Value *element = LValue<T>::getElementPointer(index.value, false); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3090 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3091 | return Reference<T>(element); |
| 3092 | } |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 3093 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3094 | template<class T, int S> |
| 3095 | Reference<T> Array<T, S>::operator[](RValue<UInt> index) |
| 3096 | { |
| 3097 | Value *element = LValue<T>::getElementPointer(index.value, true); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3098 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3099 | return Reference<T>(element); |
| 3100 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3101 | |
| 3102 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 3103 | // RValue<Array<T>> operator++(Array<T> &val, int) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3104 | // { |
| 3105 | // // FIXME: Requires storing the address of the array |
| 3106 | // } |
| 3107 | |
| 3108 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 3109 | // const Array<T> &operator++(Array<T> &val) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3110 | // { |
| 3111 | // // FIXME: Requires storing the address of the array |
| 3112 | // } |
| 3113 | |
| 3114 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 3115 | // RValue<Array<T>> operator--(Array<T> &val, int) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3116 | // { |
| 3117 | // // FIXME: Requires storing the address of the array |
| 3118 | // } |
| 3119 | |
| 3120 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 3121 | // const Array<T> &operator--(Array<T> &val) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3122 | // { |
| 3123 | // // FIXME: Requires storing the address of the array |
| 3124 | // } |
| 3125 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3126 | template<class T> |
| 3127 | RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse) |
| 3128 | { |
| 3129 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3130 | return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, ifFalse.value)); |
| 3131 | } |
| 3132 | |
| 3133 | template<class T> |
| 3134 | RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse) |
| 3135 | { |
| 3136 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3137 | Value *trueValue = ifTrue.loadValue(); |
| 3138 | |
| 3139 | return RValue<T>(Nucleus::createSelect(condition.value, trueValue, ifFalse.value)); |
| 3140 | } |
| 3141 | |
| 3142 | template<class T> |
| 3143 | RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse) |
| 3144 | { |
| 3145 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3146 | Value *falseValue = ifFalse.loadValue(); |
| 3147 | |
| 3148 | return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, falseValue)); |
| 3149 | } |
| 3150 | |
| 3151 | template<class T> |
| 3152 | RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse) |
| 3153 | { |
| 3154 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3155 | Value *trueValue = ifTrue.loadValue(); |
| 3156 | Value *falseValue = ifFalse.loadValue(); |
| 3157 | |
| 3158 | return RValue<T>(Nucleus::createSelect(condition.value, trueValue, falseValue)); |
| 3159 | } |
| 3160 | |
| 3161 | template<typename Return, typename... Arguments> |
| 3162 | Function<Return(Arguments...)>::Function() |
| 3163 | { |
| 3164 | core = new Nucleus(); |
| 3165 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3166 | Type *types[] = { Arguments::getType()... }; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3167 | for(Type *type : types) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3168 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3169 | if(type != Void::getType()) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3170 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3171 | arguments.push_back(type); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3172 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3173 | } |
| 3174 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3175 | Nucleus::createFunction(Return::getType(), arguments); |
| 3176 | } |
| 3177 | |
| 3178 | template<typename Return, typename... Arguments> |
| 3179 | Function<Return(Arguments...)>::~Function() |
| 3180 | { |
| 3181 | delete core; |
| 3182 | } |
| 3183 | |
| 3184 | template<typename Return, typename... Arguments> |
| 3185 | std::shared_ptr<Routine> Function<Return(Arguments...)>::operator()(const char *name, ...) |
| 3186 | { |
| 3187 | char fullName[1024 + 1]; |
| 3188 | |
| 3189 | va_list vararg; |
| 3190 | va_start(vararg, name); |
| 3191 | vsnprintf(fullName, 1024, name, vararg); |
| 3192 | va_end(vararg); |
| 3193 | |
| 3194 | return core->acquireRoutine(fullName, Config::Edit::None); |
| 3195 | } |
| 3196 | |
| 3197 | template<typename Return, typename... Arguments> |
| 3198 | std::shared_ptr<Routine> Function<Return(Arguments...)>::operator()(const Config::Edit &cfg, const char *name, ...) |
| 3199 | { |
| 3200 | char fullName[1024 + 1]; |
| 3201 | |
| 3202 | va_list vararg; |
| 3203 | va_start(vararg, name); |
| 3204 | vsnprintf(fullName, 1024, name, vararg); |
| 3205 | va_end(vararg); |
| 3206 | |
| 3207 | return core->acquireRoutine(fullName, cfg); |
| 3208 | } |
| 3209 | |
| 3210 | template<class T, class S> |
| 3211 | RValue<T> ReinterpretCast(RValue<S> val) |
| 3212 | { |
| 3213 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3214 | return RValue<T>(Nucleus::createBitCast(val.value, T::getType())); |
| 3215 | } |
| 3216 | |
| 3217 | template<class T, class S> |
| 3218 | RValue<T> ReinterpretCast(const LValue<S> &var) |
| 3219 | { |
| 3220 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3221 | Value *val = var.loadValue(); |
| 3222 | |
| 3223 | return RValue<T>(Nucleus::createBitCast(val, T::getType())); |
| 3224 | } |
| 3225 | |
| 3226 | template<class T, class S> |
| 3227 | RValue<T> ReinterpretCast(const Reference<S> &var) |
| 3228 | { |
| 3229 | return ReinterpretCast<T>(RValue<S>(var)); |
| 3230 | } |
| 3231 | |
| 3232 | template<class T> |
| 3233 | RValue<T> As(Value *val) |
| 3234 | { |
| 3235 | RR_DEBUG_INFO_UPDATE_LOC(); |
| 3236 | return RValue<T>(Nucleus::createBitCast(val, T::getType())); |
| 3237 | } |
| 3238 | |
| 3239 | template<class T, class S> |
| 3240 | RValue<T> As(RValue<S> val) |
| 3241 | { |
| 3242 | return ReinterpretCast<T>(val); |
| 3243 | } |
| 3244 | |
| 3245 | template<class T, class S> |
| 3246 | RValue<T> As(const LValue<S> &var) |
| 3247 | { |
| 3248 | return ReinterpretCast<T>(var); |
| 3249 | } |
| 3250 | |
| 3251 | template<class T, class S> |
| 3252 | RValue<T> As(const Reference<S> &val) |
| 3253 | { |
| 3254 | return ReinterpretCast<T>(val); |
| 3255 | } |
| 3256 | |
| 3257 | // Calls the function pointer fptr with the given arguments, return type |
| 3258 | // and parameter types. Returns the call's return value if the function has |
| 3259 | // a non-void return type. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3260 | Value *Call(RValue<Pointer<Byte>> fptr, Type *retTy, std::initializer_list<Value *> args, std::initializer_list<Type *> paramTys); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3261 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3262 | template<typename F> |
| 3263 | class CallHelper |
| 3264 | {}; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3265 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3266 | template<typename Return, typename... Arguments> |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3267 | class CallHelper<Return(Arguments...)> |
| 3268 | { |
| 3269 | public: |
| 3270 | using RReturn = CToReactorT<Return>; |
| 3271 | |
| 3272 | static inline RReturn Call(Return(fptr)(Arguments...), CToReactorT<Arguments>... args) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3273 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3274 | return RValue<RReturn>(rr::Call( |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3275 | ConstantPointer(reinterpret_cast<void *>(fptr)), |
| 3276 | RReturn::getType(), |
| 3277 | { ValueOf(args)... }, |
| 3278 | { CToReactorT<Arguments>::getType()... })); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3279 | } |
| 3280 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3281 | static inline RReturn Call(Pointer<Byte> fptr, CToReactorT<Arguments>... args) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3282 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3283 | return RValue<RReturn>(rr::Call( |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3284 | fptr, |
| 3285 | RReturn::getType(), |
| 3286 | { ValueOf(args)... }, |
| 3287 | { CToReactorT<Arguments>::getType()... })); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3288 | } |
| 3289 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3290 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3291 | template<typename... Arguments> |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3292 | class CallHelper<void(Arguments...)> |
| 3293 | { |
| 3294 | public: |
| 3295 | static inline void Call(void(fptr)(Arguments...), CToReactorT<Arguments>... args) |
| 3296 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3297 | rr::Call(ConstantPointer(reinterpret_cast<void *>(fptr)), |
| 3298 | Void::getType(), |
| 3299 | { ValueOf(args)... }, |
| 3300 | { CToReactorT<Arguments>::getType()... }); |
Ben Clayton | 68cfc78 | 2019-06-29 12:31:08 +0100 | [diff] [blame] | 3301 | } |
| 3302 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3303 | static inline void Call(Pointer<Byte> fptr, CToReactorT<Arguments>... args) |
Ben Clayton | 68cfc78 | 2019-06-29 12:31:08 +0100 | [diff] [blame] | 3304 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3305 | rr::Call(fptr, |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3306 | Void::getType(), |
| 3307 | { ValueOf(args)... }, |
| 3308 | { CToReactorT<Arguments>::getType()... }); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3309 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3310 | }; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3311 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3312 | template<typename T> |
| 3313 | inline ReactorTypeT<T> CastToReactor(const T &v) |
| 3314 | { |
| 3315 | return ReactorType<T>::cast(v); |
| 3316 | } |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3317 | |
| 3318 | // Calls the static function pointer fptr with the given arguments args. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3319 | template<typename Return, typename... CArgs, typename... RArgs> |
| 3320 | inline CToReactorT<Return> Call(Return(fptr)(CArgs...), RArgs &&... args) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3321 | { |
| 3322 | return CallHelper<Return(CArgs...)>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...); |
| 3323 | } |
| 3324 | |
| 3325 | // Calls the static function pointer fptr with the given arguments args. |
| 3326 | // Overload for calling functions with void return type. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3327 | template<typename... CArgs, typename... RArgs> |
| 3328 | inline void Call(void(fptr)(CArgs...), RArgs &&... args) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3329 | { |
| 3330 | CallHelper<void(CArgs...)>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...); |
| 3331 | } |
| 3332 | |
| 3333 | // Calls the member function pointer fptr with the given arguments args. |
| 3334 | // object can be a Class*, or a Pointer<Byte>. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3335 | template<typename Return, typename Class, typename C, typename... CArgs, typename... RArgs> |
| 3336 | inline CToReactorT<Return> Call(Return (Class::*fptr)(CArgs...), C &&object, RArgs &&... args) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3337 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3338 | using Helper = CallHelper<Return(Class *, void *, CArgs...)>; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3339 | using fptrTy = decltype(fptr); |
| 3340 | |
| 3341 | struct Static |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3342 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3343 | static inline Return Call(Class *object, void *fptrptr, CArgs... args) |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3344 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3345 | auto fptr = *reinterpret_cast<fptrTy *>(fptrptr); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3346 | return (object->*fptr)(std::forward<CArgs>(args)...); |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3347 | } |
| 3348 | }; |
| 3349 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3350 | return Helper::Call(&Static::Call, |
| 3351 | CastToReactor(object), |
| 3352 | ConstantData(&fptr, sizeof(fptr)), |
| 3353 | CastToReactor(std::forward<RArgs>(args))...); |
| 3354 | } |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3355 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3356 | // Calls the member function pointer fptr with the given arguments args. |
| 3357 | // Overload for calling functions with void return type. |
| 3358 | // object can be a Class*, or a Pointer<Byte>. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3359 | template<typename Class, typename C, typename... CArgs, typename... RArgs> |
| 3360 | inline void Call(void (Class::*fptr)(CArgs...), C &&object, RArgs &&... args) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3361 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3362 | using Helper = CallHelper<void(Class *, void *, CArgs...)>; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3363 | using fptrTy = decltype(fptr); |
| 3364 | |
| 3365 | struct Static |
| 3366 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3367 | static inline void Call(Class *object, void *fptrptr, CArgs... args) |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3368 | { |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3369 | auto fptr = *reinterpret_cast<fptrTy *>(fptrptr); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3370 | (object->*fptr)(std::forward<CArgs>(args)...); |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3371 | } |
| 3372 | }; |
| 3373 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3374 | Helper::Call(&Static::Call, |
| 3375 | CastToReactor(object), |
| 3376 | ConstantData(&fptr, sizeof(fptr)), |
| 3377 | CastToReactor(std::forward<RArgs>(args))...); |
| 3378 | } |
Ben Clayton | 51f0831 | 2019-11-08 14:39:26 +0000 | [diff] [blame] | 3379 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3380 | // Calls the Reactor function pointer fptr with the signature |
| 3381 | // FUNCTION_SIGNATURE and arguments. |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3382 | template<typename FUNCTION_SIGNATURE, typename... RArgs> |
| 3383 | inline void Call(Pointer<Byte> fptr, RArgs &&... args) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3384 | { |
| 3385 | CallHelper<FUNCTION_SIGNATURE>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...); |
| 3386 | } |
| 3387 | |
| 3388 | // Breakpoint emits an instruction that will cause the application to trap. |
| 3389 | // This can be used to stop an attached debugger at the given call. |
| 3390 | void Breakpoint(); |
| 3391 | |
| 3392 | class ForData |
| 3393 | { |
| 3394 | public: |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3395 | ForData(bool init) |
| 3396 | : loopOnce(init) |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3397 | { |
Ben Clayton | d853c12 | 2019-04-16 17:51:49 -0400 | [diff] [blame] | 3398 | } |
| 3399 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3400 | operator bool() |
Antonio Maiorano | 7363cd2 | 2019-10-11 15:23:22 -0400 | [diff] [blame] | 3401 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3402 | return loopOnce; |
Antonio Maiorano | 7363cd2 | 2019-10-11 15:23:22 -0400 | [diff] [blame] | 3403 | } |
| 3404 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3405 | bool operator=(bool value) |
Ben Clayton | b7eb3a8 | 2019-11-19 00:43:50 +0000 | [diff] [blame] | 3406 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3407 | return loopOnce = value; |
Ben Clayton | b7eb3a8 | 2019-11-19 00:43:50 +0000 | [diff] [blame] | 3408 | } |
| 3409 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3410 | bool setup() |
Ben Clayton | b7eb3a8 | 2019-11-19 00:43:50 +0000 | [diff] [blame] | 3411 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3412 | RR_DEBUG_INFO_FLUSH(); |
| 3413 | if(Nucleus::getInsertBlock() != endBB) |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3414 | { |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3415 | testBB = Nucleus::createBasicBlock(); |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3416 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3417 | Nucleus::createBr(testBB); |
| 3418 | Nucleus::setInsertBlock(testBB); |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3419 | |
| 3420 | return true; |
| 3421 | } |
| 3422 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3423 | return false; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3424 | } |
| 3425 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3426 | bool test(RValue<Bool> cmp) |
| 3427 | { |
| 3428 | BasicBlock *bodyBB = Nucleus::createBasicBlock(); |
| 3429 | endBB = Nucleus::createBasicBlock(); |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3430 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3431 | Nucleus::createCondBr(cmp.value, bodyBB, endBB); |
| 3432 | Nucleus::setInsertBlock(bodyBB); |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3433 | |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3434 | return true; |
| 3435 | } |
| 3436 | |
| 3437 | void end() |
| 3438 | { |
| 3439 | Nucleus::createBr(testBB); |
| 3440 | Nucleus::setInsertBlock(endBB); |
| 3441 | } |
| 3442 | |
| 3443 | private: |
| 3444 | BasicBlock *testBB = nullptr; |
| 3445 | BasicBlock *endBB = nullptr; |
| 3446 | bool loopOnce = true; |
| 3447 | }; |
| 3448 | |
| 3449 | class IfElseData |
| 3450 | { |
| 3451 | public: |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3452 | IfElseData(RValue<Bool> cmp) |
| 3453 | : iteration(0) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3454 | { |
| 3455 | condition = cmp.value; |
| 3456 | |
| 3457 | beginBB = Nucleus::getInsertBlock(); |
| 3458 | trueBB = Nucleus::createBasicBlock(); |
| 3459 | falseBB = nullptr; |
| 3460 | endBB = Nucleus::createBasicBlock(); |
| 3461 | |
| 3462 | Nucleus::setInsertBlock(trueBB); |
| 3463 | } |
| 3464 | |
| 3465 | ~IfElseData() |
| 3466 | { |
| 3467 | Nucleus::createBr(endBB); |
| 3468 | |
| 3469 | Nucleus::setInsertBlock(beginBB); |
| 3470 | Nucleus::createCondBr(condition, trueBB, falseBB ? falseBB : endBB); |
| 3471 | |
| 3472 | Nucleus::setInsertBlock(endBB); |
| 3473 | } |
| 3474 | |
| 3475 | operator int() |
| 3476 | { |
| 3477 | return iteration; |
| 3478 | } |
| 3479 | |
| 3480 | IfElseData &operator++() |
| 3481 | { |
| 3482 | ++iteration; |
| 3483 | |
| 3484 | return *this; |
| 3485 | } |
| 3486 | |
| 3487 | void elseClause() |
| 3488 | { |
| 3489 | Nucleus::createBr(endBB); |
| 3490 | |
| 3491 | falseBB = Nucleus::createBasicBlock(); |
| 3492 | Nucleus::setInsertBlock(falseBB); |
| 3493 | } |
| 3494 | |
| 3495 | private: |
| 3496 | Value *condition; |
| 3497 | BasicBlock *beginBB; |
| 3498 | BasicBlock *trueBB; |
| 3499 | BasicBlock *falseBB; |
| 3500 | BasicBlock *endBB; |
| 3501 | int iteration; |
| 3502 | }; |
| 3503 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3504 | #define For(init, cond, inc) \ |
| 3505 | for(ForData for__ = true; for__; for__ = false) \ |
| 3506 | for(init; for__.setup() && for__.test(cond); inc, for__.end()) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3507 | |
| 3508 | #define While(cond) For((void)0, cond, (void)0) |
| 3509 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3510 | #define Do \ |
| 3511 | { \ |
| 3512 | BasicBlock *body__ = Nucleus::createBasicBlock(); \ |
| 3513 | Nucleus::createBr(body__); \ |
| 3514 | Nucleus::setInsertBlock(body__); |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3515 | |
| 3516 | #define Until(cond) \ |
| 3517 | BasicBlock *end__ = Nucleus::createBasicBlock(); \ |
| 3518 | Nucleus::createCondBr((cond).value, end__, body__); \ |
| 3519 | Nucleus::setInsertBlock(end__); \ |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3520 | } \ |
| 3521 | do \ |
| 3522 | { \ |
| 3523 | } while(false) // Require a semi-colon at the end of the Until() |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3524 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3525 | enum |
| 3526 | { |
| 3527 | IF_BLOCK__, |
| 3528 | ELSE_CLAUSE__, |
| 3529 | ELSE_BLOCK__, |
| 3530 | IFELSE_NUM__ |
| 3531 | }; |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3532 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3533 | #define If(cond) \ |
| 3534 | for(IfElseData ifElse__(cond); ifElse__ < IFELSE_NUM__; ++ifElse__) \ |
| 3535 | if(ifElse__ == IF_BLOCK__) |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3536 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3537 | #define Else \ |
| 3538 | else if(ifElse__ == ELSE_CLAUSE__) \ |
| 3539 | { \ |
| 3540 | ifElse__.elseClause(); \ |
| 3541 | } \ |
| 3542 | else // ELSE_BLOCK__ |
Nicolas Capens | 157ba26 | 2019-12-10 17:49:14 -0500 | [diff] [blame] | 3543 | |
| 3544 | } // namespace rr |
| 3545 | |
Ben Clayton | 7e11f46 | 2019-11-18 16:00:31 +0000 | [diff] [blame] | 3546 | #include "Traits.inl" |
| 3547 | |
Ben Clayton | 713b8d3 | 2019-12-17 20:37:56 +0000 | [diff] [blame] | 3548 | #endif // rr_Reactor_hpp |