1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mcpu=generic -mtriple=i686-- | FileCheck %s
3 %struct._obstack_chunk = type { i8*, %struct._obstack_chunk*, [4 x i8] }
4 %struct.obstack = type { i32, %struct._obstack_chunk*, i8*, i8*, i8*, i32, i32, %struct._obstack_chunk* (...)*, void (...)*, i8*, i8 }
5 @stmt_obstack = external global %struct.obstack ; <%struct.obstack*> [#uses=1]
7 ; This should just not crash.
8 define void @test1() nounwind {
10 ; CHECK: # %bb.0: # %entry
11 ; CHECK-NEXT: testb $1, stmt_obstack+40
12 ; CHECK-NEXT: jne .LBB0_1
13 ; CHECK-NEXT: # %bb.2: # %cond_false30.i
14 ; CHECK-NEXT: pushl $0
16 ; CHECK-NEXT: addl $4, %esp
18 ; CHECK-NEXT: .LBB0_1: # %cond_true23.i
21 br i1 true, label %cond_true, label %cond_next
23 cond_true: ; preds = %entry
24 %new_size.0.i = select i1 false, i32 0, i32 0 ; <i32> [#uses=1]
25 %tmp.i = load i32, i32* bitcast (i8* getelementptr (%struct.obstack, %struct.obstack* @stmt_obstack, i32 0, i32 10) to i32*) ; <i32> [#uses=1]
26 %tmp.i.upgrd.1 = trunc i32 %tmp.i to i8 ; <i8> [#uses=1]
27 %tmp21.i = and i8 %tmp.i.upgrd.1, 1 ; <i8> [#uses=1]
28 %tmp22.i = icmp eq i8 %tmp21.i, 0 ; <i1> [#uses=1]
29 br i1 %tmp22.i, label %cond_false30.i, label %cond_true23.i
31 cond_true23.i: ; preds = %cond_true
34 cond_false30.i: ; preds = %cond_true
35 %tmp35.i = tail call %struct._obstack_chunk* null( i32 %new_size.0.i ) ; <%struct._obstack_chunk*> [#uses=0]
38 cond_next: ; preds = %entry
44 define i32 @test2(i16* %P, i16* %Q) nounwind {
47 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
48 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
49 ; CHECK-NEXT: movzwl (%eax), %edx
50 ; CHECK-NEXT: movzbl %dl, %eax
51 ; CHECK-NEXT: movw %dx, (%ecx)
53 %A = load i16, i16* %P, align 4 ; <i16> [#uses=11]
54 %C = zext i16 %A to i32 ; <i32> [#uses=1]
55 %D = and i32 %C, 255 ; <i32> [#uses=1]
66 ; xor in exit block will be CSE'ed and load will be folded to xor in entry.
67 define i1 @test3(i32* %P, i32* %Q) nounwind {
69 ; CHECK: # %bb.0: # %entry
70 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
71 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
72 ; CHECK-NEXT: movl (%eax), %eax
73 ; CHECK-NEXT: xorl (%ecx), %eax
74 ; CHECK-NEXT: testl $89947, %eax # imm = 0x15F5B
75 ; CHECK-NEXT: je .LBB2_2
76 ; CHECK-NEXT: # %bb.1:
77 ; CHECK-NEXT: xorl %eax, %eax
78 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
80 ; CHECK-NEXT: .LBB2_2: # %exit
81 ; CHECK-NEXT: testl $-838178173, %eax # imm = 0xCE0A6A83
82 ; CHECK-NEXT: sete %al
83 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
86 %0 = load i32, i32* %P, align 4
87 %1 = load i32, i32* %Q, align 4
89 %3 = and i32 %2, 89947
90 %4 = icmp eq i32 %3, 0
91 br i1 %4, label %exit, label %land.end
94 %shr.i.i19 = xor i32 %1, %0
95 %5 = and i32 %shr.i.i19, 3456789123
96 %6 = icmp eq i32 %5, 0
100 %7 = phi i1 [ %6, %exit ], [ false, %entry ]