This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

if_then_else usage in attribute computation


Hi,

Recently I found a weird behavior in attribute computation when
if_then_else is used. It may be easily demonstrated on i386 jump
instruction. It's original length attribute definition is following:

   (set (attr "length")
           (if_then_else (and (ge (minus (match_dup 0) (pc))
                                  (const_int -126))
                              (lt (minus (match_dup 0) (pc))
                                  (const_int 128)))
             (const_int 2)
             (const_int 5)))

I change it keeping the same resulting values:

   (set (attr "length")
           (if_then_else (and (ge (minus (match_dup 0) (pc))
                                  (const_int -126))
                              (lt (minus (match_dup 0) (pc))
                                  (const_int 128)))
             (plus (const_int 2) (const_int 0))
             (plus (const_int 5) (const_int 0))))

After that change I see in assembler:

        jmp     .L2     # 412   jump    [length = 2147483647]

It also causes fails in make check because some optimizations work in
a different way when size changes.

I tried to debug it and found that insn_current_length function always
return correct values when called for jump insn.

Seems problem always occurs when 'if_then_else' or 'cond' is combined
with 'plus'. Is such combination supposed to work?

Thanks,
Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]