From 169dfe7cebcec8a7200fc9c26bbbbaf1ab1a8081 Mon Sep 17 00:00:00 2001 From: Max Lin Date: Wed, 12 Feb 2020 18:18:56 -0800 Subject: [PATCH] rvv: vsbc/vmsbc behavior of the sub order --- riscv/insns/vmsbc_vvm.h | 2 +- riscv/insns/vmsbc_vxm.h | 2 +- riscv/insns/vsbc_vvm.h | 2 +- riscv/insns/vsbc_vxm.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/riscv/insns/vmsbc_vvm.h b/riscv/insns/vmsbc_vvm.h index ef8304bd..2f41f01f 100644 --- a/riscv/insns/vmsbc_vvm.h +++ b/riscv/insns/vmsbc_vvm.h @@ -6,7 +6,7 @@ VI_VV_LOOP_CARRY const uint128_t op_mask = (UINT64_MAX >> (64 - sew)); uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0; - uint128_t res = (op_mask & vs1) - (op_mask & vs2) - carry; + uint128_t res = (op_mask & vs2) - (op_mask & vs1) - carry; carry = (res >> sew) & 0x1u; vd = (vd & ~mmask) | ((carry << mpos) & mmask); diff --git a/riscv/insns/vmsbc_vxm.h b/riscv/insns/vmsbc_vxm.h index c0e8ba27..87ce0853 100644 --- a/riscv/insns/vmsbc_vxm.h +++ b/riscv/insns/vmsbc_vxm.h @@ -6,7 +6,7 @@ VI_XI_LOOP_CARRY const uint128_t op_mask = (UINT64_MAX >> (64 - sew)); uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0; - uint128_t res = (op_mask & rs1) - (op_mask & vs2) - carry; + uint128_t res = (op_mask & vs2) - (op_mask & rs1) - carry; carry = (res >> sew) & 0x1u; vd = (vd & ~mmask) | ((carry << mpos) & mmask); diff --git a/riscv/insns/vsbc_vvm.h b/riscv/insns/vsbc_vvm.h index 314077d5..96b8bb80 100644 --- a/riscv/insns/vsbc_vvm.h +++ b/riscv/insns/vsbc_vvm.h @@ -5,6 +5,6 @@ VI_VV_LOOP_WITH_CARRY const uint128_t op_mask = (UINT64_MAX >> (64 - sew)); uint64_t carry = (v0 >> mpos) & 0x1; - uint128_t res = (op_mask & vs1) - (op_mask & vs2) - carry; + uint128_t res = (op_mask & vs2) - (op_mask & vs1) - carry; vd = res; }) diff --git a/riscv/insns/vsbc_vxm.h b/riscv/insns/vsbc_vxm.h index f8555ab3..c6f9ca82 100644 --- a/riscv/insns/vsbc_vxm.h +++ b/riscv/insns/vsbc_vxm.h @@ -5,6 +5,6 @@ VI_XI_LOOP_WITH_CARRY const uint128_t op_mask = (UINT64_MAX >> (64 - sew)); uint64_t carry = (v0 >> mpos) & 0x1; - uint128_t res = (op_mask & rs1) - (op_mask & vs2) - carry; + uint128_t res = (op_mask & vs2) - (op_mask & rs1) - carry; vd = res; })