xref: /llvm-project/llvm/test/CodeGen/X86/2007-02-04-OrAddrMode.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mtriple=i686-- | FileCheck %s
2
3;; This example can't fold the or into an LEA.
4define i32 @test(ptr %tmp2, i32 %tmp12) nounwind {
5; CHECK-LABEL: test:
6; CHECK-NOT: ret
7; CHECK: orl $1, %{{.*}}
8; CHECK: ret
9
10	%tmp3 = load ptr, ptr %tmp2
11	%tmp132 = shl i32 %tmp12, 2		; <i32> [#uses=1]
12	%ctg2 = getelementptr i8, ptr %tmp3, i32 %tmp132		; <ptr> [#uses=1]
13	%tmp6 = ptrtoint ptr %ctg2 to i32		; <i32> [#uses=1]
14	%tmp14 = or i32 %tmp6, 1		; <i32> [#uses=1]
15	ret i32 %tmp14
16}
17
18;; This can!
19define i32 @test2(i32 %a, i32 %b) nounwind {
20; CHECK-LABEL: test2:
21; CHECK-NOT: ret
22; CHECK: leal 3(,%{{.*}},8)
23; CHECK: ret
24
25	%c = shl i32 %a, 3
26	%d = or i32 %c, 3
27	ret i32 %d
28}
29