forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMDGPU] Shrink to SOPK with 32-bit signed literals (llvm#70263)
A literal like 0xffff8000 is valid to be used as KIMM in a SOPK instruction, but at the moment our checks expect it to be fully sign extended to a 64-bit signed integer. This is not required since all cases which are being shrunk only accept 32-bit operands. We need to sign extend the operand to 64-bit though so it passes the verifier and properly printed.
- Loading branch information
Showing
2 changed files
with
67 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3 | ||
# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=si-shrink-instructions -o - %s | FileCheck -check-prefix=GCN %s | ||
|
||
--- | ||
name: shrink_kimm32_mov_b32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: shrink_kimm32_mov_b32 | ||
; GCN: $sgpr0 = S_MOVK_I32 -2048 | ||
$sgpr0 = S_MOV_B32 4294965248 | ||
... | ||
|
||
--- | ||
name: shrink_kimm32_cmp_eq_u32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: shrink_kimm32_cmp_eq_u32 | ||
; GCN: S_CMPK_EQ_I32 undef $sgpr0, -2048, implicit-def $scc | ||
S_CMP_EQ_U32 undef $sgpr0, 4294965248, implicit-def $scc | ||
... | ||
|
||
--- | ||
name: shrink_kimm32_cmp_gt_i32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: shrink_kimm32_cmp_gt_i32 | ||
; GCN: S_CMPK_GT_I32 undef $sgpr0, -2048, implicit-def $scc | ||
S_CMP_GT_I32 undef $sgpr0, 4294965248, implicit-def $scc | ||
... | ||
|
||
--- | ||
name: shrink_kimm32_add_i32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: shrink_kimm32_add_i32 | ||
; GCN: $sgpr0 = S_ADDK_I32 undef $sgpr0, -2048, implicit-def $scc | ||
$sgpr0 = S_ADD_I32 undef $sgpr0, 4294965248, implicit-def $scc | ||
... | ||
|
||
--- | ||
name: shrink_kimm32_mul_i32 | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; GCN-LABEL: name: shrink_kimm32_mul_i32 | ||
; GCN: $sgpr0 = S_MULK_I32 undef $sgpr0, -2048, implicit-def $scc | ||
$sgpr0 = S_MUL_I32 undef $sgpr0, 4294965248, implicit-def $scc | ||
... |