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

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Mon Feb 5 12:43:11 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
----------------
kkwli wrote:

For the first `RUN` step, I am wondering if `fir.target_features` is not displayed by default in `module attributes` for all triples. On ppc64le, the `fir.target_features` is set and displayed.

```
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f128, dense<128> : vector<2xi64>>, ..., fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", fir.target_features = #llvm.target_features<["+64bit"]>, llvm.data_layout = "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512", llvm.target_triple = "powerpc64le-unknown-linux-gnu"}
```

Should we add `triple amdgcn-...` on line 2 to make it triple specific? Or should adjust line 10 to handle some scenarios that the `fir.target_features` is there?

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


More information about the flang-commits mailing list