source: icGREP/icgrep-devel/llvm-3.6.1.src/test/CodeGen/Mips/cconv/arguments-varargs-small-structs-combinations.ll @ 4664

Last change on this file since 4664 was 4664, checked in by cameron, 4 years ago

Upgrade LLVM to 3.6.1

File size: 4.7 KB
Line 
1; RUN: llc --march=mips64 -mcpu=mips64r2 < %s | FileCheck %s
2
3; Generated from the C program:
4;
5; #include <stdio.h>
6; #include <string.h>
7;
8; struct SmallStruct_1b1s {
9;  char x1;
10;  short x2;
11; };
12;
13; struct SmallStruct_1b1i {
14;  char x1;
15;  int x2;
16; };
17;
18; struct SmallStruct_1b1s1b {
19;  char x1;
20;  short x2;
21;  char x3;
22; };
23;
24; struct SmallStruct_1s1i {
25;  short x1;
26;  int x2;
27; };
28;
29; struct SmallStruct_3b1s {
30;  char x1;
31;  char x2;
32;  char x3;
33;  short x4;
34; };
35;
36; void varArgF_SmallStruct(char* c, ...);
37;
38; void smallStruct_1b1s(struct SmallStruct_1b1s* ss)
39; {
40;  varArgF_SmallStruct("", *ss);
41; }
42;
43; void smallStruct_1b1i(struct SmallStruct_1b1i* ss)
44; {
45;  varArgF_SmallStruct("", *ss);
46; }
47;
48; void smallStruct_1b1s1b(struct SmallStruct_1b1s1b* ss)
49; {
50;  varArgF_SmallStruct("", *ss);
51; }
52;
53; void smallStruct_1s1i(struct SmallStruct_1s1i* ss)
54; {
55;  varArgF_SmallStruct("", *ss);
56; }
57;
58; void smallStruct_3b1s(struct SmallStruct_3b1s* ss)
59; {
60;  varArgF_SmallStruct("", *ss);
61; }
62
63%struct.SmallStruct_1b1s = type { i8, i16 }
64%struct.SmallStruct_1b1i = type { i8, i32 }
65%struct.SmallStruct_1b1s1b = type { i8, i16, i8 }
66%struct.SmallStruct_1s1i = type { i16, i32 }
67%struct.SmallStruct_3b1s = type { i8, i8, i8, i16 }
68
69@.str = private unnamed_addr constant [3 x i8] c"01\00", align 1
70
71declare void @varArgF_SmallStruct(i8* %c, ...)
72
73define void @smallStruct_1b1s(%struct.SmallStruct_1b1s* %ss) #0 {
74entry:
75  %ss.addr = alloca %struct.SmallStruct_1b1s*, align 8
76  store %struct.SmallStruct_1b1s* %ss, %struct.SmallStruct_1b1s** %ss.addr, align 8
77  %0 = load %struct.SmallStruct_1b1s** %ss.addr, align 8
78  %1 = bitcast %struct.SmallStruct_1b1s* %0 to { i32 }*
79  %2 = getelementptr { i32 }* %1, i32 0, i32 0
80  %3 = load i32* %2, align 1
81  call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i32 inreg %3)
82  ret void
83 ; CHECK-LABEL: smallStruct_1b1s:
84 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 32
85}
86
87define void @smallStruct_1b1i(%struct.SmallStruct_1b1i* %ss) #0 {
88entry:
89  %ss.addr = alloca %struct.SmallStruct_1b1i*, align 8
90  store %struct.SmallStruct_1b1i* %ss, %struct.SmallStruct_1b1i** %ss.addr, align 8
91  %0 = load %struct.SmallStruct_1b1i** %ss.addr, align 8
92  %1 = bitcast %struct.SmallStruct_1b1i* %0 to { i64 }*
93  %2 = getelementptr { i64 }* %1, i32 0, i32 0
94  %3 = load i64* %2, align 1
95  call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %3)
96  ret void
97 ; CHECK-LABEL: smallStruct_1b1i:
98 ; CHECK-NOT: dsll
99}
100
101define void @smallStruct_1b1s1b(%struct.SmallStruct_1b1s1b* %ss) #0 {
102entry:
103  %ss.addr = alloca %struct.SmallStruct_1b1s1b*, align 8
104  %.coerce = alloca { i48 }
105  store %struct.SmallStruct_1b1s1b* %ss, %struct.SmallStruct_1b1s1b** %ss.addr, align 8
106  %0 = load %struct.SmallStruct_1b1s1b** %ss.addr, align 8
107  %1 = bitcast { i48 }* %.coerce to i8*
108  %2 = bitcast %struct.SmallStruct_1b1s1b* %0 to i8*
109  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false)
110  %3 = getelementptr { i48 }* %.coerce, i32 0, i32 0
111  %4 = load i48* %3, align 1
112  call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i48 inreg %4)
113  ret void
114 ; CHECK-LABEL: smallStruct_1b1s1b:
115 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16
116}
117
118declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1
119
120define void @smallStruct_1s1i(%struct.SmallStruct_1s1i* %ss) #0 {
121entry:
122  %ss.addr = alloca %struct.SmallStruct_1s1i*, align 8
123  store %struct.SmallStruct_1s1i* %ss, %struct.SmallStruct_1s1i** %ss.addr, align 8
124  %0 = load %struct.SmallStruct_1s1i** %ss.addr, align 8
125  %1 = bitcast %struct.SmallStruct_1s1i* %0 to { i64 }*
126  %2 = getelementptr { i64 }* %1, i32 0, i32 0
127  %3 = load i64* %2, align 1
128  call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i64 inreg %3)
129  ret void
130 ; CHECK-LABEL: smallStruct_1s1i:
131 ; CHECK-NOT: dsll
132}
133
134define void @smallStruct_3b1s(%struct.SmallStruct_3b1s* %ss) #0 {
135entry:
136  %ss.addr = alloca %struct.SmallStruct_3b1s*, align 8
137  %.coerce = alloca { i48 }
138  store %struct.SmallStruct_3b1s* %ss, %struct.SmallStruct_3b1s** %ss.addr, align 8
139  %0 = load %struct.SmallStruct_3b1s** %ss.addr, align 8
140  %1 = bitcast { i48 }* %.coerce to i8*
141  %2 = bitcast %struct.SmallStruct_3b1s* %0 to i8*
142  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 6, i32 0, i1 false)
143  %3 = getelementptr { i48 }* %.coerce, i32 0, i32 0
144  %4 = load i48* %3, align 1
145  call void (i8*, ...)* @varArgF_SmallStruct(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i48 inreg %4)
146  ret void
147 ; CHECK-LABEL: smallStruct_3b1s:
148 ; CHECK: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16
149}
Note: See TracBrowser for help on using the repository browser.