[PATCH] D113660: [Flang] Add type conversion for FIR integer kind
Kiran Chandramohan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 02:23:15 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa26119b82cd: [Flang] Add type conversion for FIR integer kind (authored by kiranchandramohan).
Changed prior to commit:
https://reviews.llvm.org/D113660?vs=386465&id=386769#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113660/new/
https://reviews.llvm.org/D113660
Files:
flang/lib/Optimizer/CodeGen/TypeConverter.h
flang/test/Fir/types-to-llvm.fir
Index: flang/test/Fir/types-to-llvm.fir
===================================================================
--- flang/test/Fir/types-to-llvm.fir
+++ flang/test/Fir/types-to-llvm.fir
@@ -128,6 +128,30 @@
// -----
+// Test `!fir.integer<KIND>` conversion.
+
+func private @foo0(%arg0: !fir.int<1>)
+// CHECK-LABEL: foo0
+// CHECK-SAME: i8
+
+func private @foo1(%arg0: !fir.int<2>)
+// CHECK-LABEL: foo1
+// CHECK-SAME: i16
+
+func private @foo2(%arg0: !fir.int<4>)
+// CHECK-LABEL: foo2
+// CHECK-SAME: i32
+
+func private @foo3(%arg0: !fir.int<8>)
+// CHECK-LABEL: foo3
+// CHECK-SAME: i64
+
+func private @foo4(%arg0: !fir.int<16>)
+// CHECK-LABEL: foo4
+// CHECK-SAME: i128
+
+// -----
+
// Test `!fir.logical<KIND>` conversion.
func private @foo0(%arg0: !fir.logical<1>)
Index: flang/lib/Optimizer/CodeGen/TypeConverter.h
===================================================================
--- flang/lib/Optimizer/CodeGen/TypeConverter.h
+++ flang/lib/Optimizer/CodeGen/TypeConverter.h
@@ -57,6 +57,10 @@
addConversion(
[&](fir::CharacterType charTy) { return convertCharType(charTy); });
addConversion([&](HeapType heap) { return convertPointerLike(heap); });
+ addConversion([&](fir::IntegerType intTy) {
+ return mlir::IntegerType::get(
+ &getContext(), kindMapping.getIntegerBitsize(intTy.getFKind()));
+ });
addConversion([&](fir::LogicalType boolTy) {
return mlir::IntegerType::get(
&getContext(), kindMapping.getLogicalBitsize(boolTy.getFKind()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113660.386769.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211112/05a1873f/attachment.bin>
More information about the llvm-commits
mailing list