2018-12-26 20:09:10 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2019-04-03 08:00:58 +08:00
|
|
|
; RUN: llc -mtriple=amdgcn-- -mcpu=pitcairn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
|
2017-05-23 00:58:10 +08:00
|
|
|
|
|
|
|
define amdgpu_kernel void @zext_shl64_to_32(i64 addrspace(1)* nocapture %out, i32 %x) {
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-LABEL: zext_shl64_to_32:
|
|
|
|
; GCN: ; %bb.0:
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9
|
|
|
|
; GCN-NEXT: s_load_dword s0, s[0:1], 0xb
|
|
|
|
; GCN-NEXT: s_mov_b32 s7, 0xf000
|
|
|
|
; GCN-NEXT: s_mov_b32 s6, -1
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: v_mov_b32_e32 v1, 0
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_waitcnt lgkmcnt(0)
|
|
|
|
; GCN-NEXT: s_lshl_b32 s0, s0, 2
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v0, s0
|
|
|
|
; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_endpgm
|
2017-05-23 00:58:10 +08:00
|
|
|
%and = and i32 %x, 1073741823
|
|
|
|
%ext = zext i32 %and to i64
|
|
|
|
%shl = shl i64 %ext, 2
|
|
|
|
store i64 %shl, i64 addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @sext_shl64_to_32(i64 addrspace(1)* nocapture %out, i32 %x) {
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-LABEL: sext_shl64_to_32:
|
|
|
|
; GCN: ; %bb.0:
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9
|
|
|
|
; GCN-NEXT: s_load_dword s0, s[0:1], 0xb
|
|
|
|
; GCN-NEXT: s_mov_b32 s7, 0xf000
|
|
|
|
; GCN-NEXT: s_mov_b32 s6, -1
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: v_mov_b32_e32 v1, 0
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_waitcnt lgkmcnt(0)
|
|
|
|
; GCN-NEXT: s_and_b32 s0, s0, 0x1fffffff
|
|
|
|
; GCN-NEXT: s_lshl_b32 s0, s0, 2
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v0, s0
|
|
|
|
; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_endpgm
|
2017-05-23 00:58:10 +08:00
|
|
|
%and = and i32 %x, 536870911
|
|
|
|
%ext = sext i32 %and to i64
|
|
|
|
%shl = shl i64 %ext, 2
|
|
|
|
store i64 %shl, i64 addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @zext_shl64_overflow(i64 addrspace(1)* nocapture %out, i32 %x) {
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-LABEL: zext_shl64_overflow:
|
|
|
|
; GCN: ; %bb.0:
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9
|
|
|
|
; GCN-NEXT: s_load_dword s0, s[0:1], 0xb
|
|
|
|
; GCN-NEXT: s_mov_b32 s1, 0
|
|
|
|
; GCN-NEXT: s_mov_b32 s7, 0xf000
|
|
|
|
; GCN-NEXT: s_mov_b32 s6, -1
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_waitcnt lgkmcnt(0)
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_bitset0_b32 s0, 31
|
|
|
|
; GCN-NEXT: s_lshl_b64 s[0:1], s[0:1], 2
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v0, s0
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v1, s1
|
|
|
|
; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_endpgm
|
2017-05-23 00:58:10 +08:00
|
|
|
%and = and i32 %x, 2147483647
|
|
|
|
%ext = zext i32 %and to i64
|
|
|
|
%shl = shl i64 %ext, 2
|
|
|
|
store i64 %shl, i64 addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @sext_shl64_overflow(i64 addrspace(1)* nocapture %out, i32 %x) {
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-LABEL: sext_shl64_overflow:
|
|
|
|
; GCN: ; %bb.0:
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x9
|
|
|
|
; GCN-NEXT: s_load_dword s0, s[0:1], 0xb
|
|
|
|
; GCN-NEXT: s_mov_b32 s1, 0
|
|
|
|
; GCN-NEXT: s_mov_b32 s7, 0xf000
|
|
|
|
; GCN-NEXT: s_mov_b32 s6, -1
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_waitcnt lgkmcnt(0)
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_bitset0_b32 s0, 31
|
|
|
|
; GCN-NEXT: s_lshl_b64 s[0:1], s[0:1], 2
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v0, s0
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v1, s1
|
|
|
|
; GCN-NEXT: buffer_store_dwordx2 v[0:1], off, s[4:7], 0
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_endpgm
|
2017-05-23 00:58:10 +08:00
|
|
|
%and = and i32 %x, 2147483647
|
|
|
|
%ext = sext i32 %and to i64
|
|
|
|
%shl = shl i64 %ext, 2
|
|
|
|
store i64 %shl, i64 addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
2017-08-29 00:35:37 +08:00
|
|
|
|
|
|
|
define amdgpu_kernel void @mulu24_shl64(i32 addrspace(1)* nocapture %arg) {
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-LABEL: mulu24_shl64:
|
|
|
|
; GCN: ; %bb.0: ; %bb
|
|
|
|
; GCN-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
|
|
|
|
; GCN-NEXT: v_and_b32_e32 v0, 6, v0
|
|
|
|
; GCN-NEXT: v_mul_u32_u24_e32 v0, 7, v0
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_mov_b32 s3, 0xf000
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_mov_b32 s2, 0
|
|
|
|
; GCN-NEXT: v_lshlrev_b32_e32 v0, 2, v0
|
|
|
|
; GCN-NEXT: v_mov_b32_e32 v1, 0
|
|
|
|
; GCN-NEXT: s_waitcnt lgkmcnt(0)
|
|
|
|
; GCN-NEXT: buffer_store_dword v1, v[0:1], s[0:3], 0 addr64
|
|
|
|
; GCN-NEXT: s_endpgm
|
2017-08-29 00:35:37 +08:00
|
|
|
bb:
|
|
|
|
%tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%tmp1 = and i32 %tmp, 6
|
|
|
|
%mulconv = mul nuw nsw i32 %tmp1, 7
|
|
|
|
%tmp2 = zext i32 %mulconv to i64
|
|
|
|
%tmp3 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 %tmp2
|
|
|
|
store i32 0, i32 addrspace(1)* %tmp3, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @muli24_shl64(i64 addrspace(1)* nocapture %arg, i32 addrspace(1)* nocapture readonly %arg1) {
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-LABEL: muli24_shl64:
|
|
|
|
; GCN: ; %bb.0: ; %bb
|
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
2019-10-07 22:33:59 +08:00
|
|
|
; GCN-NEXT: s_load_dwordx4 s[4:7], s[0:1], 0x9
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: v_mov_b32_e32 v2, 0
|
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
2019-10-07 22:33:59 +08:00
|
|
|
; GCN-NEXT: s_mov_b32 s3, 0xf000
|
|
|
|
; GCN-NEXT: s_mov_b32 s2, 0
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: v_lshlrev_b32_e32 v1, 2, v0
|
|
|
|
; GCN-NEXT: s_waitcnt lgkmcnt(0)
|
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
2019-10-07 22:33:59 +08:00
|
|
|
; GCN-NEXT: s_mov_b64 s[0:1], s[6:7]
|
2020-01-07 23:43:46 +08:00
|
|
|
; GCN-NEXT: buffer_load_dword v1, v[1:2], s[0:3], 0 addr64
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: v_lshlrev_b32_e32 v3, 3, v0
|
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
2019-10-07 22:33:59 +08:00
|
|
|
; GCN-NEXT: s_mov_b64 s[6:7], s[2:3]
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: v_mov_b32_e32 v4, v2
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: s_waitcnt vmcnt(0)
|
2020-01-07 23:43:46 +08:00
|
|
|
; GCN-NEXT: v_or_b32_e32 v0, 0x800000, v1
|
2020-02-20 19:10:56 +08:00
|
|
|
; GCN-NEXT: v_mul_i32_i24_e32 v0, -7, v0
|
2019-04-03 08:00:58 +08:00
|
|
|
; GCN-NEXT: v_lshlrev_b32_e32 v1, 3, v0
|
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
2019-10-07 22:33:59 +08:00
|
|
|
; GCN-NEXT: buffer_store_dwordx2 v[1:2], v[3:4], s[4:7], 0 addr64
|
2018-12-26 20:09:10 +08:00
|
|
|
; GCN-NEXT: s_endpgm
|
2017-08-29 00:35:37 +08:00
|
|
|
bb:
|
|
|
|
%tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
|
|
|
|
%tmp2 = sext i32 %tmp to i64
|
|
|
|
%tmp3 = getelementptr inbounds i32, i32 addrspace(1)* %arg1, i64 %tmp2
|
|
|
|
%tmp4 = load i32, i32 addrspace(1)* %tmp3, align 4
|
|
|
|
%tmp5 = or i32 %tmp4, -8388608
|
|
|
|
%tmp6 = mul nsw i32 %tmp5, -7
|
|
|
|
%tmp7 = zext i32 %tmp6 to i64
|
|
|
|
%tmp8 = shl nuw nsw i64 %tmp7, 3
|
|
|
|
%tmp9 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i64 %tmp2
|
|
|
|
store i64 %tmp8, i64 addrspace(1)* %tmp9, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @llvm.amdgcn.workitem.id.x()
|