Ilya Lesokhin schrieb:

Please don't forget to CC the lists.

I think you are wrong.

the following in avr.md is wrong:

;; "mulhisi3"
;; "umulhisi3"
(define_expand "<extend_u>mulhisi3"
  [(parallel [(set (match_operand:SI 0 "register_operand" "")
                   (mult:SI (any_extend:SI (match_operand:HI 1
"register_operand" ""))
                            (any_extend:SI (match_operand:HI 2
"register_operand" ""))))
              (clobber (reg:HI 26))
              (clobber (reg:DI 18))])]
  "AVR_HAVE_MUL"
  "")

This is code from 4.7. The problem above is reported against 4.5.

you cant multiply two signed numbers this way, for example: -1*-1=1
and in 32bit its correct:  0xffffffff*0xffffffff = 1 (mod 2^32)

but using 16bit multiplication you get: 0xffff*0xffff=FFFE0001  (mod
2^32)  != -1.

In a n = n*n multiplication, and if flags don't matter, it does not
matter if you take the numbers as signed or unsigned; just like that
does not matter for addition or subtraction.

Anyway, in the pattern you see a widening multiplication, not a n = n*n
vanilla one. The multiply is performed with 32 bits so that you get
 0xffff * 0x0001 = 0xffffffff for example.

Johann

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to