assembler/fs: allow more concise assembly
This commit is contained in:
parent
4777be84d4
commit
50c53376df
@ -12,6 +12,9 @@ LDFLAGS += $(shell pkg-config --libs libdrm) -lm
|
|||||||
%.vs.inc: %.vs.asm
|
%.vs.inc: %.vs.asm
|
||||||
PYTHONPATH=../regs/ python -m assembler.vs $< > $@
|
PYTHONPATH=../regs/ python -m assembler.vs $< > $@
|
||||||
|
|
||||||
|
%.fs.inc: %.fs.asm
|
||||||
|
PYTHONPATH=../regs/ python -m assembler.fs $< > $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
find . -type f ! -name "*.*" -delete
|
find . -type f ! -name "*.*" -delete
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,9 @@ US_FC_ADDR = parse_register("US_FC_ADDR")
|
|||||||
|
|
||||||
def emit_alpha_op(code, alpha_op):
|
def emit_alpha_op(code, alpha_op):
|
||||||
# dest
|
# dest
|
||||||
|
if alpha_op.dest.wmask is not None:
|
||||||
US_CMN_INST.ALPHA_WMASK(code, alpha_op.dest.wmask.value)
|
US_CMN_INST.ALPHA_WMASK(code, alpha_op.dest.wmask.value)
|
||||||
|
if alpha_op.dest.omask is not None:
|
||||||
US_CMN_INST.ALPHA_OMASK(code, alpha_op.dest.omask.value)
|
US_CMN_INST.ALPHA_OMASK(code, alpha_op.dest.omask.value)
|
||||||
|
|
||||||
# opcode
|
# opcode
|
||||||
@ -105,7 +107,9 @@ def emit_alpha_op(code, alpha_op):
|
|||||||
|
|
||||||
def emit_rgb_op(code, rgb_op):
|
def emit_rgb_op(code, rgb_op):
|
||||||
# dest
|
# dest
|
||||||
|
if rgb_op.dest.wmask is not None:
|
||||||
US_CMN_INST.RGB_WMASK(code, rgb_op.dest.wmask.value)
|
US_CMN_INST.RGB_WMASK(code, rgb_op.dest.wmask.value)
|
||||||
|
if rgb_op.dest.omask is not None:
|
||||||
US_CMN_INST.RGB_OMASK(code, rgb_op.dest.omask.value)
|
US_CMN_INST.RGB_OMASK(code, rgb_op.dest.omask.value)
|
||||||
|
|
||||||
# opcode
|
# opcode
|
||||||
@ -150,7 +154,7 @@ def emit_addr(code, addr):
|
|||||||
if src is not None:
|
if src is not None:
|
||||||
is_const = int(src.type is SrcAddrType.const)
|
is_const = int(src.type is SrcAddrType.const)
|
||||||
is_float = int(src.type is SrcAddrType.float)
|
is_float = int(src.type is SrcAddrType.float)
|
||||||
ADDR(code, (is_float << 7) | addr.alpha.src0.value)
|
ADDR(code, (is_float << 7) | src.value)
|
||||||
ADDR_CONST(code, is_const)
|
ADDR_CONST(code, is_const)
|
||||||
else:
|
else:
|
||||||
ADDR(code, (1 << 7) | 0)
|
ADDR(code, (1 << 7) | 0)
|
||||||
@ -165,5 +169,7 @@ def emit_instruction(code, ins):
|
|||||||
US_CMN_INST.TEX_SEM_WAIT(code, int(ins.tex_sem_wait))
|
US_CMN_INST.TEX_SEM_WAIT(code, int(ins.tex_sem_wait))
|
||||||
|
|
||||||
emit_addr(code, ins.addr)
|
emit_addr(code, ins.addr)
|
||||||
|
if ins.alpha_op is not None:
|
||||||
emit_alpha_op(code, ins.alpha_op)
|
emit_alpha_op(code, ins.alpha_op)
|
||||||
|
if ins.rgb_op is not None:
|
||||||
emit_rgb_op(code, ins.rgb_op)
|
emit_rgb_op(code, ins.rgb_op)
|
||||||
|
|||||||
@ -398,7 +398,7 @@ def validate_instruction_operation_dest(dest_addr_swizzles, mask_lookup, type_cl
|
|||||||
assert False, dest
|
assert False, dest
|
||||||
if len(addrs) > 1:
|
if len(addrs) > 1:
|
||||||
raise ValidatorError(f"too many destination addresses", operation.dest_addr_swizzles[-1].addr_identifier)
|
raise ValidatorError(f"too many destination addresses", operation.dest_addr_swizzles[-1].addr_identifier)
|
||||||
addrd, = addrs
|
addrd, = addrs if addrs else [0]
|
||||||
return type_cls(
|
return type_cls(
|
||||||
addrd=addrd,
|
addrd=addrd,
|
||||||
wmask=wmask,
|
wmask=wmask,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user