1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; REQUIRES: asserts
3; RUN: llc < %s -mattr=+sse3,+sse4.1 -mcpu=penryn -stats 2>&1 | grep "5 machinelicm"
4; RUN: llc < %s -mattr=+sse3,+sse4.1 -mcpu=penryn | FileCheck %s
5; rdar://6627786
6; rdar://7792037
7
8target triple = "x86_64-apple-darwin10.0"
9	%struct.Key = type { i64 }
10	%struct.__Rec = type opaque
11	%struct.__vv = type {  }
12
13define %struct.__vv* @t(%struct.Key* %desc, i64 %p) nounwind ssp {
14; CHECK-LABEL: t:
15; CHECK:       ## %bb.0: ## %entry
16; CHECK-NEXT:    pushq %r14
17; CHECK-NEXT:    pushq %rbx
18; CHECK-NEXT:    pushq %rax
19; CHECK-NEXT:    movq %rsi, %r14
20; CHECK-NEXT:    movq %rdi, %rbx
21; CHECK-NEXT:    orq $2097152, %r14 ## imm = 0x200000
22; CHECK-NEXT:    andl $15728640, %r14d ## imm = 0xF00000
23; CHECK-NEXT:    .p2align 4, 0x90
24; CHECK-NEXT:  LBB0_1: ## %bb4
25; CHECK-NEXT:    ## =>This Inner Loop Header: Depth=1
26; CHECK-NEXT:    xorl %eax, %eax
27; CHECK-NEXT:    callq _xxGetOffsetForCode
28; CHECK-NEXT:    movq %rbx, %rdi
29; CHECK-NEXT:    xorl %esi, %esi
30; CHECK-NEXT:    xorl %eax, %eax
31; CHECK-NEXT:    callq _xxCalculateMidType
32; CHECK-NEXT:    cmpl $1, %eax
33; CHECK-NEXT:    jne LBB0_1
34; CHECK-NEXT:  ## %bb.2: ## %bb26
35; CHECK-NEXT:    ## in Loop: Header=BB0_1 Depth=1
36; CHECK-NEXT:    cmpl $1048576, %r14d ## imm = 0x100000
37; CHECK-NEXT:    jne LBB0_1
38; CHECK-NEXT:  ## %bb.3: ## %bb.i
39; CHECK-NEXT:    ## in Loop: Header=BB0_1 Depth=1
40; CHECK-NEXT:    movl 0, %eax
41; CHECK-NEXT:    xorps %xmm0, %xmm0
42; CHECK-NEXT:    cvtsi2ss %rax, %xmm0
43; CHECK-NEXT:    movl 4, %eax
44; CHECK-NEXT:    xorps %xmm1, %xmm1
45; CHECK-NEXT:    cvtsi2ss %rax, %xmm1
46; CHECK-NEXT:    movl 8, %eax
47; CHECK-NEXT:    xorps %xmm2, %xmm2
48; CHECK-NEXT:    cvtsi2ss %rax, %xmm2
49; CHECK-NEXT:    insertps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[2,3]
50; CHECK-NEXT:    insertps {{.*#+}} xmm0 = xmm0[0,1],xmm2[0],xmm0[3]
51; CHECK-NEXT:    movaps %xmm0, 0
52; CHECK-NEXT:    jmp LBB0_1
53entry:
54	br label %bb4
55
56bb4:		; preds = %bb.i, %bb26, %bb4, %entry
57
58	%0 = call i32 (...) @xxGetOffsetForCode(i32 undef) nounwind		; <i32> [#uses=0]
59	%ins = or i64 %p, 2097152		; <i64> [#uses=1]
60	%1 = call i32 (...) @xxCalculateMidType(%struct.Key* %desc, i32 0) nounwind		; <i32> [#uses=1]
61	%cond = icmp eq i32 %1, 1		; <i1> [#uses=1]
62	br i1 %cond, label %bb26, label %bb4
63
64bb26:		; preds = %bb4
65	%2 = and i64 %ins, 15728640		; <i64> [#uses=1]
66	%cond.i = icmp eq i64 %2, 1048576		; <i1> [#uses=1]
67	br i1 %cond.i, label %bb.i, label %bb4
68
69bb.i:		; preds = %bb26
70	%3 = load i32, i32* null, align 4		; <i32> [#uses=1]
71	%4 = uitofp i32 %3 to float		; <float> [#uses=1]
72	%.sum13.i = add i64 0, 4		; <i64> [#uses=1]
73	%5 = getelementptr i8, i8* null, i64 %.sum13.i		; <i8*> [#uses=1]
74	%6 = bitcast i8* %5 to i32*		; <i32*> [#uses=1]
75	%7 = load i32, i32* %6, align 4		; <i32> [#uses=1]
76	%8 = uitofp i32 %7 to float		; <float> [#uses=1]
77	%.sum.i = add i64 0, 8		; <i64> [#uses=1]
78	%9 = getelementptr i8, i8* null, i64 %.sum.i		; <i8*> [#uses=1]
79	%10 = bitcast i8* %9 to i32*		; <i32*> [#uses=1]
80	%11 = load i32, i32* %10, align 4		; <i32> [#uses=1]
81	%12 = uitofp i32 %11 to float		; <float> [#uses=1]
82	%13 = insertelement <4 x float> undef, float %4, i32 0		; <<4 x float>> [#uses=1]
83	%14 = insertelement <4 x float> %13, float %8, i32 1		; <<4 x float>> [#uses=1]
84	%15 = insertelement <4 x float> %14, float %12, i32 2		; <<4 x float>> [#uses=1]
85	store <4 x float> %15, <4 x float>* null, align 16
86	br label %bb4
87}
88
89declare i32 @xxGetOffsetForCode(...)
90
91declare i32 @xxCalculateMidType(...)
92