summaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/ExpandLargeFpConvert
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/ExpandLargeFpConvert')
-rw-r--r--llvm/test/Transforms/ExpandLargeFpConvert/X86/expand-large-fp-optnone.ll99
1 files changed, 99 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ExpandLargeFpConvert/X86/expand-large-fp-optnone.ll b/llvm/test/Transforms/ExpandLargeFpConvert/X86/expand-large-fp-optnone.ll
new file mode 100644
index 000000000000..78bc0006fda2
--- /dev/null
+++ b/llvm/test/Transforms/ExpandLargeFpConvert/X86/expand-large-fp-optnone.ll
@@ -0,0 +1,99 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -mtriple=x86_64-- --expand-fp < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-fp < %s | FileCheck %s
+
+; expand-fp must also run with optnone
+
+; Function Attrs: noinline optnone
+define double @main(i224 %0) #0 {
+; CHECK-LABEL: define double @main(
+; CHECK-SAME: i224 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[ENTRYITOFP_ENTRY:.*]]:
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i224 [[TMP0]], 0
+; CHECK-NEXT: br i1 [[TMP1]], label %[[ITOFP_RETURN:.*]], label %[[ITOFP_IF_END:.*]]
+; CHECK: [[ITOFP_IF_END]]:
+; CHECK-NEXT: [[TMP2:%.*]] = ashr i224 [[TMP0]], 223
+; CHECK-NEXT: [[TMP3:%.*]] = xor i224 [[TMP2]], [[TMP0]]
+; CHECK-NEXT: [[TMP4:%.*]] = sub i224 [[TMP3]], [[TMP2]]
+; CHECK-NEXT: [[TMP5:%.*]] = call i224 @llvm.ctlz.i224(i224 [[TMP4]], i1 true)
+; CHECK-NEXT: [[TMP6:%.*]] = trunc i224 [[TMP5]] to i32
+; CHECK-NEXT: [[TMP7:%.*]] = sub i32 224, [[TMP6]]
+; CHECK-NEXT: [[TMP8:%.*]] = sub i32 223, [[TMP6]]
+; CHECK-NEXT: [[TMP9:%.*]] = icmp sgt i32 [[TMP7]], 53
+; CHECK-NEXT: br i1 [[TMP9]], label %[[ITOFP_IF_THEN4:.*]], label %[[ITOFP_IF_ELSE:.*]]
+; CHECK: [[ITOFP_IF_THEN4]]:
+; CHECK-NEXT: switch i32 [[TMP7]], label %[[ITOFP_SW_DEFAULT:.*]] [
+; CHECK-NEXT: i32 54, label %[[ITOFP_SW_BB:.*]]
+; CHECK-NEXT: i32 55, label %[[ITOFP_SW_EPILOG:.*]]
+; CHECK-NEXT: ]
+; CHECK: [[ITOFP_SW_BB]]:
+; CHECK-NEXT: [[TMP10:%.*]] = shl i224 [[TMP4]], 1
+; CHECK-NEXT: br label %[[ITOFP_SW_EPILOG]]
+; CHECK: [[ITOFP_SW_DEFAULT]]:
+; CHECK-NEXT: [[TMP11:%.*]] = sub i32 169, [[TMP6]]
+; CHECK-NEXT: [[TMP12:%.*]] = zext i32 [[TMP11]] to i224
+; CHECK-NEXT: [[TMP13:%.*]] = lshr i224 [[TMP4]], [[TMP12]]
+; CHECK-NEXT: [[TMP14:%.*]] = add i32 [[TMP6]], 55
+; CHECK-NEXT: [[TMP15:%.*]] = zext i32 [[TMP14]] to i224
+; CHECK-NEXT: [[TMP16:%.*]] = lshr i224 -1, [[TMP15]]
+; CHECK-NEXT: [[TMP17:%.*]] = and i224 [[TMP16]], [[TMP4]]
+; CHECK-NEXT: [[TMP18:%.*]] = icmp ne i224 [[TMP17]], 0
+; CHECK-NEXT: [[TMP19:%.*]] = zext i1 [[TMP18]] to i224
+; CHECK-NEXT: [[TMP20:%.*]] = or i224 [[TMP13]], [[TMP19]]
+; CHECK-NEXT: br label %[[ITOFP_SW_EPILOG]]
+; CHECK: [[ITOFP_SW_EPILOG]]:
+; CHECK-NEXT: [[TMP21:%.*]] = phi i224 [ [[TMP20]], %[[ITOFP_SW_DEFAULT]] ], [ [[TMP4]], %[[ITOFP_IF_THEN4]] ], [ [[TMP10]], %[[ITOFP_SW_BB]] ]
+; CHECK-NEXT: [[TMP22:%.*]] = trunc i224 [[TMP21]] to i32
+; CHECK-NEXT: [[TMP23:%.*]] = lshr i32 [[TMP22]], 2
+; CHECK-NEXT: [[TMP24:%.*]] = and i32 [[TMP23]], 1
+; CHECK-NEXT: [[TMP25:%.*]] = zext i32 [[TMP24]] to i224
+; CHECK-NEXT: [[TMP26:%.*]] = or i224 [[TMP21]], [[TMP25]]
+; CHECK-NEXT: [[TMP27:%.*]] = add i224 [[TMP26]], 1
+; CHECK-NEXT: [[TMP28:%.*]] = ashr i224 [[TMP27]], 2
+; CHECK-NEXT: [[A3:%.*]] = and i224 [[TMP27]], 36028797018963968
+; CHECK-NEXT: [[TMP29:%.*]] = icmp eq i224 [[A3]], 0
+; CHECK-NEXT: [[TMP30:%.*]] = trunc i224 [[TMP28]] to i64
+; CHECK-NEXT: [[TMP31:%.*]] = lshr i224 [[TMP28]], 32
+; CHECK-NEXT: [[TMP32:%.*]] = trunc i224 [[TMP31]] to i32
+; CHECK-NEXT: br i1 [[TMP29]], label %[[ITOFP_IF_END26:.*]], label %[[ITOFP_IF_THEN20:.*]]
+; CHECK: [[ITOFP_IF_THEN20]]:
+; CHECK-NEXT: [[TMP33:%.*]] = ashr i224 [[TMP27]], 3
+; CHECK-NEXT: [[TMP34:%.*]] = trunc i224 [[TMP33]] to i64
+; CHECK-NEXT: [[TMP35:%.*]] = lshr i224 [[TMP33]], 32
+; CHECK-NEXT: [[TMP36:%.*]] = trunc i224 [[TMP35]] to i32
+; CHECK-NEXT: br label %[[ITOFP_IF_END26]]
+; CHECK: [[ITOFP_IF_ELSE]]:
+; CHECK-NEXT: [[TMP37:%.*]] = add i32 [[TMP6]], -171
+; CHECK-NEXT: [[TMP38:%.*]] = zext i32 [[TMP37]] to i224
+; CHECK-NEXT: [[TMP39:%.*]] = shl i224 [[TMP4]], [[TMP38]]
+; CHECK-NEXT: [[TMP40:%.*]] = trunc i224 [[TMP39]] to i64
+; CHECK-NEXT: [[TMP41:%.*]] = lshr i224 [[TMP39]], 32
+; CHECK-NEXT: [[TMP42:%.*]] = trunc i224 [[TMP41]] to i32
+; CHECK-NEXT: br label %[[ITOFP_IF_END26]]
+; CHECK: [[ITOFP_IF_END26]]:
+; CHECK-NEXT: [[TMP43:%.*]] = phi i64 [ [[TMP34]], %[[ITOFP_IF_THEN20]] ], [ [[TMP30]], %[[ITOFP_SW_EPILOG]] ], [ [[TMP40]], %[[ITOFP_IF_ELSE]] ]
+; CHECK-NEXT: [[TMP44:%.*]] = phi i32 [ [[TMP36]], %[[ITOFP_IF_THEN20]] ], [ [[TMP32]], %[[ITOFP_SW_EPILOG]] ], [ [[TMP42]], %[[ITOFP_IF_ELSE]] ]
+; CHECK-NEXT: [[TMP45:%.*]] = phi i32 [ [[TMP7]], %[[ITOFP_IF_THEN20]] ], [ [[TMP8]], %[[ITOFP_SW_EPILOG]] ], [ [[TMP8]], %[[ITOFP_IF_ELSE]] ]
+; CHECK-NEXT: [[TMP46:%.*]] = trunc i224 [[TMP2]] to i32
+; CHECK-NEXT: [[TMP47:%.*]] = and i32 [[TMP46]], -2147483648
+; CHECK-NEXT: [[TMP48:%.*]] = shl i32 [[TMP45]], 20
+; CHECK-NEXT: [[TMP49:%.*]] = add i32 [[TMP48]], 1072693248
+; CHECK-NEXT: [[TMP50:%.*]] = and i32 [[TMP44]], 1048575
+; CHECK-NEXT: [[TMP51:%.*]] = or i32 [[TMP50]], [[TMP47]]
+; CHECK-NEXT: [[TMP52:%.*]] = or i32 [[TMP51]], [[TMP49]]
+; CHECK-NEXT: [[TMP53:%.*]] = zext i32 [[TMP52]] to i64
+; CHECK-NEXT: [[TMP54:%.*]] = shl i64 [[TMP53]], 32
+; CHECK-NEXT: [[TMP55:%.*]] = and i64 [[TMP43]], 4294967295
+; CHECK-NEXT: [[TMP56:%.*]] = or i64 [[TMP54]], [[TMP55]]
+; CHECK-NEXT: [[TMP57:%.*]] = bitcast i64 [[TMP56]] to double
+; CHECK-NEXT: br label %[[ITOFP_RETURN]]
+; CHECK: [[ITOFP_RETURN]]:
+; CHECK-NEXT: [[TMP58:%.*]] = phi double [ [[TMP57]], %[[ITOFP_IF_END26]] ], [ 0.000000e+00, %[[ENTRYITOFP_ENTRY]] ]
+; CHECK-NEXT: ret double [[TMP58]]
+;
+entry:
+ %x = sitofp i224 %0 to double
+ ret double %x
+}
+
+attributes #0 = { noinline optnone }