1
Fork 0

Update the comments for Win64 ABI in tests.

This commit is contained in:
Luqman Aden 2015-10-14 21:16:13 -05:00
parent 3c31841c72
commit 5eb4de1a16
2 changed files with 38 additions and 54 deletions

View file

@ -38,9 +38,14 @@ struct Huge {
int32_t e;
};
// SysV ABI:
// System V x86_64 ABI:
// a, b, c, d, e should be in registers
// s should be byval pointer
//
// Win64 ABI:
// a, b, c, d should be in registers
// e should be on the stack
// s should be byval pointer
void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Rect s) {
assert(a == 1);
assert(b == 2);
@ -53,10 +58,16 @@ void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Re
assert(s.d == 556);
}
// SysV ABI:
// System V x86_64 ABI:
// a, b, c, d, e, f, g should be in sse registers
// s should be split across 2 registers
// t should be byval pointer
//
// Win64 ABI:
// a, b, c, d should be in sse registers
// e, f, g should be on the stack
// s should be on the stack (treated as 2 i64's)
// t should be on the stack (treated as an i64 and a double)
void byval_rect_floats(float a, float b, double c, float d, float e,
float f, double g, struct Rect s, struct FloatRect t) {
assert(a == 1.);
@ -75,10 +86,16 @@ void byval_rect_floats(float a, float b, double c, float d, float e,
assert(t.c == 8.);
}
// SysV ABI:
// a, b, d, e should be in registers
// System V x86_64 ABI:
// a, b, d, e, f should be in registers
// c passed via sse registers
// s should be byval pointer
//
// Win64 ABI:
// a, b, d should be in registers
// c passed via sse registers
// e, f should be on the stack
// s should be byval pointer
void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d,
int32_t e, int32_t f, struct Rect s) {
assert(a == 1);
@ -93,9 +110,9 @@ void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d,
assert(s.d == 556);
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// a, b should be in registers
// s should be split across 2 registers
// s should be split across 2 integer registers
void split_rect(int32_t a, int32_t b, struct Rect s) {
assert(a == 1);
assert(b == 2);
@ -105,9 +122,9 @@ void split_rect(int32_t a, int32_t b, struct Rect s) {
assert(s.d == 556);
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// a, b should be in sse registers
// s should be split across int32_t & sse registers
// s should be split across integer & sse registers
void split_rect_floats(float a, float b, struct FloatRect s) {
assert(a == 1.);
assert(b == 2.);
@ -116,10 +133,16 @@ void split_rect_floats(float a, float b, struct FloatRect s) {
assert(s.c == 8.);
}
// SysV ABI:
// System V x86_64 ABI:
// a, b, d, f should be in registers
// c, e passed via sse registers
// s should be split across 2 registers
//
// Win64 ABI:
// a, b, d should be in registers
// c passed via sse registers
// e, f should be on the stack
// s should be on the stack (treated as 2 i64's)
void split_rect_with_floats(int32_t a, int32_t b, float c,
int32_t d, float e, int32_t f, struct Rect s) {
assert(a == 1);
@ -134,7 +157,7 @@ void split_rect_with_floats(int32_t a, int32_t b, float c,
assert(s.d == 556);
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// a, b, c should be in registers
// s should be split across 2 registers
// t should be a byval pointer
@ -152,7 +175,7 @@ void split_and_byval_rect(int32_t a, int32_t b, int32_t c, struct Rect s, struct
assert(t.d == 556);
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// a, b should in registers
// s and return should be split across 2 registers
struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) {
@ -165,7 +188,7 @@ struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) {
return s;
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// a, b, c, d should be in registers
// return should be in a hidden sret pointer
// s should be a byval pointer
@ -184,7 +207,7 @@ struct BiggerRect sret_byval_struct(int32_t a, int32_t b, int32_t c, int32_t d,
return t;
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// a, b should be in registers
// return should be in a hidden sret pointer
// s should be split across 2 registers
@ -201,7 +224,7 @@ struct BiggerRect sret_split_struct(int32_t a, int32_t b, struct Rect s) {
return t;
}
// SysV ABI:
// System V x86_64 & Win64 ABI:
// s should be byval pointer (since sizeof(s) > 16)
// return should in a hidden sret pointer
struct Huge huge_struct(struct Huge s) {

View file

@ -9,7 +9,7 @@
// except according to those terms.
// Passing structs via FFI should work regardless of whether
// the functions gets passed in multiple registers or is a hidden pointer
// they get passed in multiple registers, byval pointers or the stack
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(C)]
@ -48,66 +48,27 @@ struct Huge {
#[link(name = "test", kind = "static")]
extern {
// SysV ABI:
// a, b, c, d, e should be in registers
// s should be byval pointer
fn byval_rect(a: i32, b: i32, c: i32, d: i32, e: i32, s: Rect);
// SysV ABI:
// a, b, c, d, e, f, g should be in sse registers
// s should be split across 2 registers
// t should be byval pointer
fn byval_rect_floats(a: f32, b: f32, c: f64, d: f32, e: f32,
f: f32, g: f64, s: Rect, t: FloatRect);
// SysV ABI:
// a, b, d, e should be in registers
// c passed via sse registers
// s should be byval pointer
fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect);
// SysV ABI:
// a, b should be in registers
// s should be split across 2 registers
fn split_rect(a: i32, b: i32, s: Rect);
// SysV ABI:
// a, b should be in sse registers
// s should be split across int & sse registers
fn split_rect_floats(a: f32, b: f32, s: FloatRect);
// SysV ABI:
// a, b, d, f should be in registers
// c, e passed via sse registers
// s should be split across 2 registers
fn split_rect_with_floats(a: i32, b: i32, c: f32, d: i32, e: f32, f: i32, s: Rect);
// SysV ABI:
// a, b, c should be in registers
// s should be split across 2 registers
// t should be a byval pointer
fn split_and_byval_rect(a: i32, b: i32, c: i32, s: Rect, t: Rect);
// SysV ABI:
// a, b should in registers
// s and return should be split across 2 registers
fn split_ret_byval_struct(a: i32, b: i32, s: Rect) -> Rect;
// SysV ABI:
// a, b, c, d should be in registers
// return should be in a hidden sret pointer
// s should be a byval pointer
fn sret_byval_struct(a: i32, b: i32, c: i32, d: i32, s: Rect) -> BiggerRect;
// SysV ABI:
// a, b should be in registers
// return should be in a hidden sret pointer
// s should be split across 2 registers
fn sret_split_struct(a: i32, b: i32, s: Rect) -> BiggerRect;
// SysV ABI:
// s should be byval pointer (since sizeof(s) > 16)
// return should in a hidden sret pointer
fn huge_struct(s: Huge) -> Huge;
}