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]

FP bugs and conditional move


Hi,

Enabling fp constant conditional move in egcs exposes many egcs bugs in
fp constant handling. One bug is fold_rtx () tries to change

(insn 39 38 29 (set (reg:DF 23)
        (if_then_else:DF (ge (cc0)
                (const_int 0))
            (mem/u:DF (symbol_ref/u:SI ("*.LC1")))
            (mem/u:DF (symbol_ref/u:SI ("*.LC0"))))) -1 (nil)
    (nil))

into

(insn 39 38 29 (set (reg:DF 23)
        (if_then_else:DF (ge (cc0)
                (const_int 0))
            (const_double:DF (cc0) 0 0 1073709056)
            (const_double:DF (const_int 0) 0 0 -1073774592))) 380 {movdfcc_1} (nil)
    (nil))

The first one is ok on x87, but not the second one. x87 only allows
a limited number of fp constants which can be loaded into fp
regsiter directly. I believe that may be also true on many other
CPUs. A new macro, IMMEDIATE_CONST_DOUBLE_OK, can be used to
indicate if we can use it as an immediate double constant. On
x87, it is defined as

#define IMMEDIATE_CONST_DOUBLE_OK(V) standard_80387_constant_p(v)

Then we use it in fold_rtx ().

Thanks.


-- 
H.J. Lu (hjl@gnu.org)


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