1; RUN: llc < %s | FileCheck %s
2
3target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
4target triple = "msp430-generic-generic"
5
6@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @ISR to i8*)], section "llvm.metadata"
7
8; MSP430 EABI p. 3.9
9; Interrupt functions must save all the registers that are used, even those
10; that are normally considered callee-saved.
11
12; To return from an interrupt function, the function must execute the special
13; instruction RETI, which restores the SR register and branches to the PC where
14; the interrupt occurred.
15
16; CHECK:      .section	__interrupt_vector_2,"ax",@progbits
17; CHECK-NEXT:	.short	ISR
18
19@g = global float 0.0
20
21define msp430_intrcc void @ISR() #0 {
22entry:
23; CHECK-LABEL: ISR:
24; CHECK: push	r15
25; CHECK: push	r14
26; CHECK: push	r13
27; CHECK: push	r12
28; CHECK: push	r11
29; CHECK: push	r10
30; CHECK: push	r9
31; CHECK: push	r8
32; CHECK: push	r7
33; CHECK: push	r6
34; CHECK: push	r5
35; CHECK: push	r4
36  %t1 = load volatile float, float* @g
37  %t2 = load volatile float, float* @g
38  %t3 = load volatile float, float* @g
39  %t4 = load volatile float, float* @g
40  %t5 = load volatile float, float* @g
41  %t6 = load volatile float, float* @g
42  %t7 = load volatile float, float* @g
43  store volatile float %t1, float* @g
44  store volatile float %t2, float* @g
45  store volatile float %t3, float* @g
46  store volatile float %t4, float* @g
47  store volatile float %t5, float* @g
48  store volatile float %t6, float* @g
49; CHECK: reti
50  ret void
51}
52
53; Functions without 'interrupt' attribute don't get a vector section.
54; CHECK-NOT: __interrupt_vector
55; CHECK-LABEL: NMI:
56; CHECK: reti
57define msp430_intrcc void @NMI() #1 {
58  ret void
59}
60
61attributes #0 = { noinline nounwind optnone "interrupt"="2" }
62attributes #1 = { noinline nounwind optnone }
63