rexcode: remove dead BFCSEL else-target scaffolding; tidy mips COPY specgen

BFCSEL's else-target turned out to be the implicit fall-through, so the
BF_BELSE operand encoding, the BFCSEL_ELSE_T32 relocation, and their
encoder/decoder cases were never referenced by any table entry. Remove
them. Also restructure the MSA COPY specgen loop so COPY_U only iterates
.B/.H (COPY_U.W is mips64-only and emitted in the mips64 section), which
drops the spurious 'skipped COPY_U_W' message. No functional change to any
generated encode form; arm64/arm32/mips all still 100%, 461/600/281 tests
green.
This commit is contained in:
Brendan Punsky
2026-06-18 05:29:20 -04:00
committed by Flāvius
parent c8851c546d
commit 83bdd501a3
7 changed files with 6 additions and 15 deletions

View File

@@ -473,9 +473,6 @@ unpack_operand :: proc(word: u32, enc: Operand_Encoding, ot: Operand_Type) -> Op
imm10 := (word >> 1) & 0x3FF // hw1[10:1]
val := (imm10 << 1) | j
return op_rel_offset(i64(val) << 1)
case .BF_BELSE:
imm := (word >> 23) & 0xF
return op_rel_offset(i64(imm) << 1)
case .BF_RM:
return op_reg(Register(REG_GPR | u16((word >> 16) & 0xF)))
case .BFCSEL_COND:

View File

@@ -574,12 +574,6 @@ pack_operand_inline :: #force_inline proc(
type = .BF_BLOC_T32, size = 4, inst_idx = inst_idx,
})
return 0
case .BF_BELSE:
append(relocs, Relocation{
offset = pc, label_id = u32(op.relative),
type = .BFCSEL_ELSE_T32, size = 4, inst_idx = inst_idx,
})
return 0
case .BF_RM:
return (u32(reg_hw(op.reg)) & 0xF) << 16 // Rm at hw0[3:0] (word bits 19:16)
case .BFCSEL_COND:

View File

@@ -356,7 +356,6 @@ Operand_Encoding :: enum u8 {
// ARMv8.1-M Branch Future fields (T32):
BF_BOFF, // bf-point offset: imm4 at hw0[10:7], (label-PC-4)/2
BF_BLOC, // branch target: J at hw1[11] + imm10 at hw1[10:1]
BF_BELSE, // BFCSEL else-target: imm4 at hw0[? ] (relative to bf-point)
BF_RM, // BFLX/BFX register target at hw0[3:0]
BFCSEL_COND, // BFCSEL condition at hw0[5:2]

View File

@@ -44,7 +44,6 @@ Relocation_Type :: enum u8 {
// T32 Branch Future (ARMv8.1-M)
BF_BOFF_T32, // bf-point: imm4 at hw0[10:7] = (label - (PC+4))/2
BF_BLOC_T32, // branch target: J at hw1[11] + imm10 at hw1[10:1]
BFCSEL_ELSE_T32, // BFCSEL else-target relative to the bf-point
// Literal load (ADR / LDR PC-rel)
LDR_LITERAL_A32, // signed 12-bit (U bit + imm12)

View File

@@ -243,10 +243,12 @@ for _, b in ipairs({{"MADD","madd"},{"MSUB","msub"},{"NMADD","nmadd"},{"NMSUB","
end
-- ---- MSA COPY (vector lane -> GPR) and INSERT (GPR -> vector lane) ----------
for _, b in ipairs({{"COPY_S","copy_s"},{"COPY_U","copy_u"}}) do
for _, d in ipairs({{"B","b",15},{"H","h",7},{"W","w",3}}) do
local r = entry(b[1].."_"..d[1], "{.GPR,.MSA_VEC,.IMM5,.NONE}", "{.GPR_AT_6,.WS,.MSA_ELM_IDX,.NONE}", "MSA",
function(v) return string.format("%s.%s $%d,$w%d[%d]", b[2], d[2], v[1], v[2], v[3]) end, {31,31,d[3]})
-- COPY_S has .B/.H/.W; COPY_U only .B/.H on mips32 (COPY_U.W is a mips64-only
-- form, emitted in the mips64 section below).
for _, c in ipairs({{"COPY_S","copy_s",{{"B","b",15},{"H","h",7},{"W","w",3}}}, {"COPY_U","copy_u",{{"B","b",15},{"H","h",7}}}}) do
for _, d in ipairs(c[3]) do
local r = entry(c[1].."_"..d[1], "{.GPR,.MSA_VEC,.IMM5,.NONE}", "{.GPR_AT_6,.WS,.MSA_ELM_IDX,.NONE}", "MSA",
function(v) return string.format("%s.%s $%d,$w%d[%d]", c[2], d[2], v[1], v[2], v[3]) end, {31,31,d[3]})
if r then sections[#sections+1]=r end
end
end