1 ; RUN: llc < %s | FileCheck %s
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 {
12 ; CHECK: testl %{{.*}}, (%{{.*}})
16 %0 = load i32, i32* %P, align 4 ; <i32> [#uses=3]
17 %1 = load i32, i32* %G, align 4 ; <i32> [#uses=1]
18 %2 = and i32 %1, %0 ; <i32> [#uses=1]
19 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
20 br i1 %3, label %bb1, label %bb
23 %4 = tail call i32 @bar() nounwind ; <i32> [#uses=0]
30 define i32 @test2(i32* %P, i32* %G) nounwind {
33 ; CHECK: testl %{{.*}}, (%{{.*}})
37 %0 = load i32, i32* %P, align 4 ; <i32> [#uses=3]
38 %1 = load i32, i32* %G, align 4 ; <i32> [#uses=1]
39 %2 = and i32 %0, %1 ; <i32> [#uses=1]
40 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
41 br i1 %3, label %bb1, label %bb
44 %4 = tail call i32 @bar() nounwind ; <i32> [#uses=0]
51 define i32 @test3(i32* %P, i32* %G) nounwind {
54 ; CHECK: testl %{{.*}}, (%{{.*}})
58 %0 = load i32, i32* %P, align 4 ; <i32> [#uses=3]
59 %1 = load i32, i32* %G, align 4 ; <i32> [#uses=1]
60 %2 = and i32 %0, %1 ; <i32> [#uses=1]
61 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
62 br i1 %3, label %bb1, label %bb
65 %4 = tail call i32 @bar() nounwind ; <i32> [#uses=0]