unrecognizable insn for byte compare in private backend

Mark Burkley mark@burkley.net
Wed Dec 27 12:50:35 GMT 2023


Hi all,

I am having with some issues in my private backend for the TMS9900 CPU 
that I hope somebody can give me some pointers to debug.

The original backend was developed for gcc-4.4.0.  I have managed to get 
this into reasonable shape now and it does create functional, though 
slightly suboptimal, machine code.  So I have recently migrated to 
gcc-13.2.0 to make sure I'm not chasing issues that have been solved by 
more recent versions of gcc.

One of the main changes was the cc0 migration.  The TMS9900 clobbers CC 
on almost every instruction so I've defined splits with condition of 
reload_completed to emit a compare before emitting jumps.  This is 
working up to a point but I'm struggling to find why I'm getting this error:

     zap.c: In function ‘test’:
     zap.c:18:1: error: unrecognizable insn:
        18 | }
           | ^
     (insn 31 30 32 (set (reg:CC 16 st)
             (compare:CC (reg:QI 1 r1 [orig:25 b.0_1 ] [25])
                 (const_int -1 [0xffffffffffffffff]))) "zap.c":7:8 -1
          (nil))
     during RTL pass: split5

given that I have a byte compare insn that does exactly that:

     (define_insn "cmpqi"
       [(set (reg:CC CC_REGNUM)
             (compare:CC (match_operand:QI 0 "nonimmediate_operand" 
"rR,rR,Q, Q,rR,Q,r,R,Q")
                         (match_operand:QI 1 "general_operand" "rR,Q, 
rR,Q,O, O,i,i,i")))
         (clobber (match_operand:QI 2 "register_operand" ""))]
       ""

albeit with a clobber, since I need to load the constant to a general 
reg to do a byte compare.  All immediate ops are 16-bit only.  But 
temporarily removing the clobber didn't match it either.

Many thanks in advance for any help

Mark




More information about the Gcc-help mailing list