<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp, branch users/chapuni/cov/single/switch</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[AArch64] Fix signed comparison warning. NFC</title>
<updated>2025-01-08T08:59:15+00:00</updated>
<author>
<name>David Green</name>
<email>david.green@arm.com</email>
</author>
<published>2025-01-08T08:59:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=32bc029be6265838833623fdd88cc665d5658dc7'/>
<id>32bc029be6265838833623fdd88cc665d5658dc7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] Add a subvector extract cost. (#121472)</title>
<updated>2025-01-08T08:13:07+00:00</updated>
<author>
<name>David Green</name>
<email>david.green@arm.com</email>
</author>
<published>2025-01-08T08:13:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a8dab1aa036f248d551f7839360eb03fac4b7d96'/>
<id>a8dab1aa036f248d551f7839360eb03fac4b7d96</id>
<content type='text'>
These can generally be emitted using an ext instruction or mov from the
high half. The half half extracts can be free depending on the users,
but that is not handled here, just the basic costs. It originally
included all subvector extracts, but that was toned-down to just
half-vector extracts to try and help the mid end not breakup high/low
extracts without having the SLP vectorizer create a mess using other
shuffles.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These can generally be emitted using an ext instruction or mov from the
high half. The half half extracts can be free depending on the users,
but that is not handled here, just the basic costs. It originally
included all subvector extracts, but that was toned-down to just
half-vector extracts to try and help the mid end not breakup high/low
extracts without having the SLP vectorizer create a mess using other
shuffles.</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] Add BF16 fpext and fptrunc costs. (#119524)</title>
<updated>2025-01-07T09:39:08+00:00</updated>
<author>
<name>David Green</name>
<email>david.green@arm.com</email>
</author>
<published>2025-01-07T09:39:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2db7b314da367e1a6bf8cf34df16f9ad5ad62f5e'/>
<id>2db7b314da367e1a6bf8cf34df16f9ad5ad62f5e</id>
<content type='text'>
This expands the recently added fp16 fpext and fpround costs to bf16.
Some of the costs are taken from the rough number of instructions
needed, some are a little aspirational.
https://godbolt.org/z/bGEEd1vsW</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This expands the recently added fp16 fpext and fpround costs to bf16.
Some of the costs are taken from the rough number of instructions
needed, some are a little aspirational.
https://godbolt.org/z/bGEEd1vsW</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] Improve codegen of vectorised early exit loops (#119534)</title>
<updated>2025-01-06T13:17:14+00:00</updated>
<author>
<name>David Sherwood</name>
<email>david.sherwood@arm.com</email>
</author>
<published>2025-01-06T13:17:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=346185c42c59c344fcf0d9fd476c85d287181baf'/>
<id>346185c42c59c344fcf0d9fd476c85d287181baf</id>
<content type='text'>
Once PR #112138 lands we are able to start vectorising more loops
that have uncountable early exits. The typical loop structure
looks like this:

vector.body:
  ...
  %pred = icmp eq &lt;2 x ptr&gt; %wide.load, %broadcast.splat
  ...
  %or.reduc = tail call i1 @llvm.vector.reduce.or.v2i1(&lt;2 x i1&gt; %pred)
  %iv.cmp = icmp eq i64 %index.next, 4
  %exit.cond = or i1 %or.reduc, %iv.cmp
  br i1 %exit.cond, label %middle.split, label %vector.body

middle.split:
  br i1 %or.reduc, label %found, label %notfound

found:
  ret i64 1

notfound:
  ret i64 0

The problem with this is that %or.reduc is kept live after the loop,
and since this is a boolean it typically requires making a copy of
the condition code register. For AArch64 this requires an additional
cset instruction, which is quite expensive for a typical find loop
that only contains 6 or 7 instructions.

This patch attempts to improve the codegen by sinking the reduction
out of the loop to the location of it's user. It's a lot cheaper to
keep the predicate alive if the type is legal and has lots of
registers for it. There is a potential downside in that a little
more work is required after the loop, but I believe this is worth
it since we are likely to spend most of our time in the loop.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Once PR #112138 lands we are able to start vectorising more loops
that have uncountable early exits. The typical loop structure
looks like this:

vector.body:
  ...
  %pred = icmp eq &lt;2 x ptr&gt; %wide.load, %broadcast.splat
  ...
  %or.reduc = tail call i1 @llvm.vector.reduce.or.v2i1(&lt;2 x i1&gt; %pred)
  %iv.cmp = icmp eq i64 %index.next, 4
  %exit.cond = or i1 %or.reduc, %iv.cmp
  br i1 %exit.cond, label %middle.split, label %vector.body

middle.split:
  br i1 %or.reduc, label %found, label %notfound

found:
  ret i64 1

notfound:
  ret i64 0

The problem with this is that %or.reduc is kept live after the loop,
and since this is a boolean it typically requires making a copy of
the condition code register. For AArch64 this requires an additional
cset instruction, which is quite expensive for a typical find loop
that only contains 6 or 7 instructions.

This patch attempts to improve the codegen by sinking the reduction
out of the loop to the location of it's user. It's a lot cheaper to
keep the predicate alive if the type is legal and has lots of
registers for it. There is a potential downside in that a little
more work is required after the loop, but I believe this is worth
it since we are likely to spend most of our time in the loop.</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64][SME] Disable inlining of callees with new ZT0 state (#121338)</title>
<updated>2025-01-06T12:02:28+00:00</updated>
<author>
<name>Kerry McLaughlin</name>
<email>kerry.mclaughlin@arm.com</email>
</author>
<published>2025-01-06T12:02:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d8d4c187619098ee7b0497b4f40311e3ee1f9259'/>
<id>d8d4c187619098ee7b0497b4f40311e3ee1f9259</id>
<content type='text'>
Inlining must be disabled for new-ZT0 callees as the callee is required
to save ZT0 and toggle PSTATE.ZA on entry.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Inlining must be disabled for new-ZT0 callees as the callee is required
to save ZT0 and toggle PSTATE.ZA on entry.</pre>
</div>
</content>
</entry>
<entry>
<title>[IRBuilder] Refactor FMF interface (#121657)</title>
<updated>2025-01-06T06:37:04+00:00</updated>
<author>
<name>Yingwei Zheng</name>
<email>dtcxzyw2333@gmail.com</email>
</author>
<published>2025-01-06T06:37:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a77346bad0d80a7f7e184f3d6e12c7f532101136'/>
<id>a77346bad0d80a7f7e184f3d6e12c7f532101136</id>
<content type='text'>
Up to now, the only way to set specified FMF flags in IRBuilder is to
use `FastMathFlagGuard`. It makes the code ugly and hard to maintain.

This patch introduces a helper class `FMFSource` to replace the original
parameter `Instruction *FMFSource` in IRBuilder. To maximize the
compatibility, it accepts an instruction or a specified FMF.
This patch also removes the use of `FastMathFlagGuard` in some simple
cases.

Compile-time impact:
https://llvm-compile-time-tracker.com/compare.php?from=f87a9db8322643ccbc324e317a75b55903129b55&amp;to=9397e712f6010be15ccf62f12740e9b4a67de2f4&amp;stat=instructions%3Au</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Up to now, the only way to set specified FMF flags in IRBuilder is to
use `FastMathFlagGuard`. It makes the code ugly and hard to maintain.

This patch introduces a helper class `FMFSource` to replace the original
parameter `Instruction *FMFSource` in IRBuilder. To maximize the
compatibility, it accepts an instruction or a specified FMF.
This patch also removes the use of `FastMathFlagGuard` in some simple
cases.

Compile-time impact:
https://llvm-compile-time-tracker.com/compare.php?from=f87a9db8322643ccbc324e317a75b55903129b55&amp;to=9397e712f6010be15ccf62f12740e9b4a67de2f4&amp;stat=instructions%3Au</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] Add an option for sve-prefer-fixed-over-scalable-if-equal. NFC</title>
<updated>2024-12-31T11:07:42+00:00</updated>
<author>
<name>David Green</name>
<email>david.green@arm.com</email>
</author>
<published>2024-12-31T11:07:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b35d3453ddf14e9564a6b65bd325051f4492311c'/>
<id>b35d3453ddf14e9564a6b65bd325051f4492311c</id>
<content type='text'>
Add a new option to control preferFixedOverScalableIfEqualCost, useful for
testing.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a new option to control preferFixedOverScalableIfEqualCost, useful for
testing.
</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] SME implementation for agnostic-ZA functions (#120150)</title>
<updated>2024-12-23T19:10:21+00:00</updated>
<author>
<name>Sander de Smalen</name>
<email>sander.desmalen@arm.com</email>
</author>
<published>2024-12-23T19:10:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2ce168baed02c7a6fdb039f4a2d9e48dee31e5c9'/>
<id>2ce168baed02c7a6fdb039f4a2d9e48dee31e5c9</id>
<content type='text'>
This implements the lowering of calls from agnostic-ZA functions to
non-agnostic-ZA functions, using the ABI routines
`__arm_sme_state_size`, `__arm_sme_save` and `__arm_sme_restore`.

This implements the proposal described in the following PRs:
* https://github.com/ARM-software/acle/pull/336
* https://github.com/ARM-software/abi-aa/pull/264</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the lowering of calls from agnostic-ZA functions to
non-agnostic-ZA functions, using the ABI routines
`__arm_sme_state_size`, `__arm_sme_save` and `__arm_sme_restore`.

This implements the proposal described in the following PRs:
* https://github.com/ARM-software/acle/pull/336
* https://github.com/ARM-software/abi-aa/pull/264</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] Unroll some loops with early-continues on Apple Silicon. (#118499)</title>
<updated>2024-12-22T13:10:54+00:00</updated>
<author>
<name>Florian Hahn</name>
<email>flo@fhahn.com</email>
</author>
<published>2024-12-22T13:10:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d486b768238c84b3fea8cb35aaceab1ae5204f92'/>
<id>d486b768238c84b3fea8cb35aaceab1ae5204f92</id>
<content type='text'>
Try to runtime-unroll loops with early-continues depending on
loop-varying loads; this helps with branch-prediction for the
early-continues and can significantly improve performance
for such loops

Builds on top of https://github.com/llvm/llvm-project/pull/118317.

PR: https://github.com/llvm/llvm-project/pull/118499.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Try to runtime-unroll loops with early-continues depending on
loop-varying loads; this helps with branch-prediction for the
early-continues and can significantly improve performance
for such loops

Builds on top of https://github.com/llvm/llvm-project/pull/118317.

PR: https://github.com/llvm/llvm-project/pull/118499.</pre>
</div>
</content>
</entry>
<entry>
<title>[AArch64] Tweak truncate costs for some scalable vector types (#119542)</title>
<updated>2024-12-19T10:07:41+00:00</updated>
<author>
<name>David Sherwood</name>
<email>david.sherwood@arm.com</email>
</author>
<published>2024-12-19T10:07:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=eaf482f01252a0276a6b422dabe810a1abc7e168'/>
<id>eaf482f01252a0276a6b422dabe810a1abc7e168</id>
<content type='text'>
== We were previously returning an invalid cost when truncating
anything to &lt;vscale x 2 x i1&gt;, which is incorrect since we can
generate perfectly good code for this.

== The costs for truncating legal or unpacked types to predicates
seemed overly optimistic. For example, when truncating
&lt;vscale x 8 x i16&gt; to &lt;vscale x 8 x i1&gt; we typically do
something like

  and z0.h, z0.h, #0x1
  cmpne   p0.h, p0/z, z0.h, #0

I guess it might depend upon whether the input value is
generated in the same block or not and if we can avoid the
inreg zero-extend. However, it feels safe to take the more
conservative cost here.

== The costs for some truncates such as

  trunc &lt;vscale x 2 x i32&gt; %a to &lt;vscale x 2 x i16&gt;

were 1, whereas in actual fact they are free and no instructions
are required.

== Also, for this

  trunc &lt;vscale x 8 x i32&gt; %a to &lt;vscale x 8 x i16&gt;

it's just a single uzp1 instruction so I reduced the cost to 1.

In general, I've added costs for all cases where the destination
type is legal or unpacked. One unfortunate side effect of this
is the costs for some fixed-width truncates when using SVE now
look too optimistic.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
== We were previously returning an invalid cost when truncating
anything to &lt;vscale x 2 x i1&gt;, which is incorrect since we can
generate perfectly good code for this.

== The costs for truncating legal or unpacked types to predicates
seemed overly optimistic. For example, when truncating
&lt;vscale x 8 x i16&gt; to &lt;vscale x 8 x i1&gt; we typically do
something like

  and z0.h, z0.h, #0x1
  cmpne   p0.h, p0/z, z0.h, #0

I guess it might depend upon whether the input value is
generated in the same block or not and if we can avoid the
inreg zero-extend. However, it feels safe to take the more
conservative cost here.

== The costs for some truncates such as

  trunc &lt;vscale x 2 x i32&gt; %a to &lt;vscale x 2 x i16&gt;

were 1, whereas in actual fact they are free and no instructions
are required.

== Also, for this

  trunc &lt;vscale x 8 x i32&gt; %a to &lt;vscale x 8 x i16&gt;

it's just a single uzp1 instruction so I reduced the cost to 1.

In general, I've added costs for all cases where the destination
type is legal or unpacked. One unfortunate side effect of this
is the costs for some fixed-width truncates when using SVE now
look too optimistic.</pre>
</div>
</content>
</entry>
</feed>
