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" |
| 20 | |
Nicolas Capens | 4dd1eff | 2017-08-04 09:33:04 -0400 | [diff] [blame] | 21 | #include <cassert> |
Nicolas Capens | 3bbc5e1 | 2016-09-27 10:49:52 -0400 | [diff] [blame] | 22 | #include <cstddef> |
Chris Forbes | 878d4b0 | 2019-01-21 10:48:35 -0800 | [diff] [blame] | 23 | #include <cstdio> |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 24 | |
| 25 | #include <string> |
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 | |
Chris Forbes | c296806 | 2019-03-19 16:48:03 -0700 | [diff] [blame] | 29 | #undef Bool // b/127920555 |
Nicolas Capens | 3bbc5e1 | 2016-09-27 10:49:52 -0400 | [diff] [blame] | 30 | |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 31 | #if !defined(NDEBUG) && (REACTOR_LLVM_VERSION >= 7) |
| 32 | #define ENABLE_RR_PRINT 1 // Enables RR_PRINT(), RR_WATCH() |
| 33 | #endif // !defined(NDEBUG) && (REACTOR_LLVM_VERSION >= 7) |
| 34 | |
Nicolas Capens | 4846150 | 2018-08-06 14:20:45 -0400 | [diff] [blame] | 35 | namespace rr |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 36 | { |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 37 | class Bool; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 38 | class Byte; |
| 39 | class SByte; |
| 40 | class Byte4; |
| 41 | class SByte4; |
| 42 | class Byte8; |
| 43 | class SByte8; |
| 44 | class Byte16; |
| 45 | class SByte16; |
| 46 | class Short; |
| 47 | class UShort; |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 48 | class Short2; |
| 49 | class UShort2; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 50 | class Short4; |
| 51 | class UShort4; |
| 52 | class Short8; |
| 53 | class UShort8; |
| 54 | class Int; |
| 55 | class UInt; |
| 56 | class Int2; |
| 57 | class UInt2; |
| 58 | class Int4; |
| 59 | class UInt4; |
| 60 | class Long; |
Alexis Hetu | 734e257 | 2018-12-20 14:00:49 -0500 | [diff] [blame] | 61 | class Half; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 62 | class Float; |
| 63 | class Float2; |
| 64 | class Float4; |
| 65 | |
| 66 | class Void |
| 67 | { |
| 68 | public: |
| 69 | static Type *getType(); |
| 70 | |
| 71 | static bool isVoid() |
| 72 | { |
| 73 | return true; |
| 74 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | template<class T> |
| 78 | class RValue; |
| 79 | |
| 80 | template<class T> |
| 81 | class Pointer; |
| 82 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 83 | class Variable |
| 84 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 85 | friend class Nucleus; |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 86 | friend class PrintValue; |
Nicolas Capens | 5da8d8d | 2019-03-27 14:45:34 -0400 | [diff] [blame] | 87 | |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 88 | Variable() = delete; |
Nicolas Capens | 5da8d8d | 2019-03-27 14:45:34 -0400 | [diff] [blame] | 89 | Variable &operator=(const Variable&) = delete; |
| 90 | |
| 91 | public: |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 92 | void materialize() const; |
| 93 | |
| 94 | Value *loadValue() const; |
| 95 | Value *storeValue(Value *value) const; |
| 96 | |
| 97 | Value *getBaseAddress() const; |
| 98 | Value *getElementPointer(Value *index, bool unsignedIndex) const; |
Nicolas Capens | 5da8d8d | 2019-03-27 14:45:34 -0400 | [diff] [blame] | 99 | |
| 100 | protected: |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 101 | Variable(Type *type, int arraySize); |
| 102 | Variable(const Variable&) = default; |
| 103 | |
| 104 | ~Variable(); |
| 105 | |
| 106 | private: |
| 107 | static void materializeAll(); |
| 108 | static void killUnmaterialized(); |
| 109 | |
| 110 | static std::unordered_set<Variable*> unmaterializedVariables; |
| 111 | |
| 112 | Type *const type; |
| 113 | const int arraySize; |
| 114 | mutable Value *rvalue = nullptr; |
| 115 | mutable Value *address = nullptr; |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 116 | }; |
| 117 | |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 118 | template<class T> |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 119 | class LValue : public Variable |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 120 | { |
| 121 | public: |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 122 | LValue(int arraySize = 0); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 123 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 124 | RValue<Pointer<T>> operator&(); |
| 125 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 126 | static bool isVoid() |
| 127 | { |
| 128 | return false; |
| 129 | } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | template<class T> |
| 133 | class Reference |
| 134 | { |
| 135 | public: |
| 136 | explicit Reference(Value *pointer, int alignment = 1); |
| 137 | |
| 138 | RValue<T> operator=(RValue<T> rhs) const; |
| 139 | RValue<T> operator=(const Reference<T> &ref) const; |
| 140 | |
| 141 | RValue<T> operator+=(RValue<T> rhs) const; |
| 142 | |
Ben Clayton | ec25573 | 2019-02-27 13:51:22 +0000 | [diff] [blame] | 143 | RValue<Pointer<T>> operator&() const { return RValue<Pointer<T>>(address); } |
| 144 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 145 | Value *loadValue() const; |
| 146 | int getAlignment() const; |
| 147 | |
| 148 | private: |
| 149 | Value *address; |
| 150 | |
| 151 | const int alignment; |
| 152 | }; |
| 153 | |
| 154 | template<class T> |
Ben Clayton | 35e90e2 | 2019-03-15 10:06:06 +0000 | [diff] [blame] | 155 | struct BoolLiteral |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 156 | { |
| 157 | struct type; |
| 158 | }; |
| 159 | |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 160 | template<> |
Ben Clayton | 35e90e2 | 2019-03-15 10:06:06 +0000 | [diff] [blame] | 161 | struct BoolLiteral<Bool> |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 162 | { |
| 163 | typedef bool type; |
| 164 | }; |
| 165 | |
Ben Clayton | 35e90e2 | 2019-03-15 10:06:06 +0000 | [diff] [blame] | 166 | template<class T> |
| 167 | struct IntLiteral |
| 168 | { |
| 169 | struct type; |
| 170 | }; |
| 171 | |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 172 | template<> |
| 173 | struct IntLiteral<Int> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 174 | { |
| 175 | typedef int type; |
| 176 | }; |
| 177 | |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 178 | template<> |
| 179 | struct IntLiteral<UInt> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 180 | { |
| 181 | typedef unsigned int type; |
| 182 | }; |
| 183 | |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 184 | template<> |
| 185 | struct IntLiteral<Long> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 186 | { |
| 187 | typedef int64_t type; |
| 188 | }; |
| 189 | |
| 190 | template<class T> |
| 191 | struct FloatLiteral |
| 192 | { |
| 193 | struct type; |
| 194 | }; |
| 195 | |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 196 | template<> |
| 197 | struct FloatLiteral<Float> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 198 | { |
| 199 | typedef float type; |
| 200 | }; |
| 201 | |
| 202 | template<class T> |
| 203 | class RValue |
| 204 | { |
| 205 | public: |
| 206 | explicit RValue(Value *rvalue); |
| 207 | |
| 208 | RValue(const T &lvalue); |
Ben Clayton | 35e90e2 | 2019-03-15 10:06:06 +0000 | [diff] [blame] | 209 | RValue(typename BoolLiteral<T>::type i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 210 | RValue(typename IntLiteral<T>::type i); |
| 211 | RValue(typename FloatLiteral<T>::type f); |
| 212 | RValue(const Reference<T> &rhs); |
| 213 | |
| 214 | RValue<T> &operator=(const RValue<T>&) = delete; |
| 215 | |
| 216 | Value *value; // FIXME: Make private |
| 217 | }; |
| 218 | |
| 219 | template<typename T> |
| 220 | struct Argument |
| 221 | { |
| 222 | explicit Argument(Value *value) : value(value) {} |
| 223 | |
| 224 | Value *value; |
| 225 | }; |
| 226 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 227 | class Bool : public LValue<Bool> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 228 | { |
| 229 | public: |
| 230 | Bool(Argument<Bool> argument); |
| 231 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 232 | Bool() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 233 | Bool(bool x); |
| 234 | Bool(RValue<Bool> rhs); |
| 235 | Bool(const Bool &rhs); |
| 236 | Bool(const Reference<Bool> &rhs); |
| 237 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 238 | // RValue<Bool> operator=(bool rhs); // FIXME: Implement |
| 239 | RValue<Bool> operator=(RValue<Bool> rhs); |
| 240 | RValue<Bool> operator=(const Bool &rhs); |
| 241 | RValue<Bool> operator=(const Reference<Bool> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 242 | |
| 243 | static Type *getType(); |
| 244 | }; |
| 245 | |
| 246 | RValue<Bool> operator!(RValue<Bool> val); |
| 247 | RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs); |
| 248 | RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs); |
Ben Clayton | f3b5797 | 2019-03-15 09:56:47 +0000 | [diff] [blame] | 249 | RValue<Bool> operator!=(RValue<Bool> lhs, RValue<Bool> rhs); |
| 250 | RValue<Bool> operator==(RValue<Bool> lhs, RValue<Bool> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 251 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 252 | class Byte : public LValue<Byte> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 253 | { |
| 254 | public: |
| 255 | Byte(Argument<Byte> argument); |
| 256 | |
| 257 | explicit Byte(RValue<Int> cast); |
| 258 | explicit Byte(RValue<UInt> cast); |
| 259 | explicit Byte(RValue<UShort> cast); |
| 260 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 261 | Byte() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 262 | Byte(int x); |
| 263 | Byte(unsigned char x); |
| 264 | Byte(RValue<Byte> rhs); |
| 265 | Byte(const Byte &rhs); |
| 266 | Byte(const Reference<Byte> &rhs); |
| 267 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 268 | // RValue<Byte> operator=(unsigned char rhs); // FIXME: Implement |
| 269 | RValue<Byte> operator=(RValue<Byte> rhs); |
| 270 | RValue<Byte> operator=(const Byte &rhs); |
| 271 | RValue<Byte> operator=(const Reference<Byte> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 272 | |
| 273 | static Type *getType(); |
| 274 | }; |
| 275 | |
| 276 | RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs); |
| 277 | RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs); |
| 278 | RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs); |
| 279 | RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs); |
| 280 | RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs); |
| 281 | RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs); |
| 282 | RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs); |
| 283 | RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs); |
| 284 | RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs); |
| 285 | RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 286 | RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs); |
| 287 | RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs); |
| 288 | RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs); |
| 289 | RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs); |
| 290 | RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs); |
| 291 | RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs); |
| 292 | RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs); |
| 293 | RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs); |
| 294 | RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs); |
| 295 | RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 296 | RValue<Byte> operator+(RValue<Byte> val); |
| 297 | RValue<Byte> operator-(RValue<Byte> val); |
| 298 | RValue<Byte> operator~(RValue<Byte> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 299 | RValue<Byte> operator++(Byte &val, int); // Post-increment |
| 300 | const Byte &operator++(Byte &val); // Pre-increment |
| 301 | RValue<Byte> operator--(Byte &val, int); // Post-decrement |
| 302 | const Byte &operator--(Byte &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 303 | RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs); |
| 304 | RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs); |
| 305 | RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs); |
| 306 | RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs); |
| 307 | RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs); |
| 308 | RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs); |
| 309 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 310 | class SByte : public LValue<SByte> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 311 | { |
| 312 | public: |
| 313 | SByte(Argument<SByte> argument); |
| 314 | |
| 315 | explicit SByte(RValue<Int> cast); |
| 316 | explicit SByte(RValue<Short> cast); |
| 317 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 318 | SByte() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 319 | SByte(signed char x); |
| 320 | SByte(RValue<SByte> rhs); |
| 321 | SByte(const SByte &rhs); |
| 322 | SByte(const Reference<SByte> &rhs); |
| 323 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 324 | // RValue<SByte> operator=(signed char rhs); // FIXME: Implement |
| 325 | RValue<SByte> operator=(RValue<SByte> rhs); |
| 326 | RValue<SByte> operator=(const SByte &rhs); |
| 327 | RValue<SByte> operator=(const Reference<SByte> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 328 | |
| 329 | static Type *getType(); |
| 330 | }; |
| 331 | |
| 332 | RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs); |
| 333 | RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs); |
| 334 | RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs); |
| 335 | RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs); |
| 336 | RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs); |
| 337 | RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs); |
| 338 | RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs); |
| 339 | RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs); |
| 340 | RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs); |
| 341 | RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 342 | RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs); |
| 343 | RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs); |
| 344 | RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs); |
| 345 | RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs); |
| 346 | RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs); |
| 347 | RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs); |
| 348 | RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs); |
| 349 | RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs); |
| 350 | RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs); |
| 351 | RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 352 | RValue<SByte> operator+(RValue<SByte> val); |
| 353 | RValue<SByte> operator-(RValue<SByte> val); |
| 354 | RValue<SByte> operator~(RValue<SByte> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 355 | RValue<SByte> operator++(SByte &val, int); // Post-increment |
| 356 | const SByte &operator++(SByte &val); // Pre-increment |
| 357 | RValue<SByte> operator--(SByte &val, int); // Post-decrement |
| 358 | const SByte &operator--(SByte &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 359 | RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs); |
| 360 | RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs); |
| 361 | RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs); |
| 362 | RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs); |
| 363 | RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs); |
| 364 | RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs); |
| 365 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 366 | class Short : public LValue<Short> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 367 | { |
| 368 | public: |
| 369 | Short(Argument<Short> argument); |
| 370 | |
| 371 | explicit Short(RValue<Int> cast); |
| 372 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 373 | Short() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 374 | Short(short x); |
| 375 | Short(RValue<Short> rhs); |
| 376 | Short(const Short &rhs); |
| 377 | Short(const Reference<Short> &rhs); |
| 378 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 379 | // RValue<Short> operator=(short rhs); // FIXME: Implement |
| 380 | RValue<Short> operator=(RValue<Short> rhs); |
| 381 | RValue<Short> operator=(const Short &rhs); |
| 382 | RValue<Short> operator=(const Reference<Short> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 383 | |
| 384 | static Type *getType(); |
| 385 | }; |
| 386 | |
| 387 | RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs); |
| 388 | RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs); |
| 389 | RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs); |
| 390 | RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs); |
| 391 | RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs); |
| 392 | RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs); |
| 393 | RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs); |
| 394 | RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs); |
| 395 | RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs); |
| 396 | RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 397 | RValue<Short> operator+=(Short &lhs, RValue<Short> rhs); |
| 398 | RValue<Short> operator-=(Short &lhs, RValue<Short> rhs); |
| 399 | RValue<Short> operator*=(Short &lhs, RValue<Short> rhs); |
| 400 | RValue<Short> operator/=(Short &lhs, RValue<Short> rhs); |
| 401 | RValue<Short> operator%=(Short &lhs, RValue<Short> rhs); |
| 402 | RValue<Short> operator&=(Short &lhs, RValue<Short> rhs); |
| 403 | RValue<Short> operator|=(Short &lhs, RValue<Short> rhs); |
| 404 | RValue<Short> operator^=(Short &lhs, RValue<Short> rhs); |
| 405 | RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs); |
| 406 | RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 407 | RValue<Short> operator+(RValue<Short> val); |
| 408 | RValue<Short> operator-(RValue<Short> val); |
| 409 | RValue<Short> operator~(RValue<Short> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 410 | RValue<Short> operator++(Short &val, int); // Post-increment |
| 411 | const Short &operator++(Short &val); // Pre-increment |
| 412 | RValue<Short> operator--(Short &val, int); // Post-decrement |
| 413 | const Short &operator--(Short &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 414 | RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs); |
| 415 | RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs); |
| 416 | RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs); |
| 417 | RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs); |
| 418 | RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs); |
| 419 | RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs); |
| 420 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 421 | class UShort : public LValue<UShort> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 422 | { |
| 423 | public: |
| 424 | UShort(Argument<UShort> argument); |
| 425 | |
| 426 | explicit UShort(RValue<UInt> cast); |
| 427 | explicit UShort(RValue<Int> cast); |
| 428 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 429 | UShort() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 430 | UShort(unsigned short x); |
| 431 | UShort(RValue<UShort> rhs); |
| 432 | UShort(const UShort &rhs); |
| 433 | UShort(const Reference<UShort> &rhs); |
| 434 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 435 | // RValue<UShort> operator=(unsigned short rhs); // FIXME: Implement |
| 436 | RValue<UShort> operator=(RValue<UShort> rhs); |
| 437 | RValue<UShort> operator=(const UShort &rhs); |
| 438 | RValue<UShort> operator=(const Reference<UShort> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 439 | |
| 440 | static Type *getType(); |
| 441 | }; |
| 442 | |
| 443 | RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs); |
| 444 | RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs); |
| 445 | RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs); |
| 446 | RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs); |
| 447 | RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs); |
| 448 | RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs); |
| 449 | RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs); |
| 450 | RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs); |
| 451 | RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs); |
| 452 | RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 453 | RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs); |
| 454 | RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs); |
| 455 | RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs); |
| 456 | RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs); |
| 457 | RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs); |
| 458 | RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs); |
| 459 | RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs); |
| 460 | RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs); |
| 461 | RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs); |
| 462 | RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 463 | RValue<UShort> operator+(RValue<UShort> val); |
| 464 | RValue<UShort> operator-(RValue<UShort> val); |
| 465 | RValue<UShort> operator~(RValue<UShort> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 466 | RValue<UShort> operator++(UShort &val, int); // Post-increment |
| 467 | const UShort &operator++(UShort &val); // Pre-increment |
| 468 | RValue<UShort> operator--(UShort &val, int); // Post-decrement |
| 469 | const UShort &operator--(UShort &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 470 | RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs); |
| 471 | RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs); |
| 472 | RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs); |
| 473 | RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs); |
| 474 | RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs); |
| 475 | RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs); |
| 476 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 477 | class Byte4 : public LValue<Byte4> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 478 | { |
| 479 | public: |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 480 | explicit Byte4(RValue<Byte8> cast); |
| 481 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 482 | Byte4() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 483 | // Byte4(int x, int y, int z, int w); |
| 484 | // Byte4(RValue<Byte4> rhs); |
| 485 | // Byte4(const Byte4 &rhs); |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 486 | Byte4(const Reference<Byte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 487 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 488 | // RValue<Byte4> operator=(RValue<Byte4> rhs); |
| 489 | // RValue<Byte4> operator=(const Byte4 &rhs); |
| 490 | // RValue<Byte4> operator=(const Reference<Byte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 491 | |
| 492 | static Type *getType(); |
| 493 | }; |
| 494 | |
| 495 | // RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 496 | // RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 497 | // RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 498 | // RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 499 | // RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 500 | // RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 501 | // RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 502 | // RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 503 | // RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs); |
| 504 | // RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 505 | // RValue<Byte4> operator+=(Byte4 &lhs, RValue<Byte4> rhs); |
| 506 | // RValue<Byte4> operator-=(Byte4 &lhs, RValue<Byte4> rhs); |
| 507 | // RValue<Byte4> operator*=(Byte4 &lhs, RValue<Byte4> rhs); |
| 508 | // RValue<Byte4> operator/=(Byte4 &lhs, RValue<Byte4> rhs); |
| 509 | // RValue<Byte4> operator%=(Byte4 &lhs, RValue<Byte4> rhs); |
| 510 | // RValue<Byte4> operator&=(Byte4 &lhs, RValue<Byte4> rhs); |
| 511 | // RValue<Byte4> operator|=(Byte4 &lhs, RValue<Byte4> rhs); |
| 512 | // RValue<Byte4> operator^=(Byte4 &lhs, RValue<Byte4> rhs); |
| 513 | // RValue<Byte4> operator<<=(Byte4 &lhs, RValue<Byte4> rhs); |
| 514 | // RValue<Byte4> operator>>=(Byte4 &lhs, RValue<Byte4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 515 | // RValue<Byte4> operator+(RValue<Byte4> val); |
| 516 | // RValue<Byte4> operator-(RValue<Byte4> val); |
| 517 | // RValue<Byte4> operator~(RValue<Byte4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 518 | // RValue<Byte4> operator++(Byte4 &val, int); // Post-increment |
| 519 | // const Byte4 &operator++(Byte4 &val); // Pre-increment |
| 520 | // RValue<Byte4> operator--(Byte4 &val, int); // Post-decrement |
| 521 | // const Byte4 &operator--(Byte4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 522 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 523 | class SByte4 : public LValue<SByte4> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 524 | { |
| 525 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 526 | SByte4() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 527 | // SByte4(int x, int y, int z, int w); |
| 528 | // SByte4(RValue<SByte4> rhs); |
| 529 | // SByte4(const SByte4 &rhs); |
| 530 | // SByte4(const Reference<SByte4> &rhs); |
| 531 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 532 | // RValue<SByte4> operator=(RValue<SByte4> rhs); |
| 533 | // RValue<SByte4> operator=(const SByte4 &rhs); |
| 534 | // RValue<SByte4> operator=(const Reference<SByte4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 535 | |
| 536 | static Type *getType(); |
| 537 | }; |
| 538 | |
| 539 | // RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 540 | // RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 541 | // RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 542 | // RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 543 | // RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 544 | // RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 545 | // RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 546 | // RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 547 | // RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs); |
| 548 | // RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 549 | // RValue<SByte4> operator+=(SByte4 &lhs, RValue<SByte4> rhs); |
| 550 | // RValue<SByte4> operator-=(SByte4 &lhs, RValue<SByte4> rhs); |
| 551 | // RValue<SByte4> operator*=(SByte4 &lhs, RValue<SByte4> rhs); |
| 552 | // RValue<SByte4> operator/=(SByte4 &lhs, RValue<SByte4> rhs); |
| 553 | // RValue<SByte4> operator%=(SByte4 &lhs, RValue<SByte4> rhs); |
| 554 | // RValue<SByte4> operator&=(SByte4 &lhs, RValue<SByte4> rhs); |
| 555 | // RValue<SByte4> operator|=(SByte4 &lhs, RValue<SByte4> rhs); |
| 556 | // RValue<SByte4> operator^=(SByte4 &lhs, RValue<SByte4> rhs); |
| 557 | // RValue<SByte4> operator<<=(SByte4 &lhs, RValue<SByte4> rhs); |
| 558 | // RValue<SByte4> operator>>=(SByte4 &lhs, RValue<SByte4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 559 | // RValue<SByte4> operator+(RValue<SByte4> val); |
| 560 | // RValue<SByte4> operator-(RValue<SByte4> val); |
| 561 | // RValue<SByte4> operator~(RValue<SByte4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 562 | // RValue<SByte4> operator++(SByte4 &val, int); // Post-increment |
| 563 | // const SByte4 &operator++(SByte4 &val); // Pre-increment |
| 564 | // RValue<SByte4> operator--(SByte4 &val, int); // Post-decrement |
| 565 | // const SByte4 &operator--(SByte4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 566 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 567 | class Byte8 : public LValue<Byte8> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 568 | { |
| 569 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 570 | Byte8() = default; |
Nicolas Capens | 3bbc5e1 | 2016-09-27 10:49:52 -0400 | [diff] [blame] | 571 | 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); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 572 | Byte8(RValue<Byte8> rhs); |
| 573 | Byte8(const Byte8 &rhs); |
| 574 | Byte8(const Reference<Byte8> &rhs); |
| 575 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 576 | RValue<Byte8> operator=(RValue<Byte8> rhs); |
| 577 | RValue<Byte8> operator=(const Byte8 &rhs); |
| 578 | RValue<Byte8> operator=(const Reference<Byte8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 579 | |
| 580 | static Type *getType(); |
| 581 | }; |
| 582 | |
| 583 | RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 584 | RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 585 | // RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 586 | // RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 587 | // RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 588 | RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 589 | RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 590 | RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 591 | // RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs); |
| 592 | // RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 593 | RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs); |
| 594 | RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs); |
| 595 | // RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs); |
| 596 | // RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs); |
| 597 | // RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs); |
| 598 | RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs); |
| 599 | RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs); |
| 600 | RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs); |
| 601 | // RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs); |
| 602 | // RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 603 | // RValue<Byte8> operator+(RValue<Byte8> val); |
| 604 | // RValue<Byte8> operator-(RValue<Byte8> val); |
| 605 | RValue<Byte8> operator~(RValue<Byte8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 606 | // RValue<Byte8> operator++(Byte8 &val, int); // Post-increment |
| 607 | // const Byte8 &operator++(Byte8 &val); // Pre-increment |
| 608 | // RValue<Byte8> operator--(Byte8 &val, int); // Post-decrement |
| 609 | // const Byte8 &operator--(Byte8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 610 | |
| 611 | RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y); |
| 612 | RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y); |
| 613 | RValue<Short4> Unpack(RValue<Byte4> x); |
Nicolas Capens | 411273e | 2017-01-26 15:13:36 -0800 | [diff] [blame] | 614 | RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 615 | RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y); |
| 616 | RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y); |
| 617 | RValue<Int> SignMask(RValue<Byte8> x); |
| 618 | // RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y); |
| 619 | RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y); |
| 620 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 621 | class SByte8 : public LValue<SByte8> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 622 | { |
| 623 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 624 | SByte8() = default; |
Nicolas Capens | 3bbc5e1 | 2016-09-27 10:49:52 -0400 | [diff] [blame] | 625 | 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); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 626 | SByte8(RValue<SByte8> rhs); |
| 627 | SByte8(const SByte8 &rhs); |
| 628 | SByte8(const Reference<SByte8> &rhs); |
| 629 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 630 | RValue<SByte8> operator=(RValue<SByte8> rhs); |
| 631 | RValue<SByte8> operator=(const SByte8 &rhs); |
| 632 | RValue<SByte8> operator=(const Reference<SByte8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 633 | |
| 634 | static Type *getType(); |
| 635 | }; |
| 636 | |
| 637 | RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 638 | RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 639 | // RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 640 | // RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 641 | // RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 642 | RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 643 | RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 644 | RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 645 | // RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs); |
| 646 | // RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 647 | RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs); |
| 648 | RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs); |
| 649 | // RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs); |
| 650 | // RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs); |
| 651 | // RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs); |
| 652 | RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs); |
| 653 | RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs); |
| 654 | RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs); |
| 655 | // RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs); |
| 656 | // RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 657 | // RValue<SByte8> operator+(RValue<SByte8> val); |
| 658 | // RValue<SByte8> operator-(RValue<SByte8> val); |
| 659 | RValue<SByte8> operator~(RValue<SByte8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 660 | // RValue<SByte8> operator++(SByte8 &val, int); // Post-increment |
| 661 | // const SByte8 &operator++(SByte8 &val); // Pre-increment |
| 662 | // RValue<SByte8> operator--(SByte8 &val, int); // Post-decrement |
| 663 | // const SByte8 &operator--(SByte8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 664 | |
| 665 | RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y); |
| 666 | RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y); |
| 667 | RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y); |
| 668 | RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y); |
| 669 | RValue<Int> SignMask(RValue<SByte8> x); |
| 670 | RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y); |
| 671 | RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y); |
| 672 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 673 | class Byte16 : public LValue<Byte16> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 674 | { |
| 675 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 676 | Byte16() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 677 | // Byte16(int x, int y, int z, int w); |
| 678 | Byte16(RValue<Byte16> rhs); |
| 679 | Byte16(const Byte16 &rhs); |
| 680 | Byte16(const Reference<Byte16> &rhs); |
| 681 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 682 | RValue<Byte16> operator=(RValue<Byte16> rhs); |
| 683 | RValue<Byte16> operator=(const Byte16 &rhs); |
| 684 | RValue<Byte16> operator=(const Reference<Byte16> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 685 | |
| 686 | static Type *getType(); |
| 687 | }; |
| 688 | |
| 689 | // RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 690 | // RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 691 | // RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 692 | // RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 693 | // RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 694 | // RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 695 | // RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 696 | // RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 697 | // RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs); |
| 698 | // RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 699 | // RValue<Byte16> operator+=(Byte16 &lhs, RValue<Byte16> rhs); |
| 700 | // RValue<Byte16> operator-=(Byte16 &lhs, RValue<Byte16> rhs); |
| 701 | // RValue<Byte16> operator*=(Byte16 &lhs, RValue<Byte16> rhs); |
| 702 | // RValue<Byte16> operator/=(Byte16 &lhs, RValue<Byte16> rhs); |
| 703 | // RValue<Byte16> operator%=(Byte16 &lhs, RValue<Byte16> rhs); |
| 704 | // RValue<Byte16> operator&=(Byte16 &lhs, RValue<Byte16> rhs); |
| 705 | // RValue<Byte16> operator|=(Byte16 &lhs, RValue<Byte16> rhs); |
| 706 | // RValue<Byte16> operator^=(Byte16 &lhs, RValue<Byte16> rhs); |
| 707 | // RValue<Byte16> operator<<=(Byte16 &lhs, RValue<Byte16> rhs); |
| 708 | // RValue<Byte16> operator>>=(Byte16 &lhs, RValue<Byte16> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 709 | // RValue<Byte16> operator+(RValue<Byte16> val); |
| 710 | // RValue<Byte16> operator-(RValue<Byte16> val); |
| 711 | // RValue<Byte16> operator~(RValue<Byte16> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 712 | // RValue<Byte16> operator++(Byte16 &val, int); // Post-increment |
| 713 | // const Byte16 &operator++(Byte16 &val); // Pre-increment |
| 714 | // RValue<Byte16> operator--(Byte16 &val, int); // Post-decrement |
| 715 | // const Byte16 &operator--(Byte16 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 716 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 717 | class SByte16 : public LValue<SByte16> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 718 | { |
| 719 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 720 | SByte16() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 721 | // SByte16(int x, int y, int z, int w); |
| 722 | // SByte16(RValue<SByte16> rhs); |
| 723 | // SByte16(const SByte16 &rhs); |
| 724 | // SByte16(const Reference<SByte16> &rhs); |
| 725 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 726 | // RValue<SByte16> operator=(RValue<SByte16> rhs); |
| 727 | // RValue<SByte16> operator=(const SByte16 &rhs); |
| 728 | // RValue<SByte16> operator=(const Reference<SByte16> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 729 | |
| 730 | static Type *getType(); |
| 731 | }; |
| 732 | |
| 733 | // RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 734 | // RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 735 | // RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 736 | // RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 737 | // RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 738 | // RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 739 | // RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 740 | // RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 741 | // RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs); |
| 742 | // RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 743 | // RValue<SByte16> operator+=(SByte16 &lhs, RValue<SByte16> rhs); |
| 744 | // RValue<SByte16> operator-=(SByte16 &lhs, RValue<SByte16> rhs); |
| 745 | // RValue<SByte16> operator*=(SByte16 &lhs, RValue<SByte16> rhs); |
| 746 | // RValue<SByte16> operator/=(SByte16 &lhs, RValue<SByte16> rhs); |
| 747 | // RValue<SByte16> operator%=(SByte16 &lhs, RValue<SByte16> rhs); |
| 748 | // RValue<SByte16> operator&=(SByte16 &lhs, RValue<SByte16> rhs); |
| 749 | // RValue<SByte16> operator|=(SByte16 &lhs, RValue<SByte16> rhs); |
| 750 | // RValue<SByte16> operator^=(SByte16 &lhs, RValue<SByte16> rhs); |
| 751 | // RValue<SByte16> operator<<=(SByte16 &lhs, RValue<SByte16> rhs); |
| 752 | // RValue<SByte16> operator>>=(SByte16 &lhs, RValue<SByte16> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 753 | // RValue<SByte16> operator+(RValue<SByte16> val); |
| 754 | // RValue<SByte16> operator-(RValue<SByte16> val); |
| 755 | // RValue<SByte16> operator~(RValue<SByte16> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 756 | // RValue<SByte16> operator++(SByte16 &val, int); // Post-increment |
| 757 | // const SByte16 &operator++(SByte16 &val); // Pre-increment |
| 758 | // RValue<SByte16> operator--(SByte16 &val, int); // Post-decrement |
| 759 | // const SByte16 &operator--(SByte16 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 760 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 761 | class Short2 : public LValue<Short2> |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 762 | { |
| 763 | public: |
| 764 | explicit Short2(RValue<Short4> cast); |
| 765 | |
| 766 | static Type *getType(); |
| 767 | }; |
| 768 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 769 | class UShort2 : public LValue<UShort2> |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 770 | { |
| 771 | public: |
| 772 | explicit UShort2(RValue<UShort4> cast); |
| 773 | |
| 774 | static Type *getType(); |
| 775 | }; |
| 776 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 777 | class Short4 : public LValue<Short4> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 778 | { |
| 779 | public: |
| 780 | explicit Short4(RValue<Int> cast); |
| 781 | explicit Short4(RValue<Int4> cast); |
| 782 | // explicit Short4(RValue<Float> cast); |
| 783 | explicit Short4(RValue<Float4> cast); |
| 784 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 785 | Short4() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 786 | Short4(short xyzw); |
| 787 | Short4(short x, short y, short z, short w); |
| 788 | Short4(RValue<Short4> rhs); |
| 789 | Short4(const Short4 &rhs); |
| 790 | Short4(const Reference<Short4> &rhs); |
| 791 | Short4(RValue<UShort4> rhs); |
| 792 | Short4(const UShort4 &rhs); |
| 793 | Short4(const Reference<UShort4> &rhs); |
| 794 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 795 | RValue<Short4> operator=(RValue<Short4> rhs); |
| 796 | RValue<Short4> operator=(const Short4 &rhs); |
| 797 | RValue<Short4> operator=(const Reference<Short4> &rhs); |
| 798 | RValue<Short4> operator=(RValue<UShort4> rhs); |
| 799 | RValue<Short4> operator=(const UShort4 &rhs); |
| 800 | RValue<Short4> operator=(const Reference<UShort4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 801 | |
| 802 | static Type *getType(); |
| 803 | }; |
| 804 | |
| 805 | RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs); |
| 806 | RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs); |
| 807 | RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs); |
| 808 | // RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs); |
| 809 | // RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs); |
| 810 | RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs); |
| 811 | RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs); |
| 812 | RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs); |
| 813 | RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs); |
| 814 | RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 815 | RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs); |
| 816 | RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs); |
| 817 | RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs); |
| 818 | // RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs); |
| 819 | // RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs); |
| 820 | RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs); |
| 821 | RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs); |
| 822 | RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs); |
| 823 | RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs); |
| 824 | RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 825 | // RValue<Short4> operator+(RValue<Short4> val); |
| 826 | RValue<Short4> operator-(RValue<Short4> val); |
| 827 | RValue<Short4> operator~(RValue<Short4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 828 | // RValue<Short4> operator++(Short4 &val, int); // Post-increment |
| 829 | // const Short4 &operator++(Short4 &val); // Pre-increment |
| 830 | // RValue<Short4> operator--(Short4 &val, int); // Post-decrement |
| 831 | // const Short4 &operator--(Short4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 832 | // RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs); |
| 833 | // RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs); |
| 834 | // RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs); |
| 835 | // RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs); |
| 836 | // RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs); |
| 837 | // RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs); |
| 838 | |
| 839 | RValue<Short4> RoundShort4(RValue<Float4> cast); |
| 840 | RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y); |
| 841 | RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y); |
| 842 | RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y); |
| 843 | RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y); |
| 844 | RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y); |
| 845 | RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y); |
Nicolas Capens | 33438a6 | 2017-09-27 11:47:35 -0400 | [diff] [blame] | 846 | RValue<SByte8> PackSigned(RValue<Short4> x, RValue<Short4> y); |
| 847 | RValue<Byte8> PackUnsigned(RValue<Short4> x, RValue<Short4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 848 | RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y); |
| 849 | RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y); |
| 850 | RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select); |
| 851 | RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i); |
| 852 | RValue<Short> Extract(RValue<Short4> val, int i); |
| 853 | RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y); |
| 854 | RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y); |
| 855 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 856 | class UShort4 : public LValue<UShort4> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 857 | { |
| 858 | public: |
| 859 | explicit UShort4(RValue<Int4> cast); |
| 860 | explicit UShort4(RValue<Float4> cast, bool saturate = false); |
| 861 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 862 | UShort4() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 863 | UShort4(unsigned short xyzw); |
| 864 | UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w); |
| 865 | UShort4(RValue<UShort4> rhs); |
| 866 | UShort4(const UShort4 &rhs); |
| 867 | UShort4(const Reference<UShort4> &rhs); |
| 868 | UShort4(RValue<Short4> rhs); |
| 869 | UShort4(const Short4 &rhs); |
| 870 | UShort4(const Reference<Short4> &rhs); |
| 871 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 872 | RValue<UShort4> operator=(RValue<UShort4> rhs); |
| 873 | RValue<UShort4> operator=(const UShort4 &rhs); |
| 874 | RValue<UShort4> operator=(const Reference<UShort4> &rhs); |
| 875 | RValue<UShort4> operator=(RValue<Short4> rhs); |
| 876 | RValue<UShort4> operator=(const Short4 &rhs); |
| 877 | RValue<UShort4> operator=(const Reference<Short4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 878 | |
| 879 | static Type *getType(); |
| 880 | }; |
| 881 | |
| 882 | RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 883 | RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 884 | RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 885 | // RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 886 | // RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs); |
Nicolas Capens | 16b5f15 | 2016-10-13 13:39:01 -0400 | [diff] [blame] | 887 | RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 888 | RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs); |
| 889 | RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 890 | RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs); |
| 891 | RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 892 | // RValue<UShort4> operator+=(UShort4 &lhs, RValue<UShort4> rhs); |
| 893 | // RValue<UShort4> operator-=(UShort4 &lhs, RValue<UShort4> rhs); |
| 894 | // RValue<UShort4> operator*=(UShort4 &lhs, RValue<UShort4> rhs); |
| 895 | // RValue<UShort4> operator/=(UShort4 &lhs, RValue<UShort4> rhs); |
| 896 | // RValue<UShort4> operator%=(UShort4 &lhs, RValue<UShort4> rhs); |
| 897 | // RValue<UShort4> operator&=(UShort4 &lhs, RValue<UShort4> rhs); |
| 898 | // RValue<UShort4> operator|=(UShort4 &lhs, RValue<UShort4> rhs); |
| 899 | // RValue<UShort4> operator^=(UShort4 &lhs, RValue<UShort4> rhs); |
| 900 | RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs); |
| 901 | RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 902 | // RValue<UShort4> operator+(RValue<UShort4> val); |
| 903 | // RValue<UShort4> operator-(RValue<UShort4> val); |
| 904 | RValue<UShort4> operator~(RValue<UShort4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 905 | // RValue<UShort4> operator++(UShort4 &val, int); // Post-increment |
| 906 | // const UShort4 &operator++(UShort4 &val); // Pre-increment |
| 907 | // RValue<UShort4> operator--(UShort4 &val, int); // Post-decrement |
| 908 | // const UShort4 &operator--(UShort4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 909 | |
| 910 | RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y); |
| 911 | RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y); |
| 912 | RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y); |
| 913 | RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y); |
| 914 | RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y); |
| 915 | RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 916 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 917 | class Short8 : public LValue<Short8> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 918 | { |
| 919 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 920 | Short8() = default; |
Nicolas Capens | 3e7062b | 2017-01-17 14:01:33 -0500 | [diff] [blame] | 921 | Short8(short c); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 922 | Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7); |
| 923 | Short8(RValue<Short8> rhs); |
| 924 | // Short8(const Short8 &rhs); |
| 925 | Short8(const Reference<Short8> &rhs); |
| 926 | Short8(RValue<Short4> lo, RValue<Short4> hi); |
| 927 | |
Nicolas Capens | f1beca4 | 2019-03-26 17:18:57 -0400 | [diff] [blame] | 928 | RValue<Short8> operator=(RValue<Short8> rhs); |
| 929 | RValue<Short8> operator=(const Short8 &rhs); |
| 930 | RValue<Short8> operator=(const Reference<Short8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 931 | |
| 932 | static Type *getType(); |
| 933 | }; |
| 934 | |
| 935 | RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs); |
| 936 | // RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs); |
| 937 | // RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs); |
| 938 | // RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs); |
| 939 | // RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs); |
| 940 | RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs); |
| 941 | // RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs); |
| 942 | // RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs); |
| 943 | RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs); |
| 944 | RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs); |
| 945 | // RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs); |
| 946 | // RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 947 | // RValue<Short8> operator+=(Short8 &lhs, RValue<Short8> rhs); |
| 948 | // RValue<Short8> operator-=(Short8 &lhs, RValue<Short8> rhs); |
| 949 | // RValue<Short8> operator*=(Short8 &lhs, RValue<Short8> rhs); |
| 950 | // RValue<Short8> operator/=(Short8 &lhs, RValue<Short8> rhs); |
| 951 | // RValue<Short8> operator%=(Short8 &lhs, RValue<Short8> rhs); |
| 952 | // RValue<Short8> operator&=(Short8 &lhs, RValue<Short8> rhs); |
| 953 | // RValue<Short8> operator|=(Short8 &lhs, RValue<Short8> rhs); |
| 954 | // RValue<Short8> operator^=(Short8 &lhs, RValue<Short8> rhs); |
| 955 | // RValue<Short8> operator<<=(Short8 &lhs, RValue<Short8> rhs); |
| 956 | // RValue<Short8> operator>>=(Short8 &lhs, RValue<Short8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 957 | // RValue<Short8> operator+(RValue<Short8> val); |
| 958 | // RValue<Short8> operator-(RValue<Short8> val); |
| 959 | // RValue<Short8> operator~(RValue<Short8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 960 | // RValue<Short8> operator++(Short8 &val, int); // Post-increment |
| 961 | // const Short8 &operator++(Short8 &val); // Pre-increment |
| 962 | // RValue<Short8> operator--(Short8 &val, int); // Post-decrement |
| 963 | // const Short8 &operator--(Short8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 964 | // RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs); |
| 965 | // RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs); |
| 966 | // RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs); |
| 967 | // RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs); |
| 968 | // RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs); |
| 969 | // RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs); |
| 970 | |
| 971 | RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y); |
| 972 | RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y); |
| 973 | RValue<Int4> Abs(RValue<Int4> x); |
| 974 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 975 | class UShort8 : public LValue<UShort8> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 976 | { |
| 977 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 978 | UShort8() = default; |
Nicolas Capens | 3e7062b | 2017-01-17 14:01:33 -0500 | [diff] [blame] | 979 | UShort8(unsigned short c); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 980 | 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); |
| 981 | UShort8(RValue<UShort8> rhs); |
| 982 | // UShort8(const UShort8 &rhs); |
| 983 | UShort8(const Reference<UShort8> &rhs); |
| 984 | UShort8(RValue<UShort4> lo, RValue<UShort4> hi); |
| 985 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 986 | RValue<UShort8> operator=(RValue<UShort8> rhs); |
| 987 | RValue<UShort8> operator=(const UShort8 &rhs); |
| 988 | RValue<UShort8> operator=(const Reference<UShort8> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 989 | |
| 990 | static Type *getType(); |
| 991 | }; |
| 992 | |
| 993 | RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 994 | // RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 995 | RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 996 | // RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 997 | // RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 998 | RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 999 | // RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1000 | // RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1001 | RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs); |
| 1002 | RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs); |
| 1003 | // RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1004 | // RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1005 | RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1006 | // RValue<UShort8> operator-=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1007 | // RValue<UShort8> operator*=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1008 | // RValue<UShort8> operator/=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1009 | // RValue<UShort8> operator%=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1010 | // RValue<UShort8> operator&=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1011 | // RValue<UShort8> operator|=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1012 | // RValue<UShort8> operator^=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1013 | // RValue<UShort8> operator<<=(UShort8 &lhs, RValue<UShort8> rhs); |
| 1014 | // RValue<UShort8> operator>>=(UShort8 &lhs, RValue<UShort8> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1015 | // RValue<UShort8> operator+(RValue<UShort8> val); |
| 1016 | // RValue<UShort8> operator-(RValue<UShort8> val); |
| 1017 | RValue<UShort8> operator~(RValue<UShort8> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1018 | // RValue<UShort8> operator++(UShort8 &val, int); // Post-increment |
| 1019 | // const UShort8 &operator++(UShort8 &val); // Pre-increment |
| 1020 | // RValue<UShort8> operator--(UShort8 &val, int); // Post-decrement |
| 1021 | // const UShort8 &operator--(UShort8 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1022 | // RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1023 | // RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1024 | // RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1025 | // RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1026 | // RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1027 | // RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs); |
| 1028 | |
| 1029 | RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7); |
| 1030 | RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y); |
| 1031 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 1032 | class Int : public LValue<Int> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1033 | { |
| 1034 | public: |
| 1035 | Int(Argument<Int> argument); |
| 1036 | |
| 1037 | explicit Int(RValue<Byte> cast); |
| 1038 | explicit Int(RValue<SByte> cast); |
| 1039 | explicit Int(RValue<Short> cast); |
| 1040 | explicit Int(RValue<UShort> cast); |
| 1041 | explicit Int(RValue<Int2> cast); |
| 1042 | explicit Int(RValue<Long> cast); |
| 1043 | explicit Int(RValue<Float> cast); |
| 1044 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 1045 | Int() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1046 | Int(int x); |
| 1047 | Int(RValue<Int> rhs); |
| 1048 | Int(RValue<UInt> rhs); |
| 1049 | Int(const Int &rhs); |
| 1050 | Int(const UInt &rhs); |
| 1051 | Int(const Reference<Int> &rhs); |
| 1052 | Int(const Reference<UInt> &rhs); |
| 1053 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1054 | RValue<Int> operator=(int rhs); |
| 1055 | RValue<Int> operator=(RValue<Int> rhs); |
| 1056 | RValue<Int> operator=(RValue<UInt> rhs); |
| 1057 | RValue<Int> operator=(const Int &rhs); |
| 1058 | RValue<Int> operator=(const UInt &rhs); |
| 1059 | RValue<Int> operator=(const Reference<Int> &rhs); |
| 1060 | RValue<Int> operator=(const Reference<UInt> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1061 | |
| 1062 | static Type *getType(); |
| 1063 | }; |
| 1064 | |
| 1065 | RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs); |
| 1066 | RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs); |
| 1067 | RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs); |
| 1068 | RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs); |
| 1069 | RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs); |
| 1070 | RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs); |
| 1071 | RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs); |
| 1072 | RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs); |
| 1073 | RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs); |
| 1074 | RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1075 | RValue<Int> operator+=(Int &lhs, RValue<Int> rhs); |
| 1076 | RValue<Int> operator-=(Int &lhs, RValue<Int> rhs); |
| 1077 | RValue<Int> operator*=(Int &lhs, RValue<Int> rhs); |
| 1078 | RValue<Int> operator/=(Int &lhs, RValue<Int> rhs); |
| 1079 | RValue<Int> operator%=(Int &lhs, RValue<Int> rhs); |
| 1080 | RValue<Int> operator&=(Int &lhs, RValue<Int> rhs); |
| 1081 | RValue<Int> operator|=(Int &lhs, RValue<Int> rhs); |
| 1082 | RValue<Int> operator^=(Int &lhs, RValue<Int> rhs); |
| 1083 | RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs); |
| 1084 | RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1085 | RValue<Int> operator+(RValue<Int> val); |
| 1086 | RValue<Int> operator-(RValue<Int> val); |
| 1087 | RValue<Int> operator~(RValue<Int> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1088 | RValue<Int> operator++(Int &val, int); // Post-increment |
| 1089 | const Int &operator++(Int &val); // Pre-increment |
| 1090 | RValue<Int> operator--(Int &val, int); // Post-decrement |
| 1091 | const Int &operator--(Int &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1092 | RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs); |
| 1093 | RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs); |
| 1094 | RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs); |
| 1095 | RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs); |
| 1096 | RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs); |
| 1097 | RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs); |
| 1098 | |
| 1099 | RValue<Int> Max(RValue<Int> x, RValue<Int> y); |
| 1100 | RValue<Int> Min(RValue<Int> x, RValue<Int> y); |
| 1101 | RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max); |
| 1102 | RValue<Int> RoundInt(RValue<Float> cast); |
| 1103 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 1104 | class Long : public LValue<Long> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1105 | { |
| 1106 | public: |
| 1107 | // Long(Argument<Long> argument); |
| 1108 | |
| 1109 | // explicit Long(RValue<Short> cast); |
| 1110 | // explicit Long(RValue<UShort> cast); |
| 1111 | explicit Long(RValue<Int> cast); |
| 1112 | explicit Long(RValue<UInt> cast); |
| 1113 | // explicit Long(RValue<Float> cast); |
| 1114 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 1115 | Long() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1116 | // Long(qword x); |
| 1117 | Long(RValue<Long> rhs); |
| 1118 | // Long(RValue<ULong> rhs); |
| 1119 | // Long(const Long &rhs); |
| 1120 | // Long(const Reference<Long> &rhs); |
| 1121 | // Long(const ULong &rhs); |
| 1122 | // Long(const Reference<ULong> &rhs); |
| 1123 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1124 | RValue<Long> operator=(int64_t rhs); |
| 1125 | RValue<Long> operator=(RValue<Long> rhs); |
| 1126 | // RValue<Long> operator=(RValue<ULong> rhs); |
| 1127 | RValue<Long> operator=(const Long &rhs); |
| 1128 | RValue<Long> operator=(const Reference<Long> &rhs); |
| 1129 | // RValue<Long> operator=(const ULong &rhs); |
| 1130 | // RValue<Long> operator=(const Reference<ULong> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1131 | |
| 1132 | static Type *getType(); |
| 1133 | }; |
| 1134 | |
| 1135 | RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs); |
| 1136 | RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs); |
Chris Forbes | aa8f699 | 2019-03-01 14:18:30 -0800 | [diff] [blame] | 1137 | RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1138 | // RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs); |
| 1139 | // RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs); |
| 1140 | // RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs); |
| 1141 | // RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs); |
| 1142 | // RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs); |
| 1143 | // RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs); |
Chris Forbes | aa8f699 | 2019-03-01 14:18:30 -0800 | [diff] [blame] | 1144 | RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1145 | RValue<Long> operator+=(Long &lhs, RValue<Long> rhs); |
| 1146 | RValue<Long> operator-=(Long &lhs, RValue<Long> rhs); |
| 1147 | // RValue<Long> operator*=(Long &lhs, RValue<Long> rhs); |
| 1148 | // RValue<Long> operator/=(Long &lhs, RValue<Long> rhs); |
| 1149 | // RValue<Long> operator%=(Long &lhs, RValue<Long> rhs); |
| 1150 | // RValue<Long> operator&=(Long &lhs, RValue<Long> rhs); |
| 1151 | // RValue<Long> operator|=(Long &lhs, RValue<Long> rhs); |
| 1152 | // RValue<Long> operator^=(Long &lhs, RValue<Long> rhs); |
| 1153 | // RValue<Long> operator<<=(Long &lhs, RValue<Long> rhs); |
| 1154 | // RValue<Long> operator>>=(Long &lhs, RValue<Long> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1155 | // RValue<Long> operator+(RValue<Long> val); |
| 1156 | // RValue<Long> operator-(RValue<Long> val); |
| 1157 | // RValue<Long> operator~(RValue<Long> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1158 | // RValue<Long> operator++(Long &val, int); // Post-increment |
| 1159 | // const Long &operator++(Long &val); // Pre-increment |
| 1160 | // RValue<Long> operator--(Long &val, int); // Post-decrement |
| 1161 | // const Long &operator--(Long &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1162 | // RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs); |
| 1163 | // RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs); |
| 1164 | // RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs); |
| 1165 | // RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs); |
| 1166 | // RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs); |
| 1167 | // RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs); |
| 1168 | |
| 1169 | // RValue<Long> RoundLong(RValue<Float> cast); |
| 1170 | RValue<Long> AddAtomic( RValue<Pointer<Long>> x, RValue<Long> y); |
| 1171 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 1172 | class UInt : public LValue<UInt> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1173 | { |
| 1174 | public: |
| 1175 | UInt(Argument<UInt> argument); |
| 1176 | |
| 1177 | explicit UInt(RValue<UShort> cast); |
| 1178 | explicit UInt(RValue<Long> cast); |
| 1179 | explicit UInt(RValue<Float> cast); |
| 1180 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 1181 | UInt() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1182 | UInt(int x); |
| 1183 | UInt(unsigned int x); |
| 1184 | UInt(RValue<UInt> rhs); |
| 1185 | UInt(RValue<Int> rhs); |
| 1186 | UInt(const UInt &rhs); |
| 1187 | UInt(const Int &rhs); |
| 1188 | UInt(const Reference<UInt> &rhs); |
| 1189 | UInt(const Reference<Int> &rhs); |
| 1190 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1191 | RValue<UInt> operator=(unsigned int rhs); |
| 1192 | RValue<UInt> operator=(RValue<UInt> rhs); |
| 1193 | RValue<UInt> operator=(RValue<Int> rhs); |
| 1194 | RValue<UInt> operator=(const UInt &rhs); |
| 1195 | RValue<UInt> operator=(const Int &rhs); |
| 1196 | RValue<UInt> operator=(const Reference<UInt> &rhs); |
| 1197 | RValue<UInt> operator=(const Reference<Int> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1198 | |
| 1199 | static Type *getType(); |
| 1200 | }; |
| 1201 | |
| 1202 | RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1203 | RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1204 | RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1205 | RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1206 | RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1207 | RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1208 | RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1209 | RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1210 | RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1211 | RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1212 | RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs); |
| 1213 | RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs); |
| 1214 | RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs); |
| 1215 | RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs); |
| 1216 | RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs); |
| 1217 | RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs); |
| 1218 | RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs); |
| 1219 | RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs); |
| 1220 | RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs); |
| 1221 | RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1222 | RValue<UInt> operator+(RValue<UInt> val); |
| 1223 | RValue<UInt> operator-(RValue<UInt> val); |
| 1224 | RValue<UInt> operator~(RValue<UInt> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1225 | RValue<UInt> operator++(UInt &val, int); // Post-increment |
| 1226 | const UInt &operator++(UInt &val); // Pre-increment |
| 1227 | RValue<UInt> operator--(UInt &val, int); // Post-decrement |
| 1228 | const UInt &operator--(UInt &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1229 | RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1230 | RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1231 | RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1232 | RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1233 | RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1234 | RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs); |
| 1235 | |
| 1236 | RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y); |
| 1237 | RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y); |
| 1238 | RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max); |
| 1239 | // RValue<UInt> RoundUInt(RValue<Float> cast); |
| 1240 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 1241 | class Int2 : public LValue<Int2> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1242 | { |
| 1243 | public: |
| 1244 | // explicit Int2(RValue<Int> cast); |
| 1245 | explicit Int2(RValue<Int4> cast); |
| 1246 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 1247 | Int2() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1248 | Int2(int x, int y); |
| 1249 | Int2(RValue<Int2> rhs); |
| 1250 | Int2(const Int2 &rhs); |
| 1251 | Int2(const Reference<Int2> &rhs); |
| 1252 | Int2(RValue<Int> lo, RValue<Int> hi); |
| 1253 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1254 | RValue<Int2> operator=(RValue<Int2> rhs); |
| 1255 | RValue<Int2> operator=(const Int2 &rhs); |
| 1256 | RValue<Int2> operator=(const Reference<Int2> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1257 | |
| 1258 | static Type *getType(); |
| 1259 | }; |
| 1260 | |
| 1261 | RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1262 | RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1263 | // RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1264 | // RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1265 | // RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1266 | RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1267 | RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1268 | RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1269 | RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs); |
| 1270 | RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1271 | RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs); |
| 1272 | RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs); |
| 1273 | // RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs); |
| 1274 | // RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs); |
| 1275 | // RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs); |
| 1276 | RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs); |
| 1277 | RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs); |
| 1278 | RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs); |
| 1279 | RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs); |
| 1280 | RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1281 | // RValue<Int2> operator+(RValue<Int2> val); |
| 1282 | // RValue<Int2> operator-(RValue<Int2> val); |
| 1283 | RValue<Int2> operator~(RValue<Int2> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1284 | // RValue<Int2> operator++(Int2 &val, int); // Post-increment |
| 1285 | // const Int2 &operator++(Int2 &val); // Pre-increment |
| 1286 | // RValue<Int2> operator--(Int2 &val, int); // Post-decrement |
| 1287 | // const Int2 &operator--(Int2 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1288 | // RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1289 | // RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1290 | // RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1291 | // RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1292 | // RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1293 | // RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs); |
| 1294 | |
| 1295 | // RValue<Int2> RoundInt(RValue<Float4> cast); |
Nicolas Capens | 45f187a | 2016-12-02 15:30:56 -0500 | [diff] [blame] | 1296 | RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y); |
| 1297 | RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1298 | RValue<Int> Extract(RValue<Int2> val, int i); |
| 1299 | RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i); |
| 1300 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 1301 | class UInt2 : public LValue<UInt2> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1302 | { |
| 1303 | public: |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 1304 | UInt2() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1305 | UInt2(unsigned int x, unsigned int y); |
| 1306 | UInt2(RValue<UInt2> rhs); |
| 1307 | UInt2(const UInt2 &rhs); |
| 1308 | UInt2(const Reference<UInt2> &rhs); |
| 1309 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1310 | RValue<UInt2> operator=(RValue<UInt2> rhs); |
| 1311 | RValue<UInt2> operator=(const UInt2 &rhs); |
| 1312 | RValue<UInt2> operator=(const Reference<UInt2> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1313 | |
| 1314 | static Type *getType(); |
| 1315 | }; |
| 1316 | |
| 1317 | RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1318 | RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1319 | // RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1320 | // RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1321 | // RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1322 | RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1323 | RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1324 | RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1325 | RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs); |
| 1326 | RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1327 | RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1328 | RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1329 | // RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1330 | // RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1331 | // RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1332 | RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1333 | RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1334 | RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs); |
| 1335 | RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs); |
| 1336 | RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1337 | // RValue<UInt2> operator+(RValue<UInt2> val); |
| 1338 | // RValue<UInt2> operator-(RValue<UInt2> val); |
| 1339 | RValue<UInt2> operator~(RValue<UInt2> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1340 | // RValue<UInt2> operator++(UInt2 &val, int); // Post-increment |
| 1341 | // const UInt2 &operator++(UInt2 &val); // Pre-increment |
| 1342 | // RValue<UInt2> operator--(UInt2 &val, int); // Post-decrement |
| 1343 | // const UInt2 &operator--(UInt2 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1344 | // RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1345 | // RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1346 | // RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1347 | // RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1348 | // RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1349 | // RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs); |
| 1350 | |
| 1351 | // RValue<UInt2> RoundInt(RValue<Float4> cast); |
| 1352 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1353 | template<class T> |
| 1354 | struct Scalar; |
| 1355 | |
| 1356 | template<class Vector4> |
| 1357 | struct XYZW; |
| 1358 | |
| 1359 | template<class Vector4, int T> |
| 1360 | class Swizzle2 |
| 1361 | { |
| 1362 | friend Vector4; |
| 1363 | |
| 1364 | public: |
| 1365 | operator RValue<Vector4>() const; |
| 1366 | |
| 1367 | private: |
| 1368 | Vector4 *parent; |
| 1369 | }; |
| 1370 | |
| 1371 | template<class Vector4, int T> |
| 1372 | class Swizzle4 |
| 1373 | { |
| 1374 | public: |
| 1375 | operator RValue<Vector4>() const; |
| 1376 | |
| 1377 | private: |
| 1378 | Vector4 *parent; |
| 1379 | }; |
| 1380 | |
| 1381 | template<class Vector4, int T> |
| 1382 | class SwizzleMask4 |
| 1383 | { |
| 1384 | friend XYZW<Vector4>; |
| 1385 | |
| 1386 | public: |
| 1387 | operator RValue<Vector4>() const; |
| 1388 | |
| 1389 | RValue<Vector4> operator=(RValue<Vector4> rhs); |
| 1390 | RValue<Vector4> operator=(RValue<typename Scalar<Vector4>::Type> rhs); |
| 1391 | |
| 1392 | private: |
| 1393 | Vector4 *parent; |
| 1394 | }; |
| 1395 | |
| 1396 | template<> |
| 1397 | struct Scalar<Float4> |
| 1398 | { |
| 1399 | using Type = Float; |
| 1400 | }; |
| 1401 | |
| 1402 | template<> |
| 1403 | struct Scalar<Int4> |
| 1404 | { |
| 1405 | using Type = Int; |
| 1406 | }; |
| 1407 | |
| 1408 | template<> |
| 1409 | struct Scalar<UInt4> |
| 1410 | { |
| 1411 | using Type = UInt; |
| 1412 | }; |
| 1413 | |
| 1414 | template<class Vector4, int T> |
| 1415 | class SwizzleMask1 |
| 1416 | { |
| 1417 | public: |
| 1418 | operator RValue<typename Scalar<Vector4>::Type>() const; |
| 1419 | operator RValue<Vector4>() const; |
| 1420 | |
| 1421 | RValue<Vector4> operator=(float x); |
| 1422 | RValue<Vector4> operator=(RValue<Vector4> rhs); |
| 1423 | RValue<Vector4> operator=(RValue<typename Scalar<Vector4>::Type> rhs); |
| 1424 | |
| 1425 | private: |
| 1426 | Float4 *parent; |
| 1427 | }; |
| 1428 | |
| 1429 | template<class Vector4, int T> |
| 1430 | class SwizzleMask2 |
| 1431 | { |
| 1432 | friend class Float4; |
| 1433 | |
| 1434 | public: |
| 1435 | operator RValue<Vector4>() const; |
| 1436 | |
| 1437 | RValue<Vector4> operator=(RValue<Vector4> rhs); |
| 1438 | |
| 1439 | private: |
| 1440 | Float4 *parent; |
| 1441 | }; |
| 1442 | |
| 1443 | template<class Vector4> |
| 1444 | struct XYZW |
| 1445 | { |
| 1446 | friend Vector4; |
| 1447 | |
| 1448 | private: |
| 1449 | XYZW(Vector4 *parent) |
| 1450 | { |
| 1451 | xyzw.parent = parent; |
| 1452 | } |
| 1453 | |
| 1454 | public: |
| 1455 | union |
| 1456 | { |
| 1457 | SwizzleMask1<Vector4, 0x00> x; |
| 1458 | SwizzleMask1<Vector4, 0x55> y; |
| 1459 | SwizzleMask1<Vector4, 0xAA> z; |
| 1460 | SwizzleMask1<Vector4, 0xFF> w; |
| 1461 | Swizzle2<Vector4, 0x00> xx; |
| 1462 | Swizzle2<Vector4, 0x01> yx; |
| 1463 | Swizzle2<Vector4, 0x02> zx; |
| 1464 | Swizzle2<Vector4, 0x03> wx; |
| 1465 | SwizzleMask2<Vector4, 0x54> xy; |
| 1466 | Swizzle2<Vector4, 0x55> yy; |
| 1467 | Swizzle2<Vector4, 0x56> zy; |
| 1468 | Swizzle2<Vector4, 0x57> wy; |
| 1469 | SwizzleMask2<Vector4, 0xA8> xz; |
| 1470 | SwizzleMask2<Vector4, 0xA9> yz; |
| 1471 | Swizzle2<Vector4, 0xAA> zz; |
| 1472 | Swizzle2<Vector4, 0xAB> wz; |
| 1473 | SwizzleMask2<Vector4, 0xFC> xw; |
| 1474 | SwizzleMask2<Vector4, 0xFD> yw; |
| 1475 | SwizzleMask2<Vector4, 0xFE> zw; |
| 1476 | Swizzle2<Vector4, 0xFF> ww; |
| 1477 | Swizzle4<Vector4, 0x00> xxx; |
| 1478 | Swizzle4<Vector4, 0x01> yxx; |
| 1479 | Swizzle4<Vector4, 0x02> zxx; |
| 1480 | Swizzle4<Vector4, 0x03> wxx; |
| 1481 | Swizzle4<Vector4, 0x04> xyx; |
| 1482 | Swizzle4<Vector4, 0x05> yyx; |
| 1483 | Swizzle4<Vector4, 0x06> zyx; |
| 1484 | Swizzle4<Vector4, 0x07> wyx; |
| 1485 | Swizzle4<Vector4, 0x08> xzx; |
| 1486 | Swizzle4<Vector4, 0x09> yzx; |
| 1487 | Swizzle4<Vector4, 0x0A> zzx; |
| 1488 | Swizzle4<Vector4, 0x0B> wzx; |
| 1489 | Swizzle4<Vector4, 0x0C> xwx; |
| 1490 | Swizzle4<Vector4, 0x0D> ywx; |
| 1491 | Swizzle4<Vector4, 0x0E> zwx; |
| 1492 | Swizzle4<Vector4, 0x0F> wwx; |
| 1493 | Swizzle4<Vector4, 0x50> xxy; |
| 1494 | Swizzle4<Vector4, 0x51> yxy; |
| 1495 | Swizzle4<Vector4, 0x52> zxy; |
| 1496 | Swizzle4<Vector4, 0x53> wxy; |
| 1497 | Swizzle4<Vector4, 0x54> xyy; |
| 1498 | Swizzle4<Vector4, 0x55> yyy; |
| 1499 | Swizzle4<Vector4, 0x56> zyy; |
| 1500 | Swizzle4<Vector4, 0x57> wyy; |
| 1501 | Swizzle4<Vector4, 0x58> xzy; |
| 1502 | Swizzle4<Vector4, 0x59> yzy; |
| 1503 | Swizzle4<Vector4, 0x5A> zzy; |
| 1504 | Swizzle4<Vector4, 0x5B> wzy; |
| 1505 | Swizzle4<Vector4, 0x5C> xwy; |
| 1506 | Swizzle4<Vector4, 0x5D> ywy; |
| 1507 | Swizzle4<Vector4, 0x5E> zwy; |
| 1508 | Swizzle4<Vector4, 0x5F> wwy; |
| 1509 | Swizzle4<Vector4, 0xA0> xxz; |
| 1510 | Swizzle4<Vector4, 0xA1> yxz; |
| 1511 | Swizzle4<Vector4, 0xA2> zxz; |
| 1512 | Swizzle4<Vector4, 0xA3> wxz; |
| 1513 | SwizzleMask4<Vector4, 0xA4> xyz; |
| 1514 | Swizzle4<Vector4, 0xA5> yyz; |
| 1515 | Swizzle4<Vector4, 0xA6> zyz; |
| 1516 | Swizzle4<Vector4, 0xA7> wyz; |
| 1517 | Swizzle4<Vector4, 0xA8> xzz; |
| 1518 | Swizzle4<Vector4, 0xA9> yzz; |
| 1519 | Swizzle4<Vector4, 0xAA> zzz; |
| 1520 | Swizzle4<Vector4, 0xAB> wzz; |
| 1521 | Swizzle4<Vector4, 0xAC> xwz; |
| 1522 | Swizzle4<Vector4, 0xAD> ywz; |
| 1523 | Swizzle4<Vector4, 0xAE> zwz; |
| 1524 | Swizzle4<Vector4, 0xAF> wwz; |
| 1525 | Swizzle4<Vector4, 0xF0> xxw; |
| 1526 | Swizzle4<Vector4, 0xF1> yxw; |
| 1527 | Swizzle4<Vector4, 0xF2> zxw; |
| 1528 | Swizzle4<Vector4, 0xF3> wxw; |
| 1529 | SwizzleMask4<Vector4, 0xF4> xyw; |
| 1530 | Swizzle4<Vector4, 0xF5> yyw; |
| 1531 | Swizzle4<Vector4, 0xF6> zyw; |
| 1532 | Swizzle4<Vector4, 0xF7> wyw; |
| 1533 | SwizzleMask4<Vector4, 0xF8> xzw; |
| 1534 | SwizzleMask4<Vector4, 0xF9> yzw; |
| 1535 | Swizzle4<Vector4, 0xFA> zzw; |
| 1536 | Swizzle4<Vector4, 0xFB> wzw; |
| 1537 | Swizzle4<Vector4, 0xFC> xww; |
| 1538 | Swizzle4<Vector4, 0xFD> yww; |
| 1539 | Swizzle4<Vector4, 0xFE> zww; |
| 1540 | Swizzle4<Vector4, 0xFF> www; |
| 1541 | Swizzle4<Vector4, 0x00> xxxx; |
| 1542 | Swizzle4<Vector4, 0x01> yxxx; |
| 1543 | Swizzle4<Vector4, 0x02> zxxx; |
| 1544 | Swizzle4<Vector4, 0x03> wxxx; |
| 1545 | Swizzle4<Vector4, 0x04> xyxx; |
| 1546 | Swizzle4<Vector4, 0x05> yyxx; |
| 1547 | Swizzle4<Vector4, 0x06> zyxx; |
| 1548 | Swizzle4<Vector4, 0x07> wyxx; |
| 1549 | Swizzle4<Vector4, 0x08> xzxx; |
| 1550 | Swizzle4<Vector4, 0x09> yzxx; |
| 1551 | Swizzle4<Vector4, 0x0A> zzxx; |
| 1552 | Swizzle4<Vector4, 0x0B> wzxx; |
| 1553 | Swizzle4<Vector4, 0x0C> xwxx; |
| 1554 | Swizzle4<Vector4, 0x0D> ywxx; |
| 1555 | Swizzle4<Vector4, 0x0E> zwxx; |
| 1556 | Swizzle4<Vector4, 0x0F> wwxx; |
| 1557 | Swizzle4<Vector4, 0x10> xxyx; |
| 1558 | Swizzle4<Vector4, 0x11> yxyx; |
| 1559 | Swizzle4<Vector4, 0x12> zxyx; |
| 1560 | Swizzle4<Vector4, 0x13> wxyx; |
| 1561 | Swizzle4<Vector4, 0x14> xyyx; |
| 1562 | Swizzle4<Vector4, 0x15> yyyx; |
| 1563 | Swizzle4<Vector4, 0x16> zyyx; |
| 1564 | Swizzle4<Vector4, 0x17> wyyx; |
| 1565 | Swizzle4<Vector4, 0x18> xzyx; |
| 1566 | Swizzle4<Vector4, 0x19> yzyx; |
| 1567 | Swizzle4<Vector4, 0x1A> zzyx; |
| 1568 | Swizzle4<Vector4, 0x1B> wzyx; |
| 1569 | Swizzle4<Vector4, 0x1C> xwyx; |
| 1570 | Swizzle4<Vector4, 0x1D> ywyx; |
| 1571 | Swizzle4<Vector4, 0x1E> zwyx; |
| 1572 | Swizzle4<Vector4, 0x1F> wwyx; |
| 1573 | Swizzle4<Vector4, 0x20> xxzx; |
| 1574 | Swizzle4<Vector4, 0x21> yxzx; |
| 1575 | Swizzle4<Vector4, 0x22> zxzx; |
| 1576 | Swizzle4<Vector4, 0x23> wxzx; |
| 1577 | Swizzle4<Vector4, 0x24> xyzx; |
| 1578 | Swizzle4<Vector4, 0x25> yyzx; |
| 1579 | Swizzle4<Vector4, 0x26> zyzx; |
| 1580 | Swizzle4<Vector4, 0x27> wyzx; |
| 1581 | Swizzle4<Vector4, 0x28> xzzx; |
| 1582 | Swizzle4<Vector4, 0x29> yzzx; |
| 1583 | Swizzle4<Vector4, 0x2A> zzzx; |
| 1584 | Swizzle4<Vector4, 0x2B> wzzx; |
| 1585 | Swizzle4<Vector4, 0x2C> xwzx; |
| 1586 | Swizzle4<Vector4, 0x2D> ywzx; |
| 1587 | Swizzle4<Vector4, 0x2E> zwzx; |
| 1588 | Swizzle4<Vector4, 0x2F> wwzx; |
| 1589 | Swizzle4<Vector4, 0x30> xxwx; |
| 1590 | Swizzle4<Vector4, 0x31> yxwx; |
| 1591 | Swizzle4<Vector4, 0x32> zxwx; |
| 1592 | Swizzle4<Vector4, 0x33> wxwx; |
| 1593 | Swizzle4<Vector4, 0x34> xywx; |
| 1594 | Swizzle4<Vector4, 0x35> yywx; |
| 1595 | Swizzle4<Vector4, 0x36> zywx; |
| 1596 | Swizzle4<Vector4, 0x37> wywx; |
| 1597 | Swizzle4<Vector4, 0x38> xzwx; |
| 1598 | Swizzle4<Vector4, 0x39> yzwx; |
| 1599 | Swizzle4<Vector4, 0x3A> zzwx; |
| 1600 | Swizzle4<Vector4, 0x3B> wzwx; |
| 1601 | Swizzle4<Vector4, 0x3C> xwwx; |
| 1602 | Swizzle4<Vector4, 0x3D> ywwx; |
| 1603 | Swizzle4<Vector4, 0x3E> zwwx; |
| 1604 | Swizzle4<Vector4, 0x3F> wwwx; |
| 1605 | Swizzle4<Vector4, 0x40> xxxy; |
| 1606 | Swizzle4<Vector4, 0x41> yxxy; |
| 1607 | Swizzle4<Vector4, 0x42> zxxy; |
| 1608 | Swizzle4<Vector4, 0x43> wxxy; |
| 1609 | Swizzle4<Vector4, 0x44> xyxy; |
| 1610 | Swizzle4<Vector4, 0x45> yyxy; |
| 1611 | Swizzle4<Vector4, 0x46> zyxy; |
| 1612 | Swizzle4<Vector4, 0x47> wyxy; |
| 1613 | Swizzle4<Vector4, 0x48> xzxy; |
| 1614 | Swizzle4<Vector4, 0x49> yzxy; |
| 1615 | Swizzle4<Vector4, 0x4A> zzxy; |
| 1616 | Swizzle4<Vector4, 0x4B> wzxy; |
| 1617 | Swizzle4<Vector4, 0x4C> xwxy; |
| 1618 | Swizzle4<Vector4, 0x4D> ywxy; |
| 1619 | Swizzle4<Vector4, 0x4E> zwxy; |
| 1620 | Swizzle4<Vector4, 0x4F> wwxy; |
| 1621 | Swizzle4<Vector4, 0x50> xxyy; |
| 1622 | Swizzle4<Vector4, 0x51> yxyy; |
| 1623 | Swizzle4<Vector4, 0x52> zxyy; |
| 1624 | Swizzle4<Vector4, 0x53> wxyy; |
| 1625 | Swizzle4<Vector4, 0x54> xyyy; |
| 1626 | Swizzle4<Vector4, 0x55> yyyy; |
| 1627 | Swizzle4<Vector4, 0x56> zyyy; |
| 1628 | Swizzle4<Vector4, 0x57> wyyy; |
| 1629 | Swizzle4<Vector4, 0x58> xzyy; |
| 1630 | Swizzle4<Vector4, 0x59> yzyy; |
| 1631 | Swizzle4<Vector4, 0x5A> zzyy; |
| 1632 | Swizzle4<Vector4, 0x5B> wzyy; |
| 1633 | Swizzle4<Vector4, 0x5C> xwyy; |
| 1634 | Swizzle4<Vector4, 0x5D> ywyy; |
| 1635 | Swizzle4<Vector4, 0x5E> zwyy; |
| 1636 | Swizzle4<Vector4, 0x5F> wwyy; |
| 1637 | Swizzle4<Vector4, 0x60> xxzy; |
| 1638 | Swizzle4<Vector4, 0x61> yxzy; |
| 1639 | Swizzle4<Vector4, 0x62> zxzy; |
| 1640 | Swizzle4<Vector4, 0x63> wxzy; |
| 1641 | Swizzle4<Vector4, 0x64> xyzy; |
| 1642 | Swizzle4<Vector4, 0x65> yyzy; |
| 1643 | Swizzle4<Vector4, 0x66> zyzy; |
| 1644 | Swizzle4<Vector4, 0x67> wyzy; |
| 1645 | Swizzle4<Vector4, 0x68> xzzy; |
| 1646 | Swizzle4<Vector4, 0x69> yzzy; |
| 1647 | Swizzle4<Vector4, 0x6A> zzzy; |
| 1648 | Swizzle4<Vector4, 0x6B> wzzy; |
| 1649 | Swizzle4<Vector4, 0x6C> xwzy; |
| 1650 | Swizzle4<Vector4, 0x6D> ywzy; |
| 1651 | Swizzle4<Vector4, 0x6E> zwzy; |
| 1652 | Swizzle4<Vector4, 0x6F> wwzy; |
| 1653 | Swizzle4<Vector4, 0x70> xxwy; |
| 1654 | Swizzle4<Vector4, 0x71> yxwy; |
| 1655 | Swizzle4<Vector4, 0x72> zxwy; |
| 1656 | Swizzle4<Vector4, 0x73> wxwy; |
| 1657 | Swizzle4<Vector4, 0x74> xywy; |
| 1658 | Swizzle4<Vector4, 0x75> yywy; |
| 1659 | Swizzle4<Vector4, 0x76> zywy; |
| 1660 | Swizzle4<Vector4, 0x77> wywy; |
| 1661 | Swizzle4<Vector4, 0x78> xzwy; |
| 1662 | Swizzle4<Vector4, 0x79> yzwy; |
| 1663 | Swizzle4<Vector4, 0x7A> zzwy; |
| 1664 | Swizzle4<Vector4, 0x7B> wzwy; |
| 1665 | Swizzle4<Vector4, 0x7C> xwwy; |
| 1666 | Swizzle4<Vector4, 0x7D> ywwy; |
| 1667 | Swizzle4<Vector4, 0x7E> zwwy; |
| 1668 | Swizzle4<Vector4, 0x7F> wwwy; |
| 1669 | Swizzle4<Vector4, 0x80> xxxz; |
| 1670 | Swizzle4<Vector4, 0x81> yxxz; |
| 1671 | Swizzle4<Vector4, 0x82> zxxz; |
| 1672 | Swizzle4<Vector4, 0x83> wxxz; |
| 1673 | Swizzle4<Vector4, 0x84> xyxz; |
| 1674 | Swizzle4<Vector4, 0x85> yyxz; |
| 1675 | Swizzle4<Vector4, 0x86> zyxz; |
| 1676 | Swizzle4<Vector4, 0x87> wyxz; |
| 1677 | Swizzle4<Vector4, 0x88> xzxz; |
| 1678 | Swizzle4<Vector4, 0x89> yzxz; |
| 1679 | Swizzle4<Vector4, 0x8A> zzxz; |
| 1680 | Swizzle4<Vector4, 0x8B> wzxz; |
| 1681 | Swizzle4<Vector4, 0x8C> xwxz; |
| 1682 | Swizzle4<Vector4, 0x8D> ywxz; |
| 1683 | Swizzle4<Vector4, 0x8E> zwxz; |
| 1684 | Swizzle4<Vector4, 0x8F> wwxz; |
| 1685 | Swizzle4<Vector4, 0x90> xxyz; |
| 1686 | Swizzle4<Vector4, 0x91> yxyz; |
| 1687 | Swizzle4<Vector4, 0x92> zxyz; |
| 1688 | Swizzle4<Vector4, 0x93> wxyz; |
| 1689 | Swizzle4<Vector4, 0x94> xyyz; |
| 1690 | Swizzle4<Vector4, 0x95> yyyz; |
| 1691 | Swizzle4<Vector4, 0x96> zyyz; |
| 1692 | Swizzle4<Vector4, 0x97> wyyz; |
| 1693 | Swizzle4<Vector4, 0x98> xzyz; |
| 1694 | Swizzle4<Vector4, 0x99> yzyz; |
| 1695 | Swizzle4<Vector4, 0x9A> zzyz; |
| 1696 | Swizzle4<Vector4, 0x9B> wzyz; |
| 1697 | Swizzle4<Vector4, 0x9C> xwyz; |
| 1698 | Swizzle4<Vector4, 0x9D> ywyz; |
| 1699 | Swizzle4<Vector4, 0x9E> zwyz; |
| 1700 | Swizzle4<Vector4, 0x9F> wwyz; |
| 1701 | Swizzle4<Vector4, 0xA0> xxzz; |
| 1702 | Swizzle4<Vector4, 0xA1> yxzz; |
| 1703 | Swizzle4<Vector4, 0xA2> zxzz; |
| 1704 | Swizzle4<Vector4, 0xA3> wxzz; |
| 1705 | Swizzle4<Vector4, 0xA4> xyzz; |
| 1706 | Swizzle4<Vector4, 0xA5> yyzz; |
| 1707 | Swizzle4<Vector4, 0xA6> zyzz; |
| 1708 | Swizzle4<Vector4, 0xA7> wyzz; |
| 1709 | Swizzle4<Vector4, 0xA8> xzzz; |
| 1710 | Swizzle4<Vector4, 0xA9> yzzz; |
| 1711 | Swizzle4<Vector4, 0xAA> zzzz; |
| 1712 | Swizzle4<Vector4, 0xAB> wzzz; |
| 1713 | Swizzle4<Vector4, 0xAC> xwzz; |
| 1714 | Swizzle4<Vector4, 0xAD> ywzz; |
| 1715 | Swizzle4<Vector4, 0xAE> zwzz; |
| 1716 | Swizzle4<Vector4, 0xAF> wwzz; |
| 1717 | Swizzle4<Vector4, 0xB0> xxwz; |
| 1718 | Swizzle4<Vector4, 0xB1> yxwz; |
| 1719 | Swizzle4<Vector4, 0xB2> zxwz; |
| 1720 | Swizzle4<Vector4, 0xB3> wxwz; |
| 1721 | Swizzle4<Vector4, 0xB4> xywz; |
| 1722 | Swizzle4<Vector4, 0xB5> yywz; |
| 1723 | Swizzle4<Vector4, 0xB6> zywz; |
| 1724 | Swizzle4<Vector4, 0xB7> wywz; |
| 1725 | Swizzle4<Vector4, 0xB8> xzwz; |
| 1726 | Swizzle4<Vector4, 0xB9> yzwz; |
| 1727 | Swizzle4<Vector4, 0xBA> zzwz; |
| 1728 | Swizzle4<Vector4, 0xBB> wzwz; |
| 1729 | Swizzle4<Vector4, 0xBC> xwwz; |
| 1730 | Swizzle4<Vector4, 0xBD> ywwz; |
| 1731 | Swizzle4<Vector4, 0xBE> zwwz; |
| 1732 | Swizzle4<Vector4, 0xBF> wwwz; |
| 1733 | Swizzle4<Vector4, 0xC0> xxxw; |
| 1734 | Swizzle4<Vector4, 0xC1> yxxw; |
| 1735 | Swizzle4<Vector4, 0xC2> zxxw; |
| 1736 | Swizzle4<Vector4, 0xC3> wxxw; |
| 1737 | Swizzle4<Vector4, 0xC4> xyxw; |
| 1738 | Swizzle4<Vector4, 0xC5> yyxw; |
| 1739 | Swizzle4<Vector4, 0xC6> zyxw; |
| 1740 | Swizzle4<Vector4, 0xC7> wyxw; |
| 1741 | Swizzle4<Vector4, 0xC8> xzxw; |
| 1742 | Swizzle4<Vector4, 0xC9> yzxw; |
| 1743 | Swizzle4<Vector4, 0xCA> zzxw; |
| 1744 | Swizzle4<Vector4, 0xCB> wzxw; |
| 1745 | Swizzle4<Vector4, 0xCC> xwxw; |
| 1746 | Swizzle4<Vector4, 0xCD> ywxw; |
| 1747 | Swizzle4<Vector4, 0xCE> zwxw; |
| 1748 | Swizzle4<Vector4, 0xCF> wwxw; |
| 1749 | Swizzle4<Vector4, 0xD0> xxyw; |
| 1750 | Swizzle4<Vector4, 0xD1> yxyw; |
| 1751 | Swizzle4<Vector4, 0xD2> zxyw; |
| 1752 | Swizzle4<Vector4, 0xD3> wxyw; |
| 1753 | Swizzle4<Vector4, 0xD4> xyyw; |
| 1754 | Swizzle4<Vector4, 0xD5> yyyw; |
| 1755 | Swizzle4<Vector4, 0xD6> zyyw; |
| 1756 | Swizzle4<Vector4, 0xD7> wyyw; |
| 1757 | Swizzle4<Vector4, 0xD8> xzyw; |
| 1758 | Swizzle4<Vector4, 0xD9> yzyw; |
| 1759 | Swizzle4<Vector4, 0xDA> zzyw; |
| 1760 | Swizzle4<Vector4, 0xDB> wzyw; |
| 1761 | Swizzle4<Vector4, 0xDC> xwyw; |
| 1762 | Swizzle4<Vector4, 0xDD> ywyw; |
| 1763 | Swizzle4<Vector4, 0xDE> zwyw; |
| 1764 | Swizzle4<Vector4, 0xDF> wwyw; |
| 1765 | Swizzle4<Vector4, 0xE0> xxzw; |
| 1766 | Swizzle4<Vector4, 0xE1> yxzw; |
| 1767 | Swizzle4<Vector4, 0xE2> zxzw; |
| 1768 | Swizzle4<Vector4, 0xE3> wxzw; |
| 1769 | SwizzleMask4<Vector4, 0xE4> xyzw; |
| 1770 | Swizzle4<Vector4, 0xE5> yyzw; |
| 1771 | Swizzle4<Vector4, 0xE6> zyzw; |
| 1772 | Swizzle4<Vector4, 0xE7> wyzw; |
| 1773 | Swizzle4<Vector4, 0xE8> xzzw; |
| 1774 | Swizzle4<Vector4, 0xE9> yzzw; |
| 1775 | Swizzle4<Vector4, 0xEA> zzzw; |
| 1776 | Swizzle4<Vector4, 0xEB> wzzw; |
| 1777 | Swizzle4<Vector4, 0xEC> xwzw; |
| 1778 | Swizzle4<Vector4, 0xED> ywzw; |
| 1779 | Swizzle4<Vector4, 0xEE> zwzw; |
| 1780 | Swizzle4<Vector4, 0xEF> wwzw; |
| 1781 | Swizzle4<Vector4, 0xF0> xxww; |
| 1782 | Swizzle4<Vector4, 0xF1> yxww; |
| 1783 | Swizzle4<Vector4, 0xF2> zxww; |
| 1784 | Swizzle4<Vector4, 0xF3> wxww; |
| 1785 | Swizzle4<Vector4, 0xF4> xyww; |
| 1786 | Swizzle4<Vector4, 0xF5> yyww; |
| 1787 | Swizzle4<Vector4, 0xF6> zyww; |
| 1788 | Swizzle4<Vector4, 0xF7> wyww; |
| 1789 | Swizzle4<Vector4, 0xF8> xzww; |
| 1790 | Swizzle4<Vector4, 0xF9> yzww; |
| 1791 | Swizzle4<Vector4, 0xFA> zzww; |
| 1792 | Swizzle4<Vector4, 0xFB> wzww; |
| 1793 | Swizzle4<Vector4, 0xFC> xwww; |
| 1794 | Swizzle4<Vector4, 0xFD> ywww; |
| 1795 | Swizzle4<Vector4, 0xFE> zwww; |
| 1796 | Swizzle4<Vector4, 0xFF> wwww; |
| 1797 | }; |
| 1798 | }; |
| 1799 | |
| 1800 | class Int4 : public LValue<Int4>, public XYZW<Int4> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1801 | { |
| 1802 | public: |
| 1803 | explicit Int4(RValue<Byte4> cast); |
| 1804 | explicit Int4(RValue<SByte4> cast); |
| 1805 | explicit Int4(RValue<Float4> cast); |
| 1806 | explicit Int4(RValue<Short4> cast); |
| 1807 | explicit Int4(RValue<UShort4> cast); |
| 1808 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1809 | Int4(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1810 | Int4(int xyzw); |
| 1811 | Int4(int x, int yzw); |
| 1812 | Int4(int x, int y, int zw); |
| 1813 | Int4(int x, int y, int z, int w); |
| 1814 | Int4(RValue<Int4> rhs); |
| 1815 | Int4(const Int4 &rhs); |
| 1816 | Int4(const Reference<Int4> &rhs); |
| 1817 | Int4(RValue<UInt4> rhs); |
| 1818 | Int4(const UInt4 &rhs); |
| 1819 | Int4(const Reference<UInt4> &rhs); |
| 1820 | Int4(RValue<Int2> lo, RValue<Int2> hi); |
| 1821 | Int4(RValue<Int> rhs); |
| 1822 | Int4(const Int &rhs); |
| 1823 | Int4(const Reference<Int> &rhs); |
| 1824 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1825 | RValue<Int4> operator=(RValue<Int4> rhs); |
| 1826 | RValue<Int4> operator=(const Int4 &rhs); |
| 1827 | RValue<Int4> operator=(const Reference<Int4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1828 | |
| 1829 | static Type *getType(); |
| 1830 | |
| 1831 | private: |
| 1832 | void constant(int x, int y, int z, int w); |
| 1833 | }; |
| 1834 | |
| 1835 | RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1836 | RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1837 | RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1838 | RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1839 | RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1840 | RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1841 | RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1842 | RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1843 | RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs); |
| 1844 | RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs); |
| 1845 | RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1846 | RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1847 | RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs); |
| 1848 | RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs); |
| 1849 | RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs); |
| 1850 | // RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs); |
| 1851 | // RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs); |
| 1852 | RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs); |
| 1853 | RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs); |
| 1854 | RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs); |
| 1855 | RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs); |
| 1856 | RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1857 | RValue<Int4> operator+(RValue<Int4> val); |
| 1858 | RValue<Int4> operator-(RValue<Int4> val); |
| 1859 | RValue<Int4> operator~(RValue<Int4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1860 | // RValue<Int4> operator++(Int4 &val, int); // Post-increment |
| 1861 | // const Int4 &operator++(Int4 &val); // Pre-increment |
| 1862 | // RValue<Int4> operator--(Int4 &val, int); // Post-decrement |
| 1863 | // const Int4 &operator--(Int4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1864 | // RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1865 | // RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1866 | // RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1867 | // RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1868 | // RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1869 | // RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs); |
| 1870 | |
Nicolas Capens | 4b74373 | 2018-05-28 13:22:07 -0400 | [diff] [blame] | 1871 | inline RValue<Int4> operator+(RValue<Int> lhs, RValue<Int4> rhs) |
| 1872 | { |
| 1873 | return Int4(lhs) + rhs; |
| 1874 | } |
| 1875 | |
| 1876 | inline RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int> rhs) |
| 1877 | { |
| 1878 | return lhs + Int4(rhs); |
| 1879 | } |
| 1880 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1881 | RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y); |
| 1882 | RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y); |
| 1883 | RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y); |
| 1884 | RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y); |
| 1885 | RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y); |
| 1886 | RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y); |
Ben Clayton | e95eeb1 | 2019-03-04 16:32:09 +0000 | [diff] [blame] | 1887 | inline RValue<Int4> CmpGT(RValue<Int4> x, RValue<Int4> y) { return CmpNLE(x, y); } |
| 1888 | inline RValue<Int4> CmpGE(RValue<Int4> x, RValue<Int4> y) { return CmpNLT(x, y); } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1889 | RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y); |
| 1890 | RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y); |
| 1891 | RValue<Int4> RoundInt(RValue<Float4> cast); |
Nicolas Capens | 33438a6 | 2017-09-27 11:47:35 -0400 | [diff] [blame] | 1892 | RValue<Short8> PackSigned(RValue<Int4> x, RValue<Int4> y); |
| 1893 | RValue<UShort8> PackUnsigned(RValue<Int4> x, RValue<Int4> y); |
Nicolas Capens | c94ab74 | 2016-11-08 15:15:31 -0500 | [diff] [blame] | 1894 | RValue<Int> Extract(RValue<Int4> val, int i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1895 | RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i); |
| 1896 | RValue<Int> SignMask(RValue<Int4> x); |
| 1897 | RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select); |
Chris Forbes | e86b6dc | 2019-03-01 09:08:47 -0800 | [diff] [blame] | 1898 | RValue<Int4> MulHigh(RValue<Int4> x, RValue<Int4> y); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1899 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1900 | class UInt4 : public LValue<UInt4>, public XYZW<UInt4> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1901 | { |
| 1902 | public: |
| 1903 | explicit UInt4(RValue<Float4> cast); |
| 1904 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 1905 | UInt4(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1906 | UInt4(int xyzw); |
| 1907 | UInt4(int x, int yzw); |
| 1908 | UInt4(int x, int y, int zw); |
| 1909 | UInt4(int x, int y, int z, int w); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1910 | UInt4(RValue<UInt4> rhs); |
| 1911 | UInt4(const UInt4 &rhs); |
| 1912 | UInt4(const Reference<UInt4> &rhs); |
| 1913 | UInt4(RValue<Int4> rhs); |
| 1914 | UInt4(const Int4 &rhs); |
| 1915 | UInt4(const Reference<Int4> &rhs); |
| 1916 | UInt4(RValue<UInt2> lo, RValue<UInt2> hi); |
| 1917 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1918 | RValue<UInt4> operator=(RValue<UInt4> rhs); |
| 1919 | RValue<UInt4> operator=(const UInt4 &rhs); |
| 1920 | RValue<UInt4> operator=(const Reference<UInt4> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1921 | |
| 1922 | static Type *getType(); |
| 1923 | |
| 1924 | private: |
| 1925 | void constant(int x, int y, int z, int w); |
| 1926 | }; |
| 1927 | |
| 1928 | RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1929 | RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1930 | RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1931 | RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1932 | RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1933 | RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1934 | RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1935 | RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1936 | RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs); |
| 1937 | RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs); |
| 1938 | RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1939 | RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1940 | RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1941 | RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1942 | RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1943 | // RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1944 | // RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1945 | RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1946 | RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1947 | RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs); |
| 1948 | RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs); |
| 1949 | RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1950 | RValue<UInt4> operator+(RValue<UInt4> val); |
| 1951 | RValue<UInt4> operator-(RValue<UInt4> val); |
| 1952 | RValue<UInt4> operator~(RValue<UInt4> val); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 1953 | // RValue<UInt4> operator++(UInt4 &val, int); // Post-increment |
| 1954 | // const UInt4 &operator++(UInt4 &val); // Pre-increment |
| 1955 | // RValue<UInt4> operator--(UInt4 &val, int); // Post-decrement |
| 1956 | // const UInt4 &operator--(UInt4 &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1957 | // RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1958 | // RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1959 | // RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1960 | // RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1961 | // RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1962 | // RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs); |
| 1963 | |
| 1964 | RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y); |
| 1965 | RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y); |
| 1966 | RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y); |
| 1967 | RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y); |
| 1968 | RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y); |
| 1969 | RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y); |
Ben Clayton | e95eeb1 | 2019-03-04 16:32:09 +0000 | [diff] [blame] | 1970 | inline RValue<UInt4> CmpGT(RValue<UInt4> x, RValue<UInt4> y) { return CmpNLE(x, y); } |
| 1971 | inline RValue<UInt4> CmpGE(RValue<UInt4> x, RValue<UInt4> y) { return CmpNLT(x, y); } |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1972 | RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y); |
| 1973 | RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y); |
Chris Forbes | e86b6dc | 2019-03-01 09:08:47 -0800 | [diff] [blame] | 1974 | RValue<UInt4> MulHigh(RValue<UInt4> x, RValue<UInt4> y); |
Ben Clayton | fc77af1 | 2019-04-09 10:48:00 -0400 | [diff] [blame] | 1975 | RValue<UInt> Extract(RValue<UInt4> val, int i); |
| 1976 | RValue<UInt4> Insert(RValue<UInt4> val, RValue<UInt> element, int i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1977 | // RValue<UInt4> RoundInt(RValue<Float4> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1978 | |
Alexis Hetu | 734e257 | 2018-12-20 14:00:49 -0500 | [diff] [blame] | 1979 | class Half : public LValue<Half> |
| 1980 | { |
| 1981 | public: |
| 1982 | explicit Half(RValue<Float> cast); |
| 1983 | |
| 1984 | static Type *getType(); |
| 1985 | }; |
| 1986 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 1987 | class Float : public LValue<Float> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1988 | { |
| 1989 | public: |
| 1990 | explicit Float(RValue<Int> cast); |
Alexis Hetu | cfd9632 | 2017-07-24 14:44:33 -0400 | [diff] [blame] | 1991 | explicit Float(RValue<UInt> cast); |
Alexis Hetu | 734e257 | 2018-12-20 14:00:49 -0500 | [diff] [blame] | 1992 | explicit Float(RValue<Half> cast); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1993 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 1994 | Float() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 1995 | Float(float x); |
| 1996 | Float(RValue<Float> rhs); |
| 1997 | Float(const Float &rhs); |
| 1998 | Float(const Reference<Float> &rhs); |
Ben Clayton | f3b5797 | 2019-03-15 09:56:47 +0000 | [diff] [blame] | 1999 | Float(Argument<Float> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2000 | |
| 2001 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2002 | Float(const SwizzleMask1<Float4, T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2003 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2004 | // RValue<Float> operator=(float rhs); // FIXME: Implement |
| 2005 | RValue<Float> operator=(RValue<Float> rhs); |
| 2006 | RValue<Float> operator=(const Float &rhs); |
| 2007 | RValue<Float> operator=(const Reference<Float> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2008 | |
| 2009 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2010 | RValue<Float> operator=(const SwizzleMask1<Float4, T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2011 | |
| 2012 | static Type *getType(); |
| 2013 | }; |
| 2014 | |
| 2015 | RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs); |
| 2016 | RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs); |
| 2017 | RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs); |
| 2018 | RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2019 | RValue<Float> operator+=(Float &lhs, RValue<Float> rhs); |
| 2020 | RValue<Float> operator-=(Float &lhs, RValue<Float> rhs); |
| 2021 | RValue<Float> operator*=(Float &lhs, RValue<Float> rhs); |
| 2022 | RValue<Float> operator/=(Float &lhs, RValue<Float> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2023 | RValue<Float> operator+(RValue<Float> val); |
| 2024 | RValue<Float> operator-(RValue<Float> val); |
| 2025 | RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs); |
| 2026 | RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs); |
| 2027 | RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs); |
| 2028 | RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs); |
| 2029 | RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs); |
| 2030 | RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs); |
| 2031 | |
| 2032 | RValue<Float> Abs(RValue<Float> x); |
| 2033 | RValue<Float> Max(RValue<Float> x, RValue<Float> y); |
| 2034 | RValue<Float> Min(RValue<Float> x, RValue<Float> y); |
| 2035 | RValue<Float> Rcp_pp(RValue<Float> val, bool exactAtPow2 = false); |
| 2036 | RValue<Float> RcpSqrt_pp(RValue<Float> val); |
| 2037 | RValue<Float> Sqrt(RValue<Float> x); |
| 2038 | RValue<Float> Round(RValue<Float> val); |
| 2039 | RValue<Float> Trunc(RValue<Float> val); |
| 2040 | RValue<Float> Frac(RValue<Float> val); |
| 2041 | RValue<Float> Floor(RValue<Float> val); |
| 2042 | RValue<Float> Ceil(RValue<Float> val); |
| 2043 | |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 2044 | class Float2 : public LValue<Float2> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2045 | { |
| 2046 | public: |
| 2047 | // explicit Float2(RValue<Byte2> cast); |
| 2048 | // explicit Float2(RValue<Short2> cast); |
| 2049 | // explicit Float2(RValue<UShort2> cast); |
| 2050 | // explicit Float2(RValue<Int2> cast); |
| 2051 | // explicit Float2(RValue<UInt2> cast); |
| 2052 | explicit Float2(RValue<Float4> cast); |
| 2053 | |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2054 | Float2() = default; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2055 | // Float2(float x, float y); |
| 2056 | // Float2(RValue<Float2> rhs); |
| 2057 | // Float2(const Float2 &rhs); |
| 2058 | // Float2(const Reference<Float2> &rhs); |
| 2059 | // Float2(RValue<Float> rhs); |
| 2060 | // Float2(const Float &rhs); |
| 2061 | // Float2(const Reference<Float> &rhs); |
| 2062 | |
| 2063 | // template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2064 | // Float2(const SwizzleMask1<T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2065 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2066 | // RValue<Float2> operator=(float replicate); |
| 2067 | // RValue<Float2> operator=(RValue<Float2> rhs); |
| 2068 | // RValue<Float2> operator=(const Float2 &rhs); |
| 2069 | // RValue<Float2> operator=(const Reference<Float2> &rhs); |
| 2070 | // RValue<Float2> operator=(RValue<Float> rhs); |
| 2071 | // RValue<Float2> operator=(const Float &rhs); |
| 2072 | // RValue<Float2> operator=(const Reference<Float> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2073 | |
| 2074 | // template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2075 | // RValue<Float2> operator=(const SwizzleMask1<T> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2076 | |
| 2077 | static Type *getType(); |
| 2078 | }; |
| 2079 | |
| 2080 | // RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2081 | // RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2082 | // RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2083 | // RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs); |
| 2084 | // RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2085 | // RValue<Float2> operator+=(Float2 &lhs, RValue<Float2> rhs); |
| 2086 | // RValue<Float2> operator-=(Float2 &lhs, RValue<Float2> rhs); |
| 2087 | // RValue<Float2> operator*=(Float2 &lhs, RValue<Float2> rhs); |
| 2088 | // RValue<Float2> operator/=(Float2 &lhs, RValue<Float2> rhs); |
| 2089 | // RValue<Float2> operator%=(Float2 &lhs, RValue<Float2> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2090 | // RValue<Float2> operator+(RValue<Float2> val); |
| 2091 | // RValue<Float2> operator-(RValue<Float2> val); |
| 2092 | |
| 2093 | // RValue<Float2> Abs(RValue<Float2> x); |
| 2094 | // RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y); |
| 2095 | // RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y); |
| 2096 | // RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select); |
| 2097 | // RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select); |
| 2098 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2099 | class Float4 : public LValue<Float4>, public XYZW<Float4> |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2100 | { |
| 2101 | public: |
| 2102 | explicit Float4(RValue<Byte4> cast); |
| 2103 | explicit Float4(RValue<SByte4> cast); |
| 2104 | explicit Float4(RValue<Short4> cast); |
| 2105 | explicit Float4(RValue<UShort4> cast); |
| 2106 | explicit Float4(RValue<Int4> cast); |
| 2107 | explicit Float4(RValue<UInt4> cast); |
| 2108 | |
| 2109 | Float4(); |
| 2110 | Float4(float xyzw); |
| 2111 | Float4(float x, float yzw); |
| 2112 | Float4(float x, float y, float zw); |
| 2113 | Float4(float x, float y, float z, float w); |
| 2114 | Float4(RValue<Float4> rhs); |
| 2115 | Float4(const Float4 &rhs); |
| 2116 | Float4(const Reference<Float4> &rhs); |
| 2117 | Float4(RValue<Float> rhs); |
| 2118 | Float4(const Float &rhs); |
| 2119 | Float4(const Reference<Float> &rhs); |
| 2120 | |
| 2121 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2122 | Float4(const SwizzleMask1<Float4, T> &rhs); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2123 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2124 | Float4(const Swizzle4<Float4, T> &rhs); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2125 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2126 | Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2127 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2128 | Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2129 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2130 | Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2131 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2132 | Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2133 | |
| 2134 | RValue<Float4> operator=(float replicate); |
| 2135 | RValue<Float4> operator=(RValue<Float4> rhs); |
| 2136 | RValue<Float4> operator=(const Float4 &rhs); |
| 2137 | RValue<Float4> operator=(const Reference<Float4> &rhs); |
| 2138 | RValue<Float4> operator=(RValue<Float> rhs); |
| 2139 | RValue<Float4> operator=(const Float &rhs); |
| 2140 | RValue<Float4> operator=(const Reference<Float> &rhs); |
| 2141 | |
| 2142 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2143 | RValue<Float4> operator=(const SwizzleMask1<Float4, T> &rhs); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2144 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2145 | RValue<Float4> operator=(const Swizzle4<Float4, T> &rhs); |
Nicolas Capens | a25311a | 2017-01-16 17:19:00 -0500 | [diff] [blame] | 2146 | |
| 2147 | static Type *getType(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2148 | |
| 2149 | private: |
| 2150 | void constant(float x, float y, float z, float w); |
| 2151 | }; |
| 2152 | |
| 2153 | RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2154 | RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2155 | RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2156 | RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs); |
| 2157 | RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2158 | RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs); |
| 2159 | RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs); |
| 2160 | RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs); |
| 2161 | RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs); |
| 2162 | RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2163 | RValue<Float4> operator+(RValue<Float4> val); |
| 2164 | RValue<Float4> operator-(RValue<Float4> val); |
| 2165 | |
| 2166 | RValue<Float4> Abs(RValue<Float4> x); |
| 2167 | RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y); |
| 2168 | RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y); |
| 2169 | RValue<Float4> Rcp_pp(RValue<Float4> val, bool exactAtPow2 = false); |
| 2170 | RValue<Float4> RcpSqrt_pp(RValue<Float4> val); |
| 2171 | RValue<Float4> Sqrt(RValue<Float4> x); |
Nicolas Capens | c94ab74 | 2016-11-08 15:15:31 -0500 | [diff] [blame] | 2172 | RValue<Float4> Insert(RValue<Float4> val, RValue<Float> element, int i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2173 | RValue<Float> Extract(RValue<Float4> x, int i); |
| 2174 | RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select); |
| 2175 | RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm); |
| 2176 | RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y); |
| 2177 | RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y); |
| 2178 | RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select); |
| 2179 | RValue<Int> SignMask(RValue<Float4> x); |
Ben Clayton | ec1aeb8 | 2019-03-04 19:33:27 +0000 | [diff] [blame] | 2180 | |
| 2181 | // Ordered comparison functions |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2182 | RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y); |
| 2183 | RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y); |
| 2184 | RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y); |
| 2185 | RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y); |
| 2186 | RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y); |
| 2187 | RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y); |
Ben Clayton | ec1aeb8 | 2019-03-04 19:33:27 +0000 | [diff] [blame] | 2188 | inline RValue<Int4> CmpGT(RValue<Float4> x, RValue<Float4> y) { return CmpNLE(x, y); } |
| 2189 | inline RValue<Int4> CmpGE(RValue<Float4> x, RValue<Float4> y) { return CmpNLT(x, y); } |
| 2190 | |
| 2191 | // Unordered comparison functions |
| 2192 | RValue<Int4> CmpUEQ(RValue<Float4> x, RValue<Float4> y); |
| 2193 | RValue<Int4> CmpULT(RValue<Float4> x, RValue<Float4> y); |
| 2194 | RValue<Int4> CmpULE(RValue<Float4> x, RValue<Float4> y); |
| 2195 | RValue<Int4> CmpUNEQ(RValue<Float4> x, RValue<Float4> y); |
| 2196 | RValue<Int4> CmpUNLT(RValue<Float4> x, RValue<Float4> y); |
| 2197 | RValue<Int4> CmpUNLE(RValue<Float4> x, RValue<Float4> y); |
| 2198 | inline RValue<Int4> CmpUGT(RValue<Float4> x, RValue<Float4> y) { return CmpUNLE(x, y); } |
| 2199 | inline RValue<Int4> CmpUGE(RValue<Float4> x, RValue<Float4> y) { return CmpUNLT(x, y); } |
| 2200 | |
Alexis Hetu | 8ef6d10 | 2017-11-09 15:49:09 -0500 | [diff] [blame] | 2201 | RValue<Int4> IsInf(RValue<Float4> x); |
| 2202 | RValue<Int4> IsNan(RValue<Float4> x); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2203 | RValue<Float4> Round(RValue<Float4> x); |
| 2204 | RValue<Float4> Trunc(RValue<Float4> x); |
| 2205 | RValue<Float4> Frac(RValue<Float4> x); |
| 2206 | RValue<Float4> Floor(RValue<Float4> x); |
| 2207 | RValue<Float4> Ceil(RValue<Float4> x); |
| 2208 | |
Ben Clayton | a2c8b77 | 2019-04-09 13:42:36 -0400 | [diff] [blame] | 2209 | // Trigonometric functions |
| 2210 | // TODO: Currentlhy unimplemented for Subzero. |
| 2211 | RValue<Float4> Sin(RValue<Float4> x); |
Ben Clayton | 1b6f8c7 | 2019-04-09 13:47:43 -0400 | [diff] [blame] | 2212 | RValue<Float4> Cos(RValue<Float4> x); |
Ben Clayton | 1474006 | 2019-04-09 13:48:41 -0400 | [diff] [blame] | 2213 | RValue<Float4> Tan(RValue<Float4> x); |
Ben Clayton | f9350d7 | 2019-04-09 14:19:02 -0400 | [diff] [blame] | 2214 | RValue<Float4> Asin(RValue<Float4> x); |
Ben Clayton | eafae47 | 2019-04-09 14:22:38 -0400 | [diff] [blame] | 2215 | RValue<Float4> Acos(RValue<Float4> x); |
Ben Clayton | 749b4e0 | 2019-04-09 14:27:43 -0400 | [diff] [blame] | 2216 | RValue<Float4> Atan(RValue<Float4> x); |
Ben Clayton | d963697 | 2019-04-09 15:09:54 -0400 | [diff] [blame] | 2217 | RValue<Float4> Sinh(RValue<Float4> x); |
Ben Clayton | 900ea2c | 2019-04-09 15:25:36 -0400 | [diff] [blame] | 2218 | RValue<Float4> Cosh(RValue<Float4> x); |
Ben Clayton | 3928bd9 | 2019-04-09 15:27:41 -0400 | [diff] [blame] | 2219 | RValue<Float4> Tanh(RValue<Float4> x); |
Ben Clayton | f6d77ab | 2019-04-09 15:30:04 -0400 | [diff] [blame] | 2220 | RValue<Float4> Asinh(RValue<Float4> x); |
Ben Clayton | 28ebcb0 | 2019-04-09 15:33:38 -0400 | [diff] [blame] | 2221 | RValue<Float4> Acosh(RValue<Float4> x); |
Ben Clayton | fa6a539 | 2019-04-09 15:35:24 -0400 | [diff] [blame] | 2222 | RValue<Float4> Atanh(RValue<Float4> x); |
Ben Clayton | a520c3e | 2019-04-09 15:43:45 -0400 | [diff] [blame] | 2223 | RValue<Float4> Atan2(RValue<Float4> x, RValue<Float4> y); |
Ben Clayton | a2c8b77 | 2019-04-09 13:42:36 -0400 | [diff] [blame] | 2224 | |
Ben Clayton | bfe94f0 | 2019-04-09 15:52:12 -0400 | [diff] [blame] | 2225 | // Exponential functions |
| 2226 | // TODO: Currentlhy unimplemented for Subzero. |
| 2227 | RValue<Float4> Pow(RValue<Float4> x, RValue<Float4> y); |
Ben Clayton | 242f002 | 2019-04-09 16:00:53 -0400 | [diff] [blame] | 2228 | RValue<Float4> Exp(RValue<Float4> x); |
Ben Clayton | 2c1da72 | 2019-04-09 16:03:03 -0400 | [diff] [blame^] | 2229 | RValue<Float4> Log(RValue<Float4> x); |
Ben Clayton | bfe94f0 | 2019-04-09 15:52:12 -0400 | [diff] [blame] | 2230 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2231 | template<class T> |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 2232 | class Pointer : public LValue<Pointer<T>> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2233 | { |
| 2234 | public: |
| 2235 | template<class S> |
| 2236 | Pointer(RValue<Pointer<S>> pointerS, int alignment = 1) : alignment(alignment) |
| 2237 | { |
| 2238 | Value *pointerT = Nucleus::createBitCast(pointerS.value, Nucleus::getPointerType(T::getType())); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2239 | LValue<Pointer<T>>::storeValue(pointerT); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2240 | } |
| 2241 | |
| 2242 | template<class S> |
| 2243 | Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment) |
| 2244 | { |
Nicolas Capens | 4126b8e | 2017-07-26 13:34:36 -0400 | [diff] [blame] | 2245 | Value *pointerS = pointer.loadValue(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2246 | Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType())); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2247 | LValue<Pointer<T>>::storeValue(pointerT); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2248 | } |
| 2249 | |
| 2250 | Pointer(Argument<Pointer<T>> argument); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2251 | |
| 2252 | Pointer(); |
| 2253 | Pointer(RValue<Pointer<T>> rhs); |
| 2254 | Pointer(const Pointer<T> &rhs); |
| 2255 | Pointer(const Reference<Pointer<T>> &rhs); |
| 2256 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2257 | RValue<Pointer<T>> operator=(RValue<Pointer<T>> rhs); |
| 2258 | RValue<Pointer<T>> operator=(const Pointer<T> &rhs); |
| 2259 | RValue<Pointer<T>> operator=(const Reference<Pointer<T>> &rhs); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2260 | |
| 2261 | Reference<T> operator*(); |
| 2262 | Reference<T> operator[](int index); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2263 | Reference<T> operator[](unsigned int index); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2264 | Reference<T> operator[](RValue<Int> index); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2265 | Reference<T> operator[](RValue<UInt> index); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2266 | |
| 2267 | static Type *getType(); |
| 2268 | |
| 2269 | private: |
| 2270 | const int alignment; |
| 2271 | }; |
| 2272 | |
| 2273 | RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset); |
| 2274 | RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset); |
| 2275 | RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2276 | RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset); |
| 2277 | RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset); |
| 2278 | RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2279 | |
| 2280 | RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset); |
| 2281 | RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset); |
| 2282 | RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset); |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2283 | RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset); |
| 2284 | RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset); |
| 2285 | RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2286 | |
Nicolas Capens | 86509d9 | 2019-03-21 13:23:50 -0400 | [diff] [blame] | 2287 | template<typename T> |
| 2288 | RValue<T> Load(RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2289 | { |
| 2290 | return RValue<T>(Nucleus::createLoad(pointer.value, T::getType(), false, alignment, atomic, memoryOrder)); |
| 2291 | } |
| 2292 | |
| 2293 | template<typename T> |
| 2294 | void Store(RValue<T> value, RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder) |
| 2295 | { |
| 2296 | Nucleus::createStore(value.value, pointer.value, T::getType(), false, alignment, atomic, memoryOrder); |
| 2297 | } |
| 2298 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2299 | template<class T, int S = 1> |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 2300 | class Array : public LValue<T> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2301 | { |
| 2302 | public: |
| 2303 | Array(int size = S); |
| 2304 | |
| 2305 | Reference<T> operator[](int index); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2306 | Reference<T> operator[](unsigned int index); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2307 | Reference<T> operator[](RValue<Int> index); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2308 | Reference<T> operator[](RValue<UInt> index); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2309 | }; |
| 2310 | |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2311 | // RValue<Array<T>> operator++(Array<T> &val, int); // Post-increment |
| 2312 | // const Array<T> &operator++(Array<T> &val); // Pre-increment |
| 2313 | // RValue<Array<T>> operator--(Array<T> &val, int); // Post-decrement |
| 2314 | // const Array<T> &operator--(Array<T> &val); // Pre-decrement |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2315 | |
Nicolas Capens | f4eec2f | 2017-05-24 15:46:48 -0400 | [diff] [blame] | 2316 | void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2317 | |
| 2318 | void Return(); |
Nicolas Capens | eb253d0 | 2016-11-18 14:40:40 -0500 | [diff] [blame] | 2319 | void Return(RValue<Int> ret); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2320 | |
| 2321 | template<class T> |
| 2322 | void Return(const Pointer<T> &ret); |
| 2323 | |
| 2324 | template<class T> |
| 2325 | void Return(RValue<Pointer<T>> ret); |
| 2326 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2327 | // Generic template, leave undefined! |
| 2328 | template<typename FunctionType> |
| 2329 | class Function; |
| 2330 | |
| 2331 | // Specialized for function types |
| 2332 | template<typename Return, typename... Arguments> |
| 2333 | class Function<Return(Arguments...)> |
| 2334 | { |
| 2335 | public: |
| 2336 | Function(); |
| 2337 | |
| 2338 | virtual ~Function(); |
| 2339 | |
| 2340 | template<int index> |
Ben Clayton | 169872e | 2019-02-27 23:58:35 +0000 | [diff] [blame] | 2341 | Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type> Arg() const |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2342 | { |
| 2343 | Value *arg = Nucleus::getArgument(index); |
Ben Clayton | 169872e | 2019-02-27 23:58:35 +0000 | [diff] [blame] | 2344 | return Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type>(arg); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2345 | } |
| 2346 | |
Chris Forbes | 878d4b0 | 2019-01-21 10:48:35 -0800 | [diff] [blame] | 2347 | Routine *operator()(const char *name, ...); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2348 | |
| 2349 | protected: |
| 2350 | Nucleus *core; |
| 2351 | std::vector<Type*> arguments; |
| 2352 | }; |
| 2353 | |
| 2354 | template<typename Return> |
| 2355 | class Function<Return()> : public Function<Return(Void)> |
| 2356 | { |
| 2357 | }; |
| 2358 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2359 | RValue<Long> Ticks(); |
| 2360 | } |
| 2361 | |
Nicolas Capens | 4846150 | 2018-08-06 14:20:45 -0400 | [diff] [blame] | 2362 | namespace rr |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2363 | { |
| 2364 | template<class T> |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2365 | LValue<T>::LValue(int arraySize) : Variable(T::getType(), arraySize) |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2366 | { |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2367 | } |
| 2368 | |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2369 | inline void Variable::materialize() const |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2370 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2371 | if(!address) |
| 2372 | { |
| 2373 | address = Nucleus::allocateStackVariable(type, arraySize); |
| 2374 | |
| 2375 | if(rvalue) |
| 2376 | { |
| 2377 | storeValue(rvalue); |
| 2378 | rvalue = nullptr; |
| 2379 | } |
| 2380 | } |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2381 | } |
| 2382 | |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2383 | inline Value *Variable::loadValue() const |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2384 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2385 | if(rvalue) |
| 2386 | { |
| 2387 | return rvalue; |
| 2388 | } |
| 2389 | |
| 2390 | if(!address) |
| 2391 | { |
| 2392 | // TODO: Return undef instead. |
| 2393 | materialize(); |
| 2394 | } |
| 2395 | |
| 2396 | return Nucleus::createLoad(address, type, false, 0); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2397 | } |
| 2398 | |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2399 | inline Value *Variable::storeValue(Value *value) const |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2400 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2401 | if(address) |
| 2402 | { |
| 2403 | return Nucleus::createStore(value, address, type, false, 0); |
| 2404 | } |
| 2405 | |
| 2406 | rvalue = value; |
| 2407 | |
| 2408 | return value; |
| 2409 | } |
| 2410 | |
| 2411 | inline Value *Variable::getBaseAddress() const |
| 2412 | { |
| 2413 | materialize(); |
| 2414 | |
| 2415 | return address; |
| 2416 | } |
| 2417 | |
| 2418 | inline Value *Variable::getElementPointer(Value *index, bool unsignedIndex) const |
| 2419 | { |
| 2420 | return Nucleus::createGEP(getBaseAddress(), type, index, unsignedIndex); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2421 | } |
| 2422 | |
| 2423 | template<class T> |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 2424 | RValue<Pointer<T>> LValue<T>::operator&() |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2425 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2426 | return RValue<Pointer<T>>(getBaseAddress()); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2427 | } |
| 2428 | |
| 2429 | template<class T> |
| 2430 | Reference<T>::Reference(Value *pointer, int alignment) : alignment(alignment) |
| 2431 | { |
| 2432 | address = pointer; |
| 2433 | } |
| 2434 | |
| 2435 | template<class T> |
| 2436 | RValue<T> Reference<T>::operator=(RValue<T> rhs) const |
| 2437 | { |
Nicolas Capens | 6d73871 | 2016-09-30 04:15:22 -0400 | [diff] [blame] | 2438 | Nucleus::createStore(rhs.value, address, T::getType(), false, alignment); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2439 | |
| 2440 | return rhs; |
| 2441 | } |
| 2442 | |
| 2443 | template<class T> |
| 2444 | RValue<T> Reference<T>::operator=(const Reference<T> &ref) const |
| 2445 | { |
Nicolas Capens | e12780d | 2016-09-27 14:18:07 -0400 | [diff] [blame] | 2446 | Value *tmp = Nucleus::createLoad(ref.address, T::getType(), false, ref.alignment); |
Nicolas Capens | 6d73871 | 2016-09-30 04:15:22 -0400 | [diff] [blame] | 2447 | Nucleus::createStore(tmp, address, T::getType(), false, alignment); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2448 | |
| 2449 | return RValue<T>(tmp); |
| 2450 | } |
| 2451 | |
| 2452 | template<class T> |
| 2453 | RValue<T> Reference<T>::operator+=(RValue<T> rhs) const |
| 2454 | { |
| 2455 | return *this = *this + rhs; |
| 2456 | } |
| 2457 | |
| 2458 | template<class T> |
| 2459 | Value *Reference<T>::loadValue() const |
| 2460 | { |
Nicolas Capens | e12780d | 2016-09-27 14:18:07 -0400 | [diff] [blame] | 2461 | return Nucleus::createLoad(address, T::getType(), false, alignment); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2462 | } |
| 2463 | |
| 2464 | template<class T> |
| 2465 | int Reference<T>::getAlignment() const |
| 2466 | { |
| 2467 | return alignment; |
| 2468 | } |
| 2469 | |
| 2470 | template<class T> |
| 2471 | RValue<T>::RValue(Value *rvalue) |
| 2472 | { |
Nicolas Capens | bea4dce | 2017-07-24 16:54:44 -0400 | [diff] [blame] | 2473 | assert(Nucleus::createBitCast(rvalue, T::getType()) == rvalue); // Run-time type should match T, so bitcast is no-op. |
| 2474 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2475 | value = rvalue; |
| 2476 | } |
| 2477 | |
| 2478 | template<class T> |
| 2479 | RValue<T>::RValue(const T &lvalue) |
| 2480 | { |
| 2481 | value = lvalue.loadValue(); |
| 2482 | } |
| 2483 | |
| 2484 | template<class T> |
Ben Clayton | 35e90e2 | 2019-03-15 10:06:06 +0000 | [diff] [blame] | 2485 | RValue<T>::RValue(typename BoolLiteral<T>::type i) |
| 2486 | { |
| 2487 | value = Nucleus::createConstantBool(i); |
| 2488 | } |
| 2489 | |
| 2490 | template<class T> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2491 | RValue<T>::RValue(typename IntLiteral<T>::type i) |
| 2492 | { |
Nicolas Capens | a16473e | 2016-11-07 15:32:52 -0500 | [diff] [blame] | 2493 | value = Nucleus::createConstantInt(i); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2494 | } |
| 2495 | |
| 2496 | template<class T> |
| 2497 | RValue<T>::RValue(typename FloatLiteral<T>::type f) |
| 2498 | { |
Nicolas Capens | a16473e | 2016-11-07 15:32:52 -0500 | [diff] [blame] | 2499 | value = Nucleus::createConstantFloat(f); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2500 | } |
| 2501 | |
| 2502 | template<class T> |
| 2503 | RValue<T>::RValue(const Reference<T> &ref) |
| 2504 | { |
| 2505 | value = ref.loadValue(); |
| 2506 | } |
| 2507 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2508 | template<class Vector4, int T> |
| 2509 | Swizzle2<Vector4, T>::operator RValue<Vector4>() const |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2510 | { |
| 2511 | Value *vector = parent->loadValue(); |
| 2512 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2513 | return Swizzle(RValue<Vector4>(vector), T); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2514 | } |
| 2515 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2516 | template<class Vector4, int T> |
| 2517 | Swizzle4<Vector4, T>::operator RValue<Vector4>() const |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2518 | { |
| 2519 | Value *vector = parent->loadValue(); |
| 2520 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2521 | return Swizzle(RValue<Vector4>(vector), T); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2522 | } |
| 2523 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2524 | template<class Vector4, int T> |
| 2525 | SwizzleMask4<Vector4, T>::operator RValue<Vector4>() const |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2526 | { |
| 2527 | Value *vector = parent->loadValue(); |
| 2528 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2529 | return Swizzle(RValue<Vector4>(vector), T); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2530 | } |
| 2531 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2532 | template<class Vector4, int T> |
| 2533 | RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<Vector4> rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2534 | { |
| 2535 | return Mask(*parent, rhs, T); |
| 2536 | } |
| 2537 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2538 | template<class Vector4, int T> |
| 2539 | RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2540 | { |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2541 | return Mask(*parent, Vector4(rhs), T); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2542 | } |
| 2543 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2544 | template<class Vector4, int T> |
| 2545 | SwizzleMask1<Vector4, T>::operator RValue<typename Scalar<Vector4>::Type>() const // FIXME: Call a non-template function |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2546 | { |
| 2547 | return Extract(*parent, T & 0x3); |
| 2548 | } |
| 2549 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2550 | template<class Vector4, int T> |
| 2551 | SwizzleMask1<Vector4, T>::operator RValue<Vector4>() const |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2552 | { |
| 2553 | Value *vector = parent->loadValue(); |
| 2554 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2555 | return Swizzle(RValue<Vector4>(vector), T); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2556 | } |
| 2557 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2558 | template<class Vector4, int T> |
| 2559 | RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(float x) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2560 | { |
Nicolas Capens | c94ab74 | 2016-11-08 15:15:31 -0500 | [diff] [blame] | 2561 | return *parent = Insert(*parent, Float(x), T & 0x3); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2562 | } |
| 2563 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2564 | template<class Vector4, int T> |
| 2565 | RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<Vector4> rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2566 | { |
| 2567 | return Mask(*parent, Float4(rhs), T); |
| 2568 | } |
| 2569 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2570 | template<class Vector4, int T> |
| 2571 | RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs) // FIXME: Call a non-template function |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2572 | { |
Nicolas Capens | c94ab74 | 2016-11-08 15:15:31 -0500 | [diff] [blame] | 2573 | return *parent = Insert(*parent, rhs, T & 0x3); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2574 | } |
| 2575 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2576 | template<class Vector4, int T> |
| 2577 | SwizzleMask2<Vector4, T>::operator RValue<Vector4>() const |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2578 | { |
| 2579 | Value *vector = parent->loadValue(); |
| 2580 | |
Nicolas Capens | e95d534 | 2016-09-30 11:37:28 -0400 | [diff] [blame] | 2581 | return Swizzle(RValue<Float4>(vector), T); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2582 | } |
| 2583 | |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2584 | template<class Vector4, int T> |
| 2585 | RValue<Vector4> SwizzleMask2<Vector4, T>::operator=(RValue<Vector4> rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2586 | { |
| 2587 | return Mask(*parent, Float4(rhs), T); |
| 2588 | } |
| 2589 | |
| 2590 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2591 | Float::Float(const SwizzleMask1<Float4, T> &rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2592 | { |
| 2593 | *this = rhs.operator RValue<Float>(); |
| 2594 | } |
| 2595 | |
| 2596 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2597 | RValue<Float> Float::operator=(const SwizzleMask1<Float4, T> &rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2598 | { |
| 2599 | return *this = rhs.operator RValue<Float>(); |
| 2600 | } |
| 2601 | |
| 2602 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2603 | Float4::Float4(const SwizzleMask1<Float4, T> &rhs) : XYZW(this) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2604 | { |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2605 | *this = rhs.operator RValue<Float4>(); |
| 2606 | } |
| 2607 | |
| 2608 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2609 | Float4::Float4(const Swizzle4<Float4, T> &rhs) : XYZW(this) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2610 | { |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2611 | *this = rhs.operator RValue<Float4>(); |
| 2612 | } |
| 2613 | |
| 2614 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2615 | Float4::Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y) : XYZW(this) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2616 | { |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2617 | *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); |
| 2618 | } |
| 2619 | |
| 2620 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2621 | Float4::Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y) : XYZW(this) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2622 | { |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2623 | *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); |
| 2624 | } |
| 2625 | |
| 2626 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2627 | Float4::Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y) : XYZW(this) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2628 | { |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2629 | *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); |
| 2630 | } |
| 2631 | |
| 2632 | template<int X, int Y> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2633 | Float4::Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y) : XYZW(this) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2634 | { |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2635 | *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4); |
| 2636 | } |
| 2637 | |
| 2638 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2639 | RValue<Float4> Float4::operator=(const SwizzleMask1<Float4, T> &rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2640 | { |
| 2641 | return *this = rhs.operator RValue<Float4>(); |
| 2642 | } |
| 2643 | |
| 2644 | template<int T> |
Nicolas Capens | cb98676 | 2017-01-20 11:34:37 -0500 | [diff] [blame] | 2645 | RValue<Float4> Float4::operator=(const Swizzle4<Float4, T> &rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2646 | { |
| 2647 | return *this = rhs.operator RValue<Float4>(); |
| 2648 | } |
| 2649 | |
| 2650 | template<class T> |
| 2651 | Pointer<T>::Pointer(Argument<Pointer<T>> argument) : alignment(1) |
| 2652 | { |
Nicolas Capens | 51d9867 | 2019-04-02 12:05:40 -0400 | [diff] [blame] | 2653 | LValue<Pointer<T>>::materialize(); // FIXME(b/129757459) |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2654 | LValue<Pointer<T>>::storeValue(argument.value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2655 | } |
| 2656 | |
| 2657 | template<class T> |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2658 | Pointer<T>::Pointer() : alignment(1) |
| 2659 | { |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2660 | LValue<Pointer<T>>::storeValue(Nucleus::createNullPointer(T::getType())); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2661 | } |
| 2662 | |
| 2663 | template<class T> |
| 2664 | Pointer<T>::Pointer(RValue<Pointer<T>> rhs) : alignment(1) |
| 2665 | { |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2666 | LValue<Pointer<T>>::storeValue(rhs.value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2667 | } |
| 2668 | |
| 2669 | template<class T> |
| 2670 | Pointer<T>::Pointer(const Pointer<T> &rhs) : alignment(rhs.alignment) |
| 2671 | { |
| 2672 | Value *value = rhs.loadValue(); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2673 | LValue<Pointer<T>>::storeValue(value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2674 | } |
| 2675 | |
| 2676 | template<class T> |
| 2677 | Pointer<T>::Pointer(const Reference<Pointer<T>> &rhs) : alignment(rhs.getAlignment()) |
| 2678 | { |
| 2679 | Value *value = rhs.loadValue(); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2680 | LValue<Pointer<T>>::storeValue(value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2681 | } |
| 2682 | |
| 2683 | template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2684 | RValue<Pointer<T>> Pointer<T>::operator=(RValue<Pointer<T>> rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2685 | { |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2686 | LValue<Pointer<T>>::storeValue(rhs.value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2687 | |
| 2688 | return rhs; |
| 2689 | } |
| 2690 | |
| 2691 | template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2692 | RValue<Pointer<T>> Pointer<T>::operator=(const Pointer<T> &rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2693 | { |
| 2694 | Value *value = rhs.loadValue(); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2695 | LValue<Pointer<T>>::storeValue(value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2696 | |
| 2697 | return RValue<Pointer<T>>(value); |
| 2698 | } |
| 2699 | |
| 2700 | template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2701 | RValue<Pointer<T>> Pointer<T>::operator=(const Reference<Pointer<T>> &rhs) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2702 | { |
| 2703 | Value *value = rhs.loadValue(); |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2704 | LValue<Pointer<T>>::storeValue(value); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2705 | |
| 2706 | return RValue<Pointer<T>>(value); |
| 2707 | } |
| 2708 | |
| 2709 | template<class T> |
| 2710 | Reference<T> Pointer<T>::operator*() |
| 2711 | { |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2712 | return Reference<T>(LValue<Pointer<T>>::loadValue(), alignment); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2713 | } |
| 2714 | |
| 2715 | template<class T> |
| 2716 | Reference<T> Pointer<T>::operator[](int index) |
| 2717 | { |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2718 | Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), Nucleus::createConstantInt(index), false); |
| 2719 | |
| 2720 | return Reference<T>(element, alignment); |
| 2721 | } |
| 2722 | |
| 2723 | template<class T> |
| 2724 | Reference<T> Pointer<T>::operator[](unsigned int index) |
| 2725 | { |
| 2726 | 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] | 2727 | |
| 2728 | return Reference<T>(element, alignment); |
| 2729 | } |
| 2730 | |
| 2731 | template<class T> |
| 2732 | Reference<T> Pointer<T>::operator[](RValue<Int> index) |
| 2733 | { |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2734 | Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), index.value, false); |
| 2735 | |
| 2736 | return Reference<T>(element, alignment); |
| 2737 | } |
| 2738 | |
| 2739 | template<class T> |
| 2740 | Reference<T> Pointer<T>::operator[](RValue<UInt> index) |
| 2741 | { |
| 2742 | 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] | 2743 | |
| 2744 | return Reference<T>(element, alignment); |
| 2745 | } |
| 2746 | |
| 2747 | template<class T> |
| 2748 | Type *Pointer<T>::getType() |
| 2749 | { |
| 2750 | return Nucleus::getPointerType(T::getType()); |
| 2751 | } |
| 2752 | |
| 2753 | template<class T, int S> |
Nicolas Capens | 297d26e | 2016-11-18 12:52:17 -0500 | [diff] [blame] | 2754 | Array<T, S>::Array(int size) : LValue<T>(size) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2755 | { |
| 2756 | } |
| 2757 | |
| 2758 | template<class T, int S> |
| 2759 | Reference<T> Array<T, S>::operator[](int index) |
| 2760 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2761 | Value *element = LValue<T>::getElementPointer(Nucleus::createConstantInt(index), false); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2762 | |
| 2763 | return Reference<T>(element); |
| 2764 | } |
| 2765 | |
| 2766 | template<class T, int S> |
| 2767 | Reference<T> Array<T, S>::operator[](unsigned int index) |
| 2768 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2769 | Value *element = LValue<T>::getElementPointer(Nucleus::createConstantInt(index), true); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2770 | |
| 2771 | return Reference<T>(element); |
| 2772 | } |
| 2773 | |
| 2774 | template<class T, int S> |
| 2775 | Reference<T> Array<T, S>::operator[](RValue<Int> index) |
| 2776 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2777 | Value *element = LValue<T>::getElementPointer(index.value, false); |
Nicolas Capens | d294def | 2017-01-26 17:44:37 -0800 | [diff] [blame] | 2778 | |
| 2779 | return Reference<T>(element); |
| 2780 | } |
| 2781 | |
| 2782 | template<class T, int S> |
| 2783 | Reference<T> Array<T, S>::operator[](RValue<UInt> index) |
| 2784 | { |
Nicolas Capens | 0192d15 | 2019-03-27 14:46:07 -0400 | [diff] [blame] | 2785 | Value *element = LValue<T>::getElementPointer(index.value, true); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2786 | |
| 2787 | return Reference<T>(element); |
| 2788 | } |
| 2789 | |
| 2790 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2791 | // RValue<Array<T>> operator++(Array<T> &val, int) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2792 | // { |
| 2793 | // // FIXME: Requires storing the address of the array |
| 2794 | // } |
| 2795 | |
| 2796 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2797 | // const Array<T> &operator++(Array<T> &val) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2798 | // { |
| 2799 | // // FIXME: Requires storing the address of the array |
| 2800 | // } |
| 2801 | |
| 2802 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2803 | // RValue<Array<T>> operator--(Array<T> &val, int) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2804 | // { |
| 2805 | // // FIXME: Requires storing the address of the array |
| 2806 | // } |
| 2807 | |
| 2808 | // template<class T> |
Nicolas Capens | 96d4e09 | 2016-11-18 14:22:38 -0500 | [diff] [blame] | 2809 | // const Array<T> &operator--(Array<T> &val) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2810 | // { |
| 2811 | // // FIXME: Requires storing the address of the array |
| 2812 | // } |
| 2813 | |
| 2814 | template<class T> |
| 2815 | RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse) |
| 2816 | { |
| 2817 | return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, ifFalse.value)); |
| 2818 | } |
| 2819 | |
| 2820 | template<class T> |
| 2821 | RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse) |
| 2822 | { |
| 2823 | Value *trueValue = ifTrue.loadValue(); |
| 2824 | |
| 2825 | return RValue<T>(Nucleus::createSelect(condition.value, trueValue, ifFalse.value)); |
| 2826 | } |
| 2827 | |
| 2828 | template<class T> |
| 2829 | RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse) |
| 2830 | { |
| 2831 | Value *falseValue = ifFalse.loadValue(); |
| 2832 | |
| 2833 | return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, falseValue)); |
| 2834 | } |
| 2835 | |
| 2836 | template<class T> |
| 2837 | RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse) |
| 2838 | { |
| 2839 | Value *trueValue = ifTrue.loadValue(); |
| 2840 | Value *falseValue = ifFalse.loadValue(); |
| 2841 | |
| 2842 | return RValue<T>(Nucleus::createSelect(condition.value, trueValue, falseValue)); |
| 2843 | } |
| 2844 | |
| 2845 | template<class T> |
| 2846 | void Return(const Pointer<T> &ret) |
| 2847 | { |
Nicolas Capens | e12780d | 2016-09-27 14:18:07 -0400 | [diff] [blame] | 2848 | Nucleus::createRet(Nucleus::createLoad(ret.address, Pointer<T>::getType())); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2849 | Nucleus::setInsertBlock(Nucleus::createBasicBlock()); |
Ben Clayton | f3b5797 | 2019-03-15 09:56:47 +0000 | [diff] [blame] | 2850 | Nucleus::createUnreachable(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2851 | } |
| 2852 | |
| 2853 | template<class T> |
| 2854 | void Return(RValue<Pointer<T>> ret) |
| 2855 | { |
| 2856 | Nucleus::createRet(ret.value); |
| 2857 | Nucleus::setInsertBlock(Nucleus::createBasicBlock()); |
Ben Clayton | f3b5797 | 2019-03-15 09:56:47 +0000 | [diff] [blame] | 2858 | Nucleus::createUnreachable(); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2859 | } |
| 2860 | |
| 2861 | template<typename Return, typename... Arguments> |
| 2862 | Function<Return(Arguments...)>::Function() |
| 2863 | { |
| 2864 | core = new Nucleus(); |
| 2865 | |
| 2866 | Type *types[] = {Arguments::getType()...}; |
| 2867 | for(Type *type : types) |
| 2868 | { |
| 2869 | if(type != Void::getType()) |
| 2870 | { |
| 2871 | arguments.push_back(type); |
| 2872 | } |
| 2873 | } |
| 2874 | |
| 2875 | Nucleus::createFunction(Return::getType(), arguments); |
| 2876 | } |
| 2877 | |
| 2878 | template<typename Return, typename... Arguments> |
| 2879 | Function<Return(Arguments...)>::~Function() |
| 2880 | { |
| 2881 | delete core; |
| 2882 | } |
| 2883 | |
| 2884 | template<typename Return, typename... Arguments> |
Chris Forbes | 878d4b0 | 2019-01-21 10:48:35 -0800 | [diff] [blame] | 2885 | Routine *Function<Return(Arguments...)>::operator()(const char *name, ...) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2886 | { |
Chris Forbes | 878d4b0 | 2019-01-21 10:48:35 -0800 | [diff] [blame] | 2887 | char fullName[1024 + 1]; |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2888 | |
| 2889 | va_list vararg; |
| 2890 | va_start(vararg, name); |
Chris Forbes | 878d4b0 | 2019-01-21 10:48:35 -0800 | [diff] [blame] | 2891 | vsnprintf(fullName, 1024, name, vararg); |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2892 | va_end(vararg); |
| 2893 | |
| 2894 | return core->acquireRoutine(fullName, true); |
| 2895 | } |
| 2896 | |
| 2897 | template<class T, class S> |
| 2898 | RValue<T> ReinterpretCast(RValue<S> val) |
| 2899 | { |
| 2900 | return RValue<T>(Nucleus::createBitCast(val.value, T::getType())); |
| 2901 | } |
| 2902 | |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2903 | template<class T, class S> |
| 2904 | RValue<T> ReinterpretCast(const LValue<S> &var) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2905 | { |
| 2906 | Value *val = var.loadValue(); |
| 2907 | |
| 2908 | return RValue<T>(Nucleus::createBitCast(val, T::getType())); |
| 2909 | } |
| 2910 | |
| 2911 | template<class T, class S> |
| 2912 | RValue<T> ReinterpretCast(const Reference<S> &var) |
| 2913 | { |
| 2914 | return ReinterpretCast<T>(RValue<S>(var)); |
| 2915 | } |
| 2916 | |
Nicolas Capens | 70dfff4 | 2016-10-27 10:20:28 -0400 | [diff] [blame] | 2917 | template<class T> |
| 2918 | RValue<T> As(Value *val) |
| 2919 | { |
| 2920 | return RValue<T>(Nucleus::createBitCast(val, T::getType())); |
| 2921 | } |
| 2922 | |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2923 | template<class T, class S> |
| 2924 | RValue<T> As(RValue<S> val) |
| 2925 | { |
| 2926 | return ReinterpretCast<T>(val); |
| 2927 | } |
| 2928 | |
Nicolas Capens | 22479eb | 2016-09-28 22:34:26 -0400 | [diff] [blame] | 2929 | template<class T, class S> |
| 2930 | RValue<T> As(const LValue<S> &var) |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 2931 | { |
| 2932 | return ReinterpretCast<T>(var); |
| 2933 | } |
| 2934 | |
| 2935 | template<class T, class S> |
| 2936 | RValue<T> As(const Reference<S> &val) |
| 2937 | { |
| 2938 | return ReinterpretCast<T>(val); |
| 2939 | } |
| 2940 | |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 2941 | #ifdef ENABLE_RR_PRINT |
| 2942 | // PrintValue holds the printf format and value(s) for a single argument |
| 2943 | // to Print(). A single argument can be expanded into multiple printf |
| 2944 | // values - for example a Float4 will expand to "%f %f %f %f" and four |
| 2945 | // scalar values. |
| 2946 | // The PrintValue constructor accepts the following: |
| 2947 | // * Reactor LValues, RValues, Pointers. |
| 2948 | // * Standard Plain-Old-Value types (int, float, bool, etc) |
| 2949 | // * Custom types that specialize the PrintValue::Ty template struct. |
| 2950 | // * Static arrays in the form T[N] where T can be any of the above. |
| 2951 | class PrintValue |
| 2952 | { |
| 2953 | // Ty is a template that can be specialized for printing type T. |
| 2954 | // Each specialization must expose: |
| 2955 | // * A 'static constexpr const char* fmt' field that provides the |
| 2956 | // printf format specifier. |
| 2957 | // * A 'static std::vector<rr::Value*> val(const T& v)' method that |
| 2958 | // returns all the printf format values. |
| 2959 | template <typename T> struct Ty |
| 2960 | { |
| 2961 | // static constexpr const char* fmt; |
| 2962 | // static std::vector<rr::Value*> val(const T& v) |
| 2963 | }; |
| 2964 | |
| 2965 | // returns the printf value(s) for the given LValue. |
| 2966 | template <typename T> |
| 2967 | static std::vector<Value*> val(const LValue<T>& v) { return val(RValue<T>(v.loadValue())); }; |
| 2968 | |
| 2969 | // returns the printf value(s) for the given RValue. |
| 2970 | template <typename T> |
| 2971 | static std::vector<Value*> val(const RValue<T>& v) { return Ty<T>::val(v); }; |
| 2972 | |
| 2973 | // returns the printf value from for the given type with a |
| 2974 | // PrintValue::Ty<T> specialization. |
| 2975 | template <typename T> |
| 2976 | static std::vector<Value*> val(const T& v) { return Ty<T>::val(v); }; |
| 2977 | |
| 2978 | // returns the printf values for all the values in the given array. |
| 2979 | template <typename T> |
| 2980 | static std::vector<Value*> val(const T* list, int count) { |
| 2981 | std::vector<Value*> values; |
| 2982 | values.reserve(count); |
| 2983 | for (int i = 0; i < count; i++) |
| 2984 | { |
| 2985 | auto v = val(list[i]); |
| 2986 | values.insert(values.end(), v.begin(), v.end()); |
| 2987 | } |
| 2988 | return values; |
| 2989 | }; |
| 2990 | |
| 2991 | // fmt returns a comma-delimited list of the string el repeated count |
| 2992 | // times enclosed in square brackets. |
| 2993 | static std::string fmt(const char* el, int count) |
| 2994 | { |
| 2995 | std::string out = "["; |
| 2996 | for (int i = 0; i < count; i++) |
| 2997 | { |
| 2998 | if (i > 0) { out += ", "; } |
| 2999 | out += el; |
| 3000 | } |
| 3001 | return out + "]"; |
| 3002 | } |
| 3003 | |
Ben Clayton | 3ed8ba0 | 2019-04-04 22:01:51 +0100 | [diff] [blame] | 3004 | static std::string addr(const void* ptr) |
| 3005 | { |
| 3006 | char buf[32]; |
| 3007 | snprintf(buf, sizeof(buf), "%p", ptr); |
| 3008 | return buf; |
| 3009 | } |
| 3010 | |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3011 | public: |
| 3012 | const std::string format; |
| 3013 | const std::vector<Value*> values; |
| 3014 | |
| 3015 | // Constructs a PrintValue for the given value. |
| 3016 | template <typename T> |
| 3017 | PrintValue(const T& v) : format(Ty<T>::fmt), values(val(v)) {} |
| 3018 | |
| 3019 | // Constructs a PrintValue for the given static array. |
| 3020 | template <typename T, int N> |
| 3021 | PrintValue(const T (&v)[N]) : format(fmt(Ty<T>::fmt, N)), values(val(&v[0], N)) {} |
| 3022 | |
| 3023 | // Constructs a PrintValue for the given array starting at arr of length |
| 3024 | // len. |
| 3025 | template <typename T> |
| 3026 | PrintValue(const T* arr, int len) : format(fmt(Ty<T>::fmt, len)), values(val(arr, len)) {} |
| 3027 | |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3028 | // PrintValue constructors for plain-old-data values. |
| 3029 | PrintValue(bool v) : format(v ? "true" : "false") {} |
| 3030 | PrintValue(int8_t v) : format(std::to_string(v)) {} |
| 3031 | PrintValue(uint8_t v) : format(std::to_string(v)) {} |
| 3032 | PrintValue(int16_t v) : format(std::to_string(v)) {} |
| 3033 | PrintValue(uint16_t v) : format(std::to_string(v)) {} |
| 3034 | PrintValue(int32_t v) : format(std::to_string(v)) {} |
| 3035 | PrintValue(uint32_t v) : format(std::to_string(v)) {} |
| 3036 | PrintValue(int64_t v) : format(std::to_string(v)) {} |
| 3037 | PrintValue(uint64_t v) : format(std::to_string(v)) {} |
| 3038 | PrintValue(float v) : format(std::to_string(v)) {} |
| 3039 | PrintValue(double v) : format(std::to_string(v)) {} |
| 3040 | PrintValue(const char* v) : format(v) {} |
| 3041 | PrintValue(const std::string& v) : format(v) {} |
| 3042 | |
Ben Clayton | 3ed8ba0 | 2019-04-04 22:01:51 +0100 | [diff] [blame] | 3043 | template <typename T> |
| 3044 | PrintValue(const T* v) : format(addr(v)) {} |
| 3045 | |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3046 | // vals is a helper to build composite value lists. |
| 3047 | // vals returns the full, sequential list of printf argument values used |
| 3048 | // to print all the provided variadic values. |
| 3049 | // vals() is intended to be used by implementations of |
| 3050 | // PrintValue::Ty<>::vals() to help declare aggregate types. |
| 3051 | // For example, if you were declaring a PrintValue::Ty<> specialization |
| 3052 | // for a custom Mat4x4 matrix formed from four Vector4 values, you'd |
| 3053 | // write: |
| 3054 | // |
| 3055 | // namespace rr |
| 3056 | // { |
| 3057 | // template <> struct PrintValue::Ty<Mat4x4> |
| 3058 | // { |
| 3059 | // static constexpr const char* fmt = |
| 3060 | // "[a: <%f, %f, %f, %f>," |
| 3061 | // " b: <%f, %f, %f, %f>," |
| 3062 | // " c: <%f, %f, %f, %f>," |
| 3063 | // " d: <%f, %f, %f, %f>]"; |
| 3064 | // static std::vector<rr::Value*> val(const Mat4x4& v) |
| 3065 | // { |
| 3066 | // return PrintValue::vals(v.a, v.b, v.c, v.d); |
| 3067 | // } |
| 3068 | // }; |
| 3069 | // } |
| 3070 | template<typename ... ARGS> |
| 3071 | static std::vector<Value*> vals(ARGS... v) |
| 3072 | { |
| 3073 | std::vector< std::vector<Value*> > lists = {val(v)...}; |
| 3074 | std::vector<Value*> joined; |
| 3075 | for (const auto& list : lists) |
| 3076 | { |
| 3077 | joined.insert(joined.end(), list.begin(), list.end()); |
| 3078 | } |
| 3079 | return joined; |
| 3080 | } |
| 3081 | }; |
| 3082 | |
| 3083 | // PrintValue::Ty<T> specializations for standard Reactor types. |
Ben Clayton | ca56e8b | 2019-03-12 20:05:43 +0000 | [diff] [blame] | 3084 | template <> struct PrintValue::Ty<Bool> |
| 3085 | { |
| 3086 | static constexpr const char* fmt = "%d"; |
| 3087 | static std::vector<Value*> val(const RValue<Bool>& v) { return {v.value}; } |
| 3088 | }; |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3089 | template <> struct PrintValue::Ty<Byte> |
| 3090 | { |
| 3091 | static constexpr const char* fmt = "%d"; |
| 3092 | static std::vector<Value*> val(const RValue<Byte>& v) { return {v.value}; } |
| 3093 | }; |
| 3094 | template <> struct PrintValue::Ty<Byte4> |
| 3095 | { |
| 3096 | static constexpr const char* fmt = "[%d, %d, %d, %d]"; |
| 3097 | static std::vector<Value*> val(const RValue<Byte4>& v); |
| 3098 | }; |
| 3099 | template <> struct PrintValue::Ty<Int> |
| 3100 | { |
| 3101 | static constexpr const char* fmt = "%d"; |
| 3102 | static std::vector<Value*> val(const RValue<Int>& v) { return {v.value}; } |
| 3103 | }; |
| 3104 | template <> struct PrintValue::Ty<Int4> |
| 3105 | { |
| 3106 | static constexpr const char* fmt = "[%d, %d, %d, %d]"; |
| 3107 | static std::vector<Value*> val(const RValue<Int4>& v); |
| 3108 | }; |
| 3109 | template <> struct PrintValue::Ty<UInt> |
| 3110 | { |
| 3111 | static constexpr const char* fmt = "%u"; |
| 3112 | static std::vector<Value*> val(const RValue<UInt>& v) { return {v.value}; } |
| 3113 | }; |
| 3114 | template <> struct PrintValue::Ty<UInt4> |
| 3115 | { |
| 3116 | static constexpr const char* fmt = "[%u, %u, %u, %u]"; |
| 3117 | static std::vector<Value*> val(const RValue<UInt4>& v); |
| 3118 | }; |
| 3119 | template <> struct PrintValue::Ty<Short> |
| 3120 | { |
| 3121 | static constexpr const char* fmt = "%d"; |
| 3122 | static std::vector<Value*> val(const RValue<Short>& v) { return {v.value}; } |
| 3123 | }; |
| 3124 | template <> struct PrintValue::Ty<Short4> |
| 3125 | { |
| 3126 | static constexpr const char* fmt = "[%d, %d, %d, %d]"; |
| 3127 | static std::vector<Value*> val(const RValue<Short4>& v); |
| 3128 | }; |
| 3129 | template <> struct PrintValue::Ty<UShort> |
| 3130 | { |
| 3131 | static constexpr const char* fmt = "%u"; |
| 3132 | static std::vector<Value*> val(const RValue<UShort>& v) { return {v.value}; } |
| 3133 | }; |
| 3134 | template <> struct PrintValue::Ty<UShort4> |
| 3135 | { |
| 3136 | static constexpr const char* fmt = "[%u, %u, %u, %u]"; |
| 3137 | static std::vector<Value*> val(const RValue<UShort4>& v); |
| 3138 | }; |
| 3139 | template <> struct PrintValue::Ty<Float> |
| 3140 | { |
| 3141 | static constexpr const char* fmt = "[%f]"; |
| 3142 | static std::vector<Value*> val(const RValue<Float>& v); |
| 3143 | }; |
| 3144 | template <> struct PrintValue::Ty<Float4> |
| 3145 | { |
| 3146 | static constexpr const char* fmt = "[%f, %f, %f, %f]"; |
| 3147 | static std::vector<Value*> val(const RValue<Float4>& v); |
| 3148 | }; |
| 3149 | template <typename T> struct PrintValue::Ty< Pointer<T> > |
| 3150 | { |
| 3151 | static constexpr const char* fmt = "%p"; |
| 3152 | static std::vector<Value*> val(const RValue<Pointer<T>>& v) { return {v.value}; } |
| 3153 | }; |
| 3154 | template <typename T> struct PrintValue::Ty< Reference<T> > |
| 3155 | { |
| 3156 | static constexpr const char* fmt = PrintValue::Ty<T>::fmt; |
| 3157 | static std::vector<Value*> val(const Reference<T>& v) { return PrintValue::Ty<T>::val(v); } |
| 3158 | }; |
| 3159 | template <typename T> struct PrintValue::Ty< RValue<T> > |
| 3160 | { |
| 3161 | static constexpr const char* fmt = PrintValue::Ty<T>::fmt; |
| 3162 | static std::vector<Value*> val(const RValue<T>& v) { return PrintValue::Ty<T>::val(v); } |
| 3163 | }; |
| 3164 | |
| 3165 | // Printv emits a call to printf() using the function, file and line, |
| 3166 | // message and optional values. |
| 3167 | // See Printv below. |
| 3168 | void Printv(const char* function, const char* file, int line, const char* msg, std::initializer_list<PrintValue> vals); |
| 3169 | |
| 3170 | // Printv emits a call to printf() using the provided message and optional |
| 3171 | // values. |
| 3172 | // Printf replaces any bracketed indices in the message with string |
| 3173 | // representations of the corresponding value in vals. |
| 3174 | // For example: |
| 3175 | // Printv("{0} and {1}", "red", "green"); |
| 3176 | // Would print the string: |
| 3177 | // "red and green" |
| 3178 | // Arguments can be indexed in any order. |
| 3179 | // Invalid indices are not substituted. |
| 3180 | inline void Printv(const char* msg, std::initializer_list<PrintValue> vals) |
| 3181 | { |
| 3182 | Printv(nullptr, nullptr, 0, msg, vals); |
| 3183 | } |
| 3184 | |
| 3185 | // Print is a wrapper over Printv that wraps the variadic arguments into an |
| 3186 | // initializer_list before calling Printv. |
| 3187 | template <typename ... ARGS> |
| 3188 | void Print(const char* msg, const ARGS& ... vals) { Printv(msg, {vals...}); } |
| 3189 | |
| 3190 | // Print is a wrapper over Printv that wraps the variadic arguments into an |
| 3191 | // initializer_list before calling Printv. |
| 3192 | template <typename ... ARGS> |
| 3193 | void Print(const char* function, const char* file, int line, const char* msg, const ARGS& ... vals) |
| 3194 | { |
| 3195 | Printv(function, file, line, msg, {vals...}); |
| 3196 | } |
| 3197 | |
| 3198 | // RR_LOG is a macro that calls Print(), automatically populating the |
| 3199 | // function, file and line parameters and appending a newline to the string. |
| 3200 | // |
| 3201 | // RR_LOG() is intended to be used for debugging JIT compiled code, and is |
| 3202 | // not intended for production use. |
| 3203 | #define RR_LOG(msg, ...) Print(__PRETTY_FUNCTION__, __FILE__, __LINE__, msg "\n", ##__VA_ARGS__) |
| 3204 | |
| 3205 | // Macro magic to perform variadic dispatch. |
| 3206 | // See: https://renenyffenegger.ch/notes/development/languages/C-C-plus-plus/preprocessor/macros/__VA_ARGS__/count-arguments |
| 3207 | // Note, this doesn't attempt to use the ##__VA_ARGS__ trick to handle 0 |
| 3208 | // args as this appears to still be broken on certain compilers. |
Ben Clayton | 221459f | 2019-03-25 15:14:45 +0000 | [diff] [blame] | 3209 | // MSVC also has issues with variadic macros which requires the RR_VA_MSVC_BUG() work-around. |
| 3210 | // See: https://stackoverflow.com/a/48711060 |
| 3211 | #define RR_VA_MSVC_BUG(MACRO, ARGS) MACRO ARGS |
| 3212 | #define RR_GET_NTH_ARG_EX(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N |
| 3213 | #define RR_GET_NTH_ARG(...) RR_VA_MSVC_BUG(RR_GET_NTH_ARG_EX, (__VA_ARGS__)) |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3214 | #define RR_COUNT_ARGUMENTS(...) RR_GET_NTH_ARG(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) |
Ben Clayton | 60a3d6f | 2019-02-26 17:24:46 +0000 | [diff] [blame] | 3215 | static_assert(1 == RR_COUNT_ARGUMENTS(a), "RR_COUNT_ARGUMENTS broken"); // Sanity checks. |
| 3216 | static_assert(2 == RR_COUNT_ARGUMENTS(a, b), "RR_COUNT_ARGUMENTS broken"); |
| 3217 | static_assert(3 == RR_COUNT_ARGUMENTS(a, b, c), "RR_COUNT_ARGUMENTS broken"); |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3218 | |
| 3219 | // RR_WATCH_FMT(...) resolves to a string literal that lists all the |
| 3220 | // arguments by name. This string can be passed to LOG() to print each of |
| 3221 | // the arguments with their name and value. |
| 3222 | // |
| 3223 | // RR_WATCH_FMT(...) uses the RR_COUNT_ARGUMENTS helper macro to delegate to a |
| 3224 | // corresponding RR_WATCH_FMT_n specialization macro below. |
| 3225 | #define RR_WATCH_CONCAT(a, b) a ## b |
| 3226 | #define RR_WATCH_CONCAT2(a, b) RR_WATCH_CONCAT(a, b) |
| 3227 | #define RR_WATCH_FMT(...) RR_WATCH_CONCAT2(RR_WATCH_FMT_, RR_COUNT_ARGUMENTS(__VA_ARGS__))(__VA_ARGS__) |
| 3228 | #define RR_WATCH_FMT_1(_1) "\n " #_1 ": {0}" |
Ben Clayton | 644a350 | 2019-03-13 11:24:46 +0000 | [diff] [blame] | 3229 | #define RR_WATCH_FMT_2(_1, _2) RR_WATCH_FMT_1(_1) "\n " #_2 ": {1}" |
| 3230 | #define RR_WATCH_FMT_3(_1, _2, _3) RR_WATCH_FMT_2(_1, _2) "\n " #_3 ": {2}" |
| 3231 | #define RR_WATCH_FMT_4(_1, _2, _3, _4) RR_WATCH_FMT_3(_1, _2, _3) "\n " #_4 ": {3}" |
| 3232 | #define RR_WATCH_FMT_5(_1, _2, _3, _4, _5) RR_WATCH_FMT_4(_1, _2, _3, _4) "\n " #_5 ": {4}" |
| 3233 | #define RR_WATCH_FMT_6(_1, _2, _3, _4, _5, _6) RR_WATCH_FMT_5(_1, _2, _3, _4, _5) "\n " #_6 ": {5}" |
| 3234 | #define RR_WATCH_FMT_7(_1, _2, _3, _4, _5, _6, _7) RR_WATCH_FMT_6(_1, _2, _3, _4, _5, _6) "\n " #_7 ": {6}" |
| 3235 | #define RR_WATCH_FMT_8(_1, _2, _3, _4, _5, _6, _7, _8) RR_WATCH_FMT_7(_1, _2, _3, _4, _5, _6, _7) "\n " #_8 ": {7}" |
| 3236 | #define RR_WATCH_FMT_9(_1, _2, _3, _4, _5, _6, _7, _8, _9) RR_WATCH_FMT_8(_1, _2, _3, _4, _5, _6, _7, _8) "\n " #_9 ": {8}" |
| 3237 | #define RR_WATCH_FMT_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) RR_WATCH_FMT_9(_1, _2, _3, _4, _5, _6, _7, _8, _9) "\n " #_10 ": {9}" |
| 3238 | #define RR_WATCH_FMT_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) RR_WATCH_FMT_10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) "\n " #_11 ": {10}" |
| 3239 | #define RR_WATCH_FMT_12(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) RR_WATCH_FMT_11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) "\n " #_12 ": {11}" |
Ben Clayton | 1bc7ee9 | 2019-02-14 18:43:22 +0000 | [diff] [blame] | 3240 | |
| 3241 | // RR_WATCH() is a helper that prints the name and value of all the supplied |
| 3242 | // arguments. |
| 3243 | // For example, if you had the Int and bool variables 'foo' and 'bar' that |
| 3244 | // you want to print, you can simply write: |
| 3245 | // RR_WATCH(foo, bar) |
| 3246 | // When this JIT compiled code is executed, it will print the string |
| 3247 | // "foo: 1, bar: true" to stdout. |
| 3248 | // |
| 3249 | // RR_WATCH() is intended to be used for debugging JIT compiled code, and |
| 3250 | // is not intended for production use. |
| 3251 | #define RR_WATCH(...) RR_LOG(RR_WATCH_FMT(__VA_ARGS__), __VA_ARGS__) |
| 3252 | #endif // ENABLE_RR_PRINT |
| 3253 | |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3254 | class ForData |
| 3255 | { |
| 3256 | public: |
| 3257 | ForData(bool init) : loopOnce(init) |
| 3258 | { |
| 3259 | } |
| 3260 | |
| 3261 | operator bool() |
| 3262 | { |
| 3263 | return loopOnce; |
| 3264 | } |
| 3265 | |
| 3266 | bool operator=(bool value) |
| 3267 | { |
| 3268 | return loopOnce = value; |
| 3269 | } |
| 3270 | |
| 3271 | bool setup() |
| 3272 | { |
| 3273 | if(Nucleus::getInsertBlock() != endBB) |
| 3274 | { |
| 3275 | testBB = Nucleus::createBasicBlock(); |
| 3276 | |
| 3277 | Nucleus::createBr(testBB); |
| 3278 | Nucleus::setInsertBlock(testBB); |
| 3279 | |
| 3280 | return true; |
| 3281 | } |
| 3282 | |
| 3283 | return false; |
| 3284 | } |
| 3285 | |
| 3286 | bool test(RValue<Bool> cmp) |
| 3287 | { |
| 3288 | BasicBlock *bodyBB = Nucleus::createBasicBlock(); |
| 3289 | endBB = Nucleus::createBasicBlock(); |
| 3290 | |
| 3291 | Nucleus::createCondBr(cmp.value, bodyBB, endBB); |
| 3292 | Nucleus::setInsertBlock(bodyBB); |
| 3293 | |
| 3294 | return true; |
| 3295 | } |
| 3296 | |
| 3297 | void end() |
| 3298 | { |
| 3299 | Nucleus::createBr(testBB); |
| 3300 | Nucleus::setInsertBlock(endBB); |
| 3301 | } |
| 3302 | |
| 3303 | private: |
| 3304 | BasicBlock *testBB = nullptr; |
| 3305 | BasicBlock *endBB = nullptr; |
| 3306 | bool loopOnce = true; |
| 3307 | }; |
| 3308 | |
| 3309 | class IfElseData |
| 3310 | { |
| 3311 | public: |
| 3312 | IfElseData(RValue<Bool> cmp) : iteration(0) |
| 3313 | { |
| 3314 | condition = cmp.value; |
| 3315 | |
| 3316 | beginBB = Nucleus::getInsertBlock(); |
| 3317 | trueBB = Nucleus::createBasicBlock(); |
| 3318 | falseBB = nullptr; |
| 3319 | endBB = Nucleus::createBasicBlock(); |
| 3320 | |
| 3321 | Nucleus::setInsertBlock(trueBB); |
| 3322 | } |
| 3323 | |
| 3324 | ~IfElseData() |
| 3325 | { |
| 3326 | Nucleus::createBr(endBB); |
| 3327 | |
| 3328 | Nucleus::setInsertBlock(beginBB); |
| 3329 | Nucleus::createCondBr(condition, trueBB, falseBB ? falseBB : endBB); |
| 3330 | |
| 3331 | Nucleus::setInsertBlock(endBB); |
| 3332 | } |
| 3333 | |
| 3334 | operator int() |
| 3335 | { |
| 3336 | return iteration; |
| 3337 | } |
| 3338 | |
| 3339 | IfElseData &operator++() |
| 3340 | { |
| 3341 | ++iteration; |
| 3342 | |
| 3343 | return *this; |
| 3344 | } |
| 3345 | |
| 3346 | void elseClause() |
| 3347 | { |
| 3348 | Nucleus::createBr(endBB); |
| 3349 | |
| 3350 | falseBB = Nucleus::createBasicBlock(); |
| 3351 | Nucleus::setInsertBlock(falseBB); |
| 3352 | } |
| 3353 | |
| 3354 | private: |
| 3355 | Value *condition; |
| 3356 | BasicBlock *beginBB; |
| 3357 | BasicBlock *trueBB; |
| 3358 | BasicBlock *falseBB; |
| 3359 | BasicBlock *endBB; |
| 3360 | int iteration; |
| 3361 | }; |
| 3362 | |
Nicolas Capens | b0eb377 | 2016-10-24 17:49:13 -0400 | [diff] [blame] | 3363 | #define For(init, cond, inc) \ |
Nicolas Capens | 8884a23 | 2016-11-16 15:03:18 -0500 | [diff] [blame] | 3364 | for(ForData for__ = true; for__; for__ = false) \ |
| 3365 | for(init; for__.setup() && for__.test(cond); inc, for__.end()) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3366 | |
Nicolas Capens | b0eb377 | 2016-10-24 17:49:13 -0400 | [diff] [blame] | 3367 | #define While(cond) For((void)0, cond, (void)0) |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3368 | |
Nicolas Capens | b0eb377 | 2016-10-24 17:49:13 -0400 | [diff] [blame] | 3369 | #define Do \ |
| 3370 | { \ |
| 3371 | BasicBlock *body__ = Nucleus::createBasicBlock(); \ |
| 3372 | Nucleus::createBr(body__); \ |
| 3373 | Nucleus::setInsertBlock(body__); |
| 3374 | |
| 3375 | #define Until(cond) \ |
| 3376 | BasicBlock *end__ = Nucleus::createBasicBlock(); \ |
| 3377 | Nucleus::createCondBr((cond).value, end__, body__); \ |
| 3378 | Nucleus::setInsertBlock(end__); \ |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3379 | } |
| 3380 | |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3381 | enum {IF_BLOCK__, ELSE_CLAUSE__, ELSE_BLOCK__, IFELSE_NUM__}; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 3382 | |
Nicolas Capens | 37ed908 | 2016-11-16 17:40:48 -0500 | [diff] [blame] | 3383 | #define If(cond) \ |
| 3384 | for(IfElseData ifElse__(cond); ifElse__ < IFELSE_NUM__; ++ifElse__) \ |
| 3385 | if(ifElse__ == IF_BLOCK__) |
| 3386 | |
| 3387 | #define Else \ |
| 3388 | else if(ifElse__ == ELSE_CLAUSE__) \ |
| 3389 | { \ |
| 3390 | ifElse__.elseClause(); \ |
| 3391 | } \ |
| 3392 | else // ELSE_BLOCK__ |
Nicolas Capens | d022e41 | 2016-09-26 13:30:14 -0400 | [diff] [blame] | 3393 | } |
| 3394 | |
Nicolas Capens | 4846150 | 2018-08-06 14:20:45 -0400 | [diff] [blame] | 3395 | #endif // rr_Reactor_hpp |