2015-01-13 00:43:00 +00:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=SI-SAFE -check-prefix=FUNC %s
|
|
|
|
; RUN: llc -enable-no-nans-fp-math -enable-unsafe-fp-math -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI-NONAN -check-prefix=SI -check-prefix=FUNC %s
|
2014-11-13 23:03:09 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
|
|
|
|
|
2015-01-13 00:43:00 +00:00
|
|
|
; FIXME: Should replace unsafe-fp-math with no signed zeros.
|
|
|
|
|
2014-11-15 05:02:57 +00:00
|
|
|
declare i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
|
2014-11-13 23:03:09 +00:00
|
|
|
; FUNC-LABEL: @test_fmax_legacy_uge_f32
|
2014-11-15 05:02:57 +00:00
|
|
|
; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
2014-12-03 03:12:13 +00:00
|
|
|
; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
2015-01-13 00:43:00 +00:00
|
|
|
; SI-SAFE: v_max_legacy_f32_e32 {{v[0-9]+}}, [[B]], [[A]]
|
|
|
|
; SI-NONAN: v_max_f32_e32 {{v[0-9]+}}, [[B]], [[A]]
|
|
|
|
|
2014-11-13 23:03:09 +00:00
|
|
|
; EG: MAX
|
2014-11-15 05:02:57 +00:00
|
|
|
define void @test_fmax_legacy_uge_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
%gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
|
|
|
|
%gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
|
|
|
|
|
|
|
|
%a = load float addrspace(1)* %gep.0, align 4
|
|
|
|
%b = load float addrspace(1)* %gep.1, align 4
|
|
|
|
|
2014-11-13 23:03:09 +00:00
|
|
|
%cmp = fcmp uge float %a, %b
|
|
|
|
%val = select i1 %cmp, float %a, float %b
|
|
|
|
store float %val, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: @test_fmax_legacy_oge_f32
|
2014-11-15 05:02:57 +00:00
|
|
|
; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
2014-12-03 03:12:13 +00:00
|
|
|
; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
2015-01-13 00:43:00 +00:00
|
|
|
; SI-SAFE: v_max_legacy_f32_e32 {{v[0-9]+}}, [[A]], [[B]]
|
|
|
|
; SI-NONAN: v_max_f32_e32 {{v[0-9]+}}, [[B]], [[A]]
|
2014-11-13 23:03:09 +00:00
|
|
|
; EG: MAX
|
2014-11-15 05:02:57 +00:00
|
|
|
define void @test_fmax_legacy_oge_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
%gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
|
|
|
|
%gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
|
|
|
|
|
|
|
|
%a = load float addrspace(1)* %gep.0, align 4
|
|
|
|
%b = load float addrspace(1)* %gep.1, align 4
|
|
|
|
|
2014-11-13 23:03:09 +00:00
|
|
|
%cmp = fcmp oge float %a, %b
|
|
|
|
%val = select i1 %cmp, float %a, float %b
|
|
|
|
store float %val, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: @test_fmax_legacy_ugt_f32
|
2014-11-15 05:02:57 +00:00
|
|
|
; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
2014-12-03 03:12:13 +00:00
|
|
|
; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
2015-01-13 00:43:00 +00:00
|
|
|
; SI-SAFE: v_max_legacy_f32_e32 {{v[0-9]+}}, [[B]], [[A]]
|
|
|
|
; SI-NONAN: v_max_f32_e32 {{v[0-9]+}}, [[B]], [[A]]
|
2014-11-13 23:03:09 +00:00
|
|
|
; EG: MAX
|
2014-11-15 05:02:57 +00:00
|
|
|
define void @test_fmax_legacy_ugt_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
%gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
|
|
|
|
%gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
|
|
|
|
|
|
|
|
%a = load float addrspace(1)* %gep.0, align 4
|
|
|
|
%b = load float addrspace(1)* %gep.1, align 4
|
|
|
|
|
2014-11-13 23:03:09 +00:00
|
|
|
%cmp = fcmp ugt float %a, %b
|
|
|
|
%val = select i1 %cmp, float %a, float %b
|
|
|
|
store float %val, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; FUNC-LABEL: @test_fmax_legacy_ogt_f32
|
2014-11-15 05:02:57 +00:00
|
|
|
; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
2014-12-03 03:12:13 +00:00
|
|
|
; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
2015-01-13 00:43:00 +00:00
|
|
|
; SI-SAFE: v_max_legacy_f32_e32 {{v[0-9]+}}, [[A]], [[B]]
|
|
|
|
; SI-NONAN: v_max_f32_e32 {{v[0-9]+}}, [[B]], [[A]]
|
2014-11-13 23:03:09 +00:00
|
|
|
; EG: MAX
|
2014-11-15 05:02:57 +00:00
|
|
|
define void @test_fmax_legacy_ogt_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
%gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
|
|
|
|
%gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
|
|
|
|
|
|
|
|
%a = load float addrspace(1)* %gep.0, align 4
|
|
|
|
%b = load float addrspace(1)* %gep.1, align 4
|
|
|
|
|
2014-11-13 23:03:09 +00:00
|
|
|
%cmp = fcmp ogt float %a, %b
|
|
|
|
%val = select i1 %cmp, float %a, float %b
|
|
|
|
store float %val, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
2014-11-15 05:02:57 +00:00
|
|
|
|
2014-12-19 23:15:30 +00:00
|
|
|
|
|
|
|
; FUNC-LABEL: @test_fmax_legacy_ogt_f32_multi_use
|
|
|
|
; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
|
|
|
|
; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:4
|
|
|
|
; SI-NOT: v_max_
|
|
|
|
; SI: v_cmp_gt_f32
|
|
|
|
; SI-NEXT: v_cndmask_b32
|
|
|
|
; SI-NOT: v_max_
|
|
|
|
|
|
|
|
; EG: MAX
|
|
|
|
define void @test_fmax_legacy_ogt_f32_multi_use(float addrspace(1)* %out0, i1 addrspace(1)* %out1, float addrspace(1)* %in) #0 {
|
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
%gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
|
|
|
|
%gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
|
|
|
|
|
|
|
|
%a = load float addrspace(1)* %gep.0, align 4
|
|
|
|
%b = load float addrspace(1)* %gep.1, align 4
|
|
|
|
|
|
|
|
%cmp = fcmp ogt float %a, %b
|
|
|
|
%val = select i1 %cmp, float %a, float %b
|
|
|
|
store float %val, float addrspace(1)* %out0, align 4
|
|
|
|
store i1 %cmp, i1addrspace(1)* %out1
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-11-15 05:02:57 +00:00
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #1 = { nounwind readnone }
|