forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix justify error for small structures in varargs for MIPS64BE
There was a problem when passing structures as variable arguments. The structures smaller than 64 bit were not left justified on MIPS64 big endian. This is now fixed by shifting the value to make it left- justified when appropriate. This fixes the bug http://llvm.org/bugs/show_bug.cgi?id=21608 Patch by Aleksandar Beserminji. Differential Revision: http://reviews.llvm.org/D7881 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230657 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent
8d4343e
commit e53d9df
Showing
4 changed files
with
596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
282 changes: 282 additions & 0 deletions
282
test/CodeGen/Mips/cconv/arguments-varargs-small-structs-byte.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,282 @@ | ||
; RUN: llc --march=mips64 -mcpu=mips64r2 < %s | FileCheck %s | ||
|
||
; Generated from the C program: | ||
; | ||
; #include <stdio.h> | ||
; #include <string.h> | ||
; | ||
; struct SmallStruct_1b { | ||
; char x1; | ||
; }; | ||
; | ||
; struct SmallStruct_2b { | ||
; char x1; | ||
; char x2; | ||
; }; | ||
; | ||
; struct SmallStruct_3b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; }; | ||
; | ||
; struct SmallStruct_4b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; }; | ||
; | ||
; struct SmallStruct_5b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; }; | ||
; | ||
; struct SmallStruct_6b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; }; | ||
; | ||
; struct SmallStruct_7b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; char x7; | ||
; }; | ||
; | ||
; struct SmallStruct_8b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; char x7; | ||
; char x8; | ||
; }; | ||
; | ||
; struct SmallStruct_9b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; char x7; | ||
; char x8; | ||
; char x9; | ||
; }; | ||
; | ||
; void varArgF_SmallStruct(char* c, ...); | ||
; | ||
; void smallStruct_1b(struct SmallStruct_1b* ss) { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_2b(struct SmallStruct_2b* ss) { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_3b(struct SmallStruct_3b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_4b(struct SmallStruct_4b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_5b(struct SmallStruct_5b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_6b(struct SmallStruct_6b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_7b(struct SmallStruct_7b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_8b(struct SmallStruct_8b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_9b(struct SmallStruct_9b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
|
||
%struct.SmallStruct_1b = type { i8 } | ||
%struct.SmallStruct_2b = type { i8, i8 } | ||
%struct.SmallStruct_3b = type { i8, i8, i8 } | ||
%struct.SmallStruct_4b = type { i8, i8, i8, i8 } | ||
%struct.SmallStruct_5b = type { i8, i8, i8, i8, i8 } | ||
%struct.SmallStruct_6b = type { i8, i8, i8, i8, i8, i8 } | ||
%struct.SmallStruct_7b = type { i8, i8, i8, i8, i8, i8, i8 } | ||
%struct.SmallStruct_8b = type { i8, i8, i8, i8, i8, i8, i8, i8 } | ||
%struct.SmallStruct_9b = type { i8, i8, i8, i8, i8, i8, i8, i8, i8 } | ||
|
||
@.str = private unnamed_addr constant [3 x i8] c"01\00", align 1 | ||
|
||
declare void @varArgF_SmallStruct(i8* %c, ...) | ||
|
||
define void @smallStruct_1b(%struct.SmallStruct_1b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
store %struct.SmallStruct_1b* %ss, %struct.SmallStruct_1b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_1b** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_1b* %0 to { i8 }* | ||
%2 = getelementptr { i8 }* %1, i32 0, i32 0 | ||
%3 = load i8* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i8 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_1b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
} | ||
|
||
define void @smallStruct_2b(%struct.SmallStruct_2b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_2b*, align 8 | ||
store %struct.SmallStruct_2b* %ss, %struct.SmallStruct_2b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_2b** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_2b* %0 to { i16 }* | ||
%2 = getelementptr { i16 }* %1, i32 0, i32 0 | ||
%3 = load i16* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i16 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_2b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 48 | ||
} | ||
|
||
define void @smallStruct_3b(%struct.SmallStruct_3b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_3b*, align 8 | ||
%.coerce = alloca { i24 } | ||
store %struct.SmallStruct_3b* %ss, %struct.SmallStruct_3b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_3b** %ss.addr, align 8 | ||
%1 = bitcast { i24 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_3b* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 3, i32 0, i1 false) | ||
%3 = getelementptr { i24 }* %.coerce, i32 0, i32 0 | ||
%4 = load i24* %3, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i24 inreg %4) | ||
ret void | ||
; CHECK-LABEL: smallStruct_3b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 40 | ||
} | ||
|
||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1 | ||
|
||
define void @smallStruct_4b(%struct.SmallStruct_4b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_4b*, align 8 | ||
store %struct.SmallStruct_4b* %ss, %struct.SmallStruct_4b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_4b** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_4b* %0 to { i32 }* | ||
%2 = getelementptr { i32 }* %1, i32 0, i32 0 | ||
%3 = load i32* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_4b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32 | ||
} | ||
|
||
define void @smallStruct_5b(%struct.SmallStruct_5b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_5b*, align 8 | ||
%.coerce = alloca { i40 } | ||
store %struct.SmallStruct_5b* %ss, %struct.SmallStruct_5b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_5b** %ss.addr, align 8 | ||
%1 = bitcast { i40 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_5b* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 5, i32 0, i1 false) | ||
%3 = getelementptr { i40 }* %.coerce, i32 0, i32 0 | ||
%4 = load i40* %3, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i40 inreg %4) | ||
ret void | ||
; CHECK-LABEL: smallStruct_5b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 24 | ||
} | ||
|
||
define void @smallStruct_6b(%struct.SmallStruct_6b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_6b*, align 8 | ||
%.coerce = alloca { i48 } | ||
store %struct.SmallStruct_6b* %ss, %struct.SmallStruct_6b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_6b** %ss.addr, align 8 | ||
%1 = bitcast { i48 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_6b* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false) | ||
%3 = getelementptr { i48 }* %.coerce, i32 0, i32 0 | ||
%4 = load i48* %3, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i48 inreg %4) | ||
ret void | ||
; CHECK-LABEL: smallStruct_6b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 | ||
} | ||
|
||
define void @smallStruct_7b(%struct.SmallStruct_7b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_7b*, align 8 | ||
%.coerce = alloca { i56 } | ||
store %struct.SmallStruct_7b* %ss, %struct.SmallStruct_7b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_7b** %ss.addr, align 8 | ||
%1 = bitcast { i56 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_7b* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 7, i32 0, i1 false) | ||
%3 = getelementptr { i56 }* %.coerce, i32 0, i32 0 | ||
%4 = load i56* %3, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i56 inreg %4) | ||
ret void | ||
; CHECK-LABEL: smallStruct_7b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 8 | ||
} | ||
|
||
define void @smallStruct_8b(%struct.SmallStruct_8b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_8b*, align 8 | ||
store %struct.SmallStruct_8b* %ss, %struct.SmallStruct_8b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_8b** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_8b* %0 to { i64 }* | ||
%2 = getelementptr { i64 }* %1, i32 0, i32 0 | ||
%3 = load i64* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_8b: | ||
; CHECK-NOT: dsll | ||
} | ||
|
||
define void @smallStruct_9b(%struct.SmallStruct_9b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_9b*, align 8 | ||
%.coerce = alloca { i64, i8 } | ||
store %struct.SmallStruct_9b* %ss, %struct.SmallStruct_9b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_9b** %ss.addr, align 8 | ||
%1 = bitcast { i64, i8 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_9b* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 9, i32 0, i1 false) | ||
%3 = getelementptr { i64, i8 }* %.coerce, i32 0, i32 0 | ||
%4 = load i64* %3, align 1 | ||
%5 = getelementptr { i64, i8 }* %.coerce, i32 0, i32 1 | ||
%6 = load i8* %5, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %4, i8 inreg %6) | ||
ret void | ||
; CHECK-LABEL: smallStruct_9b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
} |
149 changes: 149 additions & 0 deletions
149
test/CodeGen/Mips/cconv/arguments-varargs-small-structs-combinations.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
; RUN: llc --march=mips64 -mcpu=mips64r2 < %s | FileCheck %s | ||
|
||
; Generated from the C program: | ||
; | ||
; #include <stdio.h> | ||
; #include <string.h> | ||
; | ||
; struct SmallStruct_1b1s { | ||
; char x1; | ||
; short x2; | ||
; }; | ||
; | ||
; struct SmallStruct_1b1i { | ||
; char x1; | ||
; int x2; | ||
; }; | ||
; | ||
; struct SmallStruct_1b1s1b { | ||
; char x1; | ||
; short x2; | ||
; char x3; | ||
; }; | ||
; | ||
; struct SmallStruct_1s1i { | ||
; short x1; | ||
; int x2; | ||
; }; | ||
; | ||
; struct SmallStruct_3b1s { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; short x4; | ||
; }; | ||
; | ||
; void varArgF_SmallStruct(char* c, ...); | ||
; | ||
; void smallStruct_1b1s(struct SmallStruct_1b1s* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_1b1i(struct SmallStruct_1b1i* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_1b1s1b(struct SmallStruct_1b1s1b* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_1s1i(struct SmallStruct_1s1i* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
; | ||
; void smallStruct_3b1s(struct SmallStruct_3b1s* ss) | ||
; { | ||
; varArgF_SmallStruct("", *ss); | ||
; } | ||
|
||
%struct.SmallStruct_1b1s = type { i8, i16 } | ||
%struct.SmallStruct_1b1i = type { i8, i32 } | ||
%struct.SmallStruct_1b1s1b = type { i8, i16, i8 } | ||
%struct.SmallStruct_1s1i = type { i16, i32 } | ||
%struct.SmallStruct_3b1s = type { i8, i8, i8, i16 } | ||
|
||
@.str = private unnamed_addr constant [3 x i8] c"01\00", align 1 | ||
|
||
declare void @varArgF_SmallStruct(i8* %c, ...) | ||
|
||
define void @smallStruct_1b1s(%struct.SmallStruct_1b1s* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_1b1s*, align 8 | ||
store %struct.SmallStruct_1b1s* %ss, %struct.SmallStruct_1b1s** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_1b1s** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_1b1s* %0 to { i32 }* | ||
%2 = getelementptr { i32 }* %1, i32 0, i32 0 | ||
%3 = load i32* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_1b1s: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32 | ||
} | ||
|
||
define void @smallStruct_1b1i(%struct.SmallStruct_1b1i* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_1b1i*, align 8 | ||
store %struct.SmallStruct_1b1i* %ss, %struct.SmallStruct_1b1i** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_1b1i** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_1b1i* %0 to { i64 }* | ||
%2 = getelementptr { i64 }* %1, i32 0, i32 0 | ||
%3 = load i64* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_1b1i: | ||
; CHECK-NOT: dsll | ||
} | ||
|
||
define void @smallStruct_1b1s1b(%struct.SmallStruct_1b1s1b* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_1b1s1b*, align 8 | ||
%.coerce = alloca { i48 } | ||
store %struct.SmallStruct_1b1s1b* %ss, %struct.SmallStruct_1b1s1b** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_1b1s1b** %ss.addr, align 8 | ||
%1 = bitcast { i48 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_1b1s1b* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false) | ||
%3 = getelementptr { i48 }* %.coerce, i32 0, i32 0 | ||
%4 = load i48* %3, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i48 inreg %4) | ||
ret void | ||
; CHECK-LABEL: smallStruct_1b1s1b: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 | ||
} | ||
|
||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1 | ||
|
||
define void @smallStruct_1s1i(%struct.SmallStruct_1s1i* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_1s1i*, align 8 | ||
store %struct.SmallStruct_1s1i* %ss, %struct.SmallStruct_1s1i** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_1s1i** %ss.addr, align 8 | ||
%1 = bitcast %struct.SmallStruct_1s1i* %0 to { i64 }* | ||
%2 = getelementptr { i64 }* %1, i32 0, i32 0 | ||
%3 = load i64* %2, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %3) | ||
ret void | ||
; CHECK-LABEL: smallStruct_1s1i: | ||
; CHECK-NOT: dsll | ||
} | ||
|
||
define void @smallStruct_3b1s(%struct.SmallStruct_3b1s* %ss) #0 { | ||
entry: | ||
%ss.addr = alloca %struct.SmallStruct_3b1s*, align 8 | ||
%.coerce = alloca { i48 } | ||
store %struct.SmallStruct_3b1s* %ss, %struct.SmallStruct_3b1s** %ss.addr, align 8 | ||
%0 = load %struct.SmallStruct_3b1s** %ss.addr, align 8 | ||
%1 = bitcast { i48 }* %.coerce to i8* | ||
%2 = bitcast %struct.SmallStruct_3b1s* %0 to i8* | ||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false) | ||
%3 = getelementptr { i48 }* %.coerce, i32 0, i32 0 | ||
%4 = load i48* %3, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i48 inreg %4) | ||
ret void | ||
; CHECK-LABEL: smallStruct_3b1s: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 | ||
} |
161 changes: 161 additions & 0 deletions
161
test/CodeGen/Mips/cconv/arguments-varargs-small-structs-multiple-args.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
; RUN: llc --march=mips64 -mcpu=mips64r2 < %s | FileCheck %s | ||
|
||
; Generated from the C program: | ||
; | ||
; #include <stdio.h> | ||
; #include <string.h> | ||
; | ||
; struct SmallStruct_1b { | ||
; char x1; | ||
; }; | ||
; | ||
; struct SmallStruct_2b { | ||
; char x1; | ||
; char x2; | ||
; }; | ||
; | ||
; struct SmallStruct_3b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; }; | ||
; | ||
; struct SmallStruct_4b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; }; | ||
; | ||
; struct SmallStruct_5b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; }; | ||
; | ||
; struct SmallStruct_6b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; }; | ||
; | ||
; struct SmallStruct_7b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; char x7; | ||
; }; | ||
; | ||
; struct SmallStruct_8b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; char x7; | ||
; char x8; | ||
; }; | ||
; | ||
; struct SmallStruct_9b { | ||
; char x1; | ||
; char x2; | ||
; char x3; | ||
; char x4; | ||
; char x5; | ||
; char x6; | ||
; char x7; | ||
; char x8; | ||
; char x9; | ||
; }; | ||
; | ||
; void varArgF_SmallStruct(char* c, ...); | ||
; | ||
; void smallStruct_1b_x9(struct SmallStruct_1b* ss1, struct SmallStruct_1b* ss2, struct SmallStruct_1b* ss3, struct SmallStruct_1b* ss4, struct SmallStruct_1b* ss5, struct SmallStruct_1b* ss6, struct SmallStruct_1b* ss7, struct SmallStruct_1b* ss8, struct SmallStruct_1b* ss9) | ||
; { | ||
; varArgF_SmallStruct("", *ss1, *ss2, *ss3, *ss4, *ss5, *ss6, *ss7, *ss8, *ss9); | ||
; } | ||
|
||
%struct.SmallStruct_1b = type { i8 } | ||
|
||
@.str = private unnamed_addr constant [3 x i8] c"01\00", align 1 | ||
|
||
declare void @varArgF_SmallStruct(i8* %c, ...) | ||
|
||
define void @smallStruct_1b_x9(%struct.SmallStruct_1b* %ss1, %struct.SmallStruct_1b* %ss2, %struct.SmallStruct_1b* %ss3, %struct.SmallStruct_1b* %ss4, %struct.SmallStruct_1b* %ss5, %struct.SmallStruct_1b* %ss6, %struct.SmallStruct_1b* %ss7, %struct.SmallStruct_1b* %ss8, %struct.SmallStruct_1b* %ss9) #0 { | ||
entry: | ||
%ss1.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss2.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss3.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss4.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss5.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss6.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss7.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss8.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
%ss9.addr = alloca %struct.SmallStruct_1b*, align 8 | ||
store %struct.SmallStruct_1b* %ss1, %struct.SmallStruct_1b** %ss1.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss2, %struct.SmallStruct_1b** %ss2.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss3, %struct.SmallStruct_1b** %ss3.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss4, %struct.SmallStruct_1b** %ss4.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss5, %struct.SmallStruct_1b** %ss5.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss6, %struct.SmallStruct_1b** %ss6.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss7, %struct.SmallStruct_1b** %ss7.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss8, %struct.SmallStruct_1b** %ss8.addr, align 8 | ||
store %struct.SmallStruct_1b* %ss9, %struct.SmallStruct_1b** %ss9.addr, align 8 | ||
%0 = load %struct.SmallStruct_1b** %ss1.addr, align 8 | ||
%1 = load %struct.SmallStruct_1b** %ss2.addr, align 8 | ||
%2 = load %struct.SmallStruct_1b** %ss3.addr, align 8 | ||
%3 = load %struct.SmallStruct_1b** %ss4.addr, align 8 | ||
%4 = load %struct.SmallStruct_1b** %ss5.addr, align 8 | ||
%5 = load %struct.SmallStruct_1b** %ss6.addr, align 8 | ||
%6 = load %struct.SmallStruct_1b** %ss7.addr, align 8 | ||
%7 = load %struct.SmallStruct_1b** %ss8.addr, align 8 | ||
%8 = load %struct.SmallStruct_1b** %ss9.addr, align 8 | ||
%9 = bitcast %struct.SmallStruct_1b* %0 to { i8 }* | ||
%10 = getelementptr { i8 }* %9, i32 0, i32 0 | ||
%11 = load i8* %10, align 1 | ||
%12 = bitcast %struct.SmallStruct_1b* %1 to { i8 }* | ||
%13 = getelementptr { i8 }* %12, i32 0, i32 0 | ||
%14 = load i8* %13, align 1 | ||
%15 = bitcast %struct.SmallStruct_1b* %2 to { i8 }* | ||
%16 = getelementptr { i8 }* %15, i32 0, i32 0 | ||
%17 = load i8* %16, align 1 | ||
%18 = bitcast %struct.SmallStruct_1b* %3 to { i8 }* | ||
%19 = getelementptr { i8 }* %18, i32 0, i32 0 | ||
%20 = load i8* %19, align 1 | ||
%21 = bitcast %struct.SmallStruct_1b* %4 to { i8 }* | ||
%22 = getelementptr { i8 }* %21, i32 0, i32 0 | ||
%23 = load i8* %22, align 1 | ||
%24 = bitcast %struct.SmallStruct_1b* %5 to { i8 }* | ||
%25 = getelementptr { i8 }* %24, i32 0, i32 0 | ||
%26 = load i8* %25, align 1 | ||
%27 = bitcast %struct.SmallStruct_1b* %6 to { i8 }* | ||
%28 = getelementptr { i8 }* %27, i32 0, i32 0 | ||
%29 = load i8* %28, align 1 | ||
%30 = bitcast %struct.SmallStruct_1b* %7 to { i8 }* | ||
%31 = getelementptr { i8 }* %30, i32 0, i32 0 | ||
%32 = load i8* %31, align 1 | ||
%33 = bitcast %struct.SmallStruct_1b* %8 to { i8 }* | ||
%34 = getelementptr { i8 }* %33, i32 0, i32 0 | ||
%35 = load i8* %34, align 1 | ||
call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i8 inreg %11, i8 inreg %14, i8 inreg %17, i8 inreg %20, i8 inreg %23, i8 inreg %26, i8 inreg %29, i8 inreg %32, i8 inreg %35) | ||
ret void | ||
; CHECK-LABEL: smallStruct_1b_x9: | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 56 | ||
} |