18 changed files with 82 additions and 138 deletions
@ -1,5 +1,5 @@ |
|||
require_rv64; |
|||
P_RD_RS1_RS2_LOOP(32, 32, 32, { |
|||
p_rd = P_SAT(32, P_SAT(32, p_rs1 << 1) + p_rs2); |
|||
p_rd = P_SAT(32, P_SAT(32, (int64_t)p_rs1 << 1) + p_rs2); |
|||
} |
|||
) |
|||
|
|||
@ -1,15 +1,10 @@ |
|||
require_extension('P'); |
|||
require_rv64; |
|||
sreg_t sshamt = P_FIELD(RS2, 0, 8); |
|||
int sshamt = P_FIELD(RS2, 0, 8); |
|||
uint128_t shx = RS1; |
|||
if (sshamt < 0) { |
|||
if (sshamt <= -64) |
|||
WRITE_RD(0); |
|||
else |
|||
WRITE_RD(RS1 >> (-sshamt)); |
|||
WRITE_RD(shx >> std::min(-sshamt, 64)); |
|||
} else { |
|||
if (sshamt >= 64) |
|||
WRITE_RD(0); |
|||
else |
|||
WRITE_RD(RS1 << sshamt); |
|||
WRITE_RD(shx << std::min(sshamt, 64)); |
|||
} |
|||
|
|||
|
|||
@ -1,19 +1,10 @@ |
|||
require_extension('P'); |
|||
require_rv64; |
|||
sreg_t sshamt = P_FIELD(RS2, 0, 8); |
|||
int sshamt = P_FIELD(RS2, 0, 8); |
|||
if (sshamt < 0) { |
|||
__uint128_t shx; |
|||
if (sshamt < -64) |
|||
shx = 0; |
|||
else if (sshamt == -64) |
|||
shx = (RS1 >> 63) & 1; |
|||
else |
|||
shx = ((__uint128_t)RS1 << 1) >> (-sshamt); |
|||
uint128_t shx = ((uint128_t)RS1 << 1) >> std::min(-sshamt, 64); |
|||
WRITE_RD((uint64_t)((shx + 1) >> 1)); |
|||
} else { |
|||
if (sshamt >= 64) |
|||
WRITE_RD(0); |
|||
else |
|||
WRITE_RD(RS1 << sshamt); |
|||
WRITE_RD((uint128_t)RS1 << std::min(sshamt, 64)); |
|||
} |
|||
|
|||
|
|||
@ -1,13 +1,16 @@ |
|||
require_extension('P'); |
|||
require_rv32; |
|||
sreg_t sshamt = P_FIELD(RS2, 0, 8); |
|||
if (RS1 == 0) |
|||
WRITE_RD(0); |
|||
else if (sshamt >= 32) { |
|||
WRITE_RD((RS1 & 0x80000000) ? 0x80000000 : 0x7fffffff); |
|||
sreg_t val; |
|||
if (RS1 == 0) { |
|||
val = 0; |
|||
} else if (sshamt >= 32) { |
|||
val = (RS1 & 0x80000000) ? 0x80000000 : 0x7fffffff; |
|||
P.set_vxsat(); |
|||
} else if (sshamt <= -32) { |
|||
val = 0; |
|||
} else { |
|||
val = sshamt >= 0 ? P_SAT(32, static_cast<sreg_t> (RS1) << sshamt) : ((RS1 >> -sshamt) + ((RS1 >> (-sshamt - 1)) & 1)); |
|||
} |
|||
else if (sshamt <= -32) |
|||
WRITE_RD(0); |
|||
else |
|||
WRITE_RD(sshamt >= 0 ? P_SAT(32, static_cast<sreg_t> (RS1) << sshamt) : ((RS1 >> -sshamt) + ((RS1 >> (-sshamt - 1)) & 1))); |
|||
|
|||
WRITE_RD(sext32(val)); |
|||
|
|||
@ -1,18 +1,15 @@ |
|||
require_extension('P'); |
|||
require_rv32; |
|||
sreg_t sshamt = P_FIELD(RS2, 0, 8); |
|||
int sshamt = P_FIELD(RS2, 0, 8); |
|||
uint64_t shx; |
|||
if (sshamt < 0) { |
|||
if (sshamt <= -32) |
|||
WRITE_RD(0); |
|||
else |
|||
WRITE_RD(RS1 >> (-sshamt)); |
|||
shx = ((uint64_t)(uint32_t)RS1) >> std::min(-sshamt, 32); |
|||
} else { |
|||
uint64_t shx = (sshamt >= 32) ? ((uint64_t)RS1 << 32) : ((uint64_t)RS1 << sshamt); |
|||
if (shx > 0xFFFFFFFFULL) { |
|||
shx = (uint64_t)RS1 << std::min(sshamt, 32); |
|||
if (shx > UINT32_MAX) { |
|||
P.set_vxsat(); |
|||
WRITE_RD(0xFFFFFFFF); |
|||
} else { |
|||
WRITE_RD((uint32_t)shx); |
|||
shx = UINT32_MAX; |
|||
} |
|||
} |
|||
|
|||
WRITE_RD(sext32(shx)); |
|||
|
|||
@ -1,22 +1,16 @@ |
|||
require_extension('P'); |
|||
require_rv32; |
|||
sreg_t sshamt = P_FIELD(RS2, 0, 8); |
|||
if (sshamt < 0) { |
|||
int sshamt = P_FIELD(RS2, 0, 8); |
|||
uint64_t shx; |
|||
if (sshamt < -32) |
|||
shx = 0; |
|||
else if (sshamt == -32) |
|||
shx = (RS1 >> 31) & 1; |
|||
else |
|||
shx = ((uint64_t)RS1 << 1) >> (-sshamt); |
|||
WRITE_RD((uint32_t)((shx + 1) >> 1)); |
|||
if (sshamt < 0) { |
|||
shx = ((uint64_t)(uint32_t)RS1 << 1) >> std::min(-sshamt, 32); |
|||
shx = (shx + 1) >> 1; |
|||
} else { |
|||
uint64_t shx = (sshamt >= 32) ? ((uint64_t)RS1 << 32) : ((uint64_t)RS1 << sshamt); |
|||
if (shx > 0xFFFFFFFFULL) { |
|||
shx = (uint64_t)RS1 << std::min(sshamt, 32); |
|||
if (shx > UINT32_MAX) { |
|||
P.set_vxsat(); |
|||
WRITE_RD(0xFFFFFFFF); |
|||
} else { |
|||
WRITE_RD((uint32_t)shx); |
|||
shx = UINT32_MAX; |
|||
} |
|||
} |
|||
|
|||
WRITE_RD(sext32(shx)); |
|||
|
|||
Loading…
Reference in new issue