1; RUN: llc < %s -march=msp430 | FileCheck %s 2target datalayout = "e-p:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:16:16" 3target triple = "msp430-generic-generic" 4 5define i16 @am1(i16* %a) nounwind { 6 %1 = load i16, i16* %a 7 ret i16 %1 8} 9; CHECK-LABEL: am1: 10; CHECK: mov.w 0(r15), r15 11 12@foo = external global i16 13 14define i16 @am2() nounwind { 15 %1 = load i16, i16* @foo 16 ret i16 %1 17} 18; CHECK-LABEL: am2: 19; CHECK: mov.w &foo, r15 20 21@bar = internal constant [2 x i8] [ i8 32, i8 64 ] 22 23define i8 @am3(i16 %n) nounwind { 24 %1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %n 25 %2 = load i8, i8* %1 26 ret i8 %2 27} 28; CHECK-LABEL: am3: 29; CHECK: mov.b bar(r15), r15 30 31define i16 @am4() nounwind { 32 %1 = load volatile i16, i16* inttoptr(i16 32 to i16*) 33 ret i16 %1 34} 35; CHECK-LABEL: am4: 36; CHECK: mov.w &32, r15 37 38define i16 @am5(i16* %a) nounwind { 39 %1 = getelementptr i16, i16* %a, i16 2 40 %2 = load i16, i16* %1 41 ret i16 %2 42} 43; CHECK-LABEL: am5: 44; CHECK: mov.w 4(r15), r15 45 46%S = type { i16, i16 } 47@baz = common global %S zeroinitializer, align 1 48 49define i16 @am6() nounwind { 50 %1 = load i16, i16* getelementptr (%S, %S* @baz, i32 0, i32 1) 51 ret i16 %1 52} 53; CHECK-LABEL: am6: 54; CHECK: mov.w &baz+2, r15 55 56%T = type { i16, [2 x i8] } 57@duh = internal constant %T { i16 16, [2 x i8][i8 32, i8 64 ] } 58 59define i8 @am7(i16 %n) nounwind { 60 %1 = getelementptr %T, %T* @duh, i32 0, i32 1 61 %2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n 62 %3= load i8, i8* %2 63 ret i8 %3 64} 65; CHECK-LABEL: am7: 66; CHECK: mov.b duh+2(r15), r15 67 68