Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit c4a2469

Browse files
committed
R600: Fix R600ControlFlowFinalizer not considering VTX_READ 128 bit dst reg
Patch by: Vincent Lejeune https://bugs.freedesktop.org/show_bug.cgi?id=64877 NOTE: This is a candidate for the 3.3 branch. Merged from r182600 Author: Tom Stellard <[email protected]> Date: Thu May 23 18:26:42 2013 +0000 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@185868 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ce33750 commit c4a2469

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

lib/Target/R600/R600ControlFlowFinalizer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,15 @@ class R600ControlFlowFinalizer : public MachineFunctionPass {
116116
const MachineOperand &MO = *I;
117117
if (!MO.isReg())
118118
continue;
119-
if (MO.isDef())
120-
DstMI = MO.getReg();
119+
if (MO.isDef()) {
120+
unsigned Reg = MO.getReg();
121+
if (AMDGPU::R600_Reg128RegClass.contains(Reg))
122+
DstMI = Reg;
123+
else
124+
DstMI = TRI.getMatchingSuperReg(Reg,
125+
TRI.getSubRegFromChannel(TRI.getHWRegChan(Reg)),
126+
&AMDGPU::R600_Reg128RegClass);
127+
}
121128
if (MO.isUse()) {
122129
unsigned Reg = MO.getReg();
123130
if (AMDGPU::R600_Reg128RegClass.contains(Reg))

test/CodeGen/R600/vtx-schedule.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2+
3+
; This test is for a scheduler bug where VTX_READ instructions that used
4+
; the result of another VTX_READ instruction were being grouped in the
5+
; same fetch clasue.
6+
7+
; CHECK: @test
8+
; CHECK: Fetch clause
9+
; CHECK_VTX_READ_32 [[IN0:T[0-9]+\.X]], [[IN0]], 40
10+
; CHECK_VTX_READ_32 [[IN1:T[0-9]+\.X]], [[IN1]], 44
11+
; CHECK: Fetch clause
12+
; CHECK_VTX_READ_32 [[IN0:T[0-9]+\.X]], [[IN0]], 0
13+
; CHECK_VTX_READ_32 [[IN1:T[0-9]+\.X]], [[IN1]], 0
14+
define void @test(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in0, i32 addrspace(1)* nocapture %in1) {
15+
entry:
16+
%0 = load i32 addrspace(1)* %in0, align 4
17+
%1 = load i32 addrspace(1)* %in1, align 4
18+
%cmp.i = icmp slt i32 %0, %1
19+
%cond.i = select i1 %cmp.i, i32 %0, i32 %1
20+
store i32 %cond.i, i32 addrspace(1)* %out, align 4
21+
ret void
22+
}

0 commit comments

Comments
 (0)