1 ; RUN: llc < %s -march=avr -mcpu=atmega328p | FileCheck %s
3 ; This test checks a basic 'blinking led' program.
4 ; It is written for the ATmega328P
6 ; Derived from the following C program (with some cleanups):
32 ; Sets up the data direction register.
33 ; CHECK-LABEL: setup_ddr
34 define void @setup_ddr() {
37 ; This should set the 5th bit of DDRB.
41 %0 = load volatile i8, i8* inttoptr (i16 36 to i8*), align 1
42 %conv = zext i8 %0 to i16
43 %or = or i16 %conv, 32
44 %conv1 = trunc i16 %or to i8
45 store volatile i8 %conv1, i8* inttoptr (i16 36 to i8*), align 1
50 ; CHECK-LABEL: turn_on
51 define void @turn_on() {
54 ; This should set the 5th bit of PORTB
58 %0 = load volatile i8, i8* inttoptr (i16 37 to i8*), align 1
59 %conv = zext i8 %0 to i16
60 %or = or i16 %conv, 32
61 %conv1 = trunc i16 %or to i8
62 store volatile i8 %conv1, i8* inttoptr (i16 37 to i8*), align 1
67 ; CHECK-LABEL: turn_off
68 define void @turn_off() {
71 ; This should clear the 5th bit of PORTB
75 %0 = load volatile i8, i8* inttoptr (i16 37 to i8*), align 1
76 %conv = zext i8 %0 to i16
77 %and = and i16 %conv, -33
78 %conv1 = trunc i16 %and to i8
79 store volatile i8 %conv1, i8* inttoptr (i16 37 to i8*), align 1
87 ; CHECK: call setup_ddr
88 call void @setup_ddr()
92 ; CHECK-LABEL: .LBB3_1
98 ; CHECK-NEXT: call turn_off
101 ; CHECK-NEXT: rjmp .LBB3_1