1 ; RUN: llc -O3 -mtriple=armv8a-none-eabi -mattr=+fullfp16 -o - %s | FileCheck %s
2 ; RUN: llc -O3 -mtriple=thumbv8a-none-eabi -mattr=+fullfp16 -arm-no-restrict-it -o - %s | FileCheck %s
4 ; Require the vmul.f16 not to be predicated, because it's illegal to
5 ; do so with fp16 instructions
6 define half @conditional_fmul_f16(half* %p) {
7 ; CHECK-LABEL: conditional_fmul_f16:
10 %p1 = getelementptr half, half* %p, i32 1
11 %a = load half, half* %p, align 2
12 %threshold = load half, half* %p1, align 2
13 %flag = fcmp ogt half %a, %threshold
14 br i1 %flag, label %mul, label %out
17 %p2 = getelementptr half, half* %p, i32 2
18 %mult = load half, half* %p2, align 2
19 %b = fmul half %a, %mult
23 %sel = phi half [ %a, %entry ], [ %b, %mul ]
27 ; Expect that the corresponding vmul.f32 _will_ be predicated (to make
28 ; sure the previous test is really testing something)
29 define float @conditional_fmul_f32(float* %p) {
30 ; CHECK-LABEL: conditional_fmul_f32:
33 %p1 = getelementptr float, float* %p, i32 1
34 %a = load float, float* %p, align 2
35 %threshold = load float, float* %p1, align 2
36 %flag = fcmp ogt float %a, %threshold
37 br i1 %flag, label %mul, label %out
40 %p2 = getelementptr float, float* %p, i32 2
41 %mult = load float, float* %p2, align 2
42 %b = fmul float %a, %mult
46 %sel = phi float [ %a, %entry ], [ %b, %mul ]
50 ; Require the two comparisons to be done with unpredicated vcmp.f16
51 ; instructions (again, it is illegal to predicate them)
52 define void @chained_comparisons_f16(half* %p) {
53 ; CHECK-LABEL: chained_comparisons_f16:
57 %p1 = getelementptr half, half* %p, i32 1
59 %a = load half, half* %p, align 2
60 %b = load half, half* %p1, align 2
62 %aflag = fcmp oeq half %a, 0xH0000
63 %bflag = fcmp oeq half %b, 0xH0000
64 %flag = or i1 %aflag, %bflag
65 br i1 %flag, label %call, label %out
68 call void @external_function()
75 ; Again, do the corresponding test with 32-bit floats and check that
76 ; the second comparison _is_ predicated on the result of the first.
77 define void @chained_comparisons_f32(float* %p) {
78 ; CHECK-LABEL: chained_comparisons_f32:
82 %p1 = getelementptr float, float* %p, i32 1
84 %a = load float, float* %p, align 2
85 %b = load float, float* %p1, align 2
87 %aflag = fcmp oeq float %a, 0x00000000
88 %bflag = fcmp oeq float %b, 0x00000000
89 %flag = or i1 %aflag, %bflag
90 br i1 %flag, label %call, label %out
93 call void @external_function()
100 declare void @external_function()