[llvm] ac33c33 - [InstCombine] add tests for FP<->int casts; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 12:37:08 PDT 2022
Author: Sanjay Patel
Date: 2022-04-29T15:36:16-04:00
New Revision: ac33c335bd9997e80c25c384b5a559cdeac6ba68
URL: https://github.com/llvm/llvm-project/commit/ac33c335bd9997e80c25c384b5a559cdeac6ba68
DIFF: https://github.com/llvm/llvm-project/commit/ac33c335bd9997e80c25c384b5a559cdeac6ba68.diff
LOG: [InstCombine] add tests for FP<->int casts; NFC
This overlaps with at least some existing tests,
but the smaller types should be faster for alive2
to verify. We know that at least one of these is
currently wrong (miscompile) as shown in #55150.
Added:
Modified:
llvm/test/Transforms/InstCombine/sitofp.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/sitofp.ll b/llvm/test/Transforms/InstCombine/sitofp.ll
index be26ed6946cf..59a80c3a4de9 100644
--- a/llvm/test/Transforms/InstCombine/sitofp.ll
+++ b/llvm/test/Transforms/InstCombine/sitofp.ll
@@ -245,3 +245,85 @@ define i25 @low_masked_input(i25 %A) {
%C = fptoui float %B to i25
ret i25 %C
}
+
+define i11 @s32_half_s11(i32 %x) {
+; CHECK-LABEL: @s32_half_s11(
+; CHECK-NEXT: [[R:%.*]] = trunc i32 [[X:%.*]] to i11
+; CHECK-NEXT: ret i11 [[R]]
+;
+ %h = sitofp i32 %x to half
+ %r = fptosi half %h to i11
+ ret i11 %r
+}
+
+define i11 @s32_half_u11(i32 %x) {
+; CHECK-LABEL: @s32_half_u11(
+; CHECK-NEXT: [[R:%.*]] = trunc i32 [[X:%.*]] to i11
+; CHECK-NEXT: ret i11 [[R]]
+;
+ %h = sitofp i32 %x to half
+ %r = fptoui half %h to i11
+ ret i11 %r
+}
+
+define i11 @u32_half_s11(i32 %x) {
+; CHECK-LABEL: @u32_half_s11(
+; CHECK-NEXT: [[R:%.*]] = trunc i32 [[X:%.*]] to i11
+; CHECK-NEXT: ret i11 [[R]]
+;
+ %h = uitofp i32 %x to half
+ %r = fptosi half %h to i11
+ ret i11 %r
+}
+
+define i11 @u32_half_u11(i32 %x) {
+; CHECK-LABEL: @u32_half_u11(
+; CHECK-NEXT: [[R:%.*]] = trunc i32 [[X:%.*]] to i11
+; CHECK-NEXT: ret i11 [[R]]
+;
+ %h = uitofp i32 %x to half
+ %r = fptoui half %h to i11
+ ret i11 %r
+}
+
+define i12 @s32_half_s12(i32 %x) {
+; CHECK-LABEL: @s32_half_s12(
+; CHECK-NEXT: [[R:%.*]] = trunc i32 [[X:%.*]] to i12
+; CHECK-NEXT: ret i12 [[R]]
+;
+ %h = sitofp i32 %x to half
+ %r = fptosi half %h to i12
+ ret i12 %r
+}
+
+define i12 @s32_half_u12(i32 %x) {
+; CHECK-LABEL: @s32_half_u12(
+; CHECK-NEXT: [[H:%.*]] = sitofp i32 [[X:%.*]] to half
+; CHECK-NEXT: [[R:%.*]] = fptoui half [[H]] to i12
+; CHECK-NEXT: ret i12 [[R]]
+;
+ %h = sitofp i32 %x to half
+ %r = fptoui half %h to i12
+ ret i12 %r
+}
+
+define i12 @u32_half_s12(i32 %x) {
+; CHECK-LABEL: @u32_half_s12(
+; CHECK-NEXT: [[R:%.*]] = trunc i32 [[X:%.*]] to i12
+; CHECK-NEXT: ret i12 [[R]]
+;
+ %h = uitofp i32 %x to half
+ %r = fptosi half %h to i12
+ ret i12 %r
+}
+
+define i12 @u32_half_u12(i32 %x) {
+; CHECK-LABEL: @u32_half_u12(
+; CHECK-NEXT: [[H:%.*]] = uitofp i32 [[X:%.*]] to half
+; CHECK-NEXT: [[R:%.*]] = fptoui half [[H]] to i12
+; CHECK-NEXT: ret i12 [[R]]
+;
+ %h = uitofp i32 %x to half
+ %r = fptoui half %h to i12
+ ret i12 %r
+}
More information about the llvm-commits
mailing list