From 9d32ec8e7b7cb5875701f57e5eb54f9b19768c66 Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Tue, 10 Sep 2024 13:19:20 -0700 Subject: [PATCH 1/7] [flang] Disable two tests as error is being downgraded (#161) Fortran/gfortran/regression/restricted_expression_2.f90 and Fortran/gfortran/regression/restricted_expression_3.f90 are disabled with this patch, as the condition that they test will soon no longer be an error with flang, just a warning. (This is the use of a local variable with proper initialization and the SAVE attribute being used as part of a specification expression.) --- Fortran/gfortran/regression/DisabledFiles.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Fortran/gfortran/regression/DisabledFiles.cmake b/Fortran/gfortran/regression/DisabledFiles.cmake index a97def389..4195562b9 100644 --- a/Fortran/gfortran/regression/DisabledFiles.cmake +++ b/Fortran/gfortran/regression/DisabledFiles.cmake @@ -1301,6 +1301,8 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS pr95614_2.f90 pr95882_3.f90 recursive_check_3.f90 + restricted_expression_2.f90 + restricted_expression_3.f90 return_1.f90 size_kind_3.f90 string_3.f90 From 24c82a8b24a487bdb7947ba134a14ab399f8ce44 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 11 Sep 2024 09:33:03 +0200 Subject: [PATCH 2/7] Fix spurious errors in halide tests (#159) We occasionally see spurious llvm-test-suite failures with the following error message: CMake Error: failed to create symbolic link '/tmp/tmp.x1PxF3OhCA/Bitcode/Benchmarks/Halide/local_laplacian/../images/rgb.bytes': File exists The reason for this is that two halide tests try to copy a test input to the same location, and create_symlink can fail if these calls race. Fix this by putting the inputs for the tests into different directories, by not making ".." part of the result directory. --- Bitcode/Benchmarks/Halide/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bitcode/Benchmarks/Halide/CMakeLists.txt b/Bitcode/Benchmarks/Halide/CMakeLists.txt index 06f863096..34126c0c7 100644 --- a/Bitcode/Benchmarks/Halide/CMakeLists.txt +++ b/Bitcode/Benchmarks/Halide/CMakeLists.txt @@ -10,11 +10,11 @@ if(NOT MSVC) endif() macro(test_img_input img) - llvm_test_run(%S/../images/${img}.bytes ${ARGN} %S/${img}_out.bytes) + llvm_test_run(%S/images/${img}.bytes ${ARGN} %S/${img}_out.bytes) llvm_test_verify(%b/${FPCMP} %S/output/${img}_out.bytes %S/${img}_out.bytes) endmacro() macro(test_img_data target img) - llvm_test_data(${target} ../images/${img}.bytes) + llvm_test_data(${target} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. images/${img}.bytes) llvm_test_data(${target} output/${img}_out.bytes) endmacro() From 093c09fe602c9ffd3f48da475bbecca8b1c1ed98 Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Thu, 12 Sep 2024 09:03:52 -0700 Subject: [PATCH 3/7] [flang] Disable test that expects error from new extension (#163) I'm shortly adding the ability to allow real-looking input for NAMELIST integer values. GNU Fortran doesn't allow that, and has a test to check its error detection, so disable that test. --- Fortran/gfortran/regression/DisabledFiles.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Fortran/gfortran/regression/DisabledFiles.cmake b/Fortran/gfortran/regression/DisabledFiles.cmake index 4195562b9..ace6de0e2 100644 --- a/Fortran/gfortran/regression/DisabledFiles.cmake +++ b/Fortran/gfortran/regression/DisabledFiles.cmake @@ -1052,6 +1052,7 @@ file(GLOB FAILING_FILES CONFIGURE_DEPENDS io_real_boz2.f90 io_real_boz_4.f90 io_real_boz_5.f90 + namelist_96.f90 # real data for integer NAMELIST input no_unit_error_1.f90 pointer_check_10.f90 pointer_remapping_6.f08 From e77ce1bfc8dbe38b9bf5a3098cb954e58d125020 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 13 Sep 2024 09:26:57 +0200 Subject: [PATCH 4/7] fpcmp: Dump inputs on comparison failure (#160) There are occasionally spurious failures in llvm-test-suite, and you end up with a phenomenally unhelpful message like: tools/fpcmp-target: Comparison failed, textual difference between '0' and '7' This is good enough if you can inspect the inputs to fpcmp locally, but unhelpful for CI failures. Improve things by dumping the inputs to fpcmp on a textual comparison failure. --- tools/fpcmp.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/fpcmp.c b/tools/fpcmp.c index 3d026e24d..a0bab1d1f 100644 --- a/tools/fpcmp.c +++ b/tools/fpcmp.c @@ -247,6 +247,27 @@ char *load_file(const char *path, long *size_out) { return data; } +static bool contains_non_printable_characters(const char *data) { + size_t len = strlen(data); + for (size_t i = 0; i < len; ++i) + if (!isprint(data[i]) && !isspace(data[i])) + return true; + return false; +} + +static void dump_input(const char *label, const char *data) { + if (contains_non_printable_characters(data)) { + fprintf(stderr, "\n%s: Contains binary data.\n", label); + } else { + fprintf(stderr, "\n%s:\n%s", label, data); + } +} + +static void dump_inputs(const char *data_a, const char *data_b) { + dump_input("Input 1", data_a); + dump_input("Input 2", data_b); +} + int diff_file(const char *path_a, const char *path_b, bool parse_fp, double absolute_tolerance, double relative_tolerance, bool ignore_whitespace) { @@ -356,6 +377,7 @@ int diff_file(const char *path_a, const char *path_b, bool parse_fp, fprintf(stderr, "%s: Comparison failed, textual difference between '%c' and '%c'\n", g_program, F1P[0], F2P[0]); + dump_inputs(data_a, data_b); free(data_a); free(data_b); return 1; @@ -364,6 +386,7 @@ int diff_file(const char *path_a, const char *path_b, bool parse_fp, fprintf(stderr, "%s: Comparison failed, unexpected end of one of the files\n", g_program); + dump_inputs(data_a, data_b); free(data_a); free(data_b); return 1; From bd7738018decd92db239d63529243084a3fc5208 Mon Sep 17 00:00:00 2001 From: Alexandros Lamprineas Date: Fri, 20 Sep 2024 21:22:08 +0100 Subject: [PATCH 5/7] [FMV][AArch64] Unify tests for sha1 and sha2. (#164) Sha1 has been unified with sha2 in the ACLE spec (https://github.com/ARM-software/acle/pull/347) therefore I am adjusting the runtime tests for it. --- SingleSource/UnitTests/AArch64/acle-fmv-features.c | 10 +--------- .../AArch64/acle-fmv-features.reference_output | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/SingleSource/UnitTests/AArch64/acle-fmv-features.c b/SingleSource/UnitTests/AArch64/acle-fmv-features.c index 2175d446a..728d6973c 100644 --- a/SingleSource/UnitTests/AArch64/acle-fmv-features.c +++ b/SingleSource/UnitTests/AArch64/acle-fmv-features.c @@ -92,14 +92,7 @@ CHECK(sha2, sha2, { "fmov d0, #0" "\n" "fmov d1, #0" "\n" "sha256h q0, q0, v0.4s" "\n" - : : : "v0" - ); -}) -CHECK(sha1, sha1, { - asm volatile ( - "fmov s0, #0" "\n" - // FIXME: sha1h is under +sha2 in clang, and +sha1 doesn't exist yet. - ".inst 0x5e280800" "\n" // sha1h s0, s0 + "sha1h s0, s0" "\n" : : : "v0" ); }) @@ -263,7 +256,6 @@ int main(int, const char **) { check_rdm(); check_lse(); check_sha2(); - check_sha1(); check_aes(); check_pmull(); check_rcpc(); diff --git a/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output b/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output index 003c65ddf..888b30b6e 100644 --- a/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output +++ b/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output @@ -5,7 +5,6 @@ sha3 rdm lse sha2 -sha1 aes pmull rcpc From 782d3c04f48f1a71f150a2eb9f8f57740bce2be6 Mon Sep 17 00:00:00 2001 From: Alexandros Lamprineas Date: Sun, 22 Sep 2024 18:57:20 +0100 Subject: [PATCH 6/7] [FMV][AArch64] Add tests for feature ls64. (#162) The tests cover all three FEAT_LS64, FEAT_LS64_V and FEAT_LS64_ACCDATA. --- SingleSource/UnitTests/AArch64/acle-fmv-features.c | 13 +++++++++++++ .../AArch64/acle-fmv-features.reference_output | 1 + 2 files changed, 14 insertions(+) diff --git a/SingleSource/UnitTests/AArch64/acle-fmv-features.c b/SingleSource/UnitTests/AArch64/acle-fmv-features.c index 728d6973c..9e26d8472 100644 --- a/SingleSource/UnitTests/AArch64/acle-fmv-features.c +++ b/SingleSource/UnitTests/AArch64/acle-fmv-features.c @@ -235,6 +235,18 @@ CHECK(sme2, sme2, { "smstop za" "\n" ); }) +CHECK(ls64, ls64, { + long data[8]; + asm volatile ( + "ld64b x0, [%0]" "\n" + "st64b x0, [%0]" "\n" + "st64bv x8, x0, [%0]" "\n" + "st64bv0 x8, x0, [%0]" "\n" + : + : "r" (data) + : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "memory" + ); +}) static bool safe_try_feature(bool (*try_feature)(void)) { int child = fork(); @@ -275,6 +287,7 @@ int main(int, const char **) { check_crc(); check_sme(); check_sme2(); + check_ls64(); return any_fails ? -1 : 0; } diff --git a/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output b/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output index 888b30b6e..4b24c5711 100644 --- a/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output +++ b/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output @@ -24,4 +24,5 @@ fp crc sme sme2 +ls64 exit 0 From a40020695f1d4db5ec0dfb4138750c195463553d Mon Sep 17 00:00:00 2001 From: Alexandros Lamprineas Date: Fri, 27 Sep 2024 13:53:59 +0100 Subject: [PATCH 7/7] [FMV] Improve test coverage for FMV features. (#166) [FMV] Improve test coverage for FMV features. Adds tests for f32mm, f64mm, fp16fml, frintts, predres, rcpc3, rng, sve, sve2, sve2-bitperm, sve2-sha3, sve2-sm4, wfxt, sb, sm4, sme-f64f64, sme-i16i64, mops. --- .../UnitTests/AArch64/acle-fmv-features.c | 217 ++++++++++++++---- .../acle-fmv-features.reference_output | 18 ++ 2 files changed, 193 insertions(+), 42 deletions(-) diff --git a/SingleSource/UnitTests/AArch64/acle-fmv-features.c b/SingleSource/UnitTests/AArch64/acle-fmv-features.c index 9e26d8472..d7b36dbbb 100644 --- a/SingleSource/UnitTests/AArch64/acle-fmv-features.c +++ b/SingleSource/UnitTests/AArch64/acle-fmv-features.c @@ -15,58 +15,58 @@ static bool safe_try_feature(bool (*try_feature)(void)); static bool any_fails = false; #if __HAVE_FUNCTION_MULTI_VERSIONING -#define CHECK(X, TARGET_GUARD, BODY) \ +#define CHECK(FN_NAME_SUFFIX, FMV_FEATURE, TARGET_GUARD, BODY) \ __attribute__((target(#TARGET_GUARD))) \ - static bool try_##X(void) { \ + static bool try_##FN_NAME_SUFFIX(void) { \ do \ BODY \ while (0); \ return true; \ } \ - __attribute__((target_version(#X))) \ - static void check_##X(void) { \ - printf("%s\n", #X); \ + __attribute__((target_version(#FMV_FEATURE))) \ + static void check_##FN_NAME_SUFFIX(void) { \ + printf("%s\n", #FMV_FEATURE); \ fflush(stdout); \ - if (!safe_try_feature(try_##X)) { \ + if (!safe_try_feature(try_##FN_NAME_SUFFIX)) { \ printf("\tFAIL\n"); \ any_fails = true; \ } \ } \ __attribute__((target_version("default"))) \ - static void check_##X(void) { \ - printf("%s\n", #X); \ + static void check_##FN_NAME_SUFFIX(void) { \ + printf("%s\n", #FMV_FEATURE); \ fflush(stdout); \ - if (safe_try_feature(try_##X)) { \ + if (safe_try_feature(try_##FN_NAME_SUFFIX)) { \ printf("\tUPASS\n"); \ any_fails = true; \ } \ } #else -#define CHECK(X, TARGET_GUARD, BODY) \ - static void check_##X(void) { \ - printf("%s\n", #X); \ +#define CHECK(FN_NAME_SUFFIX, FMV_FEATURE, TARGET_GUARD, BODY) \ + static void check_##FN_NAME_SUFFIX(void) { \ + printf("%s\n", #FMV_FEATURE); \ } #endif -CHECK(flagm, flagm, { +CHECK(flagm, flagm, flagm, { asm volatile ( "cfinv" "\n" "cfinv" "\n" ); }) -CHECK(flagm2, arch=armv8.5-a, { +CHECK(flagm2, flagm2, arch=armv8.5-a, { asm volatile ( "axflag" "\n" "xaflag" "\n" ); }) -CHECK(dotprod, dotprod, { +CHECK(dotprod, dotprod, dotprod, { asm volatile ( "udot v0.4S,v1.16B,v2.16B" : : : "v0" ); }) -CHECK(sha3, sha3, { +CHECK(sha3, sha3, sha3, { asm volatile ( "fmov d0, #0" "\n" "fmov d1, #0" "\n" @@ -74,20 +74,20 @@ CHECK(sha3, sha3, { : : : "v0" ); }) -CHECK(rdm, rdm, { +CHECK(rdm, rdm, rdm, { asm volatile ( "sqrdmlah s0, s1, s2" : : : "s0" ); }) -CHECK(lse, lse, { +CHECK(lse, lse, lse, { uint64_t pointee = 0; asm volatile ( "swp xzr, xzr, [%[pointee]]" : : [pointee]"r"(&pointee) ); }) -CHECK(sha2, sha2, { +CHECK(sha2, sha2, sha2, { asm volatile ( "fmov d0, #0" "\n" "fmov d1, #0" "\n" @@ -96,7 +96,7 @@ CHECK(sha2, sha2, { : : : "v0" ); }) -CHECK(aes, aes, { +CHECK(aes, aes, aes, { asm volatile ( "fmov d0, #0" "\n" "fmov d1, #0" "\n" @@ -104,89 +104,88 @@ CHECK(aes, aes, { : : : "v0" ); }) -CHECK(pmull, aes, { +CHECK(pmull, pmull, aes, { asm volatile ( "fmov d0, #0" "\n" "pmull v0.1q, v0.1d, v0.1d" "\n" : : : "v0" ); }) -CHECK(rcpc, rcpc, { +CHECK(rcpc, rcpc, rcpc, { int x; asm volatile ( "ldaprb w0, [%0]" : : "r" (&x) : "w0" ); }) -CHECK(rcpc2, rcpc2, { +CHECK(rcpc2, rcpc2, arch=armv8.4-a, { int x; asm volatile ( "mov x1, %0" "\n" - // FIXME: rcpc2 instructions are under +rcpc-immo in clang, and not +rcpc2. - ".inst 0x19400020" // ldapurb w0, [x1] - : : "r" (&x) : "w0" + "ldapurb w0, [x1]" "\n" + : : "r" (&x) : "w0", "x1" ); }) -CHECK(fcma, fcma, { +CHECK(fcma, fcma, fcma, { asm volatile ( "fmov d0, #0" "\n" "fcadd v0.2s, v0.2s, v0.2s, #90" "\n" : : : "v0" ); }) -CHECK(jscvt, jscvt, { +CHECK(jscvt, jscvt, jscvt, { asm volatile ( "fmov d0, #0" "\n" "fjcvtzs w1, d0" "\n" : : : "w1", "d0" ); }) -CHECK(dpb, arch=armv8.2-a, { +CHECK(dpb, dpb, arch=armv8.2-a, { int x; asm volatile ( "dc cvap, %0" : : "r" (&x) ); }) -CHECK(dpb2, arch=armv8.5-a, { +CHECK(dpb2, dpb2, arch=armv8.5-a, { int x; asm volatile ( "dc cvadp, %0" : : "r" (&x) ); }) -CHECK(bf16, bf16, { +CHECK(bf16, bf16, bf16, { asm volatile ( "bfdot v0.4S,v1.8H,v2.8H" : : : "v0" ); }) -CHECK(i8mm, i8mm, { +CHECK(i8mm, i8mm, i8mm, { asm volatile ( "sudot v0.4S,v1.16B,v2.4B[0]" : : : "v0" ); }) -CHECK(dit, dit, { +CHECK(dit, dit, dit, { asm volatile ( "msr DIT, x0" : : : "x0" ); }) -CHECK(fp16, fp16, { +CHECK(fp16, fp16, fp16, { asm volatile ( "fmov h0, #0" : : : "v0" ); }) -CHECK(ssbs2, ssbs, { +CHECK(ssbs2, ssbs2, ssbs, { asm volatile ( "mrs x0, SSBS" "\n" "msr SSBS, x0" "\n" : : : "x0" ); }) -CHECK(bti, bti, { +CHECK(bti, bti, bti, { // The only test for this requires reading a register that is only // accessible to EL1. #ifdef __linux__ @@ -207,35 +206,35 @@ CHECK(bti, bti, { // TODO: implement me on your platform to fix this test! #endif }) -CHECK(simd, simd, { +CHECK(simd, simd, simd, { asm volatile ( "mov v0.B[0], w0" : : : ); }) -CHECK(fp, fp, { +CHECK(fp, fp, fp, { asm volatile ( "fmov s0, #0" : : : "v0" ); }) -CHECK(crc, crc, { +CHECK(crc, crc, crc, { asm volatile ( "crc32b wzr, wzr, wzr"); }) -CHECK(sme, sme, { +CHECK(sme, sme, sme, { asm volatile ( "rdsvl x0, #1" : : : "x0" ); }) -CHECK(sme2, sme2, { +CHECK(sme2, sme2, sme2, { asm volatile ( "smstart za" "\n" "zero { zt0 }" "\n" "smstop za" "\n" ); }) -CHECK(ls64, ls64, { +CHECK(ls64, ls64, ls64, { long data[8]; asm volatile ( "ld64b x0, [%0]" "\n" @@ -247,6 +246,122 @@ CHECK(ls64, ls64, { : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "memory" ); }) +CHECK(f32mm, f32mm, f32mm, { + asm volatile ( + "fmmla z0.s, z1.s, z2.s" + : : : "v0" + ); +}) +CHECK(f64mm, f64mm, f64mm, { + asm volatile ( + "fmmla z0.d, z1.d, z2.d" + : : : "v0" + ); +}) +CHECK(fp16fml, fp16fml, fp16fml, { + asm volatile ( + "fmlal v0.2s, v1.2h, v2.2h" + : : : "v0" + ); +}) +CHECK(frintts, frintts, arch=armv8.5-a, { + asm volatile ( + "frint32z s0, s1" + : : : "v0" + ); +}) +CHECK(predres, predres, predres, { + asm volatile ( + "cfp rctx, x0" "\n" + "dvp rctx, x1" "\n" + "cpp rctx, x2" "\n" + ); +}) +CHECK(rcpc3, rcpc3, rcpc3, { + long x; + asm volatile ( + "stilp wzr, wzr, [%0]" + : : "r" (&x) : "memory" + ); +}) +CHECK(rng, rng, rng, { + asm volatile ( + "mrs x0, rndr" "\n" + "mrs x1, rndrrs" "\n" + : : : "x0", "x1" + ); +}) +CHECK(sve, sve, sve, { + asm volatile ( + "fadda s0, p7, s0, z31.s" + : : : "v0" + ); +}) +CHECK(sve2, sve2, sve2, { + asm volatile ( + "match p15.b, p7/z, z0.b, z1.b" + : : : "p15", "cc" + ); +}) +CHECK(sve2_bitperm, sve2-bitperm, sve2-bitperm, { + asm volatile ( + "bext z0.s, z1.s, z2.s" + : : : "z0" + ); +}) +CHECK(sve2_sha3, sve2-sha3, sve2-sha3, { + asm volatile ( + "rax1 z0.d, z1.d, z2.d" + : : : "z0" + ); +}) +CHECK(sve2_sm4, sve2-sm4, sve2-sm4, { + asm volatile ( + "sm4e z0.s, z0.s, z2.s" + : : : "z0" + ); +}) +CHECK(wfxt, wfxt, wfxt, { + asm volatile ( + "wfet x0" "\n" + "wfit x1" "\n" + ); +}) +CHECK(sb, sb, sb, { + asm volatile ("sb"); +}) +CHECK(sm4, sm4, sm4, { + asm volatile ( + "sm4e v0.4s, v1.4s" + : : : "v0" + ); +}) +CHECK(sme_f64f64, sme-f64f64, sme-f64f64, { + asm volatile ( + "fmops za0.d, p0/m, p0/m, z0.d, z0.d" + : : : "za" + ); +}) +CHECK(sme_i16i64, sme-i16i64, sme-i16i64, { + asm volatile ( + "smopa za0.d, p0/m, p0/m, z0.h, z0.h" + : : : "za" + ); +}) +CHECK(mops, mops, mops, { + long dst[64]; + long src[64]; + size_t n = 32; + long *to = dst; + long *from = src; + asm volatile ( + "cpyfp [%0]!, [%1]!, %2!" "\n" + "cpyfm [%0]!, [%1]!, %2!" "\n" + "cpyfe [%0]!, [%1]!, %2!" "\n" + : "+r" (to), "+r" (from), "+r" (n) + : : "cc", "memory" + ); +}) static bool safe_try_feature(bool (*try_feature)(void)) { int child = fork(); @@ -288,6 +403,24 @@ int main(int, const char **) { check_sme(); check_sme2(); check_ls64(); + check_f32mm(); + check_f64mm(); + check_fp16fml(); + check_frintts(); + check_predres(); + check_rcpc3(); + check_rng(); + check_sve(); + check_sve2(); + check_sve2_bitperm(); + check_sve2_sha3(); + check_sve2_sm4(); + check_wfxt(); + check_sb(); + check_sm4(); + check_sme_f64f64(); + check_sme_i16i64(); + check_mops(); return any_fails ? -1 : 0; } diff --git a/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output b/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output index 4b24c5711..f00fba43a 100644 --- a/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output +++ b/SingleSource/UnitTests/AArch64/acle-fmv-features.reference_output @@ -25,4 +25,22 @@ crc sme sme2 ls64 +f32mm +f64mm +fp16fml +frintts +predres +rcpc3 +rng +sve +sve2 +sve2-bitperm +sve2-sha3 +sve2-sm4 +wfxt +sb +sm4 +sme-f64f64 +sme-i16i64 +mops exit 0