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
5 declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
7 define zeroext i1 @a(i32 %x) nounwind {
10 ; X86-NEXT: movl $3, %eax
11 ; X86-NEXT: mull {{[0-9]+}}(%esp)
17 ; X64-NEXT: movl %edi, %eax
18 ; X64-NEXT: movl $3, %ecx
22 %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3)
23 %obil = extractvalue {i32, i1} %res, 1
27 define i32 @test2(i32 %a, i32 %b) nounwind readnone {
29 ; X86: # %bb.0: # %entry
30 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
31 ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
32 ; X86-NEXT: addl %eax, %eax
36 ; X64: # %bb.0: # %entry
37 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
38 ; X64-NEXT: addl %esi, %edi
39 ; X64-NEXT: leal (%rdi,%rdi), %eax
42 %tmp0 = add i32 %b, %a
43 %tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 2)
44 %tmp2 = extractvalue { i32, i1 } %tmp1, 0
48 define i32 @test3(i32 %a, i32 %b) nounwind readnone {
50 ; X86: # %bb.0: # %entry
51 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
52 ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
53 ; X86-NEXT: movl $4, %ecx
58 ; X64: # %bb.0: # %entry
59 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
60 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
61 ; X64-NEXT: leal (%rdi,%rsi), %eax
62 ; X64-NEXT: movl $4, %ecx
66 %tmp0 = add i32 %b, %a
67 %tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 4)
68 %tmp2 = extractvalue { i32, i1 } %tmp1, 0
72 ; Check that shifts larger than the shift amount type are handled.
73 ; Intentionally not testing codegen here, only that this doesn't assert.
74 declare {i300, i1} @llvm.umul.with.overflow.i300(i300 %a, i300 %b)
75 define i300 @test4(i300 %a, i300 %b) nounwind {
76 %x = call {i300, i1} @llvm.umul.with.overflow.i300(i300 %a, i300 %b)
77 %y = extractvalue {i300, i1} %x, 0