brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · edfa61f Raw
101 lines · plain
1; RUN: llc -O3 -mtriple=armv8a-none-eabi -mattr=+fullfp16 -arm-restrict-it -o - %s | FileCheck %s2; RUN: llc -O3 -mtriple=thumbv8a-none-eabi -mattr=+fullfp16 -o - %s | FileCheck %s3 4; Require the vmul.f16 not to be predicated, because it's illegal to5; do so with fp16 instructions6define half @conditional_fmul_f16(ptr %p) {7; CHECK-LABEL: conditional_fmul_f16:8; CHECK: vmul.f169entry:10  %p1 = getelementptr half, ptr %p, i32 111  %a = load half, ptr %p, align 212  %threshold = load half, ptr %p1, align 213  %flag = fcmp ogt half %a, %threshold14  br i1 %flag, label %mul, label %out15 16mul:17  %p2 = getelementptr half, ptr %p, i32 218  %mult = load half, ptr %p2, align 219  %b = fmul half %a, %mult20  br label %out21 22out:23  %sel = phi half [ %a, %entry ], [ %b, %mul ]24  ret half %sel25}26 27; Expect that the corresponding vmul.f32 _will_ be predicated (to make28; sure the previous test is really testing something)29define float @conditional_fmul_f32(ptr %p) {30; CHECK-LABEL: conditional_fmul_f32:31; CHECK: vmulgt.f3232entry:33  %p1 = getelementptr float, ptr %p, i32 134  %a = load float, ptr %p, align 235  %threshold = load float, ptr %p1, align 236  %flag = fcmp ogt float %a, %threshold37  br i1 %flag, label %mul, label %out38 39mul:40  %p2 = getelementptr float, ptr %p, i32 241  %mult = load float, ptr %p2, align 242  %b = fmul float %a, %mult43  br label %out44 45out:46  %sel = phi float [ %a, %entry ], [ %b, %mul ]47  ret float %sel48}49 50; Require the two comparisons to be done with unpredicated vcmp.f1651; instructions (again, it is illegal to predicate them)52define void @chained_comparisons_f16(ptr %p) {53; CHECK-LABEL: chained_comparisons_f16:54; CHECK: vcmp.f1655; CHECK: vcmp.f1656entry:57  %p1 = getelementptr half, ptr %p, i32 158 59  %a = load half, ptr %p, align 260  %b = load half, ptr %p1, align 261 62  %aflag = fcmp oeq half %a, 0xH000063  %bflag = fcmp oeq half %b, 0xH000064  %flag = or i1 %aflag, %bflag65  br i1 %flag, label %call, label %out66 67call:68  call void @external_function()69  br label %out70 71out:72  ret void73}74 75; Again, do the corresponding test with 32-bit floats and check that76; the second comparison _is_ predicated on the result of the first.77define void @chained_comparisons_f32(ptr %p) {78; CHECK-LABEL: chained_comparisons_f32:79; CHECK: vcmp.f3280; CHECK: vcmpne.f3281entry:82  %p1 = getelementptr float, ptr %p, i32 183 84  %a = load float, ptr %p, align 285  %b = load float, ptr %p1, align 286 87  %aflag = fcmp oeq float %a, 0x0000000088  %bflag = fcmp oeq float %b, 0x0000000089  %flag = or i1 %aflag, %bflag90  br i1 %flag, label %call, label %out91 92call:93  call void @external_function()94  br label %out95 96out:97  ret void98}99 100declare void @external_function()101