[flang-commits] [flang] [Flang][Lower] Attach target_cpu and target_features attributes to MLIR functions (PR #78289)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Tue Feb 6 03:06:28 PST 2024


================
@@ -0,0 +1,21 @@
+! REQUIRES: amdgpu-registered-target
+! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefixes=ALL,NONE
+! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefixes=ALL,TRIPLE
+! RUN: %flang_fc1 -emit-fir -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,CPU
+! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,BOTH
+
+! ALL: module attributes {
+
+! NONE-NOT: fir.target_cpu
+! NONE-NOT: fir.target_features
----------------
skatrak wrote:

Thanks for letting me know of this issue. I understand this test fails in ppc64le because some target features are implicitly added when the triple and target CPU options are not specified. Is that correct?

Maybe the best option then would be to remove negative checks and only check the attributes we've manually set, to avoid relying on implicit behavior. Maybe doing the same as for the x86 test and always setting the triple rather than making that a variable as well.

Let me know if that works for you and I'll look into creating a PR for it.

https://github.com/llvm/llvm-project/pull/78289


More information about the flang-commits mailing list