[PATCH] D14730: [Aarch64] Add zero cost for extensions that may be eliminated.

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 02:34:13 PST 2015


sbaranga added a comment.

Correct me if I misunderstood, but emitting these instructions would require some context?

For example:

define <8 x i32> @g(<8 x i16>* %a, <8 x i32>* %b) {
entry:

  %opa = load <8 x i16>, <8 x i16>* %a
  %opb = load <8 x i32>, <8 x i32>* %b
  %zea = zext <8 x i16> %opa to <8 x i32>
  %res  = sub nsw <8 x i32> %zea, %opb
  ret <8 x i32> %res

}

gives:

ldr		q0, [x0]
	ldp		q2, q1, [x1]
	ushll	v3.4s, v0.4h, #0
	ushll2	v0.4s, v0.8h, #0
	sub	v1.4s, v0.4s, v1.4s
	sub	v0.4s, v3.4s, v2.4s
ret

which does perform an extension. This is a general problem with the cost model.
A fix for this this is matching this pattern (two exts and an add) in SLP and having a cost hook for it.

Do you think this might be an issue?

Thanks,
Silviu


http://reviews.llvm.org/D14730





More information about the llvm-commits mailing list