1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+cmov | FileCheck %s
4 define i32 @test1(i32 %X) {
7 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
8 ; CHECK-NEXT: movl $-2139062143, %edx # imm = 0x80808081
9 ; CHECK-NEXT: movl %ecx, %eax
10 ; CHECK-NEXT: imull %edx
11 ; CHECK-NEXT: addl %ecx, %edx
12 ; CHECK-NEXT: movl %edx, %eax
13 ; CHECK-NEXT: shrl $31, %eax
14 ; CHECK-NEXT: sarl $7, %edx
15 ; CHECK-NEXT: addl %eax, %edx
16 ; CHECK-NEXT: movl %edx, %eax
17 ; CHECK-NEXT: shll $8, %eax
18 ; CHECK-NEXT: subl %eax, %edx
19 ; CHECK-NEXT: addl %edx, %ecx
20 ; CHECK-NEXT: movl %ecx, %eax
22 %tmp1 = srem i32 %X, 255
26 define i32 @test2(i32 %X) {
29 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
30 ; CHECK-NEXT: leal 255(%eax), %ecx
31 ; CHECK-NEXT: testl %eax, %eax
32 ; CHECK-NEXT: cmovnsl %eax, %ecx
33 ; CHECK-NEXT: andl $-256, %ecx
34 ; CHECK-NEXT: subl %ecx, %eax
36 %tmp1 = srem i32 %X, 256
40 define i32 @test3(i32 %X) {
43 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
44 ; CHECK-NEXT: movl $-2139062143, %edx # imm = 0x80808081
45 ; CHECK-NEXT: movl %ecx, %eax
46 ; CHECK-NEXT: mull %edx
47 ; CHECK-NEXT: shrl $7, %edx
48 ; CHECK-NEXT: movl %edx, %eax
49 ; CHECK-NEXT: shll $8, %eax
50 ; CHECK-NEXT: subl %eax, %edx
51 ; CHECK-NEXT: addl %edx, %ecx
52 ; CHECK-NEXT: movl %ecx, %eax
54 %tmp1 = urem i32 %X, 255
58 define i32 @test4(i32 %X) {
61 ; CHECK-NEXT: movzbl {{[0-9]+}}(%esp), %eax
63 %tmp1 = urem i32 %X, 256
67 define i32 @test5(i32 %X) nounwind readnone {
69 ; CHECK: # %bb.0: # %entry
70 ; CHECK-NEXT: movl $41, %eax
71 ; CHECK-NEXT: xorl %edx, %edx
72 ; CHECK-NEXT: idivl {{[0-9]+}}(%esp)
73 ; CHECK-NEXT: movl %edx, %eax