• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=X64
4
5declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
6
7define zeroext i1 @a(i32 %x)  nounwind {
8; X86-LABEL: a:
9; X86:       # %bb.0:
10; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
11; X86-NEXT:    movl $3, %ecx
12; X86-NEXT:    mull %ecx
13; X86-NEXT:    seto %al
14; X86-NEXT:    retl
15;
16; X64-LABEL: a:
17; X64:       # %bb.0:
18; X64-NEXT:    movl $3, %ecx
19; X64-NEXT:    movl %edi, %eax
20; X64-NEXT:    mull %ecx
21; X64-NEXT:    seto %al
22; X64-NEXT:    retq
23  %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3)
24  %obil = extractvalue {i32, i1} %res, 1
25  ret i1 %obil
26}
27
28define i32 @test2(i32 %a, i32 %b) nounwind readnone {
29; X86-LABEL: test2:
30; X86:       # %bb.0: # %entry
31; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
32; X86-NEXT:    addl {{[0-9]+}}(%esp), %eax
33; X86-NEXT:    addl %eax, %eax
34; X86-NEXT:    retl
35;
36; X64-LABEL: test2:
37; X64:       # %bb.0: # %entry
38; X64-NEXT:    # kill: def $edi killed $edi def $rdi
39; X64-NEXT:    addl %esi, %edi
40; X64-NEXT:    leal (%rdi,%rdi), %eax
41; X64-NEXT:    retq
42entry:
43	%tmp0 = add i32 %b, %a
44	%tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 2)
45	%tmp2 = extractvalue { i32, i1 } %tmp1, 0
46	ret i32 %tmp2
47}
48
49define i32 @test3(i32 %a, i32 %b) nounwind readnone {
50; X86-LABEL: test3:
51; X86:       # %bb.0: # %entry
52; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
53; X86-NEXT:    addl {{[0-9]+}}(%esp), %eax
54; X86-NEXT:    movl $4, %ecx
55; X86-NEXT:    mull %ecx
56; X86-NEXT:    retl
57;
58; X64-LABEL: test3:
59; X64:       # %bb.0: # %entry
60; X64-NEXT:    # kill: def $esi killed $esi def $rsi
61; X64-NEXT:    # kill: def $edi killed $edi def $rdi
62; X64-NEXT:    leal (%rdi,%rsi), %eax
63; X64-NEXT:    movl $4, %ecx
64; X64-NEXT:    mull %ecx
65; X64-NEXT:    retq
66entry:
67	%tmp0 = add i32 %b, %a
68	%tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 4)
69	%tmp2 = extractvalue { i32, i1 } %tmp1, 0
70	ret i32 %tmp2
71}
72