xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2008-02-22-LocalRegAllocBug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -regalloc=fast -optimize-regalloc=0 -march=x86 -mattr=+mmx | grep esi
2*9880d681SAndroid Build Coastguard Worker; PR2082
3*9880d681SAndroid Build Coastguard Worker; Local register allocator was refusing to use ESI, EDI, and EBP so it ran out of
4*9880d681SAndroid Build Coastguard Worker; registers.
5*9880d681SAndroid Build Coastguard Workerdefine void @transpose4x4(i8* %dst, i8* %src, i32 %dst_stride, i32 %src_stride) {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker	%dst_addr = alloca i8*		; <i8**> [#uses=5]
8*9880d681SAndroid Build Coastguard Worker	%src_addr = alloca i8*		; <i8**> [#uses=5]
9*9880d681SAndroid Build Coastguard Worker	%dst_stride_addr = alloca i32		; <i32*> [#uses=4]
10*9880d681SAndroid Build Coastguard Worker	%src_stride_addr = alloca i32		; <i32*> [#uses=4]
11*9880d681SAndroid Build Coastguard Worker	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
12*9880d681SAndroid Build Coastguard Worker	store i8* %dst, i8** %dst_addr
13*9880d681SAndroid Build Coastguard Worker	store i8* %src, i8** %src_addr
14*9880d681SAndroid Build Coastguard Worker	store i32 %dst_stride, i32* %dst_stride_addr
15*9880d681SAndroid Build Coastguard Worker	store i32 %src_stride, i32* %src_stride_addr
16*9880d681SAndroid Build Coastguard Worker	%tmp = load i8*, i8** %dst_addr, align 4		; <i8*> [#uses=1]
17*9880d681SAndroid Build Coastguard Worker	%tmp1 = getelementptr i8, i8* %tmp, i32 0		; <i8*> [#uses=1]
18*9880d681SAndroid Build Coastguard Worker	%tmp12 = bitcast i8* %tmp1 to i32*		; <i32*> [#uses=1]
19*9880d681SAndroid Build Coastguard Worker	%tmp3 = load i8*, i8** %dst_addr, align 4		; <i8*> [#uses=1]
20*9880d681SAndroid Build Coastguard Worker	%tmp4 = load i32, i32* %dst_stride_addr, align 4		; <i32> [#uses=1]
21*9880d681SAndroid Build Coastguard Worker	%tmp5 = getelementptr i8, i8* %tmp3, i32 %tmp4		; <i8*> [#uses=1]
22*9880d681SAndroid Build Coastguard Worker	%tmp56 = bitcast i8* %tmp5 to i32*		; <i32*> [#uses=1]
23*9880d681SAndroid Build Coastguard Worker	%tmp7 = load i32, i32* %dst_stride_addr, align 4		; <i32> [#uses=1]
24*9880d681SAndroid Build Coastguard Worker	%tmp8 = mul i32 %tmp7, 2		; <i32> [#uses=1]
25*9880d681SAndroid Build Coastguard Worker	%tmp9 = load i8*, i8** %dst_addr, align 4		; <i8*> [#uses=1]
26*9880d681SAndroid Build Coastguard Worker	%tmp10 = getelementptr i8, i8* %tmp9, i32 %tmp8		; <i8*> [#uses=1]
27*9880d681SAndroid Build Coastguard Worker	%tmp1011 = bitcast i8* %tmp10 to i32*		; <i32*> [#uses=1]
28*9880d681SAndroid Build Coastguard Worker	%tmp13 = load i32, i32* %dst_stride_addr, align 4		; <i32> [#uses=1]
29*9880d681SAndroid Build Coastguard Worker	%tmp14 = mul i32 %tmp13, 3		; <i32> [#uses=1]
30*9880d681SAndroid Build Coastguard Worker	%tmp15 = load i8*, i8** %dst_addr, align 4		; <i8*> [#uses=1]
31*9880d681SAndroid Build Coastguard Worker	%tmp16 = getelementptr i8, i8* %tmp15, i32 %tmp14		; <i8*> [#uses=1]
32*9880d681SAndroid Build Coastguard Worker	%tmp1617 = bitcast i8* %tmp16 to i32*		; <i32*> [#uses=1]
33*9880d681SAndroid Build Coastguard Worker	%tmp18 = load i8*, i8** %src_addr, align 4		; <i8*> [#uses=1]
34*9880d681SAndroid Build Coastguard Worker	%tmp19 = getelementptr i8, i8* %tmp18, i32 0		; <i8*> [#uses=1]
35*9880d681SAndroid Build Coastguard Worker	%tmp1920 = bitcast i8* %tmp19 to i32*		; <i32*> [#uses=1]
36*9880d681SAndroid Build Coastguard Worker	%tmp21 = load i8*, i8** %src_addr, align 4		; <i8*> [#uses=1]
37*9880d681SAndroid Build Coastguard Worker	%tmp22 = load i32, i32* %src_stride_addr, align 4		; <i32> [#uses=1]
38*9880d681SAndroid Build Coastguard Worker	%tmp23 = getelementptr i8, i8* %tmp21, i32 %tmp22		; <i8*> [#uses=1]
39*9880d681SAndroid Build Coastguard Worker	%tmp2324 = bitcast i8* %tmp23 to i32*		; <i32*> [#uses=1]
40*9880d681SAndroid Build Coastguard Worker	%tmp25 = load i32, i32* %src_stride_addr, align 4		; <i32> [#uses=1]
41*9880d681SAndroid Build Coastguard Worker	%tmp26 = mul i32 %tmp25, 2		; <i32> [#uses=1]
42*9880d681SAndroid Build Coastguard Worker	%tmp27 = load i8*, i8** %src_addr, align 4		; <i8*> [#uses=1]
43*9880d681SAndroid Build Coastguard Worker	%tmp28 = getelementptr i8, i8* %tmp27, i32 %tmp26		; <i8*> [#uses=1]
44*9880d681SAndroid Build Coastguard Worker	%tmp2829 = bitcast i8* %tmp28 to i32*		; <i32*> [#uses=1]
45*9880d681SAndroid Build Coastguard Worker	%tmp30 = load i32, i32* %src_stride_addr, align 4		; <i32> [#uses=1]
46*9880d681SAndroid Build Coastguard Worker	%tmp31 = mul i32 %tmp30, 3		; <i32> [#uses=1]
47*9880d681SAndroid Build Coastguard Worker	%tmp32 = load i8*, i8** %src_addr, align 4		; <i8*> [#uses=1]
48*9880d681SAndroid Build Coastguard Worker	%tmp33 = getelementptr i8, i8* %tmp32, i32 %tmp31		; <i8*> [#uses=1]
49*9880d681SAndroid Build Coastguard Worker	%tmp3334 = bitcast i8* %tmp33 to i32*		; <i32*> [#uses=1]
50*9880d681SAndroid Build Coastguard Worker	call void asm sideeffect "movd  $4, %mm0                \0A\09movd  $5, %mm1                \0A\09movd  $6, %mm2                \0A\09movd  $7, %mm3                \0A\09punpcklbw %mm1, %mm0         \0A\09punpcklbw %mm3, %mm2         \0A\09movq %mm0, %mm1              \0A\09punpcklwd %mm2, %mm0         \0A\09punpckhwd %mm2, %mm1         \0A\09movd  %mm0, $0                \0A\09punpckhdq %mm0, %mm0         \0A\09movd  %mm0, $1                \0A\09movd  %mm1, $2                \0A\09punpckhdq %mm1, %mm1         \0A\09movd  %mm1, $3                \0A\09", "=*m,=*m,=*m,=*m,*m,*m,*m,*m,~{dirflag},~{fpsr},~{flags}"( i32* %tmp12, i32* %tmp56, i32* %tmp1011, i32* %tmp1617, i32* %tmp1920, i32* %tmp2324, i32* %tmp2829, i32* %tmp3334 ) nounwind
51*9880d681SAndroid Build Coastguard Worker	br label %return
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Workerreturn:		; preds = %entry
54*9880d681SAndroid Build Coastguard Worker	ret void
55*9880d681SAndroid Build Coastguard Worker}
56