fe2c3260a8b04b63b1ea23252de0054c18a45240
[oota-llvm.git] / test / CodeGen / AArch64 / fcmp.ll
1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-none-linux-gnu | FileCheck %s
3
4 declare void @bar(i32)
5
6 define void @test_float(float %a, float %b) {
7 ; CHECK-LABEL: test_float:
8
9   %tst1 = fcmp oeq float %a, %b
10   br i1 %tst1, label %end, label %t2
11 ; CHECK: fcmp {{s[0-9]+}}, {{s[0-9]+}}
12 ; CHECK: b.eq .L
13
14 t2:
15   %tst2 = fcmp une float %b, 0.0
16   br i1 %tst2, label %t3, label %end
17 ; CHECK: fcmp {{s[0-9]+}}, #0.0
18 ; CHECK: b.eq .L
19
20
21 t3:
22 ; This test can't be implemented with just one A64 conditional
23 ; branch. LLVM converts "ordered and not equal" to "unordered or
24 ; equal" before instruction selection, which is what we currently
25 ; test. Obviously, other sequences are valid.
26   %tst3 = fcmp one float %a,  %b
27   br i1 %tst3, label %t4, label %end
28 ; CHECK: fcmp {{s[0-9]+}}, {{s[0-9]+}}
29 ; CHECK-NEXT: b.eq .[[T4:LBB[0-9]+_[0-9]+]]
30 ; CHECK-NEXT: b.vs .[[T4]]
31 t4:
32   %tst4 = fcmp uge float %a, -0.0
33   br i1 %tst4, label %t5, label %end
34 ; CHECK-NOT: fcmp {{s[0-9]+}}, #0.0
35 ; CHECK: b.mi .LBB
36
37 t5:
38   call void @bar(i32 0)
39   ret void
40 end:
41   ret void
42
43 }
44
45 define void @test_double(double %a, double %b) {
46 ; CHECK-LABEL: test_double:
47
48   %tst1 = fcmp oeq double %a, %b
49   br i1 %tst1, label %end, label %t2
50 ; CHECK: fcmp {{d[0-9]+}}, {{d[0-9]+}}
51 ; CHECK: b.eq .L
52
53 t2:
54   %tst2 = fcmp une double %b, 0.0
55   br i1 %tst2, label %t3, label %end
56 ; CHECK: fcmp {{d[0-9]+}}, #0.0
57 ; CHECK: b.eq .L
58
59
60 t3:
61 ; This test can't be implemented with just one A64 conditional
62 ; branch. LLVM converts "ordered and not equal" to "unordered or
63 ; equal" before instruction selection, which is what we currently
64 ; test. Obviously, other sequences are valid.
65   %tst3 = fcmp one double %a,  %b
66   br i1 %tst3, label %t4, label %end
67 ; CHECK: fcmp {{d[0-9]+}}, {{d[0-9]+}}
68 ; CHECK-NEXT: b.eq .[[T4:LBB[0-9]+_[0-9]+]]
69 ; CHECK-NEXT: b.vs .[[T4]]
70 t4:
71   %tst4 = fcmp uge double %a, -0.0
72   br i1 %tst4, label %t5, label %end
73 ; CHECK-NOT: fcmp {{d[0-9]+}}, #0.0
74 ; CHECK: b.mi .LBB
75
76 t5:
77   call void @bar(i32 0)
78   ret void
79 end:
80   ret void
81
82 }