blob: eb9b6460cddd9b449f2ebcbc8529cc9fb7790832 [file] [log] [blame]
Eric Christopher362fee92011-06-17 20:41:29 +00001; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
2%0 = type { i64, i64 }
3%1 = type { i128, i1 }
4
5@.str = private unnamed_addr constant [11 x i8] c"%llx %llx\0A\00", align 1
6
7define %0 @x(i64 %a.coerce0, i64 %a.coerce1, i64 %b.coerce0, i64 %b.coerce1) nounwind uwtable ssp {
8entry:
9 %tmp16 = zext i64 %a.coerce0 to i128
10 %tmp11 = zext i64 %a.coerce1 to i128
11 %tmp12 = shl nuw i128 %tmp11, 64
12 %ins14 = or i128 %tmp12, %tmp16
13 %tmp6 = zext i64 %b.coerce0 to i128
14 %tmp3 = zext i64 %b.coerce1 to i128
15 %tmp4 = shl nuw i128 %tmp3, 64
16 %ins = or i128 %tmp4, %tmp6
17 %0 = tail call %1 @llvm.smul.with.overflow.i128(i128 %ins14, i128 %ins)
18; CHECK: callq ___muloti4
19 %1 = extractvalue %1 %0, 0
20 %2 = extractvalue %1 %0, 1
21 br i1 %2, label %overflow, label %nooverflow
22
23overflow: ; preds = %entry
24 tail call void @llvm.trap()
25 unreachable
26
27nooverflow: ; preds = %entry
28 %tmp20 = trunc i128 %1 to i64
29 %tmp21 = insertvalue %0 undef, i64 %tmp20, 0
30 %tmp22 = lshr i128 %1, 64
31 %tmp23 = trunc i128 %tmp22 to i64
32 %tmp24 = insertvalue %0 %tmp21, i64 %tmp23, 1
33 ret %0 %tmp24
34}
35
36declare %1 @llvm.smul.with.overflow.i128(i128, i128) nounwind readnone
37
38declare void @llvm.trap() nounwind