blob: 48da2b650c8f91a33ae17ed2b1725f76680f8d52 [file] [log] [blame]
Dan Gohman12e03292009-09-18 19:59:53 +00001; RUN: llc < %s -march=x86 | FileCheck %s
2
3; LLVM should omit the testl and use the flags result from the orl.
4
5; CHECK: or:
6define void @or(float* %A, i32 %IA, i32 %N) nounwind {
7entry:
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
Dan Gohman3c5ec3c2009-09-18 21:23:12 +000012; CHECK-NEXT: je
Dan Gohman12e03292009-09-18 19:59:53 +000013 %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
16
17bb: ; preds = %entry
18 store float 0.000000e+00, float* %A, align 4
19 ret void
20
21return: ; preds = %entry
22 ret void
23}
24; CHECK: xor:
25define void @xor(float* %A, i32 %IA, i32 %N) nounwind {
26entry:
27 %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1]
28 %1 = and i32 %0, 3 ; <i32> [#uses=1]
29; CHECK: xorl $1, %e
Dan Gohman3c5ec3c2009-09-18 21:23:12 +000030; CHECK-NEXT: je
Dan Gohman12e03292009-09-18 19:59:53 +000031 %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
35
36bb: ; preds = %entry
37 store float 0.000000e+00, float* %A, align 4
38 ret void
39
40return: ; preds = %entry
41 ret void
42}
43; CHECK: and:
44define void @and(float* %A, i32 %IA, i32 %N, i8* %p) nounwind {
45entry:
46 store i8 0, i8* %p
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]
50; CHECK: andl $3, %
51; CHECK-NEXT: movb %
Dan Gohman3c5ec3c2009-09-18 21:23:12 +000052; CHECK-NEXT: je
Dan Gohman12e03292009-09-18 19:59:53 +000053 %3 = and i32 %2, %1 ; <i32> [#uses=1]
54 %t = trunc i32 %3 to i8
55 store i8 %t, i8* %p
56 %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1]
57 br i1 %4, label %return, label %bb
58
59bb: ; preds = %entry
60 store float 0.000000e+00, float* null, align 4
61 ret void
62
63return: ; preds = %entry
64 ret void
65}
66
67; Just like @and, but without the trunc+store. This should use a testl
68; instead of an andl.
69; CHECK: test:
70define void @test(float* %A, i32 %IA, i32 %N, i8* %p) nounwind {
71entry:
72 store i8 0, i8* %p
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]
76; CHECK: testb $3, %
Dan Gohman3c5ec3c2009-09-18 21:23:12 +000077; CHECK-NEXT: je
Dan Gohman12e03292009-09-18 19:59:53 +000078 %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
81
82bb: ; preds = %entry
83 store float 0.000000e+00, float* null, align 4
84 ret void
85
86return: ; preds = %entry
87 ret void
88}