llvm-project/flang/test/Fir/inline.fir
Andrzej Warzynski cc3c6b6109 [flang][driver] Make flang-new -fc1 accept MLIR files
This relatively small change will allow Flang's frontend driver,
`flang-new -fc1`, to consume and parse MLIR files.  Semantically (i.e.
from user's perspective) this is identical to reading LLVM IR files.

Two file extensions are associated with MLIR files: .fir and .mlir. Note
that reading MLIR files makes only sense when running one of the
code-generation actions, i.e. when using one of the following action
flags: -S, -emit-obj, -emit-llvm, -emit-llvm-bc.

The majority of tests that required `tco` to run are updated to also run
with `flang-new -fc1`. A few tests are updated to use `fir-opt` instead
of `tco` (that's the preferred choice when testing a particular MLIR
pass). basic-program.fir is not updated as that test is intended to
verify the behaviour of `tco` specifically.

Differential Revision: https://reviews.llvm.org/D126890
2022-06-10 10:58:54 +00:00

21 lines
653 B
Plaintext

// RUN: tco --target=x86_64-unknown-linux-gnu --inline-all %s -o - | FileCheck %s
// RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -mmlir --inline-all -emit-llvm %s -o - | FileCheck %s
// CHECK-LABEL: @add
func.func @add(%a : i32, %b : i32) -> i32 {
// CHECK: %[[add:.*]] = add i32
%p = arith.addi %a, %b : i32
// CHECK: ret i32 %[[add]]
return %p : i32
}
// CHECK-LABEL: @test
func.func @test(%a : i32, %b : i32, %c : i32) -> i32 {
// CHECK: %[[add:.*]] = add i32
%m = fir.call @add(%a, %b) : (i32, i32) -> i32
// CHECK: %[[mul:.*]] = mul i32 %[[add]],
%n = arith.muli %m, %c : i32
// CHECK: ret i32 %[[mul]]
return %n : i32
}