[Mlir-commits] [mlir] [mlir][ArmSVE] Lower predicate-sized vector.create_masks to whilelt (PR #95531)

Benjamin Maxwell llvmlistbot at llvm.org
Fri Jun 14 05:09:12 PDT 2024


MacDue wrote:

As an example:

```
func.func @mask(%a: index) -> vector<[16]xi1> {
  %0 = vector.create_mask %a : vector<[16]xi1>
  return %0 : vector<[16]xi1>
}
```

Currently lowers to:
```
	index	z0.s, #0, #1
	mov	z1.s, w0
	ptrue	p0.s
	mov	z2.d, z0.d
	mov	z3.d, z0.d
	cmpgt	p3.s, p0/z, z1.s, z0.s
	incw	z2.s
	incw	z3.s, all, mul #2
	mov	z4.d, z2.d
	cmpgt	p1.s, p0/z, z1.s, z3.s
	incw	z4.s, all, mul #2
	cmpgt	p2.s, p0/z, z1.s, z4.s
	cmpgt	p0.s, p0/z, z1.s, z2.s
	uzp1	p1.h, p1.h, p2.h
	uzp1	p0.h, p3.h, p0.h
	uzp1	p0.b, p0.b, p1.b
	ret
```

With this patch it lowers to:
```
	whilelt	p0.b, xzr, x0
	ret
```

https://github.com/llvm/llvm-project/pull/95531


More information about the Mlir-commits mailing list