#42 BURS rules for storing booleans in INTs

closed
None
5
2012-09-21
2006-03-29
Ian Rogers
No

A long running feature request #1147147 is that we pack
subword quantities in objects. We don't currently so
we store boolean quantities using INT_STORE (see
OPT_IRTools.getStoreOp). This means the Intel BURS rule:
stm: BYTE_STORE(boolcmp, OTHER_OPERAND(r,riv))
never gets fired. This means we generate a store of a
boolcmp to memory as:
1) test
2) set
3) zero extend set result
4) move zero extended result to memory
This can be simplified down to:
1) test
2) mov zero to memory
3) set least significant byte in memory
Although fixing REF #1147147 would be better as that
would generate:
1) test
2) set memory
Anyway, this patch at least makes option 2 a choice. As
ever, the BURS costs a guesses.

NB we zero extend rather than clearing the register as
the register allocator detects the clearing of the
register prior to setting as dead code. As this patch
concerns memory, the register allocator isn't a problem.

    STATEMENT OF ORIGIN FOR A SINGLE CONTRIBUTOR

I, Ian Rogers:

(a) represent that either:

(i) I am the only author and owner of the contributed
software
(described as/entitled BURS rules for storing
booleans in INTs
),
which was neither derived nor copied from any
other software,
or

(ii) that any exception to (i) is software which was
obtained under the
CPL (Common Public License),

and

(b) hereby agree to license this contributed software
under the CPL.

Discussion

  • Ian Rogers

    Ian Rogers - 2006-03-29

    Patch to allow int stores to store boolean results in Intel BURS rules.

     
  • Ian Rogers

    Ian Rogers - 2006-03-29

    Logged In: YES
    user_id=308843

    If we knew we were storing the boolcmp to a memory location
    that only ever held a boolean we could remove the mov
    [mem],0 (step 2). It's worth noting this patch will also
    free a register :-)

    Ian

     
  • Ian Rogers

    Ian Rogers - 2006-03-29

    Logged In: YES
    user_id=308843

    By peeking at the location operand it's possible to realise
    that the INT_STORE is only actually accessing a boolean or
    byte. This patch makes it so that for bools and bytes we
    generate:

    1) test
    2) set with memory

    Happy, happy, joy, joy..

    Ian

     
  • Ian Rogers

    Ian Rogers - 2006-04-06

    Logged In: YES
    user_id=308843

    I'm fairly sure there's a bug with this now. I will submit a
    fix soon. Thanks,
    Ian

     
  • Ian Rogers

    Ian Rogers - 2006-04-12

    Logged In: YES
    user_id=308843

    There's definitely a bug, but I'm not sure why. I will
    submit a proper patch later and close this one for now.
    Ian

     
  • Dave Grove

    Dave Grove - 2006-04-13

    Logged In: YES
    user_id=1215435

    thanks, yep. I was about to remark that it seemed to break
    a few things for me, but that I had deferred looking at it
    until I had a chance to get the PPC32 regressions working
    again (they've been off for a while due to machine changes,
    and the system has rotted a little bit in the meantime).

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks