On 7/13/21 6:37 AM, Peter Maydell wrote:
if (mask01 > 8) {
- /* high bit set, but not 0b1000: invert the relevant half of P0 */
- vpr ^= 0xff;
+ if (eci == ECI_NONE) {
+ /* high bit set, but not 0b1000: invert the relevant half of P0 */
+ vpr ^= 0xff;
+ } else if (eci == ECI_A0) {
+ /* Invert only the beat 1 P0 bits, as we didn't execute beat 0 */
+ vpr ^= 0xf0;
+ } /* otherwise we didn't execute either beat 0 or beat 1 */
}
if (mask23 > 8) {
- /* high bit set, but not 0b1000: invert the relevant half of P0 */
- vpr ^= 0xff00;
+ if (eci != ECI_A0A1A2 && eci != ECI_A0A1A2B0) {
+ /* high bit set, but not 0b1000: invert the relevant half of P0 */
+ vpr ^= 0xff00;
+ } else {
+ /* We didn't execute beat 2, only invert the beat 3 P0 bits */
+ vpr ^= 0xf000;
+ }
}
It might not be any cleaner, but I wondered if mve_eci_mask could help here.
inv_mask = mve_eci_mask(...);
if (mask01 <= 8) {
inv_mask &= ~0xff;
}
if (mask23 <= 8) {
inv_mask &= ~0xff00;
}
vpr ^= inv_mask;
r~