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]

rs6000 machine description/assembly question


Hi, I have a question regarding a machine description template that
shows up in rs6000.md file of 2.95.3 release.

(define_insn "ffssi2"
  [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
	(ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  ""
  "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
  [(set_attr "length" "16")])

Here I dont understand the 1st 3 instructions. I think there is some
redundancy unless I am making some mistake.
I think negative of a number and a number itself will have same number
of leading zeros. so when you do and %0,%0,%1, %0 will have the same
number of leading zeros that %1 has. so whats the point of first two
instructions?
in other words, I think cntlzw %0, %1\;subfic %0,%0,32 should work same
as the above instructin sequence.
Can anyone tell what am I missing here?
Thanx
Spundun


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