compare instructions

Dmitry diwil@eis.ru
Mon Jan 28 05:59:00 GMT 2002


Jan,
thanks. I declared a pattern then like:

(define_insn "*tstsi_for_zero_const"
  [(set (cc0) (compare:SI (and:SI (match_operand:SI 0 "nonimmediate_operand" "rm")
                                  (match_operand:SI 1 "const_int_operand"    ""))
                          (const_int 0)))
                      (clobber (match_operand:HI 2 "register_operand" ""))]
 "(halfnibble_integer(operands[1],SImode)||halfnibble_constant(operands[1],SImode))"
 ";#")

(define_split
  [(set (cc0) (compare:SI (and:SI (match_operand:SI 0 "nonimmediate_operand" "rm")
                                  (match_operand:SI 1 "const_int_operand" ""))
                          (const_int 0)))
                      (clobber (match_operand:HI 2 "register_operand" ""))]
 "(halfnibble_integer(operands[1],SImode)||halfnibble_constant(operands[1],SImode))"
 [(set (match_dup 2)
       (and:HI (match_dup 0)
               (match_dup 1)))
  (set (cc0) (match_dup 2))]
"
{
        int n = which_nibble(INTVAL(operands[1]));
        if(n==0)
        {
                operands[0] = gen_lowpart(HImode, operands[0]);
                operands[1] = gen_rtx_CONST_INT(HImode,INTVAL(operands[1]));   
        }
        else
        {
                operands[0] = gen_highpart(HImode, operands[0]);
                operands[1] = gen_rtx_CONST_INT(HImode,(INTVAL(operands[1])>>16));
        }
}
")


recog_for_combine debug for 'while(a&8L);' shows:

*pnewpat
(parallel[ 
        (set (reg:HI 23)
            (and:HI (mem/f:HI (symbol_ref:HI ("a")) 0)
                (const_int 8 [0x8])))
        (set (reg:SI 22)
            (and:SI (mem/f:SI (symbol_ref:HI ("a")) 0)
                (const_int 8 [0x8])))
    ] )
insn
(insn 28 27 29 (set (reg:HI 23)
        (and:HI (mem/f:HI (symbol_ref:HI ("a")) 0)
            (const_int 8 [0x8]))) -1 (insn_list 27 (nil))
    (nil))
*pnotes
(insn 27 4 28 (set (reg:SI 22)
        (and:SI (mem/f:SI (symbol_ref:HI ("a")) 0)
            (const_int 8 [0x8]))) -1 (nil)
    (nil))
 >> exit from recog_for_combine with code -1 ---------------
*pnewpat
(set (pc)
    (if_then_else (ne (reg:HI 23)
            (const_int 0 [0x0]))
        (label_ref 18)
        (pc)))
insn
(jump_insn 15 14 20 (set (pc)
        (if_then_else (ne (reg:HI 23)
                (const_int 0 [0x0]))
            (label_ref 18)
            (pc))) -1 (nil)
    (nil))
*pnotes
(insn 14 26 15 (set (cc0)
        (reg:HI 23)) -1 (nil)
    (nil))
 >> exit from recog_for_combine with code -1 ---------------

It seems to me, that it does not want to produce an instruction defined.
Did I miss something here?

Cheers,
Dmitry.


Jan Hubicka <jh at suse dot cz> Wrote:
....

*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
*********************************************************************



More information about the Gcc mailing list