Commit 67792032 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[turbofan] Add float unit tests for c-linkage/x64

Bug: chromium:1052746
Change-Id: Iafe5104952d8086e2cabdff8aa031e964ff0626a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2423704
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70173}
parent 9b385eb7
......@@ -391,6 +391,11 @@ MachineType MachineTypeForCType<double>() {
return MachineType::Float64();
}
template <>
MachineType MachineTypeForCType<float>() {
return MachineType::Float32();
}
#define SIGNATURE_TYPES_END(TYPE, IDX, VALUE) MachineTypeForCType<TYPE>()
#define SIGNATURE_TYPES(TYPE, IDX, VALUE) SIGNATURE_TYPES_END(TYPE, IDX, VALUE),
......@@ -678,6 +683,254 @@ int64_t func_only_int_20(int32_t arg0, int32_t arg1, int32_t arg2, int32_t arg3,
SIGNATURE_TEST(RunCallWithSignatureOnlyInt20, SIGNATURE_ONLY_INT_20,
func_only_int_20)
#define MIXED_SIGNATURE_SIMPLE_FLOAT(V) \
V(int32_t, 0, 0) \
V(float, 1, 1.5) \
V##_END(int32_t, 2, 2)
int64_t test_api_func_simple_float(int32_t arg0, float arg1, int32_t arg2) {
CHECK(MIXED_SIGNATURE_SIMPLE_FLOAT(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureSimpleFloat,
MIXED_SIGNATURE_SIMPLE_FLOAT, test_api_func_simple_float)
#define MIXED_SIGNATURE_FLOAT(V) \
V(int32_t, 0, 0) \
V(float, 1, 1.5) \
V(int32_t, 2, 2) \
V(float, 3, 3.5) \
V(int32_t, 4, 4) \
V(float, 5, 5.5) \
V(int32_t, 6, 6) \
V(float, 7, 7.5) \
V(int32_t, 8, 8) \
V(float, 9, 9.5) \
V##_END(int32_t, 10, 10)
int64_t test_api_func_float(int32_t arg0, float arg1, int32_t arg2, float arg3,
int32_t arg4, float arg5, int32_t arg6, float arg7,
int32_t arg8, float arg9, int32_t arg10) {
CHECK(MIXED_SIGNATURE_FLOAT(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureFloat, MIXED_SIGNATURE_FLOAT,
test_api_func_float)
#define MIXED_SIGNATURE_INT_FLOAT_ALT(V) \
V(int32_t, 0, 0) \
V(float, 1, 1.5) \
V(int32_t, 2, 2) \
V(float, 3, 3.5) \
V(int32_t, 4, 4) \
V(float, 5, 5.5) \
V(int32_t, 6, 6) \
V(float, 7, 7.5) \
V(int32_t, 8, 8) \
V(float, 9, 9.5) \
V(int32_t, 10, 10) \
V(float, 11, 11.5) \
V(int32_t, 12, 12) \
V(float, 13, 13.5) \
V(int32_t, 14, 14) \
V(float, 15, 15.5) \
V(int32_t, 16, 16) \
V(float, 17, 17.5) \
V(int32_t, 18, 18) \
V##_END(float, 19, 19.5)
int64_t func_mixed_int_float_alt(int32_t arg0, float arg1, int32_t arg2,
float arg3, int32_t arg4, float arg5,
int32_t arg6, float arg7, int32_t arg8,
float arg9, int32_t arg10, float arg11,
int32_t arg12, float arg13, int32_t arg14,
float arg15, int32_t arg16, float arg17,
int32_t arg18, float arg19) {
CHECK(MIXED_SIGNATURE_INT_FLOAT_ALT(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureIntFloatAlt,
MIXED_SIGNATURE_INT_FLOAT_ALT, func_mixed_int_float_alt)
#define SIGNATURE_ONLY_FLOAT_20(V) \
V(float, 0, 0.5) \
V(float, 1, 1.5) \
V(float, 2, 2.5) \
V(float, 3, 3.5) \
V(float, 4, 4.5) \
V(float, 5, 5.5) \
V(float, 6, 6.5) \
V(float, 7, 7.5) \
V(float, 8, 8.5) \
V(float, 9, 9.5) \
V(float, 10, 10.5) \
V(float, 11, 11.5) \
V(float, 12, 12.5) \
V(float, 13, 13.5) \
V(float, 14, 14.5) \
V(float, 15, 15.5) \
V(float, 16, 16.5) \
V(float, 17, 17.5) \
V(float, 18, 18.5) \
V##_END(float, 19, 19.5)
int64_t func_only_float_20(float arg0, float arg1, float arg2, float arg3,
float arg4, float arg5, float arg6, float arg7,
float arg8, float arg9, float arg10, float arg11,
float arg12, float arg13, float arg14, float arg15,
float arg16, float arg17, float arg18, float arg19) {
CHECK(SIGNATURE_ONLY_FLOAT_20(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithSignatureOnlyFloat20, SIGNATURE_ONLY_FLOAT_20,
func_only_float_20)
#define MIXED_SIGNATURE_FLOAT_INT(V) \
V(float, 0, 0.5) \
V(float, 1, 1.5) \
V(float, 2, 2.5) \
V(float, 3, 3.5) \
V(float, 4, 4.5) \
V(float, 5, 5.5) \
V(float, 6, 6.5) \
V(float, 7, 7.5) \
V(float, 8, 8.5) \
V(float, 9, 9.5) \
V(int32_t, 10, 10) \
V(int32_t, 11, 11) \
V(int32_t, 12, 12) \
V(int32_t, 13, 13) \
V(int32_t, 14, 14) \
V(int32_t, 15, 15) \
V(int32_t, 16, 16) \
V(int32_t, 17, 17) \
V(int32_t, 18, 18) \
V##_END(int32_t, 19, 19)
int64_t func_mixed_float_int(float arg0, float arg1, float arg2, float arg3,
float arg4, float arg5, float arg6, float arg7,
float arg8, float arg9, int32_t arg10,
int32_t arg11, int32_t arg12, int32_t arg13,
int32_t arg14, int32_t arg15, int32_t arg16,
int32_t arg17, int32_t arg18, int32_t arg19) {
CHECK(MIXED_SIGNATURE_FLOAT_INT(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureFloatInt, MIXED_SIGNATURE_FLOAT_INT,
func_mixed_float_int)
#define MIXED_SIGNATURE_INT_FLOAT(V) \
V(int32_t, 0, 0) \
V(int32_t, 1, 1) \
V(int32_t, 2, 2) \
V(int32_t, 3, 3) \
V(int32_t, 4, 4) \
V(int32_t, 5, 5) \
V(int32_t, 6, 6) \
V(int32_t, 7, 7) \
V(int32_t, 8, 8) \
V(int32_t, 9, 9) \
V(float, 10, 10.5) \
V(float, 11, 11.5) \
V(float, 12, 12.5) \
V(float, 13, 13.5) \
V(float, 14, 14.5) \
V(float, 15, 15.5) \
V(float, 16, 16.5) \
V(float, 17, 17.5) \
V(float, 18, 18.5) \
V##_END(float, 19, 19.5)
int64_t func_mixed_int_float(int32_t arg0, int32_t arg1, int32_t arg2,
int32_t arg3, int32_t arg4, int32_t arg5,
int32_t arg6, int32_t arg7, int32_t arg8,
int32_t arg9, float arg10, float arg11,
float arg12, float arg13, float arg14, float arg15,
float arg16, float arg17, float arg18,
float arg19) {
CHECK(MIXED_SIGNATURE_INT_FLOAT(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureIntFloat, MIXED_SIGNATURE_INT_FLOAT,
func_mixed_int_float)
#define MIXED_SIGNATURE_FLOAT_DOUBLE(V) \
V(float, 0, 0.5) \
V(float, 1, 1.5) \
V(float, 2, 2.5) \
V(float, 3, 3.5) \
V(float, 4, 4.5) \
V(float, 5, 5.5) \
V(float, 6, 6.5) \
V(float, 7, 7.5) \
V(float, 8, 8.5) \
V(float, 9, 9.5) \
V(double, 10, 10.7) \
V(double, 11, 11.7) \
V(double, 12, 12.7) \
V(double, 13, 13.7) \
V(double, 14, 14.7) \
V(double, 15, 15.7) \
V(double, 16, 16.7) \
V(double, 17, 17.7) \
V(double, 18, 18.7) \
V##_END(double, 19, 19.7)
int64_t func_mixed_float_double(float arg0, float arg1, float arg2, float arg3,
float arg4, float arg5, float arg6, float arg7,
float arg8, float arg9, double arg10,
double arg11, double arg12, double arg13,
double arg14, double arg15, double arg16,
double arg17, double arg18, double arg19) {
CHECK(MIXED_SIGNATURE_FLOAT_DOUBLE(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureFloatDouble,
MIXED_SIGNATURE_FLOAT_DOUBLE, func_mixed_float_double)
#define MIXED_SIGNATURE_DOUBLE_FLOAT(V) \
V(double, 0, 0.7) \
V(double, 1, 1.7) \
V(double, 2, 2.7) \
V(double, 3, 3.7) \
V(double, 4, 4.7) \
V(double, 5, 5.7) \
V(double, 6, 6.7) \
V(double, 7, 7.7) \
V(double, 8, 8.7) \
V(double, 9, 9.7) \
V(float, 10, 10.5) \
V(float, 11, 11.5) \
V(float, 12, 12.5) \
V(float, 13, 13.5) \
V(float, 14, 14.5) \
V(float, 15, 15.5) \
V(float, 16, 16.5) \
V(float, 17, 17.5) \
V(float, 18, 18.5) \
V##_END(float, 19, 19.5)
int64_t func_mixed_double_float(double arg0, double arg1, double arg2,
double arg3, double arg4, double arg5,
double arg6, double arg7, double arg8,
double arg9, float arg10, float arg11,
float arg12, float arg13, float arg14,
float arg15, float arg16, float arg17,
float arg18, float arg19) {
CHECK(MIXED_SIGNATURE_DOUBLE_FLOAT(COMPARE_ARG_I));
return 42;
}
SIGNATURE_TEST(RunCallWithMixedSignatureDoubleFloat,
MIXED_SIGNATURE_DOUBLE_FLOAT, func_mixed_double_float)
#endif // V8_ENABLE_FP_PARAMS_IN_C_LINKAGE
} // namespace compiler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment