1; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; Make sure we don't try to form FMAX_LEGACY nodes with f64
3
4declare i32 @llvm.r600.read.tidig.x() #1
5
6; FUNC-LABEL: @test_fmax_legacy_uge_f64
7define void @test_fmax_legacy_uge_f64(double addrspace(1)* %out, double addrspace(1)* %in) #0 {
8  %tid = call i32 @llvm.r600.read.tidig.x() #1
9  %gep.0 = getelementptr double, double addrspace(1)* %in, i32 %tid
10  %gep.1 = getelementptr double, double addrspace(1)* %gep.0, i32 1
11
12  %a = load double, double addrspace(1)* %gep.0, align 8
13  %b = load double, double addrspace(1)* %gep.1, align 8
14
15  %cmp = fcmp uge double %a, %b
16  %val = select i1 %cmp, double %a, double %b
17  store double %val, double addrspace(1)* %out, align 8
18  ret void
19}
20
21; FUNC-LABEL: @test_fmax_legacy_oge_f64
22define void @test_fmax_legacy_oge_f64(double addrspace(1)* %out, double addrspace(1)* %in) #0 {
23  %tid = call i32 @llvm.r600.read.tidig.x() #1
24  %gep.0 = getelementptr double, double addrspace(1)* %in, i32 %tid
25  %gep.1 = getelementptr double, double addrspace(1)* %gep.0, i32 1
26
27  %a = load double, double addrspace(1)* %gep.0, align 8
28  %b = load double, double addrspace(1)* %gep.1, align 8
29
30  %cmp = fcmp oge double %a, %b
31  %val = select i1 %cmp, double %a, double %b
32  store double %val, double addrspace(1)* %out, align 8
33  ret void
34}
35
36; FUNC-LABEL: @test_fmax_legacy_ugt_f64
37define void @test_fmax_legacy_ugt_f64(double addrspace(1)* %out, double addrspace(1)* %in) #0 {
38  %tid = call i32 @llvm.r600.read.tidig.x() #1
39  %gep.0 = getelementptr double, double addrspace(1)* %in, i32 %tid
40  %gep.1 = getelementptr double, double addrspace(1)* %gep.0, i32 1
41
42  %a = load double, double addrspace(1)* %gep.0, align 8
43  %b = load double, double addrspace(1)* %gep.1, align 8
44
45  %cmp = fcmp ugt double %a, %b
46  %val = select i1 %cmp, double %a, double %b
47  store double %val, double addrspace(1)* %out, align 8
48  ret void
49}
50
51; FUNC-LABEL: @test_fmax_legacy_ogt_f64
52define void @test_fmax_legacy_ogt_f64(double addrspace(1)* %out, double addrspace(1)* %in) #0 {
53  %tid = call i32 @llvm.r600.read.tidig.x() #1
54  %gep.0 = getelementptr double, double addrspace(1)* %in, i32 %tid
55  %gep.1 = getelementptr double, double addrspace(1)* %gep.0, i32 1
56
57  %a = load double, double addrspace(1)* %gep.0, align 8
58  %b = load double, double addrspace(1)* %gep.1, align 8
59
60  %cmp = fcmp ogt double %a, %b
61  %val = select i1 %cmp, double %a, double %b
62  store double %val, double addrspace(1)* %out, align 8
63  ret void
64}
65
66attributes #0 = { nounwind }
67attributes #1 = { nounwind readnone }
68