diff --git a/SingleSource/Regression/C/2003-05-21-UnionBitfields.c b/SingleSource/Regression/C/2003-05-21-UnionBitfields.c index 57ceec724..37e796cf8 100644 --- a/SingleSource/Regression/C/2003-05-21-UnionBitfields.c +++ b/SingleSource/Regression/C/2003-05-21-UnionBitfields.c @@ -6,7 +6,7 @@ int target_isinf(double x) { union { double d; struct { - unsigned mantissa2; + unsigned long mantissa2; unsigned long mantissa1 : 20; unsigned exponent : 11; unsigned sign : 1; diff --git a/SingleSource/Regression/C/2003-05-21-UnionTest.c b/SingleSource/Regression/C/2003-05-21-UnionTest.c index 626ba09d7..5a66ea504 100644 --- a/SingleSource/Regression/C/2003-05-21-UnionTest.c +++ b/SingleSource/Regression/C/2003-05-21-UnionTest.c @@ -1,7 +1,7 @@ #include int __signbit (double __x) { - union { double __d; int __i[3]; } __u = { __d: __x }; + union { double __d; long __i[3]; } __u = { __d: __x }; return __u.__i[1] < 0; } diff --git a/SingleSource/Regression/C/2003-10-12-GlobalVarInitializers.c b/SingleSource/Regression/C/2003-10-12-GlobalVarInitializers.c index 27d41a3dd..d6e2e062f 100644 --- a/SingleSource/Regression/C/2003-10-12-GlobalVarInitializers.c +++ b/SingleSource/Regression/C/2003-10-12-GlobalVarInitializers.c @@ -1,9 +1,9 @@ #include -union { unsigned __l; float __d; } GlobalUnion = { 0x70c00000U }; +union { unsigned long __l; float __d; } GlobalUnion = { 0x70c00000U }; int main() { - union { unsigned __l; float __d; } LocalUnion = { 0x7fc00000U }; + union { unsigned long __l; float __d; } LocalUnion = { 0x7fc00000U }; printf("%f %f\n", GlobalUnion.__d, LocalUnion.__d); diff --git a/SingleSource/Regression/C/CMakeLists.txt b/SingleSource/Regression/C/CMakeLists.txt index b378b9beb..92b92137d 100644 --- a/SingleSource/Regression/C/CMakeLists.txt +++ b/SingleSource/Regression/C/CMakeLists.txt @@ -1,4 +1,3 @@ - if(ARCH MATCHES "x86" OR ARCH MATCHES "riscv" OR ARCH MATCHES "SystemZ" OR ARCH MATCHES "Mips" OR ARCH MATCHES "AArch64" OR ARCH MATCHES "ARM" OR @@ -9,24 +8,21 @@ endif() if (ARCH STREQUAL "MOS") file(GLOB Source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c) list(REMOVE_ITEM Source + # Permanently disabled tests. + # --------------------------- + + # Requires large stack. + test_indvars.c + + # Too slow + bigstack.c + # Temporarily disabled tests. # --------------------------- # Requires indirect branch. 2004-03-15-IndirectGoto.c - # Requires floating point. - 2003-05-21-UnionBitfields.c - 2003-05-21-UnionTest.c - 2003-10-12-GlobalVarInitializers.c - 2008-01-07-LongDouble.c - bigstack.c - callargs.c - casts.c - matrixTranspose.c - test_indvars.c - uint64_to_float.c - # Requires fprintf. PR491.c @@ -34,6 +30,15 @@ if (ARCH STREQUAL "MOS") badidx.c sumarraymalloc.c + # Requires atof. + casts.c + + # Requires fenv.h. + uint64_to_float.c + + # Requires large whole number float printf + 2003-10-12-GlobalVarInitializers.c + # Requires argc/argv. 2005-05-06-LongLongSignedShift.c ) @@ -42,3 +47,11 @@ endif() list(APPEND LDFLAGS -lm) list(APPEND CFLAGS -Wno-implicit-int) llvm_singlesource(PREFIX "Regression-C-") + +if(ARCH STREQUAL "MOS") + target_link_libraries(Regression-C-2003-05-21-UnionBitfields PRIVATE printf_flt) + target_link_libraries(Regression-C-2003-05-21-UnionTest PRIVATE printf_flt) + target_link_libraries(Regression-C-2008-01-07-LongDouble PRIVATE printf_flt) + target_link_libraries(Regression-C-callargs PRIVATE printf_flt) + target_link_libraries(Regression-C-matrixTranspose PRIVATE printf_flt) +endif() diff --git a/SingleSource/UnitTests/2002-05-02-ManyArguments.c b/SingleSource/UnitTests/2002-05-02-ManyArguments.c index 484fa2d57..df3187e9f 100644 --- a/SingleSource/UnitTests/2002-05-02-ManyArguments.c +++ b/SingleSource/UnitTests/2002-05-02-ManyArguments.c @@ -7,6 +7,6 @@ void printfn(int a, short b, double C, float D, signed char E, char F, void *G, } int main() { - printfn(12, 2, 123.234, 1231.12312f, -12, 23, (void*)123456, 0, 1234567, 123124124124LL); + printfn(12, 2, 123.234, 1231.12312f, -12, 23, (void*)12345, 0, 12345, 123124124124LL); return 0; } diff --git a/SingleSource/UnitTests/2002-05-02-ManyArguments.reference_output b/SingleSource/UnitTests/2002-05-02-ManyArguments.reference_output index 7a9091071..6d05c0664 100644 --- a/SingleSource/UnitTests/2002-05-02-ManyArguments.reference_output +++ b/SingleSource/UnitTests/2002-05-02-ManyArguments.reference_output @@ -1,3 +1,3 @@ 12, 2, 123.234000, 1231.123169, -12 -23, 123456, 0, 1234567, 123124124124 +23, 12345, 0, 12345, 123124124124 exit 0 diff --git a/SingleSource/UnitTests/2003-08-05-CastFPToUint.c b/SingleSource/UnitTests/2003-08-05-CastFPToUint.c index c6d6b3bdf..247fcb4aa 100644 --- a/SingleSource/UnitTests/2003-08-05-CastFPToUint.c +++ b/SingleSource/UnitTests/2003-08-05-CastFPToUint.c @@ -16,9 +16,9 @@ main(int argc, char** argv) { double DI = getDI(); unsigned char uc = (unsigned char ) DC; unsigned short us = (unsigned short) DS; - unsigned int ui = (unsigned int ) DI; + unsigned long ui = (unsigned long ) DI; printf("DC = %lf, DS = %lf, DI = %lf\n", DC, DS, DI); - printf("uc = %u, us = %u, ui = %u\n", uc, us, ui); + printf("uc = %u, us = %u, ui = %lu\n", uc, us, ui); return 0; } diff --git a/SingleSource/UnitTests/2005-07-17-INT-To-FP.c b/SingleSource/UnitTests/2005-07-17-INT-To-FP.c index 382a76e5d..d000fa399 100644 --- a/SingleSource/UnitTests/2005-07-17-INT-To-FP.c +++ b/SingleSource/UnitTests/2005-07-17-INT-To-FP.c @@ -1,7 +1,7 @@ // Test the various SINT-TO-FP and UINT-TO-FP conversions. #include -int tests[] = { +long tests[] = { 0x80000000, -123456792, -10, @@ -33,12 +33,12 @@ int main() { (double)(unsigned long long)((unsigned long long)i << 58ULL)); // i64 } // edge case tests - for (i = 0; i < (sizeof(tests) / sizeof(int)); i++) { + for (i = 0; i < (sizeof(tests) / sizeof(long)); i++) { printf("%d %f, %f, %f, %f\n", i, - (double)(unsigned)tests[i], - (double)( signed)tests[i], + (double)(unsigned long)tests[i], + (double)( signed long)tests[i], (float) tests[i], - (float) ( signed)tests[i]); + (float) ( signed long)tests[i]); } return 0; } diff --git a/SingleSource/UnitTests/2007-01-04-KNR-Args.c b/SingleSource/UnitTests/2007-01-04-KNR-Args.c index 84299a048..324af521c 100644 --- a/SingleSource/UnitTests/2007-01-04-KNR-Args.c +++ b/SingleSource/UnitTests/2007-01-04-KNR-Args.c @@ -3,12 +3,12 @@ p1 (c, f1, s, d1, i, f2, l, d2) char c; float f1; short s; double d1; int i; float f2; long l; double d2; { - printf("%c %f %d %f %d %f %d %f\n", c, f1, s, d1,i, f2, l, d2); + printf("%c %f %d %f %d %f %ld %f\n", c, f1, s, d1,i, f2, l, d2); } void p2 (char c, float f1, short s, double d1, int i, float f2, long l, double d2) { - printf("%c %f %d %f %d %f %d %f\n", c, f1, s, d1,i, f2, l, d2); + printf("%c %f %d %f %d %f %ld %f\n", c, f1, s, d1,i, f2, l, d2); } int main(int argc, const char *argv[]) { diff --git a/SingleSource/UnitTests/CMakeLists.txt b/SingleSource/UnitTests/CMakeLists.txt index 70e52ccaa..7e087d3cc 100644 --- a/SingleSource/UnitTests/CMakeLists.txt +++ b/SingleSource/UnitTests/CMakeLists.txt @@ -83,24 +83,9 @@ if(ARCH STREQUAL "MOS") # Temporarily disabled tests. # --------------------------- - # Requires floating point. - 2002-05-02-ArgumentTest.c - 2002-05-02-ManyArguments.c - 2002-10-12-StructureArgs.c - 2002-10-12-StructureArgsSimple.c - 2003-05-07-VarArgs.c - 2003-08-05-CastFPToUint.c - 2003-08-11-VaListArg.c - 2004-02-02-NegativeZero.c + # Requires printing large floating point whole numbers 2005-05-12-Int64ToFP.c 2005-07-17-INT-To-FP.c - 2006-12-01-float_varg.c - 2007-01-04-KNR-Args.c - 2009-04-16-BitfieldInitialization.c - 2009-12-07-StructReturn.c - FloatPrecision.c - StructModifyTest.c - byval-alignment.c # Requires scanf. 2004-11-28-GlobalBoolLayout.c @@ -123,7 +108,23 @@ endif() llvm_singlesource() -if(NOT ARCH STREQUAL "MOS") +if(ARCH STREQUAL "MOS") + target_link_libraries(2002-05-02-ArgumentTest PRIVATE printf_flt) + target_link_libraries(2002-05-02-ManyArguments PRIVATE printf_flt) + target_link_libraries(2002-10-12-StructureArgs PRIVATE printf_flt) + target_link_libraries(2002-10-12-StructureArgsSimple PRIVATE printf_flt) + target_link_libraries(2003-05-07-VarArgs PRIVATE printf_flt) + target_link_libraries(2003-08-05-CastFPToUint PRIVATE printf_flt) + target_link_libraries(2003-08-11-VaListArg PRIVATE printf_flt) + target_link_libraries(2004-02-02-NegativeZero PRIVATE printf_flt) + target_link_libraries(2006-12-01-float_varg PRIVATE printf_flt) + target_link_libraries(2007-01-04-KNR-Args PRIVATE printf_flt) + target_link_libraries(2009-04-16-BitfieldInitialization PRIVATE printf_flt) + target_link_libraries(2009-12-07-StructReturn PRIVATE printf_flt) + target_link_libraries(FloatPrecision PRIVATE printf_flt) + target_link_libraries(StructModifyTest PRIVATE printf_flt) + target_link_libraries(byval-alignment PRIVATE printf_flt) +else() if (COMPILER_HAS_MATRIX_FLAG) set_property(TARGET matrix-types-spec PROPERTY LINK_OPTIONS -fenable-matrix) endif()