reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s

__attribute__((regparm(3))) void f1(int a, int b, int c, int d);
// CHECK: declare void @f1(i32 inreg, i32 inreg, i32 inreg, i32)
void g1() {
  f1(41, 42, 43, 44);
}

struct s1 {
  int x1;
};
__attribute__((regparm(3))) void f2(int a, int b, struct s1 c, int d);
// CHECK: declare void @f2(i32 inreg, i32 inreg, i32 inreg, i32)
void g2() {
  struct s1 x = {43};
  f2(41, 42, x, 44);
}

struct s2 {
  int x1;
  int x2;
};
__attribute__((regparm(3))) void f3(int a, int b, struct s2 c, int d);
// CHECK: declare void @f3(i32 inreg, i32 inreg, i32, i32, i32)
void g3() {
  struct s2 x = {43, 44};
  f3(41, 42, x, 45);
}
__attribute__((regparm(3))) void f4(int a, struct s2 b, int c);
// CHECK: declare void @f4(i32 inreg, i32 inreg, i32 inreg, i32)
void g4() {
  struct s2 x = {42, 43};
  f4(41, x, 44);
}

struct s3 {
  int x1;
  int x2;
  int x3;
};
__attribute__((regparm(3))) void f5(int a, struct s3 b, int c);
// CHECK: declare void @f5(i32 inreg, i32, i32, i32, i32)
void g5() {
  struct s3 x = {42, 43, 44};
  f5(41, x, 45);
}
__attribute__((regparm(3))) void f6(struct s3 a, int b);
// CHECK: declare void @f6(i32 inreg, i32 inreg, i32 inreg, i32)
void g6() {
  struct s3 x = {41, 42, 43};
  f6(x, 44);
}

struct s4 {
  int x1;
  int x2;
  int x3;
  int x4;
};
__attribute__((regparm(3))) void f7(struct s4 a, int b);
// CHECK: declare void @f7(i32, i32, i32, i32, i32)
void g7() {
  struct s4 x = {41, 42, 43, 44};
  f7(x, 45);
}

__attribute__((regparm(3))) void f8(float a, int b);
// CHECK: declare void @f8(float, i32 inreg)
void g8(void) {
  f8(41, 42);
}

struct s5 {
  float x1;
};
__attribute__((regparm(3))) void f9(struct s5 a, int b);
// CHECK: declare void @f9(float, i32 inreg)
void g9(void) {
  struct s5 x = {41};
  f9(x, 42);
}

struct s6 {
  float x1;
  int x2;
};
__attribute__((regparm(3))) void f10(struct s6 a, int b);
// CHECK: declare void @f10(i32 inreg, i32 inreg, i32 inreg)
void g10(void) {
  struct s6 x = {41, 42};
  f10(x, 43);
}

struct s7 {
  float x1;
  int x2;
  float x3;
};
__attribute__((regparm(3))) void f11(struct s7 a, int b);
// CHECK: declare void @f11(i32 inreg, i32 inreg, i32 inreg, i32)
void g11(void) {
  struct s7 x = {41, 42, 43};
  f11(x, 44);
}

struct s8 {
  float x1;
  float x2;
};
__attribute__((regparm(3))) void f12(struct s8 a, int b);
// CHECK: declare void @f12(i32 inreg, i32 inreg, i32 inreg)
void g12(void) {
  struct s8 x = {41, 42};
  f12(x, 43);
}

struct s9 {
  float x1;
  float x2;
  float x3;
};
__attribute__((regparm(3))) void f13(struct s9 a, int b);
// CHECK: declare void @f13(i32 inreg, i32 inreg, i32 inreg, i32)
void g13(void) {
  struct s9 x = {41, 42, 43};
  f13(x, 44);
}

struct s10 {
  double x1;
};
__attribute__((regparm(3))) void f14(struct s10 a, int b, int c);
// CHECK: declare void @f14(double, i32 inreg, i32 inreg)
void g14(void) {
  struct s10 x = { 41 };
  f14(x, 42, 43);
}

struct s11 {
  double x1;
  double x2;
};
__attribute__((regparm(3))) void f15(struct s11 a, int b);
// CHECK: declare void @f15(double, double, i32)
void g15(void) {
  struct s11 x = { 41, 42 };
  f15(x, 43);
}

struct s12 {
  double x1;
  float x2;
};
__attribute__((regparm(3))) void f16(struct s12 a, int b);
// CHECK: declare void @f16(i32 inreg, i32 inreg, i32 inreg, i32)
void g16(void) {
  struct s12 x = { 41, 42 };
  f16(x, 43);
}

__attribute__((regparm(3))) struct s12 f17(int a, int b, int c);
// CHECK: declare void @f17(%struct.s12* inreg sret, i32 inreg, i32 inreg, i32)
void g17(void) {
  f17(41, 42, 43);
}

struct s13 {
  struct inner {
    float x;
  } y;
};
__attribute__((regparm(3))) void f18(struct s13 a, int b, int c, int d);
// CHECK: declare void @f18(%struct.s13* byval(%struct.s13) align 4, i32 inreg, i32 inreg, i32 inreg)
void g18(void) {
  struct s13 x = {{41}};
  f18(x, 42, 43, 44);
}