Re: Problem with zero extend from BI to SI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jeff,

It is not in the backend.
The assign from BI to QI is produced in the front-end of the compiler.
I debugged it all the way, to finally find out there is no such thing as a BI type in
the front-end of the compiler. :-(.
Boolean is always QI, its not hard-wired, but among the zillions of types in the
front-end, there is no BI.
As a result, I have given it up. Trying another solution.

Best Regards,

Henri.


On 02/07/2020 05:04 PM, Jeff Law wrote:
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






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux