Commit af3c3ec
authored
[AArch64] recognise trn1/trn2 with flipped operands (#169858)
This PR is very similar to #167235, but applied to `trn` rather than
`zip`. There are two further differences:
- The `@combine_v8i16_8first` and `@combine_v8i16_8firstundef` test
cases in `arm64-zip.ll` didn't have equivalents in `arm64-trn.ll`, so
this PR adds new test cases `@vtrni8_8first`, `@vtrni8_9first`,
`@vtrni8_89first_undef`.
- `AArch64TTIImpl::getShuffleCost` calls `isZIPMask`, but not
`isTRNMask`. It relies on `Kind == TTI::SK_Transpose` instead (which
in turn is based on `ShuffleVectorInst::isTransposeMask` through
`improveShuffleKindFromMask`).
Therefore, this PR does not itself influence the slp-vectorizer. In a
follow-up PR, I intend to override
`AArch64TTIImpl::improveShuffleKindFromMask` to ensure we get
`ShuffleKind::SK_Transpose` based on the new `isTRNMask`. In fact, that
follow-up change is the actual motivation for this PR, as it will result
in
```C++
int8x16_t g(int8_t x)
{
return (int8x16_t) { 0, x, 1, x, 2, x, 3, x,
4, x, 5, x, 6, x, 7, x };
}
```
from #137447 being optimised by the slp-vectorizer.1 parent 8a115b6 commit af3c3ec
File tree
6 files changed
+202
-123
lines changed- llvm
- lib/Target/AArch64
- GISel
- test/CodeGen/AArch64
6 files changed
+202
-123
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14965 | 14965 | | |
14966 | 14966 | | |
14967 | 14967 | | |
14968 | | - | |
| 14968 | + | |
14969 | 14969 | | |
14970 | | - | |
| 14970 | + | |
| 14971 | + | |
14971 | 14972 | | |
14972 | 14973 | | |
14973 | 14974 | | |
| |||
16679 | 16680 | | |
16680 | 16681 | | |
16681 | 16682 | | |
16682 | | - | |
| 16683 | + | |
16683 | 16684 | | |
16684 | 16685 | | |
16685 | 16686 | | |
| |||
31798 | 31799 | | |
31799 | 31800 | | |
31800 | 31801 | | |
31801 | | - | |
| 31802 | + | |
| 31803 | + | |
31802 | 31804 | | |
31803 | | - | |
31804 | | - | |
| 31805 | + | |
| 31806 | + | |
| 31807 | + | |
| 31808 | + | |
31805 | 31809 | | |
31806 | 31810 | | |
31807 | 31811 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6699 | 6699 | | |
6700 | 6700 | | |
6701 | 6701 | | |
6702 | | - | |
6703 | | - | |
| 6702 | + | |
| 6703 | + | |
| 6704 | + | |
| 6705 | + | |
6704 | 6706 | | |
6705 | | - | |
| 6707 | + | |
6706 | 6708 | | |
6707 | 6709 | | |
6708 | | - | |
6709 | | - | |
| 6710 | + | |
| 6711 | + | |
| 6712 | + | |
| 6713 | + | |
| 6714 | + | |
| 6715 | + | |
| 6716 | + | |
| 6717 | + | |
| 6718 | + | |
6710 | 6719 | | |
6711 | 6720 | | |
6712 | | - | |
6713 | | - | |
| 6721 | + | |
| 6722 | + | |
| 6723 | + | |
| 6724 | + | |
| 6725 | + | |
| 6726 | + | |
| 6727 | + | |
| 6728 | + | |
| 6729 | + | |
6714 | 6730 | | |
6715 | 6731 | | |
6716 | | - | |
6717 | | - | |
| 6732 | + | |
| 6733 | + | |
| 6734 | + | |
| 6735 | + | |
| 6736 | + | |
| 6737 | + | |
| 6738 | + | |
| 6739 | + | |
| 6740 | + | |
6718 | 6741 | | |
6719 | 6742 | | |
6720 | | - | |
| 6743 | + | |
| 6744 | + | |
6721 | 6745 | | |
6722 | 6746 | | |
6723 | | - | |
6724 | | - | |
6725 | | - | |
6726 | | - | |
6727 | | - | |
6728 | | - | |
| 6747 | + | |
| 6748 | + | |
6729 | 6749 | | |
6730 | 6750 | | |
6731 | 6751 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | | - | |
| 222 | + | |
222 | 223 | | |
223 | 224 | | |
224 | | - | |
225 | | - | |
| 225 | + | |
| 226 | + | |
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
249 | 306 | | |
250 | 307 | | |
251 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
13 | 12 | | |
14 | | - | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| |||
0 commit comments