Commit 151b440
committed
[AArch64] Improve expansion of immediates of the form (~w << 32 | w).
When one half of a 64-bit immediate corresponds to the negation of the
other half, we can use a sequence of MOVN, MOVK and EOR to expand the
bottom half of the immediate and replicate its negation to the top half.
In the general case, this saves us a MOVK compared to expanding the
immediate explicitly.
As a refinement, when the bottom half contains a 16-bit chunk of ones,
the intermediate MOVK can be omitted. Similarly, when the bottom half
contains a chunk of zeros, we can alternatively expand its negation and
use a EON to reconstruct the expected result. In either case, this still
saves us a MOVK compared to the default expansion.1 parent 3056f39 commit 151b440
File tree
3 files changed
+69
-16
lines changed- llvm
- lib/Target/AArch64
- test/CodeGen/AArch64
3 files changed
+69
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 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 | + | |
242 | 293 | | |
243 | 294 | | |
244 | 295 | | |
| |||
617 | 668 | | |
618 | 669 | | |
619 | 670 | | |
620 | | - | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
621 | 677 | | |
622 | 678 | | |
623 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
560 | | - | |
561 | | - | |
562 | | - | |
| 560 | + | |
| 561 | + | |
563 | 562 | | |
564 | 563 | | |
565 | 564 | | |
566 | 565 | | |
567 | 566 | | |
568 | 567 | | |
569 | 568 | | |
570 | | - | |
571 | | - | |
572 | | - | |
| 569 | + | |
| 570 | + | |
573 | 571 | | |
574 | 572 | | |
575 | 573 | | |
576 | 574 | | |
577 | 575 | | |
578 | 576 | | |
579 | 577 | | |
580 | | - | |
581 | | - | |
582 | | - | |
| 578 | + | |
| 579 | + | |
583 | 580 | | |
584 | 581 | | |
585 | 582 | | |
586 | 583 | | |
587 | 584 | | |
588 | 585 | | |
589 | 586 | | |
590 | | - | |
591 | | - | |
592 | | - | |
| 587 | + | |
| 588 | + | |
593 | 589 | | |
594 | 590 | | |
595 | 591 | | |
596 | 592 | | |
597 | 593 | | |
598 | 594 | | |
599 | 595 | | |
600 | | - | |
| 596 | + | |
601 | 597 | | |
602 | | - | |
603 | | - | |
| 598 | + | |
604 | 599 | | |
605 | 600 | | |
606 | 601 | | |
0 commit comments