[SelectionDAG] Fix in legalization of UMAX/SMAX/UMIN/SMIN. Solves PR31486.
Summary:
Originally
i64 = umax t8, Constant:i64<4>
was expanded into
i32,i32 = umax Constant:i32<0>, Constant:i32<0>
i32,i32 = umax t7, Constant:i32<4>
Now instead the two produced umax:es return i32 instead of i32, i32.
Thanks to Jan Vesely for help with the test case.
Patch by mikael.holmen at ericsson.com
Reviewers: bogner, jvesely, tstellarAMD, arsenm
Subscribers: test, wdng, RKSimon, arsenm, nhaehnle, llvm-commits
Differential Revision: https://reviews.llvm.org/D28135
llvm-svn: 291441
2017-01-09 20:03:50 +08:00
|
|
|
; RUN: llc -march=r600 -mcpu=cypress -start-after safe-stack %s -o - | FileCheck %s
|
|
|
|
; Don't crash
|
|
|
|
|
|
|
|
; CHECK: MAX_UINT
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test(i64 addrspace(1)* %out) {
|
[SelectionDAG] Fix in legalization of UMAX/SMAX/UMIN/SMIN. Solves PR31486.
Summary:
Originally
i64 = umax t8, Constant:i64<4>
was expanded into
i32,i32 = umax Constant:i32<0>, Constant:i32<0>
i32,i32 = umax t7, Constant:i32<4>
Now instead the two produced umax:es return i32 instead of i32, i32.
Thanks to Jan Vesely for help with the test case.
Patch by mikael.holmen at ericsson.com
Reviewers: bogner, jvesely, tstellarAMD, arsenm
Subscribers: test, wdng, RKSimon, arsenm, nhaehnle, llvm-commits
Differential Revision: https://reviews.llvm.org/D28135
llvm-svn: 291441
2017-01-09 20:03:50 +08:00
|
|
|
bb:
|
|
|
|
store i64 2, i64 addrspace(1)* %out
|
|
|
|
%tmp = load i64, i64 addrspace(1)* %out
|
|
|
|
br label %jump
|
|
|
|
|
|
|
|
jump: ; preds = %bb
|
|
|
|
%tmp1 = icmp ugt i64 %tmp, 4
|
|
|
|
%umax = select i1 %tmp1, i64 %tmp, i64 4
|
|
|
|
store i64 %umax, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|