• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86 | FileCheck %s
2
3declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
4define zeroext i1 @a(i32 %x)  nounwind {
5  %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3)
6  %obil = extractvalue {i32, i1} %res, 1
7  ret i1 %obil
8
9; CHECK: a:
10; CHECK: mull
11; CHECK: seto %al
12; CHECK: movzbl	%al, %eax
13; CHECK: ret
14}
15
16define i32 @test2(i32 %a, i32 %b) nounwind readnone {
17entry:
18	%tmp0 = add i32 %b, %a
19	%tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 2)
20	%tmp2 = extractvalue { i32, i1 } %tmp1, 0
21	ret i32 %tmp2
22; CHECK: test2:
23; CHECK: addl
24; CHECK-NEXT: addl
25; CHECK-NEXT: ret
26}
27
28define i32 @test3(i32 %a, i32 %b) nounwind readnone {
29entry:
30	%tmp0 = add i32 %b, %a
31	%tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 4)
32	%tmp2 = extractvalue { i32, i1 } %tmp1, 0
33	ret i32 %tmp2
34; CHECK: test3:
35; CHECK: addl
36; CHECK: mull
37; CHECK-NEXT: ret
38}
39