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