1 ; RUN: llc -march=r600 -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4 declare i32 @llvm.r600.read.tidig.x() #1
6 ; FUNC-LABEL: @test_fmax_legacy_uge_f32
7 ; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
8 ; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:0x4
9 ; SI: v_max_legacy_f32_e32 {{v[0-9]+}}, [[A]], [[B]]
11 define void @test_fmax_legacy_uge_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
12 %tid = call i32 @llvm.r600.read.tidig.x() #1
13 %gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
14 %gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
16 %a = load float addrspace(1)* %gep.0, align 4
17 %b = load float addrspace(1)* %gep.1, align 4
19 %cmp = fcmp uge float %a, %b
20 %val = select i1 %cmp, float %a, float %b
21 store float %val, float addrspace(1)* %out, align 4
25 ; FUNC-LABEL: @test_fmax_legacy_oge_f32
26 ; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
27 ; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:0x4
28 ; SI: v_max_legacy_f32_e32 {{v[0-9]+}}, [[A]], [[B]]
30 define void @test_fmax_legacy_oge_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
31 %tid = call i32 @llvm.r600.read.tidig.x() #1
32 %gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
33 %gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
35 %a = load float addrspace(1)* %gep.0, align 4
36 %b = load float addrspace(1)* %gep.1, align 4
38 %cmp = fcmp oge float %a, %b
39 %val = select i1 %cmp, float %a, float %b
40 store float %val, float addrspace(1)* %out, align 4
44 ; FUNC-LABEL: @test_fmax_legacy_ugt_f32
45 ; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
46 ; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:0x4
47 ; SI: v_max_legacy_f32_e32 {{v[0-9]+}}, [[A]], [[B]]
49 define void @test_fmax_legacy_ugt_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
50 %tid = call i32 @llvm.r600.read.tidig.x() #1
51 %gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
52 %gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
54 %a = load float addrspace(1)* %gep.0, align 4
55 %b = load float addrspace(1)* %gep.1, align 4
57 %cmp = fcmp ugt float %a, %b
58 %val = select i1 %cmp, float %a, float %b
59 store float %val, float addrspace(1)* %out, align 4
63 ; FUNC-LABEL: @test_fmax_legacy_ogt_f32
64 ; SI: buffer_load_dword [[A:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64{{$}}
65 ; SI: buffer_load_dword [[B:v[0-9]+]], {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0 addr64 offset:0x4
66 ; SI: v_max_legacy_f32_e32 {{v[0-9]+}}, [[A]], [[B]]
68 define void @test_fmax_legacy_ogt_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
69 %tid = call i32 @llvm.r600.read.tidig.x() #1
70 %gep.0 = getelementptr float addrspace(1)* %in, i32 %tid
71 %gep.1 = getelementptr float addrspace(1)* %gep.0, i32 1
73 %a = load float addrspace(1)* %gep.0, align 4
74 %b = load float addrspace(1)* %gep.1, align 4
76 %cmp = fcmp ogt float %a, %b
77 %val = select i1 %cmp, float %a, float %b
78 store float %val, float addrspace(1)* %out, align 4
82 attributes #0 = { nounwind }
83 attributes #1 = { nounwind readnone }