Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][lowering] Add support for lowering of the
ibclr
intrinsic
This patch adds support for lowering of the `ibclr` 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/D121789
- Loading branch information
1 parent
8a3d75a
commit 365fcec
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
! RUN: bbc -emit-fir %s -o - | FileCheck %s | ||
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s | ||
|
||
! CHECK-LABEL: ibclr_test | ||
function ibclr_test(i, j) | ||
! CHECK-DAG: %[[result:.*]] = fir.alloca i32 {bindc_name = "ibclr_test" | ||
! CHECK-DAG: %[[i:.*]] = fir.load %arg0 : !fir.ref<i32> | ||
! CHECK-DAG: %[[j:.*]] = fir.load %arg1 : !fir.ref<i32> | ||
! CHECK-DAG: %[[VAL_5:.*]] = arith.constant 1 : i32 | ||
! CHECK-DAG: %[[VAL_6:.*]] = arith.constant -1 : i32 | ||
! CHECK: %[[VAL_7:.*]] = arith.shli %[[VAL_5]], %[[j]] : i32 | ||
! CHECK: %[[VAL_8:.*]] = arith.xori %[[VAL_6]], %[[VAL_7]] : i32 | ||
! CHECK: %[[VAL_9:.*]] = arith.andi %[[i]], %[[VAL_8]] : i32 | ||
! CHECK: fir.store %[[VAL_9]] to %[[result]] : !fir.ref<i32> | ||
! CHECK: %[[VAL_10:.*]] = fir.load %[[result]] : !fir.ref<i32> | ||
! CHECK: return %[[VAL_10]] : i32 | ||
ibclr_test = ibclr(i, j) | ||
end | ||
|