luismarques created this revision. luismarques added reviewers: jyknight, eli.friedman, lenary. Herald added subscribers: cfe-commits, evandro, sameer.abuasal, s.egerton, Jim, benna, psnobl, PkmX, jfb, rkruppe, rogfer01, shiva0217, kito-cheng, simoncook. Herald added a project: clang.
By default the RISC-V target doesn't have the atomics standard extension enabled. The first RUN line in `clang/test/CodeGen/atomic_ops.c` doesn't specify a target triple, which means that on RISC-V Linux hosts it will target RISC-V, but because we use clang cc1 we don't get the toolchain driver functionality to automatically turn on the extensions implied by the target triple (riscv64-linux includes atomics). This causes the test to fail on RISC-V hosts. I waffled a bit regarding the best way to fix this. In the end I decided to 1) use XFAIL to blacklist RISC-V hosts and 2) add explicitly run lines for riscv32/64, with the atomics extension enabled. With that choice we //effectively// don't do the test on RISC-V hosts, but still get to test those two RISC-V targets on other hosts. An alternative approach would be to eliminate the first RUN line and explicitly list all of the target triples we want to test. But looking at the other clang tests, there doesn't seem to be any test that comprehensively lists all of the targets, and it wasn't quite clear which should be listed on this test. Running clang with the non-cc1 interface would also be an option, but in principle that could still fail in some hypothetical scenarios, and the tests seem to prefer to use cc1. (It's a shame that XFAIL necessarily means blacklisting host triples, and not target triples. That doesn't interact very well with cross-compilers.) Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D74847 Files: clang/test/CodeGen/atomic_ops.c Index: clang/test/CodeGen/atomic_ops.c =================================================================== --- clang/test/CodeGen/atomic_ops.c +++ clang/test/CodeGen/atomic_ops.c @@ -1,7 +1,13 @@ // XFAIL: hexagon,sparc // (due to not having native load atomic support) +// XFAIL: riscv +// (due to requiring an explicit -target-feature +a) // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +a -emit-llvm %s \ +// RUN: -o - | FileCheck %s +// RUN: %clang_cc1 -triple riscv32 -target-feature +a -emit-llvm %s \ +// RUN: -o - | FileCheck %s void foo(int x) {
Index: clang/test/CodeGen/atomic_ops.c =================================================================== --- clang/test/CodeGen/atomic_ops.c +++ clang/test/CodeGen/atomic_ops.c @@ -1,7 +1,13 @@ // XFAIL: hexagon,sparc // (due to not having native load atomic support) +// XFAIL: riscv +// (due to requiring an explicit -target-feature +a) // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +a -emit-llvm %s \ +// RUN: -o - | FileCheck %s +// RUN: %clang_cc1 -triple riscv32 -target-feature +a -emit-llvm %s \ +// RUN: -o - | FileCheck %s void foo(int x) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits