1 ; RUN: llc < %s -march=x86 | FileCheck %s
3 ; LLVM should omit the testl and use the flags result from the orl.
6 define void @or(float* %A, i32 %IA, i32 %N) nounwind {
8 %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1]
9 %1 = and i32 %0, 3 ; <i32> [#uses=1]
10 %2 = xor i32 %IA, 1 ; <i32> [#uses=1]
11 ; CHECK: orl %ecx, %edx
12 ; CHECK-NEXT: je .LBB1_2
13 %3 = or i32 %2, %1 ; <i32> [#uses=1]
14 %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1]
15 br i1 %4, label %return, label %bb
18 store float 0.000000e+00, float* %A, align 4
21 return: ; preds = %entry
25 define void @xor(float* %A, i32 %IA, i32 %N) nounwind {
27 %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1]
28 %1 = and i32 %0, 3 ; <i32> [#uses=1]
30 ; CHECK-NEXT: je .LBB2_2
31 %2 = xor i32 %IA, 1 ; <i32> [#uses=1]
32 %3 = xor i32 %2, %1 ; <i32> [#uses=1]
33 %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1]
34 br i1 %4, label %return, label %bb
37 store float 0.000000e+00, float* %A, align 4
40 return: ; preds = %entry
44 define void @and(float* %A, i32 %IA, i32 %N, i8* %p) nounwind {
47 %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1]
48 %1 = and i32 %0, 3 ; <i32> [#uses=1]
49 %2 = xor i32 %IA, 1 ; <i32> [#uses=1]
52 ; CHECK-NEXT: je .LBB3_2
53 %3 = and i32 %2, %1 ; <i32> [#uses=1]
54 %t = trunc i32 %3 to i8
56 %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1]
57 br i1 %4, label %return, label %bb
60 store float 0.000000e+00, float* null, align 4
63 return: ; preds = %entry
67 ; Just like @and, but without the trunc+store. This should use a testl
70 define void @test(float* %A, i32 %IA, i32 %N, i8* %p) nounwind {
73 %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1]
74 %1 = and i32 %0, 3 ; <i32> [#uses=1]
75 %2 = xor i32 %IA, 1 ; <i32> [#uses=1]
77 ; CHECK-NEXT: je .LBB4_2
78 %3 = and i32 %2, %1 ; <i32> [#uses=1]
79 %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1]
80 br i1 %4, label %return, label %bb
83 store float 0.000000e+00, float* null, align 4
86 return: ; preds = %entry