xref: /llvm-project/flang/test/Fir/target-rewrite-target-cpu.fir (revision 837bff11cb7d31f40805c73d4f539960a77eda33)
1// RUN: fir-opt --target-rewrite %s | FileCheck %s --check-prefixes=ALL_MLIR,UNCHANGED_MLIR
2// RUN: fir-opt --target-rewrite="target-cpu=gfx90a" %s | FileCheck %s --check-prefixes=ALL_MLIR,CHANGED_MLIR
3
4// RUN: tco %s | FileCheck %s --check-prefixes=ALL_LLVM,UNCHANGED_LLVM
5// RUN: tco -target-cpu=gfx90a %s | FileCheck %s --check-prefixes=ALL_LLVM,CHANGED_LLVM
6
7
8// Check MLIR output from the 'fir-opt' tool
9
10// ALL_MLIR: module attributes {
11// ALL_MLIR-SAME: fir.target_cpu =
12
13// UNCHANGED_MLIR-SAME: "x86_64"
14// CHANGED_MLIR-SAME: "gfx90a"
15
16// ALL_MLIR: func.func @dummyfunc() attributes {
17// ALL_MLIR-SAME: target_cpu =
18
19// UNCHANGED_MLIR-SAME: "x86_64"
20// CHANGED_MLIR-SAME: "gfx90a"
21
22
23// Check LLVM output from the 'tco' tool
24
25// ALL_LLVM: define void @dummyfunc() #[[ATTRS:.*]] {
26// ALL_LLVM: attributes #[[ATTRS]] = {
27
28// UNCHANGED_LLVM-SAME: "target-cpu"="x86_64"
29// CHANGED_LLVM-SAME: "target-cpu"="gfx90a"
30
31module attributes {fir.target_cpu = "x86_64"}  {
32  func.func @dummyfunc() -> () {
33    return
34  }
35}
36