1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64
4 ; Verify expansion by using constant values. We just want to cover all the paths layed out by ExpandIntRes_MULFIX.
6 declare i4 @llvm.smul.fix.sat.i4 (i4, i4, i32)
7 declare i32 @llvm.smul.fix.sat.i32 (i32, i32, i32)
8 declare i64 @llvm.smul.fix.sat.i64 (i64, i64, i32)
9 declare <4 x i32> @llvm.smul.fix.sat.v4i32(<4 x i32>, <4 x i32>, i32)
10 declare { i64, i1 } @llvm.smul.with.overflow.i64(i64, i64)
12 define i64 @func() nounwind {
15 ; X64-NEXT: movl $2, %eax
17 ; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
18 ; X64-NEXT: movl $1, %ecx
19 ; X64-NEXT: cmovgeq %rax, %rcx
20 ; X64-NEXT: movq $-2, %rax
22 ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
23 ; X64-NEXT: cmovgeq %rcx, %rax
25 %tmp = call i64 @llvm.smul.fix.sat.i64(i64 3, i64 2, i32 2)
29 define i64 @func2() nounwind {
32 ; X64-NEXT: movl $3, %eax
33 ; X64-NEXT: imulq $2, %rax, %rcx
34 ; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
35 ; X64-NEXT: cmovnoq %rcx, %rax
37 %tmp = call i64 @llvm.smul.fix.sat.i64(i64 3, i64 2, i32 0)
41 define i64 @func3() nounwind {
44 ; X64-NEXT: movl $2, %eax
46 ; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
47 ; X64-NEXT: movabsq $4611686018427387903, %rcx # imm = 0x3FFFFFFFFFFFFFFF
48 ; X64-NEXT: cmovgeq %rax, %rcx
49 ; X64-NEXT: movq $-2, %rax
51 ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
52 ; X64-NEXT: cmovgeq %rcx, %rax
54 %tmp = call i64 @llvm.smul.fix.sat.i64(i64 9223372036854775807, i64 2, i32 2)
58 define i64 @func4() nounwind {
61 ; X64-NEXT: movl $2147483647, %eax # imm = 0x7FFFFFFF
63 ; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
64 ; X64-NEXT: movl $4294967295, %ecx # imm = 0xFFFFFFFF
65 ; X64-NEXT: cmovgq %rax, %rcx
66 ; X64-NEXT: movq $-2147483648, %rax # imm = 0x80000000
68 ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
69 ; X64-NEXT: cmovgeq %rcx, %rax
71 %tmp = call i64 @llvm.smul.fix.sat.i64(i64 9223372036854775807, i64 2, i32 32)
75 define i64 @func5() nounwind {
78 ; X64-NEXT: movabsq $4611686018427387903, %rax # imm = 0x3FFFFFFFFFFFFFFF
80 ; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
81 ; X64-NEXT: movl $1, %ecx
82 ; X64-NEXT: cmovgq %rax, %rcx
83 ; X64-NEXT: movabsq $-4611686018427387904, %rax # imm = 0xC000000000000000
85 ; X64-NEXT: movabsq $-9223372036854775808, %rax # imm = 0x8000000000000000
86 ; X64-NEXT: cmovgeq %rcx, %rax
88 %tmp = call i64 @llvm.smul.fix.sat.i64(i64 9223372036854775807, i64 2, i32 63)