1; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16_h 2; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16_b 3 4@.str = private unnamed_addr constant [9 x i8] c"%hd %c \0A\00", align 1 5@sp = common global i16* null, align 4 6@cp = common global i8* null, align 4 7 8define void @p1(i16 signext %s, i8 signext %c) nounwind { 9entry: 10 %conv = sext i16 %s to i32 11 %conv1 = sext i8 %c to i32 12 %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i32 %conv, i32 %conv1) nounwind 13 ret void 14} 15 16declare i32 @printf(i8* nocapture, ...) nounwind 17 18define void @p2() nounwind { 19entry: 20 %0 = load i16*, i16** @sp, align 4 21 %1 = load i16, i16* %0, align 2 22 %2 = load i8*, i8** @cp, align 4 23 %3 = load i8, i8* %2, align 1 24 %conv.i = sext i16 %1 to i32 25 %conv1.i = sext i8 %3 to i32 26 %call.i = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i32 %conv.i, i32 %conv1.i) nounwind 27 %4 = load i16*, i16** @sp, align 4 28 store i16 32, i16* %4, align 2 29 %5 = load i8*, i8** @cp, align 4 30 store i8 97, i8* %5, align 1 31 ret void 32} 33 34define void @test() nounwind { 35entry: 36 %s = alloca i16, align 4 37 %c = alloca i8, align 4 38 store i16 16, i16* %s, align 4 39 store i8 99, i8* %c, align 4 40 store i16* %s, i16** @sp, align 4 41 store i8* %c, i8** @cp, align 4 42 %call.i.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i32 16, i32 99) nounwind 43 %0 = load i16*, i16** @sp, align 4 44 store i16 32, i16* %0, align 2 45 %1 = load i8*, i8** @cp, align 4 46 store i8 97, i8* %1, align 1 47 %2 = load i16, i16* %s, align 4 48 %3 = load i8, i8* %c, align 4 49 %conv.i = sext i16 %2 to i32 50 %conv1.i = sext i8 %3 to i32 51 %call.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i32 %conv.i, i32 %conv1.i) nounwind 52 ret void 53; 16_b-LABEL: test: 54; 16_h-LABEL: test: 55; 16_b: sb ${{[0-9]+}}, [[offset1:[0-9]+]](${{[0-9]+}}) 56; 16_b: lb ${{[0-9]+}}, [[offset1]](${{[0-9]+}}) 57; 16_h: sh ${{[0-9]+}}, [[offset2:[0-9]+]](${{[0-9]+}}) 58; 16_h: lh ${{[0-9]+}}, [[offset2]](${{[0-9]+}}) 59} 60 61define i32 @main() nounwind { 62entry: 63 %s.i = alloca i16, align 4 64 %c.i = alloca i8, align 4 65 %0 = bitcast i16* %s.i to i8* 66 call void @llvm.lifetime.start(i64 -1, i8* %0) nounwind 67 call void @llvm.lifetime.start(i64 -1, i8* %c.i) nounwind 68 store i16 16, i16* %s.i, align 4 69 store i8 99, i8* %c.i, align 4 70 store i16* %s.i, i16** @sp, align 4 71 store i8* %c.i, i8** @cp, align 4 72 %call.i.i.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i32 16, i32 99) nounwind 73 %1 = load i16*, i16** @sp, align 4 74 store i16 32, i16* %1, align 2 75 %2 = load i8*, i8** @cp, align 4 76 store i8 97, i8* %2, align 1 77 %3 = load i16, i16* %s.i, align 4 78 %4 = load i8, i8* %c.i, align 4 79 %conv.i.i = sext i16 %3 to i32 80 %conv1.i.i = sext i8 %4 to i32 81 %call.i.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i32 %conv.i.i, i32 %conv1.i.i) nounwind 82 call void @llvm.lifetime.end(i64 -1, i8* %0) nounwind 83 call void @llvm.lifetime.end(i64 -1, i8* %c.i) nounwind 84 ret i32 0 85} 86 87declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind 88 89declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind 90 91