xref: /llvm-project/llvm/test/CodeGen/AArch64/fmov-imm-licm.ll (revision 1ee315ae7964c8433b772e0b5d667834994ba753)
1; RUN: llc -mtriple=aarch64-linux-gnu -o - %s | FileCheck %s
2
3; The purpose of this test is to check that an FMOV instruction that
4; only materializes an immediate is not MachineLICM'd out of a loop.
5; We check this in two ways: by looking for the FMOV inside the loop,
6; and also by checking that we're not spilling any FP callee-saved
7; registers.
8
9%struct.Node = type { ptr, ptr }
10
11define void @process_nodes(ptr %0) {
12; CHECK-LABEL: process_nodes:
13; CHECK-NOT:   stp {{d[0-9]+}}
14; CHECK-LABEL: .LBB0_2:
15; CHECK:       fmov s0, #1.00000000
16; CHECK:       bl do_it
17entry:
18  %1 = icmp eq ptr %0, null
19  br i1 %1, label %exit, label %loop
20
21loop:
22  %2 = phi ptr [ %4, %loop ], [ %0, %entry ]
23  tail call void @do_it(float 1.000000e+00, ptr nonnull %2)
24  %3 = getelementptr inbounds %struct.Node, ptr %2, i64 0, i32 0
25  %4 = load ptr, ptr %3, align 8
26  %5 = icmp eq ptr %4, null
27  br i1 %5, label %exit, label %loop
28
29exit:
30  ret void
31}
32
33declare void @do_it(float, ptr)
34