+ if v30b_op not in svp64.instrs:
+ raise Exception("opcode %s of '%s' not an svp64 instruction" % \
+ (v30b_op, insn))
+ isa.instr[v30b_op].regs[0]
+ v30b_regs = isa.instr[v30b_op].regs[0]
+ rm = svp64.instrs[v30b_op]
+ print ("v3.0B regs", opcode, v30b_regs)
+ print (rm)
+
+ # right. the first thing to do is identify the ordering of
+ # the registers, by name. the EXTRA2/3 ordering is in
+ # rm['0']..rm['3'] but those fields contain the names RA, BB
+ # etc. we have to read the pseudocode to understand which
+ # reg is which in our instruction. sigh.
+
+ # first turn the svp64 rm into a "by name" dict, recording
+ # which position in the RM EXTRA it goes into
+ svp64_reg_byname = {}
+ for i in range(4):
+ rfield = rm[str(i)]
+ if not rfield or rfield == '0':
+ continue
+ print ("EXTRA field", i, rfield)
+ rfield = rfield.split(";") # s:RA;d:CR1 etc.
+ for r in rfield:
+ r = r[2:] # ignore s: and d:
+ svp64_reg_byname[r] = i # this reg in EXTRA position 0-3
+ print ("EXTRA field index, by regname", svp64_reg_byname)
+
+ # okaaay now we identify the field value (opcode N,N,N) with
+ # the pseudo-code info (opcode RT, RA, RB)
+ opregfields = zip(fields, v30b_regs) # err that was easy
+
+ # now for each of those find its place in the EXTRA encoding
+ extras = {}
+ for field, regname in opregfields:
+ extra = svp64_reg_byname[regname]
+ regtype = get_regtype(regname)
+ extras[extra] = (field, regname, regtype)
+ print (" ", extra, extras[extra])
+
+ etype = rm['Etype'] # Extra type: EXTRA3/EXTRA2