1; RUN: llc < %s -march=avr | FileCheck %s 2 3define avr_intrcc void @interrupt_handler() { 4; CHECK-LABEL: interrupt_handler: 5; CHECK: sei 6; CHECK-NEXT: push r0 7; CHECK-NEXT: push r1 8; CHECK-NEXT: in r0, 63 9; CHECK-NEXT: push r0 10; CHECK: clr r0 11; CHECK: pop r0 12; CHECK-NEXT: out 63, r0 13; CHECK-NEXT: pop r1 14; CHECK-NEXT: pop r0 15; CHECK-NEXT: reti 16 ret void 17} 18 19define void @interrupt_handler_via_ir_attribute() #0 { 20; CHECK-LABEL: interrupt_handler_via_ir_attribute: 21; CHECK: sei 22; CHECK-NEXT: push r0 23; CHECK-NEXT: push r1 24; CHECK-NEXT: in r0, 63 25; CHECK-NEXT: push r0 26; CHECK: clr r0 27; CHECK: pop r0 28; CHECK-NEXT: out 63, r0 29; CHECK-NEXT: pop r1 30; CHECK-NEXT: pop r0 31; CHECK-NEXT: reti 32 ret void 33} 34 35define avr_signalcc void @signal_handler() { 36; CHECK-LABEL: signal_handler: 37; CHECK-NOT: sei 38; CHECK: push r0 39; CHECK-NEXT: push r1 40; CHECK-NEXT: in r0, 63 41; CHECK-NEXT: push r0 42; CHECK: clr r0 43; CHECK: pop r0 44; CHECK-NEXT: out 63, r0 45; CHECK-NEXT: pop r1 46; CHECK-NEXT: pop r0 47; CHECK-NEXT: reti 48 ret void 49} 50 51define void @signal_handler_via_attribute() #1 { 52; CHECK-LABEL: signal_handler_via_attribute: 53; CHECK-NOT: sei 54; CHECK: push r0 55; CHECK-NEXT: push r1 56; CHECK-NEXT: in r0, 63 57; CHECK-NEXT: push r0 58; CHECK: clr r0 59; CHECK: pop r0 60; CHECK-NEXT: out 63, r0 61; CHECK-NEXT: pop r1 62; CHECK-NEXT: pop r0 63; CHECK-NEXT: reti 64 ret void 65} 66 67define avr_intrcc void @interrupt_alloca() { 68; CHECK-LABEL: interrupt_alloca: 69; CHECK: sei 70; CHECK-NEXT: push r0 71; CHECK-NEXT: push r1 72; CHECK-NEXT: in r0, 63 73; CHECK-NEXT: push r0 74; CHECK: clr r0 75; CHECK: push r28 76; CHECK-NEXT: push r29 77; CHECK-NEXT: in r28, 61 78; CHECK-NEXT: in r29, 62 79; CHECK-NEXT: sbiw r28, 1 80; CHECK-NEXT: in r0, 63 81; CHECK-NEXT: cli 82; CHECK-NEXT: out 62, r29 83; CHECK-NEXT: out 63, r0 84; CHECK-NEXT: out 61, r28 85; CHECK: adiw r28, 1 86; CHECK-NEXT: in r0, 63 87; CHECK-NEXT: cli 88; CHECK-NEXT: out 62, r29 89; CHECK-NEXT: out 63, r0 90; CHECK-NEXT: out 61, r28 91; CHECK-NEXT: pop r29 92; CHECK-NEXT: pop r28 93; CHECK: pop r0 94; CHECK-NEXT: out 63, r0 95; CHECK-NEXT: pop r1 96; CHECK-NEXT: pop r0 97; CHECK-NEXT: reti 98 alloca i8 99 ret void 100} 101 102attributes #0 = { "interrupt" } 103attributes #1 = { "signal" } 104