1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i686-- | FileCheck %s 3 4 ; Don't duplicate the load. 5 6 define fastcc i32 @foo(i32* %p) nounwind { 7 ; CHECK-LABEL: foo: 8 ; CHECK: # %bb.0: 9 ; CHECK-NEXT: movl (%ecx), %eax 10 ; CHECK-NEXT: andl $10, %eax 11 ; CHECK-NEXT: je .LBB0_2 12 ; CHECK-NEXT: # %bb.1: # %bb63 13 ; CHECK-NEXT: retl 14 ; CHECK-NEXT: .LBB0_2: # %bb76 15 ; CHECK-NEXT: xorl %eax, %eax 16 ; CHECK-NEXT: retl 17 %t0 = load i32, i32* %p 18 %t2 = and i32 %t0, 10 19 %t3 = icmp ne i32 %t2, 0 20 br i1 %t3, label %bb63, label %bb76 21 bb63: 22 ret i32 %t2 23 bb76: 24 ret i32 0 25 } 26 27 define fastcc double @bar(i32 %hash, double %x, double %y) nounwind { 28 ; CHECK-LABEL: bar: 29 ; CHECK: # %bb.0: # %entry 30 ; CHECK-NEXT: pushl %ebp 31 ; CHECK-NEXT: movl %esp, %ebp 32 ; CHECK-NEXT: andl $-8, %esp 33 ; CHECK-NEXT: fldl 16(%ebp) 34 ; CHECK-NEXT: fldl 8(%ebp) 35 ; CHECK-NEXT: movl %ecx, %eax 36 ; CHECK-NEXT: andl $15, %eax 37 ; CHECK-NEXT: cmpl $8, %eax 38 ; CHECK-NEXT: jb .LBB1_2 39 ; CHECK-NEXT: # %bb.1: # %bb10 40 ; CHECK-NEXT: testb $1, %cl 41 ; CHECK-NEXT: je .LBB1_3 42 ; CHECK-NEXT: .LBB1_2: # %bb11 43 ; CHECK-NEXT: fchs 44 ; CHECK-NEXT: .LBB1_3: # %bb13 45 ; CHECK-NEXT: testb $2, %cl 46 ; CHECK-NEXT: je .LBB1_5 47 ; CHECK-NEXT: # %bb.4: # %bb14 48 ; CHECK-NEXT: fxch %st(1) 49 ; CHECK-NEXT: fchs 50 ; CHECK-NEXT: fxch %st(1) 51 ; CHECK-NEXT: .LBB1_5: # %bb16 52 ; CHECK-NEXT: faddp %st(1) 53 ; CHECK-NEXT: movl %ebp, %esp 54 ; CHECK-NEXT: popl %ebp 55 ; CHECK-NEXT: retl 56 entry: 57 %0 = and i32 %hash, 15 58 %1 = icmp ult i32 %0, 8 59 br i1 %1, label %bb11, label %bb10 60 61 bb10: 62 %2 = and i32 %hash, 1 63 %3 = icmp eq i32 %2, 0 64 br i1 %3, label %bb13, label %bb11 65 66 bb11: 67 %4 = fsub double -0.000000e+00, %x 68 br label %bb13 69 70 bb13: 71 %iftmp.9.0 = phi double [ %4, %bb11 ], [ %x, %bb10 ] 72 %5 = and i32 %hash, 2 73 %6 = icmp eq i32 %5, 0 74 br i1 %6, label %bb16, label %bb14 75 76 bb14: 77 %7 = fsub double -0.000000e+00, %y 78 br label %bb16 79 80 bb16: 81 %iftmp.10.0 = phi double [ %7, %bb14 ], [ %y, %bb13 ] 82 %8 = fadd double %iftmp.9.0, %iftmp.10.0 83 ret double %8 84 } 85