mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-05 17:12:00 +00:00
[flang][lowering] Add support for lowering of the ieor
intrinsic
This patch adds support for lowering of the `ieor` intrinsic from Fortran to the FIR dialect of MLIR. This is part of the upstreaming effort from the `fir-dev` branch in [1]. [1] https://github.com/flang-compiler/f18-llvm-project Co-authored-by: V Donaldson <vdonaldson@nvidia.com> Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Valentin Clement <clementval@gmail.com> Differential Revision: https://reviews.llvm.org/D121791
This commit is contained in:
parent
30718f3aa6
commit
3887ebbba0
@ -459,6 +459,7 @@ struct IntrinsicLibrary {
|
||||
mlir::Value genIand(mlir::Type, llvm::ArrayRef<mlir::Value>);
|
||||
mlir::Value genIbits(mlir::Type, llvm::ArrayRef<mlir::Value>);
|
||||
mlir::Value genIbset(mlir::Type, llvm::ArrayRef<mlir::Value>);
|
||||
mlir::Value genIeor(mlir::Type, llvm::ArrayRef<mlir::Value>);
|
||||
mlir::Value genIshft(mlir::Type, llvm::ArrayRef<mlir::Value>);
|
||||
mlir::Value genIshftc(mlir::Type, llvm::ArrayRef<mlir::Value>);
|
||||
fir::ExtendedValue genLbound(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
|
||||
@ -635,6 +636,7 @@ static constexpr IntrinsicHandler handlers[]{
|
||||
{"iand", &I::genIand},
|
||||
{"ibits", &I::genIbits},
|
||||
{"ibset", &I::genIbset},
|
||||
{"ieor", &I::genIeor},
|
||||
{"ishft", &I::genIshft},
|
||||
{"ishftc", &I::genIshftc},
|
||||
{"len",
|
||||
@ -1930,6 +1932,13 @@ mlir::Value IntrinsicLibrary::genIbset(mlir::Type resultType,
|
||||
return builder.create<mlir::arith::OrIOp>(loc, args[0], mask);
|
||||
}
|
||||
|
||||
// IEOR
|
||||
mlir::Value IntrinsicLibrary::genIeor(mlir::Type resultType,
|
||||
llvm::ArrayRef<mlir::Value> args) {
|
||||
assert(args.size() == 2);
|
||||
return builder.create<mlir::arith::XOrIOp>(loc, args[0], args[1]);
|
||||
}
|
||||
|
||||
// ISHFT
|
||||
mlir::Value IntrinsicLibrary::genIshft(mlir::Type resultType,
|
||||
llvm::ArrayRef<mlir::Value> args) {
|
||||
|
9
flang/test/Lower/Intrinsics/ieor.f90
Normal file
9
flang/test/Lower/Intrinsics/ieor.f90
Normal file
@ -0,0 +1,9 @@
|
||||
! RUN: bbc -emit-fir %s -o - | FileCheck %s
|
||||
|
||||
! CHECK-LABEL: ieor_test
|
||||
subroutine ieor_test(a, b)
|
||||
integer :: a, b
|
||||
print *, ieor(a, b)
|
||||
! CHECK: %{{[0-9]+}} = arith.xori %{{[0-9]+}}, %{{[0-9]+}} : i{{(8|16|32|64|128)}}
|
||||
end subroutine ieor_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user