[Bug target/102584] [OpenRISC] backend generates wrong halfword constant

thrustl at hotmail dot com gcc-bugzilla@gcc.gnu.org
Mon Oct 4 03:49:59 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102584

--- Comment #1 from thrustl at hotmail dot com ---
-fdump-tree-optimized looks fine, with one unsigned and one signed constant:

;; Function main (main, funcdef_no=0, decl_uid=1383, cgraph_uid=1,
symbol_order=0)

int main ()
{
  int D.1386;
  int _4;

;;   basic block 2, loop depth 0
;;    pred:       ENTRY
  f1 (61731);
  f2 (-3805);
  _4 = 0;
;;    succ:       3

;;   basic block 3, loop depth 0
;;    pred:       2
<L0>:
  return _4;
;;    succ:       EXIT

}

While the RTL generation shows both signed constant:

/* ...header omitted... */
(insn 5 2 6 2 (set (reg:HI 3 r3)
        (const_int -3805 [0xfffffffffffff123])) "35.c":6:5 -1
     (nil))
(call_insn 6 5 7 2 (parallel [
            (call (mem:SI (symbol_ref:SI ("f1") [flags 0x41]  <function_decl
0x7f45ceb62f00 f1>) [0 f1 S4 A32])
                (const_int 0 [0]))
            (clobber (reg:SI 9 r9))
        ]) "35.c":6:5 -1
     (nil)
    (expr_list:HI (use (reg:HI 3 r3))
        (nil)))
(insn 7 6 8 2 (set (reg:HI 3 r3)
        (const_int -3805 [0xfffffffffffff123])) "35.c":7:5 -1
     (nil))
(call_insn 8 7 9 2 (parallel [
            (call (mem:SI (symbol_ref:SI ("f2") [flags 0x41]  <function_decl
0x7f45ceb7f000 f2>) [0 f2 S4 A32])
                (const_int 0 [0]))
            (clobber (reg:SI 9 r9))
        ]) "35.c":7:5 -1
     (nil)
    (expr_list:HI (use (reg:HI 3 r3))
        (nil)))
/* The rest are omitted */


More information about the Gcc-bugs mailing list