-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AArch64][GlobalISel] Expand handling for fptosi and fptoui #70635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Now that we have more types handled for zext/sext and trunc, it is possible to get more types working for the vector float to integer conversions. This patch adds fp16, widening and narrowing vector support to handle more types. The smaller types wil be expanded to the size of the larger element type. A couple of case require more awkward truncates to get working as they go from illegal to illegal types.
@llvm/pr-subscribers-llvm-globalisel @llvm/pr-subscribers-backend-aarch64 Author: David Green (davemgreen) ChangesNow that we have more types handled for zext/sext and trunc, it is possible to get more types working for the vector float to integer conversions. This patch adds fp16, widening and narrowing vector support to handle more types. The smaller types wil be expanded to the size of the larger element type. A couple of case require more awkward truncates to get working as they go from illegal to illegal types. Patch is 257.01 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/70635.diff 4 Files Affected:
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 108768494ccbb28..00d9f3f7c30c95f 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -5124,7 +5124,9 @@ LegalizerHelper::moreElementsVector(MachineInstr &MI, unsigned TypeIdx,
}
case TargetOpcode::G_TRUNC:
case TargetOpcode::G_FPTRUNC:
- case TargetOpcode::G_FPEXT: {
+ case TargetOpcode::G_FPEXT:
+ case TargetOpcode::G_FPTOSI:
+ case TargetOpcode::G_FPTOUI: {
if (TypeIdx != 0)
return UnableToLegalize;
Observer.changingInstr(MI);
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 598a195d4fb1016..7edfa41d237836a 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -643,10 +643,33 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
// Conversions
getActionDefinitionsBuilder({G_FPTOSI, G_FPTOUI})
.legalForCartesianProduct({s32, s64, v2s64, v4s32, v2s32})
+ .legalIf([=](const LegalityQuery &Query) {
+ return HasFP16 &&
+ (Query.Types[1] == s16 || Query.Types[1] == v4s16 ||
+ Query.Types[1] == v8s16) &&
+ (Query.Types[0] == s32 || Query.Types[0] == s64 ||
+ Query.Types[0] == v4s16 || Query.Types[0] == v8s16);
+ })
.widenScalarToNextPow2(0)
.clampScalar(0, s32, s64)
.widenScalarToNextPow2(1)
- .clampScalar(1, s32, s64);
+ .clampScalarOrElt(1, MinFPScalar, s64)
+ .moreElementsToNextPow2(0)
+ .widenScalarIf(
+ [=](const LegalityQuery &Query) {
+ return Query.Types[0].getScalarSizeInBits() >
+ Query.Types[1].getScalarSizeInBits();
+ },
+ LegalizeMutations::changeElementSizeTo(1, 0))
+ .widenScalarIf(
+ [=](const LegalityQuery &Query) {
+ return Query.Types[0].getScalarSizeInBits() <
+ Query.Types[1].getScalarSizeInBits();
+ },
+ LegalizeMutations::changeElementSizeTo(0, 1))
+ .clampNumElements(0, v4s16, v8s16)
+ .clampNumElements(0, v2s32, v4s32)
+ .clampMaxNumElements(0, s64, 2);
getActionDefinitionsBuilder({G_SITOFP, G_UITOFP})
.legalForCartesianProduct({s32, s64, v2s64, v4s32, v2s32})
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
index d5f7507ec5dd767..f7493b128de1e23 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
@@ -503,12 +503,12 @@
# DEBUG-NEXT: .. the first uncovered type index: 2, OK
# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
# DEBUG-NEXT: G_FPTOSI (opcode {{[0-9]+}}): 2 type indices, 0 imm indices
-# DEBUG-NEXT: .. the first uncovered type index: 2, OK
-# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
+# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
+# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
# DEBUG-NEXT: G_FPTOUI (opcode {{[0-9]+}}): 2 type indices, 0 imm indices
# DEBUG-NEXT: .. opcode {{[0-9]+}} is aliased to {{[0-9]+}}
-# DEBUG-NEXT: .. the first uncovered type index: 2, OK
-# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
+# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
+# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
# DEBUG-NEXT: G_SITOFP (opcode {{[0-9]+}}): 2 type indices, 0 imm indices
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
diff --git a/llvm/test/CodeGen/AArch64/fptoi.ll b/llvm/test/CodeGen/AArch64/fptoi.ll
index c13d9144d2aea31..f30dad966492c12 100644
--- a/llvm/test/CodeGen/AArch64/fptoi.ll
+++ b/llvm/test/CodeGen/AArch64/fptoi.ll
@@ -4,140 +4,10 @@
; RUN: llc -mtriple=aarch64-none-eabi -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI,CHECK-GI-NOFP16
; RUN: llc -mtriple=aarch64-none-eabi -mattr=+fullfp16 -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI,CHECK-GI-FP16
-; CHECK-GI: warning: Instruction selection used fallback path for fptos_v3f64_v3i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f64_v3i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f64_v4i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f64_v4i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f64_v8i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f64_v8i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f64_v16i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f64_v16i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f64_v32i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f64_v32i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f64_v3i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f64_v3i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f64_v4i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f64_v4i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f64_v8i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f64_v8i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f64_v16i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f64_v16i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f64_v32i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f64_v32i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f64_v2i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f64_v2i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f64_v3i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f64_v3i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f64_v4i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f64_v4i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f64_v8i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f64_v8i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f64_v16i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f64_v16i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f64_v32i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f64_v32i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f64_v2i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f64_v2i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f64_v3i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f64_v3i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f64_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f64_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f64_v8i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f64_v8i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f64_v16i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f64_v16i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f64_v32i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f64_v32i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f32_v3i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f32_v3i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f32_v4i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f32_v4i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f32_v8i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f32_v8i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f32_v16i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f32_v16i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f32_v32i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f32_v32i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f32_v3i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f32_v3i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f32_v8i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f32_v8i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f32_v16i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f32_v16i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f32_v32i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f32_v32i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f32_v2i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f32_v2i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f32_v3i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f32_v3i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f32_v4i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f32_v4i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f32_v8i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f32_v8i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f32_v16i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f32_v16i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f32_v32i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f32_v32i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f32_v2i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f32_v2i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f32_v3i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f32_v3i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f32_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f32_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f32_v8i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f32_v8i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f32_v16i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f32_v16i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f32_v32i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f32_v32i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f16_v2i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f16_v2i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f16_v3i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f16_v3i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f16_v4i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f16_v4i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f16_v8i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f16_v8i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f16_v16i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f16_v16i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f16_v32i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f16_v32i64
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f16_v2i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f16_v2i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f16_v3i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f16_v3i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f16_v4i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f16_v4i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f16_v8i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f16_v8i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f16_v16i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f16_v16i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f16_v32i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f16_v32i32
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f16_v2i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f16_v2i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f16_v3i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f16_v3i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f16_v4i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f16_v4i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f16_v8i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f16_v8i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f16_v16i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f16_v16i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f16_v32i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f16_v32i16
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v2f16_v2i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v2f16_v2i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v3f16_v3i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v3f16_v3i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v4f16_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v4f16_v4i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v8f16_v8i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v8f16_v8i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v16f16_v16i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v16f16_v16i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptos_v32f16_v32i8
-; CHECK-GI-NEXT: warning: Instruction selection used fallback path for fptou_v32f16_v32i8
+; CHECK-GI-FP16: warning: Instruction selection used fallback path for fptos_v2f16_v2i16
+; CHECK-GI-FP16-NEXT: warning: Instruction selection used fallback path for fptou_v2f16_v2i16
+; CHECK-GI-FP16-NEXT: warning: Instruction selection used fallback path for fptos_v2f16_v2i8
+; CHECK-GI-FP16-NEXT: warning: Instruction selection used fallback path for fptou_v2f16_v2i8
define i64 @fptos_f64_i64(double %a) {
; CHECK-LABEL: fptos_f64_i64:
@@ -331,11 +201,16 @@ define i64 @fptos_f16_i64(half %a) {
; CHECK-SD-FP16-NEXT: fcvtzs x0, h0
; CHECK-SD-FP16-NEXT: ret
;
-; CHECK-GI-LABEL: fptos_f16_i64:
-; CHECK-GI: // %bb.0: // %entry
-; CHECK-GI-NEXT: fcvt s0, h0
-; CHECK-GI-NEXT: fcvtzs x0, s0
-; CHECK-GI-NEXT: ret
+; CHECK-GI-NOFP16-LABEL: fptos_f16_i64:
+; CHECK-GI-NOFP16: // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT: fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT: fcvtzs x0, s0
+; CHECK-GI-NOFP16-NEXT: ret
+;
+; CHECK-GI-FP16-LABEL: fptos_f16_i64:
+; CHECK-GI-FP16: // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT: fcvtzs x0, h0
+; CHECK-GI-FP16-NEXT: ret
entry:
%c = fptosi half %a to i64
ret i64 %c
@@ -353,11 +228,16 @@ define i64 @fptou_f16_i64(half %a) {
; CHECK-SD-FP16-NEXT: fcvtzu x0, h0
; CHECK-SD-FP16-NEXT: ret
;
-; CHECK-GI-LABEL: fptou_f16_i64:
-; CHECK-GI: // %bb.0: // %entry
-; CHECK-GI-NEXT: fcvt s0, h0
-; CHECK-GI-NEXT: fcvtzu x0, s0
-; CHECK-GI-NEXT: ret
+; CHECK-GI-NOFP16-LABEL: fptou_f16_i64:
+; CHECK-GI-NOFP16: // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT: fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT: fcvtzu x0, s0
+; CHECK-GI-NOFP16-NEXT: ret
+;
+; CHECK-GI-FP16-LABEL: fptou_f16_i64:
+; CHECK-GI-FP16: // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT: fcvtzu x0, h0
+; CHECK-GI-FP16-NEXT: ret
entry:
%c = fptoui half %a to i64
ret i64 %c
@@ -375,11 +255,16 @@ define i32 @fptos_f16_i32(half %a) {
; CHECK-SD-FP16-NEXT: fcvtzs w0, h0
; CHECK-SD-FP16-NEXT: ret
;
-; CHECK-GI-LABEL: fptos_f16_i32:
-; CHECK-GI: // %bb.0: // %entry
-; CHECK-GI-NEXT: fcvt s0, h0
-; CHECK-GI-NEXT: fcvtzs w0, s0
-; CHECK-GI-NEXT: ret
+; CHECK-GI-NOFP16-LABEL: fptos_f16_i32:
+; CHECK-GI-NOFP16: // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT: fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT: fcvtzs w0, s0
+; CHECK-GI-NOFP16-NEXT: ret
+;
+; CHECK-GI-FP16-LABEL: fptos_f16_i32:
+; CHECK-GI-FP16: // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT: fcvtzs w0, h0
+; CHECK-GI-FP16-NEXT: ret
entry:
%c = fptosi half %a to i32
ret i32 %c
@@ -397,11 +282,16 @@ define i32 @fptou_f16_i32(half %a) {
; CHECK-SD-FP16-NEXT: fcvtzu w0, h0
; CHECK-SD-FP16-NEXT: ret
;
-; CHECK-GI-LABEL: fptou_f16_i32:
-; CHECK-GI: // %bb.0: // %entry
-; CHECK-GI-NEXT: fcvt s0, h0
-; CHECK-GI-NEXT: fcvtzu w0, s0
-; CHECK-GI-NEXT: ret
+; CHECK-GI-NOFP16-LABEL: fptou_f16_i32:
+; CHECK-GI-NOFP16: // %bb.0: // %entry
+; CHECK-GI-NOFP16-NEXT: fcvt s0, h0
+; CHECK-GI-NOFP16-NEXT: fcvtzu w0, s0
+; CHECK-GI-NOFP16-NEXT: ret
+;
+; CHECK-GI-FP16-LABEL: fptou_f16_i32:
+; CHECK-GI-FP16: // %bb.0: // %entry
+; CHECK-GI-FP16-NEXT: fcvtzu w0, h0
+; CHECK-GI-FP16-NEXT: ret
entry:
%c = fptoui half %a to i32
ret i32 %c
@@ -419,11 +309,16 @@ define i16 @fptos_f16_i16(half %a) {
; CHECK-SD-FP16-NEXT: fcvtzs w0, h0
; CHECK-SD-FP16-NEXT: ret
;
-; CHECK-GI-LABEL: fptos_f16_i16:
-; CHECK-GI: // %bb.0: // %entry
-; CHECK-GI-NEXT: fcvt s0, h0
-; CHECK-GI-NEXT: fcvtzs w0, s0
-; CHECK-GI-NEXT: ret
+; CHECK-GI-NOFP16-LABEL: fptos_f16_i16:
+; CHECK-GI-NOFP16: // %bb.0: // %entry
+...
[truncated]
|
I wrote this a while ago, but haven't had much time to get it cleaned up and whatnot. I have a few other patches in a similar vein. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Similar to llvm#70635, this expands the handling of integer to fp conversions. The code is very similar to the float->integer conversions with types handled oppositely. There are some extra unhandled cases which require more handling for ASR types.
Similar to #70635, this expands the handling of integer to fp conversions. The code is very similar to the float->integer conversions with types handled oppositely. There are some extra unhandled cases which require more handling for ASR operations.
Similar to llvm#70635, this expands the handling of integer to fp conversions. The code is very similar to the float->integer conversions with types handled oppositely. There are some extra unhandled cases which require more handling for ASR operations.
Now that we have more types handled for zext/sext and trunc, it is possible to get more types working for the vector float to integer conversions. This patch adds fp16, widening and narrowing vector support to handle more types. The smaller types wil be expanded to the size of the larger element type. A couple of case require more awkward truncates to get working as they go from illegal to illegal types.