-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Baseline test for ptrtoaddr code generation #143813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arichardson
wants to merge
1
commit into
users/arichardson/spr/main.amdgpu-baseline-test-for-ptrtoaddr-code-generation
Choose a base branch
from
users/arichardson/spr/amdgpu-baseline-test-for-ptrtoaddr-code-generation
base: users/arichardson/spr/main.amdgpu-baseline-test-for-ptrtoaddr-code-generation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
llvm/test/CodeGen/AMDGPU/GlobalISel/ptrtoint-ptrtoaddr-p8.ll
This file contains hidden or 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,118 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=amdgcn -global-isel -verify-machineinstrs < %s | FileCheck %s | ||
;; Check that we can lower ptrtoaddr differently from ptrtoint. | ||
;; Includes an ignored argument so the registers actually need to be written | ||
;; Also all functions are zeroext to show that non-address bits are masked off | ||
;; instead of filling them with arbitrary data | ||
|
||
define zeroext i128 @ptrtoint(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoint: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint ptr addrspace(8) %ptr to i128 | ||
ret i128 %ret | ||
} | ||
|
||
define zeroext i48 @ptrtoaddr(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoaddr: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_and_b32_e32 v1, 0xffff, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr ptr addrspace(8) %ptr to i48 | ||
ret i48 %ret | ||
} | ||
|
||
define <2 x i128> @ptrtoint_vec(ptr addrspace(8) %ignored, <2 x ptr addrspace(8)> %ptr) { | ||
; CHECK-LABEL: ptrtoint_vec: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v4, v8 | ||
; CHECK-NEXT: v_mov_b32_e32 v5, v9 | ||
; CHECK-NEXT: v_mov_b32_e32 v6, v10 | ||
; CHECK-NEXT: v_mov_b32_e32 v7, v11 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint <2 x ptr addrspace(8)> %ptr to <2 x i128> | ||
ret <2 x i128> %ret | ||
} | ||
|
||
;; Note: needs to be 2 x i64 instead of 2 x i48 since the latter is not supported. | ||
define <2 x i64> @ptrtoaddr_vec(ptr addrspace(8) %ignored, <2 x ptr addrspace(8)> %ptr) { | ||
; CHECK-LABEL: ptrtoaddr_vec: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v8 | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v9 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr <2 x ptr addrspace(8)> %ptr to <2 x i64> | ||
ret <2 x i64> %ret | ||
} | ||
|
||
define zeroext i256 @ptrtoint_ext(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoint_ext: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v4, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v5, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v6, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v7, 0 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint ptr addrspace(8) %ptr to i256 | ||
ret i256 %ret | ||
} | ||
|
||
;; Check that we extend the offset to i256 instead of reinterpreting all bits. | ||
;; FIXME: this is wrong, we are removing the trunc to i48: | ||
define zeroext i256 @ptrtoaddr_ext(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoaddr_ext: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v4, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v5, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v6, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v7, 0 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr ptr addrspace(8) %ptr to i256 | ||
ret i256 %ret | ||
} | ||
|
||
define zeroext i64 @ptrtoint_trunc(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoint_trunc: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint ptr addrspace(8) %ptr to i64 | ||
ret i64 %ret | ||
} | ||
|
||
define zeroext i16 @ptrtoaddr_trunc(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoaddr_trunc: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_and_b32_e32 v0, 0xffff, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr ptr addrspace(8) %ptr to i16 | ||
ret i16 %ret | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should have SGPR variants too |
This file contains hidden or 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,118 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck %s | ||
;; Check that we can lower ptrtoaddr differently from ptrtoint. | ||
;; Includes an ignored argument so the registers actually need to be written | ||
;; Also all functions are zeroext to show that non-address bits are masked off | ||
;; instead of filling them with arbitrary data | ||
|
||
define zeroext i128 @ptrtoint(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoint: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint ptr addrspace(8) %ptr to i128 | ||
ret i128 %ret | ||
} | ||
|
||
define zeroext i48 @ptrtoaddr(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoaddr: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_and_b32_e32 v1, 0xffff, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr ptr addrspace(8) %ptr to i48 | ||
ret i48 %ret | ||
} | ||
|
||
define <2 x i128> @ptrtoint_vec(ptr addrspace(8) %ignored, <2 x ptr addrspace(8)> %ptr) { | ||
; CHECK-LABEL: ptrtoint_vec: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v4, v8 | ||
; CHECK-NEXT: v_mov_b32_e32 v5, v9 | ||
; CHECK-NEXT: v_mov_b32_e32 v6, v10 | ||
; CHECK-NEXT: v_mov_b32_e32 v7, v11 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint <2 x ptr addrspace(8)> %ptr to <2 x i128> | ||
ret <2 x i128> %ret | ||
} | ||
|
||
;; Note: needs to be 2 x i64 instead of 2 x i48 since the latter is not supported. | ||
define <2 x i64> @ptrtoaddr_vec(ptr addrspace(8) %ignored, <2 x ptr addrspace(8)> %ptr) { | ||
; CHECK-LABEL: ptrtoaddr_vec: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v9 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v8 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr <2 x ptr addrspace(8)> %ptr to <2 x i64> | ||
ret <2 x i64> %ret | ||
} | ||
|
||
define zeroext i256 @ptrtoint_ext(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoint_ext: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v4, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v5, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v6, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v7, 0 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint ptr addrspace(8) %ptr to i256 | ||
ret i256 %ret | ||
} | ||
|
||
;; Check that we extend the offset to i256 instead of reinterpreting all bits. | ||
;; FIXME: this is wrong, we are removing the trunc to i48: | ||
define zeroext i256 @ptrtoaddr_ext(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoaddr_ext: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v3, v7 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, v6 | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: v_mov_b32_e32 v4, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v5, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v6, 0 | ||
; CHECK-NEXT: v_mov_b32_e32 v7, 0 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr ptr addrspace(8) %ptr to i256 | ||
ret i256 %ret | ||
} | ||
|
||
define zeroext i64 @ptrtoint_trunc(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoint_trunc: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_mov_b32_e32 v1, v5 | ||
; CHECK-NEXT: v_mov_b32_e32 v0, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoint ptr addrspace(8) %ptr to i64 | ||
ret i64 %ret | ||
} | ||
|
||
define zeroext i16 @ptrtoaddr_trunc(ptr addrspace(8) %ignored, ptr addrspace(8) %ptr) { | ||
; CHECK-LABEL: ptrtoaddr_trunc: | ||
; CHECK: ; %bb.0: | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: v_and_b32_e32 v0, 0xffff, v4 | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
%ret = ptrtoaddr ptr addrspace(8) %ptr to i16 | ||
ret i16 %ret | ||
} |
Oops, something went wrong.
You are viewing a condensed version of this merge commit. You can view the full changes here.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using the default subtarget