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