xref: /aosp_15_r20/external/llvm/test/CodeGen/MSP430/fp.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -disable-fp-elim < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"
4*9880d681SAndroid Build Coastguard Workertarget triple = "msp430---elf"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine void @fp() nounwind {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: fp:
9*9880d681SAndroid Build Coastguard Worker; CHECK: push.w r4
10*9880d681SAndroid Build Coastguard Worker; CHECK: mov.w r1, r4
11*9880d681SAndroid Build Coastguard Worker; CHECK: sub.w #2, r1
12*9880d681SAndroid Build Coastguard Worker  %i = alloca i16, align 2
13*9880d681SAndroid Build Coastguard Worker; CHECK: mov.w #0, -2(r4)
14*9880d681SAndroid Build Coastguard Worker  store i16 0, i16* %i, align 2
15*9880d681SAndroid Build Coastguard Worker; CHECK: pop.w r4
16*9880d681SAndroid Build Coastguard Worker  ret void
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; Due to FPB not being marked as reserved, the register allocator used to select
20*9880d681SAndroid Build Coastguard Worker; r4 as the register for the "r" constraint below. This test verifies that this
21*9880d681SAndroid Build Coastguard Worker; does not happen anymore. Note that the only reason an ISR is used here is that
22*9880d681SAndroid Build Coastguard Worker; the register allocator selects r4 first instead of fifth in a normal function.
23*9880d681SAndroid Build Coastguard Workerdefine msp430_intrcc void @fpb_alloced() #0 {
24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: fpb_alloced:
25*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: mov.b #0, r4
26*9880d681SAndroid Build Coastguard Worker; CHECK: nop
27*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "nop", "r"(i8 0)
28*9880d681SAndroid Build Coastguard Worker  ret void
29*9880d681SAndroid Build Coastguard Worker}
30