This is the mail archive of the gcc-bugs@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]

Minor bug in sh.md?


I think the definition of ashlsi_c in sh.md is slightly wrong:

(define_insn "ashlsi_c"
  [(set (match_operand:SI 0 "arith_reg_operand" "=r")
        (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") 
(const_int 1)))
   (set (reg:SI 18) (lt:SI (match_operand:SI 2 "arith_reg_operand" "0")
                           (const_int 0)))]

The T bit (reg 18) is set if the operand 0 is negative, because the MSB is
shifted into the T bit, and not the MSB of an arbitrary operand 2.

If this is correct, please apply this patch:

*** sh.md.bak   Mon Mar 16 11:54:05 1998
--- sh.md       Mon Mar 16 11:54:29 1998
***************
*** 1256,1262 ****
    [(const_int 0)]
    "
  {
!   emit_insn (gen_ashlsi_c (operands[0], operands[1], operands[1]));
    emit_insn (gen_subc1 (operands[0], operands[0], operands[0]));
    DONE;
  }")
--- 1256,1262 ----
    [(const_int 0)]
    "
  {
!   emit_insn (gen_ashlsi_c (operands[0], operands[1]));
    emit_insn (gen_subc1 (operands[0], operands[0], operands[0]));
    DONE;
  }")
***************
*** 1264,1270 ****
  (define_insn "ashlsi_c"
    [(set (match_operand:SI 0 "arith_reg_operand" "=r")
        (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") 
(const_int 1)))
!    (set (reg:SI 18) (lt:SI (match_operand:SI 2 "arith_reg_operand" "0")
                           (const_int 0)))]
    ""
    "shll       %0"
--- 1264,1270 ----
  (define_insn "ashlsi_c"
    [(set (match_operand:SI 0 "arith_reg_operand" "=r")
        (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") 
(const_int 1)))
!    (set (reg:SI 18) (lt:SI (match_dup 1)
                           (const_int 0)))]
    ""
    "shll       %0"

Toshi




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