-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalISel][ARM] Legalization of G_CONSTANT using constant pool (#98308
) ARM uses complex encoding of immediate values using small number of bits. As a result, some values cannot be represented as immediate operands, they need to be synthesized in a register. This change implements legalization of such constants with loading values from constant pool. --------- Co-authored-by: Matt Arsenault <[email protected]>
- Loading branch information
Showing
7 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
# RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s | ||
|
||
--- | ||
name: get_const | ||
legalized: false | ||
regBankSelected: false | ||
selected: false | ||
tracksRegLiveness: true | ||
body: | | ||
bb.1.entry: | ||
; CHECK-LABEL: name: get_const | ||
; CHECK: [[CONSTANT_POOL:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.0 | ||
; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[CONSTANT_POOL]](p0) :: (load (s32) from constant-pool) | ||
; CHECK-NEXT: $r0 = COPY [[LOAD]](s32) | ||
; CHECK-NEXT: MOVPCLR 14 /* CC::al */, $noreg, implicit $r0 | ||
%0:_(s32) = G_CONSTANT i32 287454020 | ||
$r0 = COPY %0(s32) | ||
MOVPCLR 14 /* CC::al */, $noreg, implicit $r0 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
# RUN: llc -mtriple arm-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s | ||
|
||
--- | ||
name: get_const | ||
legalized: true | ||
regBankSelected: true | ||
selected: false | ||
tracksRegLiveness: true | ||
constants: | ||
- id: 0 | ||
value: i32 287454020 | ||
alignment: 4 | ||
isTargetSpecific: false | ||
body: | | ||
bb.1.entry: | ||
; CHECK-LABEL: name: get_const | ||
; CHECK: [[LDRcp:%[0-9]+]]:gpr = LDRcp %const.0, 0, 14 /* CC::al */, $noreg :: (load (s32) from constant-pool) | ||
; CHECK-NEXT: $r0 = COPY [[LDRcp]] | ||
; CHECK-NEXT: MOVPCLR 14 /* CC::al */, $noreg, implicit $r0 | ||
%1:gprb(p0) = G_CONSTANT_POOL %const.0 | ||
%0:gprb(s32) = G_LOAD %1(p0) :: (load (s32) from constant-pool) | ||
$r0 = COPY %0(s32) | ||
MOVPCLR 14 /* CC::al */, $noreg, implicit $r0 | ||
... |