|
| 1 | +/** |
| 2 | + ****************************************************************************** |
| 3 | + * Xenia : Xbox 360 Emulator Research Project * |
| 4 | + ****************************************************************************** |
| 5 | + * Copyright 2022 Ben Vanik. All rights reserved. * |
| 6 | + * Released under the BSD license - see LICENSE in the root for more details. * |
| 7 | + ****************************************************************************** |
| 8 | + */ |
| 9 | + |
| 10 | +#ifndef XENIA_CPU_BACKEND_X64_X64_UTIL_H_ |
| 11 | +#define XENIA_CPU_BACKEND_X64_X64_UTIL_H_ |
| 12 | + |
| 13 | +#include "xenia/base/vec128.h" |
| 14 | +#include "xenia/cpu/backend/x64/x64_backend.h" |
| 15 | +#include "xenia/cpu/backend/x64/x64_emitter.h" |
| 16 | + |
| 17 | +namespace xe { |
| 18 | +namespace cpu { |
| 19 | +namespace backend { |
| 20 | +namespace x64 { |
| 21 | + |
| 22 | +// Used to generate ternary logic truth-tables for vpternlog |
| 23 | +// Use these to directly refer to terms and perform binary operations upon them |
| 24 | +// and the resulting value will be the ternary lookup table |
| 25 | +// ex: |
| 26 | +// (TernaryOperand::a | ~TernaryOperand::b) & TernaryOperand::c |
| 27 | +// = 0b10100010 |
| 28 | +// = 0xa2 |
| 29 | +// vpternlog a, b, c, 0xa2 |
| 30 | +// |
| 31 | +// ~(TernaryOperand::a ^ TernaryOperand::b) & TernaryOperand::c |
| 32 | +// = 0b10000010 |
| 33 | +// = 0x82 |
| 34 | +// vpternlog a, b, c, 0x82 |
| 35 | +namespace TernaryOperand { |
| 36 | +constexpr uint8_t a = 0b11110000; |
| 37 | +constexpr uint8_t b = 0b11001100; |
| 38 | +constexpr uint8_t c = 0b10101010; |
| 39 | +} // namespace TernaryOperand |
| 40 | + |
| 41 | +} // namespace x64 |
| 42 | +} // namespace backend |
| 43 | +} // namespace cpu |
| 44 | +} // namespace xe |
| 45 | + |
| 46 | +#endif // XENIA_CPU_BACKEND_X64_X64_UTIL_H_ |
0 commit comments