1 ; RUN: llvm-as < %s | llc | grep {testl.*\(%r.i\), %} | count 3
3 ; The loads should fold into the testl instructions, no matter how
4 ; the inputs are commuted.
6 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
7 target triple = "x86_64-apple-darwin7"
9 define i32 @test(i32* %P, i32* %G) nounwind {
11 %0 = load i32* %P, align 4 ; <i32> [#uses=3]
12 %1 = load i32* %G, align 4 ; <i32> [#uses=1]
13 %2 = and i32 %1, %0 ; <i32> [#uses=1]
14 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
15 br i1 %3, label %bb1, label %bb
18 %4 = tail call i32 @bar() nounwind ; <i32> [#uses=0]
25 define i32 @test2(i32* %P, i32* %G) nounwind {
27 %0 = load i32* %P, align 4 ; <i32> [#uses=3]
28 %1 = load i32* %G, align 4 ; <i32> [#uses=1]
29 %2 = and i32 %0, %1 ; <i32> [#uses=1]
30 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
31 br i1 %3, label %bb1, label %bb
34 %4 = tail call i32 @bar() nounwind ; <i32> [#uses=0]
40 define i32 @test3(i32* %P, i32* %G) nounwind {
42 %0 = load i32* %P, align 4 ; <i32> [#uses=3]
43 %1 = load i32* %G, align 4 ; <i32> [#uses=1]
44 %2 = and i32 %0, %1 ; <i32> [#uses=1]
45 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
46 br i1 %3, label %bb1, label %bb
49 %4 = tail call i32 @bar() nounwind ; <i32> [#uses=0]