On Wed, 2020-02-05 at 20:47 +0100, Henri Cloetens wrote: > Hello all, > > I have a problem with zero extension from BI mode into SI mode. > I try to compile following piece of code: > > _Bool check_test(int a, int b) > { > _Bool check = (a > b) ; > return(check) ; > } > > The description is such that it puts the _Bool check flag in the > Condition Code register. > This is a 16-bit register file in the machine that handles booleans. > The calling convention of the machine returns the return value in > register 32. > To do this operation, a sign extend from the boolean (BI) check to the > int (SI) > R20 needs to be done. When I run the code through the compiler, after > the expand step, > I get following: > > file : check_test2.c.233r.expand > > <preceding INSNs putting the result into check> > > (insn 10 9 11 2 (set (reg:QI 79 [ check ]) > (reg:BI 81)) "check_test2.c":3:7 -1 > (nil)) > (insn 11 10 12 2 (set (reg:SI 82) > (zero_extend:SI (reg:QI 79 [ check ]))) "check_test2.c":4:7 -1 > (nil)) > (insn 12 11 16 2 (set (reg/v:SI 74 [ <retval> ]) > (reg:SI 82)) "check_test2.c":4:7 -1 > (nil)) > > The first insn of this list is not consistent. I mean, as far as I > understand it, it should be a zero_extend and not a set. Right. You can't mix modes like that. The way I'd debug this would be to put a conditional breakpoint in make_insn_raw using cur_insn_uid == 10 as the condition (cur_insn_uid is a macro these days, so you'll have to expand it to get the field within the crtl structure you want). jeff