diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-17 07:59:14 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-17 07:59:14 +0000 |
commit | 83b3d8267225d585678d5d3af9bba5735f4b415d (patch) | |
tree | 9d6c2ad7bfd568186e83a39e6f03e1c0bf415715 /llvm/test/CodeGen/X86 | |
parent | 100602d7561ca5e245db6194bddae86357d203d4 (diff) | |
download | bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.tar.gz bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.zip |
Regression is gone, don't try to find it on clean target.
llvm-svn: 33296
Diffstat (limited to 'llvm/test/CodeGen/X86')
158 files changed, 4056 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/.cvsignore b/llvm/test/CodeGen/X86/.cvsignore new file mode 100644 index 00000000000..7f2443f2f31 --- /dev/null +++ b/llvm/test/CodeGen/X86/.cvsignore @@ -0,0 +1,3 @@ +Output +*.log +*.sum diff --git a/llvm/test/CodeGen/X86/2002-12-23-LocalRAProblem.llx b/llvm/test/CodeGen/X86/2002-12-23-LocalRAProblem.llx new file mode 100644 index 00000000000..f79781cb7b9 --- /dev/null +++ b/llvm/test/CodeGen/X86/2002-12-23-LocalRAProblem.llx @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -regalloc=simple + +int %main() { + %A = add int 0, 0 ; %A = 0 + %B = add int 0, 1 ; %B = 1 + br label %bb1 +bb1: + %X = mul int %A, %B ; %X = 0*1 = 0 + %R = sub int %B, 1 ; %r = 0 + ret int %R +} diff --git a/llvm/test/CodeGen/X86/2002-12-23-SubProblem.llx b/llvm/test/CodeGen/X86/2002-12-23-SubProblem.llx new file mode 100644 index 00000000000..3d893786099 --- /dev/null +++ b/llvm/test/CodeGen/X86/2002-12-23-SubProblem.llx @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -regalloc=simple + +int %main(int %B) { + ;%B = add int 0, 1 + %R = sub int %B, 1 ; %r = 0 + ret int %R +} diff --git a/llvm/test/CodeGen/X86/2003-08-03-CallArgLiveRanges.llx b/llvm/test/CodeGen/X86/2003-08-03-CallArgLiveRanges.llx new file mode 100644 index 00000000000..77ac17bc30e --- /dev/null +++ b/llvm/test/CodeGen/X86/2003-08-03-CallArgLiveRanges.llx @@ -0,0 +1,15 @@ +; The old instruction selector used to load all arguments to a call up in +; registers, then start pushing them all onto the stack. This is bad news as +; it makes a ton of annoying overlapping live ranges. This code should not +; cause spills! +; +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats 2>&1 | not grep spilled + +target endian = little +target pointersize = 32 + +int %test(int, int, int, int, int, int, int, int, int, int) { ret int 0 } +int %main() { + %X = call int %test(int 1, int 2, int 3, int 4, int 5, int 6, int 7, int 8, int 9, int 10) + ret int %X +} diff --git a/llvm/test/CodeGen/X86/2003-08-23-DeadBlockTest.llx b/llvm/test/CodeGen/X86/2003-08-23-DeadBlockTest.llx new file mode 100644 index 00000000000..48623b90120 --- /dev/null +++ b/llvm/test/CodeGen/X86/2003-08-23-DeadBlockTest.llx @@ -0,0 +1,13 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +implementation + +int %test() { +entry: ret int 7 +Test: ; dead block! + %A = call int %test() + %B = call int %test() + %C = add int %A, %B + ret int %C +} + diff --git a/llvm/test/CodeGen/X86/2003-11-03-GlobalBool.llx b/llvm/test/CodeGen/X86/2003-11-03-GlobalBool.llx new file mode 100644 index 00000000000..64236853e4c --- /dev/null +++ b/llvm/test/CodeGen/X86/2003-11-03-GlobalBool.llx @@ -0,0 +1,4 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep '.byte[[:space:]]*true' + +%X = global bool true + diff --git a/llvm/test/CodeGen/X86/2004-02-12-Memcpy.llx b/llvm/test/CodeGen/X86/2004-02-12-Memcpy.llx new file mode 100644 index 00000000000..8cd9a50cbb3 --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-02-12-Memcpy.llx @@ -0,0 +1,24 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep movs +declare void %llvm.memcpy.i32(sbyte* %A, sbyte* %B, uint %amt, uint %align) + +%A = global [1000 x int] zeroinitializer +%B = global [1000 x int] zeroinitializer + + +void %main() { + ; dword copy + call void %llvm.memcpy.i32(sbyte* cast (int* getelementptr ([1000 x int]* %A, long 0, long 0) to sbyte*), + sbyte* cast (int* getelementptr ([1000 x int]* %B, long 0, long 0) to sbyte*), + uint 4000, uint 4) + + ; word copy + call void %llvm.memcpy.i32(sbyte* cast (int* getelementptr ([1000 x int]* %A, long 0, long 0) to sbyte*), + sbyte* cast (int* getelementptr ([1000 x int]* %B, long 0, long 0) to sbyte*), + uint 4000, uint 2) + + ; byte copy + call void %llvm.memcpy.i32(sbyte* cast (int* getelementptr ([1000 x int]* %A, long 0, long 0) to sbyte*), + sbyte* cast (int* getelementptr ([1000 x int]* %B, long 0, long 0) to sbyte*), + uint 4000, uint 1) + ret void +} diff --git a/llvm/test/CodeGen/X86/2004-02-13-FrameReturnAddress.llx b/llvm/test/CodeGen/X86/2004-02-13-FrameReturnAddress.llx new file mode 100644 index 00000000000..3eec89a032f --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-02-13-FrameReturnAddress.llx @@ -0,0 +1,14 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep '(%esp' + +declare sbyte* %llvm.returnaddress(uint) +declare sbyte* %llvm.frameaddress(uint) + +sbyte *%test1() { + %X = call sbyte* %llvm.returnaddress(uint 0) + ret sbyte* %X +} + +sbyte *%test2() { + %X = call sbyte* %llvm.frameaddress(uint 0) + ret sbyte* %X +} diff --git a/llvm/test/CodeGen/X86/2004-02-14-InefficientStackPointer.llx b/llvm/test/CodeGen/X86/2004-02-14-InefficientStackPointer.llx new file mode 100644 index 00000000000..69e4c1d011f --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-02-14-InefficientStackPointer.llx @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep ESP | not grep sub + +int %test(int %X) { + ret int %X +} diff --git a/llvm/test/CodeGen/X86/2004-02-22-Casts.llx b/llvm/test/CodeGen/X86/2004-02-22-Casts.llx new file mode 100644 index 00000000000..8f5f5f8671d --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-02-22-Casts.llx @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +bool %test1(double %X) { + %V = cast double %X to bool + ret bool %V +} + +double %test2(ulong %X) { + %V = cast ulong %X to double + ret double %V +} diff --git a/llvm/test/CodeGen/X86/2004-03-30-Select-Max.llx b/llvm/test/CodeGen/X86/2004-03-30-Select-Max.llx new file mode 100644 index 00000000000..5ae8be2b318 --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-03-30-Select-Max.llx @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 'j[lgbe]' + +int %max(int %A, int %B) { + %gt = setgt int %A, %B + %R = select bool %gt, int %A, int %B + ret int %R +} diff --git a/llvm/test/CodeGen/X86/2004-04-09-SameValueCoalescing.llx b/llvm/test/CodeGen/X86/2004-04-09-SameValueCoalescing.llx new file mode 100644 index 00000000000..83434f99fc7 --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-04-09-SameValueCoalescing.llx @@ -0,0 +1,11 @@ +; Linear scan does not currently coalesce any two variables that have +; overlapping live intervals. When two overlapping intervals have the same +; value, they can be joined though. +; +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -regalloc=linearscan | not grep 'mov %[A-Z]\{2,3\}, %[A-Z]\{2,3\}' + +long %test(long %x) { +entry: + %tmp.1 = mul long %x, 4294967297 ; <long> [#uses=1] + ret long %tmp.1 +} diff --git a/llvm/test/CodeGen/X86/2004-04-13-FPCMOV-Crash.llx b/llvm/test/CodeGen/X86/2004-04-13-FPCMOV-Crash.llx new file mode 100644 index 00000000000..5896c142ee6 --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-04-13-FPCMOV-Crash.llx @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +implementation ; Functions: + +double %test(double %d) { + %X = select bool false, double %d, double %d ; <double> [#uses=0] + ret double %X +} diff --git a/llvm/test/CodeGen/X86/2004-06-10-StackifierCrash.llx b/llvm/test/CodeGen/X86/2004-06-10-StackifierCrash.llx new file mode 100644 index 00000000000..3df962b5a31 --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-06-10-StackifierCrash.llx @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +bool %T(double %X) { + %V = seteq double %X, %X + ret bool %V +} diff --git a/llvm/test/CodeGen/X86/2004-10-08-SelectSetCCFold.llx b/llvm/test/CodeGen/X86/2004-10-08-SelectSetCCFold.llx new file mode 100644 index 00000000000..6757be2782f --- /dev/null +++ b/llvm/test/CodeGen/X86/2004-10-08-SelectSetCCFold.llx @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +bool %test(bool %C, bool %D, int %X, int %Y) { + %E = setlt int %X, %Y + %F = select bool %C, bool %D, bool %E + ret bool %F +} + diff --git a/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll b/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll new file mode 100644 index 00000000000..8dbff537f59 --- /dev/null +++ b/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll @@ -0,0 +1,16 @@ +; This testcase was distilled from 132.ijpeg. Bsaically we cannot fold the +; load into the sub instruction here as it induces a cycle in the dag, which +; is invalid code (there is no correct way to order the instruction). Check +; that we do not fold the load into the sub. + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 'sub.*GLOBAL' + +%GLOBAL = external global int + +int %test(int* %P1, int* %P2, int* %P3) { + %L = load int* %GLOBAL + store int 12, int* %P2 + %Y = load int* %P3 + %Z = sub int %Y, %L + ret int %Z +} diff --git a/llvm/test/CodeGen/X86/2005-02-14-IllegalAssembler.ll b/llvm/test/CodeGen/X86/2005-02-14-IllegalAssembler.ll new file mode 100644 index 00000000000..4547bff657e --- /dev/null +++ b/llvm/test/CodeGen/X86/2005-02-14-IllegalAssembler.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 18446744073709551612 + +%A = external global int + +%Y = global int* getelementptr (int* %A, int -1) diff --git a/llvm/test/CodeGen/X86/2005-05-08-FPStackifierPHI.ll b/llvm/test/CodeGen/X86/2005-05-08-FPStackifierPHI.ll new file mode 100644 index 00000000000..5a304db3fbb --- /dev/null +++ b/llvm/test/CodeGen/X86/2005-05-08-FPStackifierPHI.ll @@ -0,0 +1,49 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=generic +; Make sure LLC doesn't crash in the stackifier due to FP PHI nodes. + +void %radfg_() { +entry: + br bool false, label %no_exit.16.preheader, label %loopentry.0 + +loopentry.0: ; preds = %entry + ret void + +no_exit.16.preheader: ; preds = %entry + br label %no_exit.16 + +no_exit.16: ; preds = %no_exit.16, %no_exit.16.preheader + br bool false, label %loopexit.16.loopexit, label %no_exit.16 + +loopexit.16.loopexit: ; preds = %no_exit.16 + br label %no_exit.18 + +no_exit.18: ; preds = %loopexit.20, %loopexit.16.loopexit + %tmp.882 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=2] + br bool false, label %loopexit.19, label %no_exit.19.preheader + +no_exit.19.preheader: ; preds = %no_exit.18 + ret void + +loopexit.19: ; preds = %no_exit.18 + br bool false, label %loopexit.20, label %no_exit.20 + +no_exit.20: ; preds = %loopexit.21, %loopexit.19 + %ai2.1122.tmp.3 = phi float [ %tmp.958, %loopexit.21 ], [ %tmp.882, %loopexit.19 ] ; <float> [#uses=1] + %tmp.950 = mul float %tmp.882, %ai2.1122.tmp.3 ; <float> [#uses=1] + %tmp.951 = sub float 0.000000e+00, %tmp.950 ; <float> [#uses=1] + %tmp.958 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=1] + br bool false, label %loopexit.21, label %no_exit.21.preheader + +no_exit.21.preheader: ; preds = %no_exit.20 + ret void + +loopexit.21: ; preds = %no_exit.20 + br bool false, label %loopexit.20, label %no_exit.20 + +loopexit.20: ; preds = %loopexit.21, %loopexit.19 + %ar2.1124.tmp.2 = phi float [ 0.000000e+00, %loopexit.19 ], [ %tmp.951, %loopexit.21 ] ; <float> [#uses=0] + br bool false, label %loopexit.18.loopexit, label %no_exit.18 + +loopexit.18.loopexit: ; preds = %loopexit.20 + ret void +} diff --git a/llvm/test/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll b/llvm/test/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll new file mode 100644 index 00000000000..eef09d8d73b --- /dev/null +++ b/llvm/test/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll @@ -0,0 +1,17 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep 'test.*AL' || \ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep 'cmove.*EAX' + +; This testcase was compiling to: +; +; _pypy_simple5: +; movl $13, %ecx +; movl $12, %eax +; movb 4(%esp), %al +; testb %al, %al ;; clobber EAX! +; cmove %ecx, %eax +; ret + +int %pypy_simple5(bool %b_4787) { + %retval = select bool %b_4787, int 12, int 13 ; <int> [#uses=1] + ret int %retval +} diff --git a/llvm/test/CodeGen/X86/2005-12-03-IndirectTailCall.ll b/llvm/test/CodeGen/X86/2005-12-03-IndirectTailCall.ll new file mode 100644 index 00000000000..9847a3641d0 --- /dev/null +++ b/llvm/test/CodeGen/X86/2005-12-03-IndirectTailCall.ll @@ -0,0 +1,25 @@ +; XFAIL: * +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -enable-x86-fastcc | grep 'jmp \*ecx' +declare int %putchar(int) + +int %main(){ + %f = cast int (int, int*, int)* %check_tail to int* + %res = tail call fastcc int %check_tail( int 10, int* %f,int 10) + ret int %res +} + +fastcc int %check_tail(int %x, int* %f, int %g) { + %tmp1 = setgt int %x, 0 + br bool %tmp1, label %if-then, label %if-else + +if-then: + %fun_ptr = cast int* %f to int(int, int*, int)* + %arg1 = add int %x, -1 + call int %putchar(int 90) + %res = tail call fastcc int %fun_ptr( int %arg1, int * %f, int %g) + ret int %res + +if-else: + ret int %x +} + diff --git a/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll b/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll new file mode 100644 index 00000000000..7d687472346 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll @@ -0,0 +1,15 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 'shld' | wc -l | grep 1 +; +; Check that the isel does not fold the shld, which already folds a load +; and has two uses, into a store. +%A = external global uint + +uint %test5(uint %B, ubyte %C) { + %tmp.1 = load uint *%A; + %tmp.2 = shl uint %tmp.1, ubyte %C + %tmp.3 = sub ubyte 32, %C + %tmp.4 = shr uint %B, ubyte %tmp.3 + %tmp.5 = or uint %tmp.4, %tmp.2 + store uint %tmp.5, uint* %A + ret uint %tmp.5 +} diff --git a/llvm/test/CodeGen/X86/2006-01-30-LongSetcc.ll b/llvm/test/CodeGen/X86/2006-01-30-LongSetcc.ll new file mode 100644 index 00000000000..2195645f7f1 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-01-30-LongSetcc.ll @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +bool %test(long %X) { + %B = setlt long %X, 0 ; <bool> [#uses=1] + ret bool %B +} diff --git a/llvm/test/CodeGen/X86/2006-03-01-InstrSchedBug.ll b/llvm/test/CodeGen/X86/2006-03-01-InstrSchedBug.ll new file mode 100644 index 00000000000..c9e4b0675e1 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-03-01-InstrSchedBug.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 'subl.*%esp' + +int %f(int %a, int %b) { + %tmp.2 = mul int %a, %a + %tmp.5 = shl int %a, ubyte 1 + %tmp.6 = mul int %tmp.5, %b + %tmp.10 = mul int %b, %b + %tmp.7 = add int %tmp.10, %tmp.2 + %tmp.11 = add int %tmp.7, %tmp.6 + ret int %tmp.11 +} diff --git a/llvm/test/CodeGen/X86/2006-03-02-InstrSchedBug.ll b/llvm/test/CodeGen/X86/2006-03-02-InstrSchedBug.ll new file mode 100644 index 00000000000..bf96708da25 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-03-02-InstrSchedBug.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats 2>&1 | grep 'asm-printer' | grep 7 + +int %g(int %a, int %b) { + %tmp.1 = shl int %b, ubyte 1 + %tmp.3 = add int %tmp.1, %a + %tmp.5 = mul int %tmp.3, %a + %tmp.8 = mul int %b, %b + %tmp.9 = add int %tmp.5, %tmp.8 + ret int %tmp.9 +} diff --git a/llvm/test/CodeGen/X86/2006-04-04-CrossBlockCrash.ll b/llvm/test/CodeGen/X86/2006-04-04-CrossBlockCrash.ll new file mode 100644 index 00000000000..5d380b57912 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-04-04-CrossBlockCrash.ll @@ -0,0 +1,55 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah + +target endian = little +target pointersize = 32 +target triple = "i686-apple-darwin8.6.1" + %struct.GLTColor4 = type { float, float, float, float } + %struct.GLTCoord3 = type { float, float, float } + %struct.__GLIContextRec = type { { %struct.anon, { [24 x [16 x float]], [24 x [16 x float]] }, %struct.GLTColor4, { float, float, float, float, %struct.GLTCoord3, float } }, { float, float, float, float, float, float, float, float, [4 x uint], [4 x uint], [4 x uint] } } + %struct.__GLvertex = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTCoord3, float, %struct.GLTColor4, float, float, float, ubyte, ubyte, ubyte, ubyte, [4 x float], [2 x sbyte*], uint, uint, [16 x %struct.GLTColor4] } + %struct.anon = type { float, float, float, float, float, float, float, float } + +implementation ; Functions: + +declare <4 x float> %llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, sbyte) + +declare <4 x int> %llvm.x86.sse2.packssdw.128(<4 x int>, <4 x int>) + +declare int %llvm.x86.sse2.pmovmskb.128(<16 x sbyte>) + +void %gleLLVMVecInterpolateClip() { +entry: + br bool false, label %cond_false, label %cond_false183 + +cond_false: ; preds = %entry + br bool false, label %cond_false183, label %cond_true69 + +cond_true69: ; preds = %cond_false + ret void + +cond_false183: ; preds = %cond_false, %entry + %vuizmsk.0.1 = phi <4 x int> [ < int -1, int -1, int -1, int 0 >, %entry ], [ < int -1, int 0, int 0, int 0 >, %cond_false ] ; <<4 x int>> [#uses=2] + %tmp192 = extractelement <4 x int> %vuizmsk.0.1, uint 2 ; <int> [#uses=1] + %tmp193 = extractelement <4 x int> %vuizmsk.0.1, uint 3 ; <int> [#uses=2] + %tmp195 = insertelement <4 x int> zeroinitializer, int %tmp192, uint 1 ; <<4 x int>> [#uses=1] + %tmp196 = insertelement <4 x int> %tmp195, int %tmp193, uint 2 ; <<4 x int>> [#uses=1] + %tmp197 = insertelement <4 x int> %tmp196, int %tmp193, uint 3 ; <<4 x int>> [#uses=1] + %tmp336 = and <4 x int> zeroinitializer, %tmp197 ; <<4 x int>> [#uses=1] + %tmp337 = cast <4 x int> %tmp336 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp378 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp337, <4 x float> zeroinitializer, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp379 = cast <4 x float> %tmp378 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp388 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> zeroinitializer, <4 x int> %tmp379 ) ; <<4 x int>> [#uses=1] + %tmp392 = cast <4 x int> %tmp388 to <8 x short> ; <<8 x short>> [#uses=1] + %tmp399 = extractelement <8 x short> %tmp392, uint 7 ; <short> [#uses=1] + %tmp423 = insertelement <8 x short> zeroinitializer, short %tmp399, uint 7 ; <<8 x short>> [#uses=1] + %tmp427 = cast <8 x short> %tmp423 to <16 x sbyte> ; <<16 x sbyte>> [#uses=1] + %tmp428 = tail call int %llvm.x86.sse2.pmovmskb.128( <16 x sbyte> %tmp427 ) ; <int> [#uses=1] + %tmp432 = cast int %tmp428 to sbyte ; <sbyte> [#uses=1] + %tmp = and sbyte %tmp432, 42 ; <sbyte> [#uses=1] + %tmp436 = cast sbyte %tmp to ubyte ; <ubyte> [#uses=1] + %tmp446 = cast ubyte %tmp436 to uint ; <uint> [#uses=1] + %tmp447 = shl uint %tmp446, ubyte 24 ; <uint> [#uses=1] + %tmp449 = or uint 0, %tmp447 ; <uint> [#uses=1] + store uint %tmp449, uint* null + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-04-27-ISelFoldingBug.ll b/llvm/test/CodeGen/X86/2006-04-27-ISelFoldingBug.ll new file mode 100644 index 00000000000..25a2ca84526 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-04-27-ISelFoldingBug.ll @@ -0,0 +1,32 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mtriple=i686-apple-darwin8 -relocation-model=static | grep 'movl _last' | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mtriple=i686-apple-darwin8 -relocation-model=static | grep 'cmpl.*_last' | wc -l | grep 1 + +%block = external global ubyte* ; <ubyte**> [#uses=1] +%last = external global int ; <int*> [#uses=3] + +implementation ; Functions: + +bool %loadAndRLEsource_no_exit_2E_1_label_2E_0(int %tmp.21.reload, int %tmp.8) { +newFuncRoot: + br label %label.0 + +label.0.no_exit.1_crit_edge.exitStub: ; preds = %label.0 + ret bool true + +codeRepl5.exitStub: ; preds = %label.0 + ret bool false + +label.0: ; preds = %newFuncRoot + %tmp.35 = load int* %last ; <int> [#uses=1] + %inc.1 = add int %tmp.35, 1 ; <int> [#uses=2] + store int %inc.1, int* %last + %tmp.36 = load ubyte** %block ; <ubyte*> [#uses=1] + %tmp.38 = getelementptr ubyte* %tmp.36, int %inc.1 ; <ubyte*> [#uses=1] + %tmp.40 = cast int %tmp.21.reload to ubyte ; <ubyte> [#uses=1] + store ubyte %tmp.40, ubyte* %tmp.38 + %tmp.910 = load int* %last ; <int> [#uses=1] + %tmp.1111 = setlt int %tmp.910, %tmp.8 ; <bool> [#uses=1] + %tmp.1412 = setne int %tmp.21.reload, 257 ; <bool> [#uses=1] + %tmp.1613 = and bool %tmp.1111, %tmp.1412 ; <bool> [#uses=1] + br bool %tmp.1613, label %label.0.no_exit.1_crit_edge.exitStub, label %codeRepl5.exitStub +} diff --git a/llvm/test/CodeGen/X86/2006-05-01-SchedCausingSpills.ll b/llvm/test/CodeGen/X86/2006-05-01-SchedCausingSpills.ll new file mode 100644 index 00000000000..71b90760e33 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-01-SchedCausingSpills.ll @@ -0,0 +1,73 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah -stats 2>&1 | not grep 'Number of register spills' + +int %foo(<4 x float>* %a, <4 x float>* %b, <4 x float>* %c, <4 x float>* %d) { + %tmp44 = load <4 x float>* %a ; <<4 x float>> [#uses=9] + %tmp46 = load <4 x float>* %b ; <<4 x float>> [#uses=1] + %tmp48 = load <4 x float>* %c ; <<4 x float>> [#uses=1] + %tmp50 = load <4 x float>* %d ; <<4 x float>> [#uses=1] + %tmp51 = cast <4 x float> %tmp44 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp = shufflevector <4 x int> %tmp51, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] + %tmp52 = cast <4 x int> %tmp to <4 x float> ; <<4 x float>> [#uses=1] + %tmp60 = xor <4 x int> %tmp, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] + %tmp61 = cast <4 x int> %tmp60 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp74 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp52, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp75 = cast <4 x float> %tmp74 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp88 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp61, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp89 = cast <4 x float> %tmp88 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp98 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp75, <4 x int> %tmp89 ) ; <<4 x int>> [#uses=1] + %tmp102 = cast <4 x int> %tmp98 to <8 x short> ; <<8 x short>> [#uses=1] + %tmp = shufflevector <8 x short> %tmp102, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] + %tmp105 = shufflevector <8 x short> %tmp, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] + %tmp105 = cast <8 x short> %tmp105 to <4 x float> ; <<4 x float>> [#uses=1] + store <4 x float> %tmp105, <4 x float>* %a + %tmp108 = cast <4 x float> %tmp46 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp109 = shufflevector <4 x int> %tmp108, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] + %tmp109 = cast <4 x int> %tmp109 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp119 = xor <4 x int> %tmp109, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] + %tmp120 = cast <4 x int> %tmp119 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp133 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp109, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp134 = cast <4 x float> %tmp133 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp147 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp120, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp148 = cast <4 x float> %tmp147 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp159 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp134, <4 x int> %tmp148 ) ; <<4 x int>> [#uses=1] + %tmp163 = cast <4 x int> %tmp159 to <8 x short> ; <<8 x short>> [#uses=1] + %tmp164 = shufflevector <8 x short> %tmp163, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] + %tmp166 = shufflevector <8 x short> %tmp164, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] + %tmp166 = cast <8 x short> %tmp166 to <4 x float> ; <<4 x float>> [#uses=1] + store <4 x float> %tmp166, <4 x float>* %b + %tmp169 = cast <4 x float> %tmp48 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp170 = shufflevector <4 x int> %tmp169, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] + %tmp170 = cast <4 x int> %tmp170 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp180 = xor <4 x int> %tmp170, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] + %tmp181 = cast <4 x int> %tmp180 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp194 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp170, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp195 = cast <4 x float> %tmp194 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp208 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp181, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp209 = cast <4 x float> %tmp208 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp220 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp195, <4 x int> %tmp209 ) ; <<4 x int>> [#uses=1] + %tmp224 = cast <4 x int> %tmp220 to <8 x short> ; <<8 x short>> [#uses=1] + %tmp225 = shufflevector <8 x short> %tmp224, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] + %tmp227 = shufflevector <8 x short> %tmp225, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] + %tmp227 = cast <8 x short> %tmp227 to <4 x float> ; <<4 x float>> [#uses=1] + store <4 x float> %tmp227, <4 x float>* %c + %tmp230 = cast <4 x float> %tmp50 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp231 = shufflevector <4 x int> %tmp230, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] + %tmp231 = cast <4 x int> %tmp231 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp241 = xor <4 x int> %tmp231, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] + %tmp242 = cast <4 x int> %tmp241 to <4 x float> ; <<4 x float>> [#uses=1] + %tmp255 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp231, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp256 = cast <4 x float> %tmp255 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp269 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp242, sbyte 1 ) ; <<4 x float>> [#uses=1] + %tmp270 = cast <4 x float> %tmp269 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp281 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp256, <4 x int> %tmp270 ) ; <<4 x int>> [#uses=1] + %tmp285 = cast <4 x int> %tmp281 to <8 x short> ; <<8 x short>> [#uses=1] + %tmp286 = shufflevector <8 x short> %tmp285, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] + %tmp288 = shufflevector <8 x short> %tmp286, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] + %tmp288 = cast <8 x short> %tmp288 to <4 x float> ; <<4 x float>> [#uses=1] + store <4 x float> %tmp288, <4 x float>* %d + ret int 0 +} + +declare <4 x float> %llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, sbyte) + +declare <4 x int> %llvm.x86.sse2.packssdw.128(<4 x int>, <4 x int>) diff --git a/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll b/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll new file mode 100644 index 00000000000..631e416836d --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -relocation-model=static -stats 2>&1 | grep "asm-printer" | grep 14 +%size20 = external global uint ; <uint*> [#uses=1] +%in5 = external global ubyte* ; <ubyte**> [#uses=1] + +int %compare(sbyte* %a, sbyte* %b) { + %tmp = cast sbyte* %a to uint* ; <uint*> [#uses=1] + %tmp1 = cast sbyte* %b to uint* ; <uint*> [#uses=1] + %tmp = load uint* %size20 ; <uint> [#uses=1] + %tmp = load ubyte** %in5 ; <ubyte*> [#uses=2] + %tmp3 = load uint* %tmp1 ; <uint> [#uses=1] + %tmp4 = getelementptr ubyte* %tmp, uint %tmp3 ; <ubyte*> [#uses=1] + %tmp7 = load uint* %tmp ; <uint> [#uses=1] + %tmp8 = getelementptr ubyte* %tmp, uint %tmp7 ; <ubyte*> [#uses=1] + %tmp8 = cast ubyte* %tmp8 to sbyte* ; <sbyte*> [#uses=1] + %tmp4 = cast ubyte* %tmp4 to sbyte* ; <sbyte*> [#uses=1] + %tmp = tail call int %memcmp( sbyte* %tmp8, sbyte* %tmp4, uint %tmp ) ; <int> [#uses=1] + ret int %tmp +} + +declare int %memcmp(sbyte*, sbyte*, uint) diff --git a/llvm/test/CodeGen/X86/2006-05-02-InstrSched2.ll b/llvm/test/CodeGen/X86/2006-05-02-InstrSched2.ll new file mode 100644 index 00000000000..9b58de251a6 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-02-InstrSched2.ll @@ -0,0 +1,24 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats 2>&1 | grep "asm-printer" | grep 18 + +void %_ZN9__gnu_cxx9hashtableISt4pairIKPKciES3_NS_4hashIS3_EESt10_Select1stIS5_E5eqstrSaIiEE14find_or_insertERKS5__cond_true456.i(sbyte* %tmp435.i, uint* %tmp449.i.out) { +newFuncRoot: + br label %cond_true456.i + +bb459.i.exitStub: ; preds = %cond_true456.i + store uint %tmp449.i, uint* %tmp449.i.out + ret void + +cond_true456.i: ; preds = %cond_true456.i, %newFuncRoot + %__s441.2.4.i = phi sbyte* [ %tmp451.i, %cond_true456.i ], [ %tmp435.i, %newFuncRoot ] ; <sbyte*> [#uses=2] + %__h.2.4.i = phi uint [ %tmp449.i, %cond_true456.i ], [ 0, %newFuncRoot ] ; <uint> [#uses=1] + %tmp446.i = mul uint %__h.2.4.i, 5 ; <uint> [#uses=1] + %tmp.i = load sbyte* %__s441.2.4.i ; <sbyte> [#uses=1] + %tmp448.i = cast sbyte %tmp.i to uint ; <uint> [#uses=1] + %tmp449.i = add uint %tmp448.i, %tmp446.i ; <uint> [#uses=2] + %tmp450.i = cast sbyte* %__s441.2.4.i to uint ; <uint> [#uses=1] + %tmp451.i = add uint %tmp450.i, 1 ; <uint> [#uses=1] + %tmp451.i = cast uint %tmp451.i to sbyte* ; <sbyte*> [#uses=2] + %tmp45435.i = load sbyte* %tmp451.i ; <sbyte> [#uses=1] + %tmp45536.i = seteq sbyte %tmp45435.i, 0 ; <bool> [#uses=1] + br bool %tmp45536.i, label %bb459.i.exitStub, label %cond_true456.i +} diff --git a/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll b/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll new file mode 100644 index 00000000000..009a4bb759e --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll @@ -0,0 +1,22 @@ +; Coalescing from R32 to a subset R32_. Once another register coalescer bug is +; fixed, the movb should go away as well. + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -relocation-model=static | grep 'movl' | wc -l + +%B = external global uint +%C = external global ushort* + +void %test(uint %A) { + %A = cast uint %A to ubyte + %tmp2 = load uint* %B + %tmp3 = and ubyte %A, 16 + %tmp4 = shl uint %tmp2, ubyte %tmp3 + store uint %tmp4, uint* %B + %tmp6 = shr uint %A, ubyte 3 + %tmp = load ushort** %C + %tmp8 = cast ushort* %tmp to uint + %tmp9 = add uint %tmp8, %tmp6 + %tmp9 = cast uint %tmp9 to ushort* + store ushort* %tmp9, ushort** %C + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll b/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll new file mode 100644 index 00000000000..8897692be21 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll @@ -0,0 +1,22 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -relocation-model=static | not grep 'subl.*%esp' + +%A = external global ushort* +%B = external global uint +%C = external global uint + +void %test() { + %tmp = load ushort** %A + %tmp1 = getelementptr ushort* %tmp, int 1 + %tmp = load ushort* %tmp1 + %tmp3 = cast ushort %tmp to uint + %tmp = load uint* %B + %tmp4 = and uint %tmp, 16 + %tmp5 = load uint* %C + %tmp6 = cast uint %tmp4 to ubyte + %tmp7 = shl uint %tmp5, ubyte %tmp6 + %tmp9 = xor ubyte %tmp6, 16 + %tmp11 = shr uint %tmp3, ubyte %tmp9 + %tmp12 = or uint %tmp11, %tmp7 + store uint %tmp12, uint* %C + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll b/llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll new file mode 100644 index 00000000000..40dd61a2d12 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll @@ -0,0 +1,52 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 -stats 2>&1 | grep 'asm-printer' | grep 39 + +void %foo(int* %mc, int* %bp, int* %ms, int* %xmb, int* %mpp, int* %tpmm, int* %ip, int* %tpim, int* %dpp, int* %tpdm, int* %bpi, int %M) { +entry: + %tmp9 = setlt int %M, 5 ; <bool> [#uses=1] + br bool %tmp9, label %return, label %cond_true + +cond_true: ; preds = %cond_true, %entry + %indvar = phi uint [ 0, %entry ], [ %indvar.next, %cond_true ] ; <uint> [#uses=2] + %tmp. = shl uint %indvar, ubyte 2 ; <uint> [#uses=1] + %tmp.10 = add uint %tmp., 1 ; <uint> [#uses=2] + %k.0.0 = cast uint %tmp.10 to int ; <int> [#uses=2] + %tmp31 = add int %k.0.0, -1 ; <int> [#uses=4] + %tmp32 = getelementptr int* %mpp, int %tmp31 ; <int*> [#uses=1] + %tmp34 = cast int* %tmp32 to sbyte* ; <sbyte*> [#uses=1] + %tmp = tail call <16 x sbyte> %llvm.x86.sse2.loadu.dq( sbyte* %tmp34 ) ; <<16 x sbyte>> [#uses=1] + %tmp42 = getelementptr int* %tpmm, int %tmp31 ; <int*> [#uses=1] + %tmp42 = cast int* %tmp42 to <4 x int>* ; <<4 x int>*> [#uses=1] + %tmp46 = load <4 x int>* %tmp42 ; <<4 x int>> [#uses=1] + %tmp54 = cast <16 x sbyte> %tmp to <4 x int> ; <<4 x int>> [#uses=1] + %tmp55 = add <4 x int> %tmp54, %tmp46 ; <<4 x int>> [#uses=2] + %tmp55 = cast <4 x int> %tmp55 to <2 x long> ; <<2 x long>> [#uses=1] + %tmp62 = getelementptr int* %ip, int %tmp31 ; <int*> [#uses=1] + %tmp65 = cast int* %tmp62 to sbyte* ; <sbyte*> [#uses=1] + %tmp66 = tail call <16 x sbyte> %llvm.x86.sse2.loadu.dq( sbyte* %tmp65 ) ; <<16 x sbyte>> [#uses=1] + %tmp73 = getelementptr int* %tpim, int %tmp31 ; <int*> [#uses=1] + %tmp73 = cast int* %tmp73 to <4 x int>* ; <<4 x int>*> [#uses=1] + %tmp77 = load <4 x int>* %tmp73 ; <<4 x int>> [#uses=1] + %tmp87 = cast <16 x sbyte> %tmp66 to <4 x int> ; <<4 x int>> [#uses=1] + %tmp88 = add <4 x int> %tmp87, %tmp77 ; <<4 x int>> [#uses=2] + %tmp88 = cast <4 x int> %tmp88 to <2 x long> ; <<2 x long>> [#uses=1] + %tmp99 = tail call <4 x int> %llvm.x86.sse2.pcmpgt.d( <4 x int> %tmp88, <4 x int> %tmp55 ) ; <<4 x int>> [#uses=1] + %tmp99 = cast <4 x int> %tmp99 to <2 x long> ; <<2 x long>> [#uses=2] + %tmp110 = xor <2 x long> %tmp99, < long -1, long -1 > ; <<2 x long>> [#uses=1] + %tmp111 = and <2 x long> %tmp110, %tmp55 ; <<2 x long>> [#uses=1] + %tmp121 = and <2 x long> %tmp99, %tmp88 ; <<2 x long>> [#uses=1] + %tmp131 = or <2 x long> %tmp121, %tmp111 ; <<2 x long>> [#uses=1] + %tmp137 = getelementptr int* %mc, uint %tmp.10 ; <int*> [#uses=1] + %tmp137 = cast int* %tmp137 to <2 x long>* ; <<2 x long>*> [#uses=1] + store <2 x long> %tmp131, <2 x long>* %tmp137 + %tmp147 = add int %k.0.0, 8 ; <int> [#uses=1] + %tmp = setgt int %tmp147, %M ; <bool> [#uses=1] + %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] + br bool %tmp, label %return, label %cond_true + +return: ; preds = %cond_true, %entry + ret void +} + +declare <16 x sbyte> %llvm.x86.sse2.loadu.dq(sbyte*) + +declare <4 x int> %llvm.x86.sse2.pcmpgt.d(<4 x int>, <4 x int>) diff --git a/llvm/test/CodeGen/X86/2006-05-17-VectorArg.ll b/llvm/test/CodeGen/X86/2006-05-17-VectorArg.ll new file mode 100644 index 00000000000..1f2af1473ab --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-17-VectorArg.ll @@ -0,0 +1,14 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 + +<4 x float> %opRSQ(<4 x float> %a) { +entry: + %tmp2 = extractelement <4 x float> %a, uint 3 + %abscond = setge float %tmp2, -0.000000e+00 + %abs = select bool %abscond, float %tmp2, float 0.000000e+00 + %tmp3 = tail call float %llvm.sqrt.f32( float %abs ) + %tmp4 = div float 1.000000e+00, %tmp3 + %tmp11 = insertelement <4 x float> zeroinitializer, float %tmp4, uint 3 + ret <4 x float> %tmp11 +} + +declare float %llvm.sqrt.f32(float) diff --git a/llvm/test/CodeGen/X86/2006-05-22-FPSetEQ.ll b/llvm/test/CodeGen/X86/2006-05-22-FPSetEQ.ll new file mode 100644 index 00000000000..a6f7bd68e23 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-22-FPSetEQ.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 'setnp' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -enable-unsafe-fp-math | not grep 'setnp' + +uint %test(float %f) { + %tmp = seteq float %f, 0.000000e+00 + %tmp = cast bool %tmp to uint + ret uint %tmp +} diff --git a/llvm/test/CodeGen/X86/2006-05-25-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-05-25-CycleInDAG.ll new file mode 100644 index 00000000000..8258f0b3227 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-05-25-CycleInDAG.ll @@ -0,0 +1,21 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +int %test() { + br bool false, label %cond_next33, label %cond_true12 + +cond_true12: + ret int 0 + +cond_next33: + %tmp44.i = call double %foo( double 0.000000e+00, int 32 ) + %tmp61.i = load ubyte* null + %tmp61.i = cast ubyte %tmp61.i to int + %tmp58.i = or int 0, %tmp61.i + %tmp62.i = or int %tmp58.i, 0 + %tmp62.i = cast int %tmp62.i to double + %tmp64.i = add double %tmp62.i, %tmp44.i + %tmp68.i = call double %foo( double %tmp64.i, int 0 ) + ret int 0 +} + +declare double %foo(double, int) diff --git a/llvm/test/CodeGen/X86/2006-07-10-InlineAsmAConstraint.ll b/llvm/test/CodeGen/X86/2006-07-10-InlineAsmAConstraint.ll new file mode 100644 index 00000000000..d044fd71531 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-07-10-InlineAsmAConstraint.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 +; PR825 + +long %test() { + %tmp.i5 = call long asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"( ) ; <long> [#uses=0] + ret long %tmp.i5 +} diff --git a/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll b/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll new file mode 100644 index 00000000000..1bacc16573b --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll @@ -0,0 +1,18 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 +; PR828 + +target endian = little +target pointersize = 32 +target triple = "i686-pc-linux-gnu" + +implementation ; Functions: + +void %_ZN5() { + +cond_true9: ; preds = %entry + %tmp3.i.i = call int asm sideeffect "lock; cmpxchg $1,$2", +"={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( int 0, int* null, int 0 ) + ; <int> [#uses=0] + ret void +} + diff --git a/llvm/test/CodeGen/X86/2006-07-19-ATTAsm.ll b/llvm/test/CodeGen/X86/2006-07-19-ATTAsm.ll new file mode 100644 index 00000000000..adfe88c9d10 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-07-19-ATTAsm.ll @@ -0,0 +1,51 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att +; PR834 + +target endian = little +target pointersize = 32 +target triple = "i386-unknown-freebsd6.1" + + %llvm.dbg.anchor.type = type { uint, uint } + %llvm.dbg.basictype.type = type { uint, { }*, sbyte*, { }*, uint, ulong, ulong, ulong, uint, uint } + %llvm.dbg.compile_unit.type = type { uint, { }*, uint, sbyte*, sbyte*, sbyte* } + %llvm.dbg.global_variable.type = type { uint, { }*, { }*, sbyte*, sbyte*, { }*, uint, { }*, bool, bool, { }* } +%x = global int 0 ; <int*> [#uses=1] +%llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { + uint 327732, + { }* cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to { }*), + { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), + sbyte* getelementptr ([2 x sbyte]* %str, int 0, int 0), + sbyte* null, + { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), + uint 1, + { }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*), + bool false, + bool true, + { }* cast (int* %x to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] +%llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { uint 327680, uint 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +%llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { + uint 327697, + { }* cast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to { }*), + uint 4, + sbyte* getelementptr ([10 x sbyte]* %str, int 0, int 0), + sbyte* getelementptr ([32 x sbyte]* %str, int 0, int 0), + sbyte* getelementptr ([45 x sbyte]* %str, int 0, int 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] +%llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { uint 327680, uint 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] +%str = internal constant [10 x sbyte] c"testb.cpp\00", section "llvm.metadata" ; <[10 x sbyte]*> [#uses=1] +%str = internal constant [32 x sbyte] c"/Sources/Projects/DwarfTesting/\00", section "llvm.metadata" ; <[32 x sbyte]*> [#uses=1] +%str = internal constant [45 x sbyte] c"4.0.1 LLVM (Apple Computer, Inc. build 5400)\00", section "llvm.metadata" ; <[45 x sbyte]*> [#uses=1] +%str = internal constant [2 x sbyte] c"x\00", section "llvm.metadata" ; <[2 x sbyte]*> [#uses=1] +%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { + uint 327716, + { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), + sbyte* getelementptr ([4 x sbyte]* %str, int 0, int 0), + { }* null, + uint 0, + ulong 32, + ulong 32, + ulong 0, + uint 0, + uint 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] +%str = internal constant [4 x sbyte] c"int\00", section "llvm.metadata" ; <[4 x sbyte]*> [#uses=1] + +implementation ; Functions: diff --git a/llvm/test/CodeGen/X86/2006-07-20-InlineAsm.ll b/llvm/test/CodeGen/X86/2006-07-20-InlineAsm.ll new file mode 100644 index 00000000000..8f409eb8412 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-07-20-InlineAsm.ll @@ -0,0 +1,24 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 +; PR833 + +%G = weak global int 0 ; <int*> [#uses=3] + +implementation ; Functions: + +int %foo(int %X) { +entry: + %X_addr = alloca int ; <int*> [#uses=3] + store int %X, int* %X_addr + call void asm sideeffect "xchg{l} {$0,$1|$1,$0}", "==m,==r,m,1,~{dirflag},~{fpsr},~{flags}"( int* %G, int* %X_addr, int* %G, int %X ) + %tmp1 = load int* %X_addr ; <int> [#uses=1] + ret int %tmp1 +} + +int %foo2(int %X) { +entry: + %X_addr = alloca int ; <int*> [#uses=3] + store int %X, int* %X_addr + call void asm sideeffect "xchg{l} {$0,$1|$1,$0}", "==m,==r,1,~{dirflag},~{fpsr},~{flags}"( int* %G, int* %X_addr, int %X ) + %tmp1 = load int* %X_addr ; <int> [#uses=1] + ret int %tmp1 +} diff --git a/llvm/test/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll b/llvm/test/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll new file mode 100644 index 00000000000..26c71a312e2 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-07-28-AsmPrint-Long-As-Pointer.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep -- 4294967240 +; PR853 + +%X = global int* cast (ulong 18446744073709551560 to int*) + diff --git a/llvm/test/CodeGen/X86/2006-07-31-SingleRegClass.ll b/llvm/test/CodeGen/X86/2006-07-31-SingleRegClass.ll new file mode 100644 index 00000000000..99e2f70f59e --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-07-31-SingleRegClass.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att | grep 'movl 4(%eax),%ebp' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att | grep 'movl 0(%eax), %ebx' + +; PR850 + +int %foo(int %__s.i.i, int %tmp5.i.i, int %tmp6.i.i, int %tmp7.i.i, int %tmp8.i.i ) { + +%tmp9.i.i = call int asm sideeffect "push %ebp\0Apush %ebx\0Amovl 4($2),%ebp\0Amovl 0($2), %ebx\0Amovl $1,%eax\0Aint $$0x80\0Apop %ebx\0Apop %ebp", "={ax},i,0,{cx},{dx},{si},{di}"(int 192, int %__s.i.i, int %tmp5.i.i, int %tmp6.i.i, int %tmp7.i.i, int %tmp8.i.i ) + ret int %tmp9.i.i +} diff --git a/llvm/test/CodeGen/X86/2006-08-07-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-08-07-CycleInDAG.ll new file mode 100644 index 00000000000..c66d553c111 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-08-07-CycleInDAG.ll @@ -0,0 +1,34 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 + +%struct.foo = type opaque + +implementation + +fastcc int %test(%struct.foo* %v, %struct.foo* %vi) { + br bool false, label %ilog2.exit, label %cond_true.i + +cond_true.i: ; preds = %entry + ret int 0 + +ilog2.exit: ; preds = %entry + %tmp24.i = load int* null ; <int> [#uses=1] + %tmp13.i12.i = tail call double %ldexp( double 0.000000e+00, int 0 ) ; <double> [#uses=1] + %tmp13.i13.i = cast double %tmp13.i12.i to float ; <float> [#uses=1] + %tmp11.s = load int* null ; <int> [#uses=1] + %tmp11.i = cast int %tmp11.s to uint ; <uint> [#uses=1] + %n.i = cast int %tmp24.i to uint ; <uint> [#uses=1] + %tmp13.i7 = mul uint %tmp11.i, %n.i ; <uint> [#uses=1] + %tmp.i8 = tail call sbyte* %calloc( uint %tmp13.i7, uint 4 ) ; <sbyte*> [#uses=0] + br bool false, label %bb224.preheader.i, label %bb.i + +bb.i: ; preds = %ilog2.exit + ret int 0 + +bb224.preheader.i: ; preds = %ilog2.exit + %tmp165.i = cast float %tmp13.i13.i to double ; <double> [#uses=0] + ret int 0 +} + +declare sbyte* %calloc(uint, uint) + +declare double %ldexp(double, int) diff --git a/llvm/test/CodeGen/X86/2006-08-16-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-08-16-CycleInDAG.ll new file mode 100644 index 00000000000..c0668a9dbd5 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-08-16-CycleInDAG.ll @@ -0,0 +1,23 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + + %struct.expr = type { %struct.rtx_def*, int, %struct.expr*, %struct.occr*, %struct.occr*, %struct.rtx_def* } + %struct.hash_table = type { %struct.expr**, uint, uint, int } + %struct.occr = type { %struct.occr*, %struct.rtx_def*, sbyte, sbyte } + %struct.rtx_def = type { ushort, ubyte, ubyte, %struct.u } + %struct.u = type { [1 x long] } + +void %test() { + %tmp = load uint* null ; <uint> [#uses=1] + %tmp8 = call uint %hash_rtx( ) ; <uint> [#uses=1] + %tmp11 = rem uint %tmp8, %tmp ; <uint> [#uses=1] + br bool false, label %cond_next, label %return + +cond_next: ; preds = %entry + %tmp17 = getelementptr %struct.expr** null, uint %tmp11 ; <%struct.expr**> [#uses=0] + ret void + +return: ; preds = %entry + ret void +} + +declare uint %hash_rtx() diff --git a/llvm/test/CodeGen/X86/2006-08-21-ExtraMovInst.ll b/llvm/test/CodeGen/X86/2006-08-21-ExtraMovInst.ll new file mode 100644 index 00000000000..c2d905a5e39 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-08-21-ExtraMovInst.ll @@ -0,0 +1,15 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=i386 | not grep 'movl %eax, %edx' + +int %foo(int %t, int %C) { +entry: + br label %cond_true + +cond_true: ; preds = %cond_true, %entry + %t_addr.0.0 = phi int [ %t, %entry ], [ %tmp7, %cond_true ] ; <int> [#uses=2] + %tmp7 = add int %t_addr.0.0, 1 ; <int> [#uses=1] + %tmp = setgt int %C, 39 ; <bool> [#uses=1] + br bool %tmp, label %bb12, label %cond_true + +bb12: ; preds = %cond_true + ret int %t_addr.0.0 +} diff --git a/llvm/test/CodeGen/X86/2006-09-01-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-09-01-CycleInDAG.ll new file mode 100644 index 00000000000..2e0a69a5514 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-09-01-CycleInDAG.ll @@ -0,0 +1,135 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +target endian = little +target pointersize = 32 +target triple = "i686-apple-darwin8" + %struct.CUMULATIVE_ARGS = type { int, int, int, int, int, int, int, int, int, int, int, int } + %struct.FILE = type { ubyte*, int, int, short, short, %struct.__sbuf, int, sbyte*, int (sbyte*)*, int (sbyte*, sbyte*, int)*, long (sbyte*, long, int)*, int (sbyte*, sbyte*, int)*, %struct.__sbuf, %struct.__sFILEX*, int, [3 x ubyte], [1 x ubyte], %struct.__sbuf, int, long } + %struct.VEC_edge = type { uint, uint, [1 x %struct.edge_def*] } + %struct.VEC_tree = type { uint, uint, [1 x %struct.tree_node*] } + %struct.__sFILEX = type opaque + %struct.__sbuf = type { ubyte*, int } + %struct._obstack_chunk = type { sbyte*, %struct._obstack_chunk*, [4 x sbyte] } + %struct._var_map = type { %struct.partition_def*, int*, int*, %struct.tree_node**, uint, uint, int* } + %struct.basic_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.tree_node*, %struct.VEC_edge*, %struct.VEC_edge*, %struct.bitmap_head_def*, %struct.bitmap_head_def*, sbyte*, %struct.loop*, [2 x %struct.et_node*], %struct.basic_block_def*, %struct.basic_block_def*, %struct.reorder_block_def*, %struct.bb_ann_d*, long, int, int, int, int } + %struct.bb_ann_d = type { %struct.tree_node*, ubyte, %struct.edge_prediction* } + %struct.bitmap_element_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, [4 x uint] } + %struct.bitmap_head_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, %struct.bitmap_obstack* } + %struct.bitmap_iterator = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, uint, uint } + %struct.bitmap_obstack = type { %struct.bitmap_element_def*, %struct.bitmap_head_def*, %struct.obstack } + %struct.block_stmt_iterator = type { %struct.tree_stmt_iterator, %struct.basic_block_def* } + %struct.coalesce_list_d = type { %struct._var_map*, %struct.partition_pair_d**, bool } + %struct.conflict_graph_def = type opaque + %struct.dataflow_d = type { %struct.varray_head_tag*, [2 x %struct.tree_node*] } + %struct.def_operand_ptr = type { %struct.tree_node** } + %struct.def_optype_d = type { uint, [1 x %struct.def_operand_ptr] } + %struct.die_struct = type opaque + %struct.edge_def = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.edge_def_insns, sbyte*, %struct.location_t*, int, int, long, uint } + %struct.edge_def_insns = type { %struct.rtx_def* } + %struct.edge_iterator = type { uint, %struct.VEC_edge** } + %struct.edge_prediction = type { %struct.edge_prediction*, %struct.edge_def*, uint, int } + %struct.eh_status = type opaque + %struct.elt_list = type opaque + %struct.emit_status = type { int, int, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, int, %struct.location_t, int, ubyte*, %struct.rtx_def** } + %struct.et_node = type opaque + %struct.expr_status = type { int, int, int, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } + %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, int, int, int, int, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, ubyte, int, long, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, int, %struct.var_refs_queue*, int, int, %struct.rtvec_def*, %struct.tree_node*, int, int, int, %struct.machine_function*, uint, uint, bool, bool, %struct.language_function*, %struct.rtx_def*, uint, int, int, int, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, ubyte, ubyte, ubyte } + %struct.ht_identifier = type { ubyte*, uint, uint } + %struct.initial_value_struct = type opaque + %struct.lang_decl = type opaque + %struct.lang_type = type opaque + %struct.language_function = type opaque + %struct.location_t = type { sbyte*, int } + %struct.loop = type opaque + %struct.machine_function = type { int, uint, sbyte*, int, int } + %struct.obstack = type { int, %struct._obstack_chunk*, sbyte*, sbyte*, sbyte*, int, int, %struct._obstack_chunk* (sbyte*, int)*, void (sbyte*, %struct._obstack_chunk*)*, sbyte*, ubyte } + %struct.partition_def = type { int, [1 x %struct.partition_elem] } + %struct.partition_elem = type { int, %struct.partition_elem*, uint } + %struct.partition_pair_d = type { int, int, int, %struct.partition_pair_d* } + %struct.phi_arg_d = type { %struct.tree_node*, bool } + %struct.pointer_set_t = type opaque + %struct.ptr_info_def = type { ubyte, %struct.bitmap_head_def*, %struct.tree_node* } + %struct.real_value = type opaque + %struct.reg_info_def = type opaque + %struct.reorder_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, int, int, int } + %struct.rtvec_def = type opaque + %struct.rtx_def = type opaque + %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } + %struct.simple_bitmap_def = type { uint, uint, uint, [1 x ulong] } + %struct.ssa_op_iter = type { int, int, int, int, int, int, int, int, int, int, int, int, int, int, %struct.stmt_operands_d*, bool } + %struct.stmt_ann_d = type { %struct.tree_ann_common_d, ubyte, %struct.basic_block_def*, %struct.stmt_operands_d, %struct.dataflow_d*, %struct.bitmap_head_def*, uint } + %struct.stmt_operands_d = type { %struct.def_optype_d*, %struct.def_optype_d*, %struct.v_may_def_optype_d*, %struct.vuse_optype_d*, %struct.v_may_def_optype_d* } + %struct.temp_slot = type opaque + %struct.tree_ann_common_d = type { uint, sbyte*, %struct.tree_node* } + %struct.tree_ann_d = type { %struct.stmt_ann_d } + %struct.tree_binfo = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.VEC_tree*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.VEC_tree } + %struct.tree_block = type { %struct.tree_common, ubyte, [3 x ubyte], %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node* } + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %struct.tree_ann_d*, ubyte, ubyte, ubyte, ubyte, ubyte } + %struct.tree_complex = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, uint, %struct.tree_node*, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, uint, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, int, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, long, %struct.lang_decl* } + %struct.tree_decl_u1 = type { long } + %struct.tree_decl_u1_a = type { uint } + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_exp = type { %struct.tree_common, %struct.location_t*, int, %struct.tree_node*, [1 x %struct.tree_node*] } + %struct.tree_identifier = type { %struct.tree_common, %struct.ht_identifier } + %struct.tree_int_cst = type { %struct.tree_common, %struct.tree_int_cst_lowhi } + %struct.tree_int_cst_lowhi = type { ulong, long } + %struct.tree_list = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } + %struct.tree_live_info_d = type { %struct._var_map*, %struct.bitmap_head_def*, %struct.bitmap_head_def**, int, %struct.bitmap_head_def** } + %struct.tree_node = type { %struct.tree_decl } + %struct.tree_partition_associator_d = type { %struct.varray_head_tag*, %struct.varray_head_tag*, int*, int*, int, int, %struct._var_map* } + %struct.tree_phi_node = type { %struct.tree_common, %struct.tree_node*, int, int, int, %struct.basic_block_def*, %struct.dataflow_d*, [1 x %struct.phi_arg_d] } + %struct.tree_real_cst = type { %struct.tree_common, %struct.real_value* } + %struct.tree_ssa_name = type { %struct.tree_common, %struct.tree_node*, uint, %struct.ptr_info_def*, %struct.tree_node*, sbyte* } + %struct.tree_statement_list = type { %struct.tree_common, %struct.tree_statement_list_node*, %struct.tree_statement_list_node* } + %struct.tree_statement_list_node = type { %struct.tree_statement_list_node*, %struct.tree_statement_list_node*, %struct.tree_node* } + %struct.tree_stmt_iterator = type { %struct.tree_statement_list_node*, %struct.tree_node* } + %struct.tree_string = type { %struct.tree_common, int, [1 x sbyte] } + %struct.tree_type = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, uint, ushort, ubyte, ubyte, uint, %struct.tree_node*, %struct.tree_node*, %struct.tree_type_symtab, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, long, %struct.lang_type* } + %struct.tree_type_symtab = type { int } + %struct.tree_value_handle = type { %struct.tree_common, %struct.value_set*, uint } + %struct.tree_vec = type { %struct.tree_common, int, [1 x %struct.tree_node*] } + %struct.tree_vector = type { %struct.tree_common, %struct.tree_node* } + %struct.use_operand_ptr = type { %struct.tree_node** } + %struct.use_optype_d = type { uint, [1 x %struct.def_operand_ptr] } + %struct.v_def_use_operand_type_t = type { %struct.tree_node*, %struct.tree_node* } + %struct.v_may_def_optype_d = type { uint, [1 x %struct.v_def_use_operand_type_t] } + %struct.v_must_def_optype_d = type { uint, [1 x %struct.v_def_use_operand_type_t] } + %struct.value_set = type opaque + %struct.var_ann_d = type { %struct.tree_ann_common_d, ubyte, ubyte, %struct.tree_node*, %struct.varray_head_tag*, uint, uint, uint, %struct.tree_node*, %struct.tree_node* } + %struct.var_refs_queue = type { %struct.rtx_def*, uint, int, %struct.var_refs_queue* } + %struct.varasm_status = type opaque + %struct.varray_data = type { [1 x long] } + %struct.varray_head_tag = type { uint, uint, uint, sbyte*, %struct.varray_data } + %struct.vuse_optype_d = type { uint, [1 x %struct.tree_node*] } +%basic_block_info = external global %struct.varray_head_tag* ; <%struct.varray_head_tag**> [#uses=1] + +implementation ; Functions: + + +void %calculate_live_on_entry_cond_true3632(%struct.varray_head_tag* %stack3023.6, uint* %tmp3629, %struct.VEC_edge*** %tmp3397.out) { +newFuncRoot: + br label %cond_true3632 + +bb3502.exitStub: ; preds = %cond_true3632 + store %struct.VEC_edge** %tmp3397, %struct.VEC_edge*** %tmp3397.out + ret void + +cond_true3632: ; preds = %newFuncRoot + %tmp3378 = load uint* %tmp3629 ; <uint> [#uses=1] + %tmp3379 = add uint %tmp3378, 4294967295 ; <uint> [#uses=1] + %tmp3381 = getelementptr %struct.varray_head_tag* %stack3023.6, int 0, uint 4 ; <%struct.varray_data*> [#uses=1] + %tmp3382 = cast %struct.varray_data* %tmp3381 to [1 x int]* ; <[1 x int]*> [#uses=1] + %tmp3383 = getelementptr [1 x int]* %tmp3382, int 0, uint %tmp3379 ; <int*> [#uses=1] + %tmp3384 = load int* %tmp3383 ; <int> [#uses=1] + %tmp3387 = load uint* %tmp3629 ; <uint> [#uses=1] + %tmp3388 = add uint %tmp3387, 4294967295 ; <uint> [#uses=1] + store uint %tmp3388, uint* %tmp3629 + %tmp3391 = load %struct.varray_head_tag** %basic_block_info ; <%struct.varray_head_tag*> [#uses=1] + %tmp3393 = getelementptr %struct.varray_head_tag* %tmp3391, int 0, uint 4 ; <%struct.varray_data*> [#uses=1] + %tmp3394 = cast %struct.varray_data* %tmp3393 to [1 x %struct.basic_block_def*]* ; <[1 x %struct.basic_block_def*]*> [#uses=1] + %tmp3395 = getelementptr [1 x %struct.basic_block_def*]* %tmp3394, int 0, int %tmp3384 ; <%struct.basic_block_def**> [#uses=1] + %tmp3396 = load %struct.basic_block_def** %tmp3395 ; <%struct.basic_block_def*> [#uses=1] + %tmp3397 = getelementptr %struct.basic_block_def* %tmp3396, int 0, uint 3 ; <%struct.VEC_edge**> [#uses=1] + br label %bb3502.exitStub +} diff --git a/llvm/test/CodeGen/X86/2006-10-02-BoolRetCrash.ll b/llvm/test/CodeGen/X86/2006-10-02-BoolRetCrash.ll new file mode 100644 index 00000000000..c918ef93129 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-02-BoolRetCrash.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc && +; RUN: llvm-upgrade < %s | llvm-as | llc -enable-x86-fastcc +; PR933 + +fastcc bool %test() { + ret bool true +} diff --git a/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll b/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll new file mode 100644 index 00000000000..d8b2defea88 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll @@ -0,0 +1,17 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=sse | grep movaps +; Test that the load is NOT folded into the intrinsic, which would zero the top +; elts of the loaded vector. + +target endian = little +target pointersize = 32 +target triple = "i686-apple-darwin8.7.2" + +implementation ; Functions: + +<4 x float> %test(<4 x float> %A, <4 x float>* %B) { + %BV = load <4 x float>* %B + %tmp28 = tail call <4 x float> %llvm.x86.sse.sub.ss( <4 x float> %A, <4 x float> %BV) + ret <4 x float> %tmp28 +} + +declare <4 x float> %llvm.x86.sse.sub.ss(<4 x float>, <4 x float>) diff --git a/llvm/test/CodeGen/X86/2006-10-09-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-10-09-CycleInDAG.ll new file mode 100644 index 00000000000..fbcc5cd078e --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-09-CycleInDAG.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +void %_ZN13QFSFileEngine4readEPcx() { + %tmp201 = load int* null + %tmp201 = cast int %tmp201 to long + %tmp202 = load long* null + %tmp203 = add long %tmp201, %tmp202 + store long %tmp203, long* null + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll b/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll new file mode 100644 index 00000000000..8baba8118c5 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll @@ -0,0 +1,31 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep shrl +; Bug in FindModifiedNodeSlot cause tmp14 load to become a zextload and shr 31 +; is then optimized away. + +%tree_code_type = external global [0 x uint] + +void %copy_if_shared_r() { + %tmp = load uint* null + %tmp56 = and uint %tmp, 255 + %tmp8 = getelementptr [0 x uint]* %tree_code_type, int 0, uint %tmp56 + %tmp9 = load uint* %tmp8 + %tmp10 = add uint %tmp9, 4294967295 + %tmp = setgt uint %tmp10, 2 + %tmp14 = load uint* null + %tmp15 = shr uint %tmp14, ubyte 31 + %tmp15 = cast uint %tmp15 to ubyte + %tmp16 = setne ubyte %tmp15, 0 + br bool %tmp, label %cond_false25, label %cond_true + +cond_true: + br bool %tmp16, label %cond_true17, label %cond_false + +cond_true17: + ret void + +cond_false: + ret void + +cond_false25: + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-10-12-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-10-12-CycleInDAG.ll new file mode 100644 index 00000000000..b96ec98fcc3 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-12-CycleInDAG.ll @@ -0,0 +1,41 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + %struct.function = type opaque + %struct.lang_decl = type opaque + %struct.location_t = type { sbyte*, int } + %struct.rtx_def = type opaque + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, ubyte, ubyte, ubyte, ubyte, ubyte } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, uint, %struct.tree_node*, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, uint, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, int, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, long, %struct.lang_decl* } + %struct.tree_decl_u1 = type { long } + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_node = type { %struct.tree_decl } + %union.tree_ann_d = type opaque + +void %check_format_arg() { + br bool false, label %cond_next196, label %bb12.preheader + +bb12.preheader: + ret void + +cond_next196: + br bool false, label %cond_next330, label %cond_true304 + +cond_true304: + ret void + +cond_next330: + br bool false, label %cond_next472, label %bb441 + +bb441: + ret void + +cond_next472: + %tmp490 = load %struct.tree_node** null + %tmp492 = getelementptr %struct.tree_node* %tmp490, int 0, uint 0, uint 0, uint 3 + %tmp492 = cast ubyte* %tmp492 to uint* + %tmp493 = load uint* %tmp492 + %tmp495 = cast uint %tmp493 to ubyte + %tmp496 = seteq ubyte %tmp495, 11 + %tmp496 = cast bool %tmp496 to sbyte + store sbyte %tmp496, sbyte* null + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll new file mode 100644 index 00000000000..c2b43fb7012 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +%str = external global [18 x sbyte] + +void %test() { +bb.i: + %tmp.i660 = load <4 x float>* null + call void (int, ...)* %printf( int 0, sbyte* getelementptr ([18 x sbyte]* %str, int 0, uint 0), double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00 ) + %tmp152.i = load <4 x uint>* null + %tmp156.i = cast <4 x uint> %tmp152.i to <4 x int> + %tmp175.i = cast <4 x float> %tmp.i660 to <4 x int> + %tmp176.i = xor <4 x int> %tmp156.i, < int -1, int -1, int -1, int -1 > + %tmp177.i = and <4 x int> %tmp176.i, %tmp175.i + %tmp190.i = or <4 x int> %tmp177.i, zeroinitializer + %tmp191.i = cast <4 x int> %tmp190.i to <4 x float> + store <4 x float> %tmp191.i, <4 x float>* null + ret void +} + +declare void %printf(int, ...) diff --git a/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll b/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll new file mode 100644 index 00000000000..5103679cccd --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll @@ -0,0 +1,27 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | %prcontext je 1 | grep "BB1_4:" + +%str = internal constant [14 x sbyte] c"Hello world!\0A\00" ; <[14 x sbyte]*> [#uses=1] +%str = internal constant [13 x sbyte] c"Blah world!\0A\00" ; <[13 x sbyte]*> [#uses=1] + +implementation ; Functions: + +int %main(int %argc, sbyte** %argv) { +entry: + switch int %argc, label %UnifiedReturnBlock [ + int 1, label %bb + int 2, label %bb2 + ] + +bb: ; preds = %entry + %tmp1 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([14 x sbyte]* %str, int 0, uint 0) ) ; <int> [#uses=0] + ret int 0 + +bb2: ; preds = %entry + %tmp4 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([13 x sbyte]* %str, int 0, uint 0) ) ; <int> [#uses=0] + ret int 0 + +UnifiedReturnBlock: ; preds = %entry + ret int 0 +} + +declare int %printf(sbyte*, ...) diff --git a/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll b/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll new file mode 100644 index 00000000000..04cca162c4e --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll @@ -0,0 +1,62 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 'subl $4, %esp' + +target triple = "i686-pc-linux-gnu" + +%str = internal constant [9 x sbyte] c"%f+%f*i\0A\00" ; <[9 x sbyte]*> [#uses=1] + +implementation ; Functions: + +int %main() { +entry: + %retval = alloca int, align 4 ; <int*> [#uses=1] + %tmp = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + %tmp1 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + %tmp2 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=3] + %pi = alloca double, align 8 ; <double*> [#uses=2] + %z = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + "alloca point" = cast int 0 to int ; <int> [#uses=0] + store double 0x400921FB54442D18, double* %pi + %tmp = load double* %pi ; <double> [#uses=1] + %real = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; <double*> [#uses=1] + store double 0.000000e+00, double* %real + %real3 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; <double*> [#uses=1] + store double %tmp, double* %real3 + %tmp = getelementptr { double, double }* %tmp, uint 0, uint 0 ; <double*> [#uses=1] + %tmp4 = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; <double*> [#uses=1] + %tmp5 = load double* %tmp4 ; <double> [#uses=1] + store double %tmp5, double* %tmp + %tmp6 = getelementptr { double, double }* %tmp, uint 0, uint 1 ; <double*> [#uses=1] + %tmp7 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; <double*> [#uses=1] + %tmp8 = load double* %tmp7 ; <double> [#uses=1] + store double %tmp8, double* %tmp6 + %tmp = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] + %tmp = getelementptr { long, long }* %tmp, uint 0, uint 0 ; <long*> [#uses=1] + %tmp = load long* %tmp ; <long> [#uses=1] + %tmp9 = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] + %tmp10 = getelementptr { long, long }* %tmp9, uint 0, uint 1 ; <long*> [#uses=1] + %tmp11 = load long* %tmp10 ; <long> [#uses=1] + call csretcc void %cexp( { double, double }* %tmp2, long %tmp, long %tmp11 ) + %tmp12 = getelementptr { double, double }* %z, uint 0, uint 0 ; <double*> [#uses=1] + %tmp13 = getelementptr { double, double }* %tmp2, uint 0, uint 0 ; <double*> [#uses=1] + %tmp14 = load double* %tmp13 ; <double> [#uses=1] + store double %tmp14, double* %tmp12 + %tmp15 = getelementptr { double, double }* %z, uint 0, uint 1 ; <double*> [#uses=1] + %tmp16 = getelementptr { double, double }* %tmp2, uint 0, uint 1 ; <double*> [#uses=1] + %tmp17 = load double* %tmp16 ; <double> [#uses=1] + store double %tmp17, double* %tmp15 + %tmp18 = getelementptr { double, double }* %z, uint 0, uint 1 ; <double*> [#uses=1] + %tmp19 = load double* %tmp18 ; <double> [#uses=1] + %tmp20 = getelementptr { double, double }* %z, uint 0, uint 0 ; <double*> [#uses=1] + %tmp21 = load double* %tmp20 ; <double> [#uses=1] + %tmp = getelementptr [9 x sbyte]* %str, int 0, uint 0 ; <sbyte*> [#uses=1] + %tmp = call int (sbyte*, ...)* %printf( sbyte* %tmp, double %tmp21, double %tmp19 ) ; <int> [#uses=0] + br label %return + +return: ; preds = %entry + %retval = load int* %retval ; <int> [#uses=1] + ret int %retval +} + +declare csretcc void %cexp({ double, double }*, long, long) + +declare int %printf(sbyte*, ...) diff --git a/llvm/test/CodeGen/X86/2006-11-17-IllegalMove.ll b/llvm/test/CodeGen/X86/2006-11-17-IllegalMove.ll new file mode 100644 index 00000000000..98543e56798 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-11-17-IllegalMove.ll @@ -0,0 +1,41 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86-64 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86-64 | not grep 'movb %sil, %ah' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86-64 | grep 'movzbw %al, %ax' + +void %handle_vector_size_attribute() { +entry: + %tmp69 = load uint* null ; <uint> [#uses=1] + switch uint %tmp69, label %bb84 [ + uint 2, label %bb77 + uint 1, label %bb77 + ] + +bb77: ; preds = %entry, %entry + %tmp99 = udiv ulong 0, 0 ; <ulong> [#uses=1] + %tmp = load ubyte* null ; <ubyte> [#uses=1] + %tmp114 = seteq ulong 0, 0 ; <bool> [#uses=1] + br bool %tmp114, label %cond_true115, label %cond_next136 + +bb84: ; preds = %entry + ret void + +cond_true115: ; preds = %bb77 + %tmp118 = load ubyte* null ; <ubyte> [#uses=1] + br bool false, label %cond_next129, label %cond_true120 + +cond_true120: ; preds = %cond_true115 + %tmp127 = udiv ubyte %tmp, %tmp118 ; <ubyte> [#uses=1] + %tmp127 = cast ubyte %tmp127 to ulong ; <ulong> [#uses=1] + br label %cond_next129 + +cond_next129: ; preds = %cond_true120, %cond_true115 + %iftmp.30.0 = phi ulong [ %tmp127, %cond_true120 ], [ 0, %cond_true115 ] ; <ulong> [#uses=1] + %tmp132 = seteq ulong %iftmp.30.0, %tmp99 ; <bool> [#uses=1] + br bool %tmp132, label %cond_false148, label %cond_next136 + +cond_next136: ; preds = %cond_next129, %bb77 + ret void + +cond_false148: ; preds = %cond_next129 + ret void +} diff --git a/llvm/test/CodeGen/X86/2006-11-27-SelectLegalize.ll b/llvm/test/CodeGen/X86/2006-11-27-SelectLegalize.ll new file mode 100644 index 00000000000..5cebff5bacc --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-11-27-SelectLegalize.ll @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep test.*1 +; PR1016 + +int %test(int %A, int %B, int %C) { + %a = trunc int %A to bool + %D = select bool %a, int %B, int %C + ret int %D +} diff --git a/llvm/test/CodeGen/X86/2006-11-28-Memcpy.ll b/llvm/test/CodeGen/X86/2006-11-28-Memcpy.ll new file mode 100644 index 00000000000..b53c6a37667 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-11-28-Memcpy.ll @@ -0,0 +1,34 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 3721182122 | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep -E 'movl _?bytes2' | wc -l | grep 1 +; PR1022, 1023 + +%fmt = constant [4 x sbyte] c"%x\0A\00" +%bytes = constant [4 x sbyte] c"\AA\BB\CC\DD" +%bytes2 = global [4 x sbyte] c"\AA\BB\CC\DD" + + +int %test1() { + %y = alloca uint + %c = cast uint* %y to sbyte* + %z = getelementptr [4 x sbyte]* %bytes, int 0, int 0 + call void %llvm.memcpy.i32( sbyte* %c, sbyte* %z, uint 4, uint 1 ) + %r = load uint* %y + %t = cast [4 x sbyte]* %fmt to sbyte* + %tmp = call int (sbyte*, ...)* %printf( sbyte* %t, uint %r ) + ret int 0 +} + +void %test2() { + %y = alloca uint + %c = cast uint* %y to sbyte* + %z = getelementptr [4 x sbyte]* %bytes2, int 0, int 0 + call void %llvm.memcpy.i32( sbyte* %c, sbyte* %z, uint 4, uint 1 ) + %r = load uint* %y + %t = cast [4 x sbyte]* %fmt to sbyte* + %tmp = call int (sbyte*, ...)* %printf( sbyte* %t, uint %r ) + ret void +} + +declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint) +declare int %printf(sbyte*, ...) diff --git a/llvm/test/CodeGen/X86/2006-12-19-IntelSyntax.ll b/llvm/test/CodeGen/X86/2006-12-19-IntelSyntax.ll new file mode 100644 index 00000000000..6985bd0e7a0 --- /dev/null +++ b/llvm/test/CodeGen/X86/2006-12-19-IntelSyntax.ll @@ -0,0 +1,91 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel +; PR1061 + +target datalayout = "e-p:32:32" +target endian = little +target pointersize = 32 +target triple = "i686-pc-linux-gnu" + +implementation ; Functions: + +void %bar(uint %n) { +entry: + switch uint %n, label %bb12 [ + uint 1, label %bb + uint 2, label %bb6 + uint 4, label %bb7 + uint 5, label %bb8 + uint 6, label %bb10 + uint 7, label %bb1 + uint 8, label %bb3 + uint 9, label %bb4 + uint 10, label %bb9 + uint 11, label %bb2 + uint 12, label %bb5 + uint 13, label %bb11 + ] + +bb: ; preds = %entry + call void (...)* %foo1( ) + ret void + +bb1: ; preds = %entry + call void (...)* %foo2( ) + ret void + +bb2: ; preds = %entry + call void (...)* %foo6( ) + ret void + +bb3: ; preds = %entry + call void (...)* %foo3( ) + ret void + +bb4: ; preds = %entry + call void (...)* %foo4( ) + ret void + +bb5: ; preds = %entry + call void (...)* %foo5( ) + ret void + +bb6: ; preds = %entry + call void (...)* %foo1( ) + ret void + +bb7: ; preds = %entry + call void (...)* %foo2( ) + ret void + +bb8: ; preds = %entry + call void (...)* %foo6( ) + ret void + +bb9: ; preds = %entry + call void (...)* %foo3( ) + ret void + +bb10: ; preds = %entry + call void (...)* %foo4( ) + ret void + +bb11: ; preds = %entry + call void (...)* %foo5( ) + ret void + +bb12: ; preds = %entry + call void (...)* %foo6( ) + ret void +} + +declare void %foo1(...) + +declare void %foo2(...) + +declare void %foo6(...) + +declare void %foo3(...) + +declare void %foo4(...) + +declare void %foo5(...) diff --git a/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll b/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll new file mode 100644 index 00000000000..800eec2a431 --- /dev/null +++ b/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | \ +; RUN: %prcontext 'mulss LCPI1_3' 1 | grep mulss | wc -l | grep 1 +; PR1075 + +define float %foo(float %x) { + %tmp1 = mul float %x, 3.000000e+00 + %tmp3 = mul float %x, 5.000000e+00 + %tmp5 = mul float %x, 7.000000e+00 + %tmp7 = mul float %x, 1.100000e+01 + %tmp10 = add float %tmp1, %tmp3 + %tmp12 = add float %tmp10, %tmp5 + %tmp14 = add float %tmp12, %tmp7 + ret float %tmp14 +} diff --git a/llvm/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll b/llvm/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll new file mode 100644 index 00000000000..9a73130a653 --- /dev/null +++ b/llvm/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll @@ -0,0 +1,464 @@ +; RUN: llvm-as < %s | llc -march=x86-64 -sched=none | grep leaq && +; RUN: llvm-as < %s | llc -march=x86-64 -sched=none | not grep ',%rsp)' +; PR1103 + +target datalayout = "e-p:64:64" +target endian = little +target pointersize = 64 +%i6000 = global [128 x i64] zeroinitializer, align 16 + +implementation + +define void %foo(i32* %a0, i32* %a1, i32* %a2, i32* %a3, i32* %a4, i32* %a5) { +b: + %r = load i32* %a0 + %r2 = load i32* %a1 + %r4 = load i32* %a2 + %r6 = load i32* %a3 + %r8 = load i32* %a4 + %r14 = load i32* %a5 + %r = sext i32 %r2 to i64 + %r9 = sext i32 %r to i64 + %r11 = add i64 %r, 0 + %r = icmp slt i64 %r11, 0 + %r12 = select i1 %r, i64 0, i64 %r11 + %r16 = sext i32 %r14 to i64 + %r17 = sext i32 %r8 to i64 + %r18 = sub i64 %r16, 0 + %r19 = add i64 %r18, 0 + %r20 = icmp slt i64 %r19, 0 + %r19h = add i64 %r18, 0 + %r22 = select i1 %r20, i64 1, i64 %r19h + %r23 = mul i64 %r22, 0 + %r23 = trunc i64 %r23 to i32 + %r24 = shl i32 %r23, i8 0 + %r25 = add i32 %r24, 0 + %r = alloca i8, i32 %r25, align 16 + %r28 = getelementptr i8* %r, i32 0 + %r38 = shl i64 %r12, i8 0 + %s2013 = add i64 %r38, 0 + %c22012 = getelementptr i8* %r, i64 %s2013 + %r42 = shl i64 %r12, i8 0 + %s2011 = add i64 %r42, 16 + %c22010 = getelementptr i8* %r, i64 %s2011 + %r50 = add i64 %r16, 0 + %r51 = icmp slt i64 %r50, 0 + %r50sh = shl i64 %r50, i8 0 + %r50j = add i64 %r50sh, 0 + %r54 = select i1 %r51, i64 0, i64 %r50j + %r56 = mul i64 %r54, %r12 + %r28s = add i64 %r56, 16 + %c2 = getelementptr i8* %r, i64 %r28s + %r60 = sub i32 %r2, %r + %r61 = icmp slt i32 %r60, 0 + br i1 %r61, label %a29b, label %b63 +a29b: + %r155 = sub i32 %r6, %r4 + %r156 = icmp slt i32 %r155, 0 + br i1 %r156, label %a109b, label %b158 +b63: + %r66 = sext i32 %r60 to i64 + %r67 = add i64 %r66, 0 + %r76 = mul i64 %r17, 0 + %r82 = add i64 %r76, 0 + %r84 = icmp slt i64 %r67, 0 + br i1 %r84, label %b85, label %a25b +b85: + %e641 = phi i64 [ 0, %b63 ], [ %r129, %a25b ] + %r137 = icmp slt i64 %e641, 0 + br i1 %r137, label %a25b140q, label %a29b +a25b140q: + br label %a25b140 +a25b: + %w1989 = phi i64 [ 0, %b63 ], [ %v1990, %a25b ] + %e642 = shl i64 %w1989, i8 0 + %r129 = add i64 %e642, 0 + %r132 = add i64 %e642, 0 + %r134 = icmp slt i64 %r132, 0 + %v1990 = add i64 %w1989, 0 + br i1 %r134, label %b85, label %a25b +a25b140: + %w1982 = phi i64 [ 0, %a25b140q ], [ %v1983, %a25b140 ] + %r145 = add i64 %r82, 0 + %v1983 = add i64 %w1982, 0 + %u1987 = icmp slt i64 %v1983, 0 + br i1 %u1987, label %a29b, label %a25b140 +b158: + %r161 = sext i32 %r to i64 + %r163 = sext i32 %r4 to i64 + br label %a29b173 +a29b173: + %w1964 = phi i64 [ 0, %b158 ], [ %v1973, %b1606 ] + %b1974 = mul i64 %r163, 0 + %b1975 = add i64 %r161, 0 + %b1976 = mul i64 %w1964, 0 + %b1977 = add i64 %b1976, 0 + %s761 = bitcast i64 %b1977 to i64 + %b1980 = mul i64 %w1964, 0 + %s661 = add i64 %b1980, 0 + br i1 %r61, label %a33b, label %b179 +a33b: + %r328 = icmp slt i32 %r14, 0 + %r335 = or i1 %r328, %r61 + br i1 %r335, label %a50b, label %b341 +b179: + %r182 = sext i32 %r60 to i64 + %r183 = add i64 %r182, 0 + %r187 = icmp slt i64 %r183, 0 + br i1 %r187, label %b188, label %a30b +b188: + %e653 = phi i64 [ 0, %b179 ], [ %r283, %a30b ] + %r291 = icmp slt i64 %e653, 0 + br i1 %r291, label %a30b294q, label %a33b +a30b294q: + br label %a30b294 +a30b: + %w = phi i64 [ 0, %b179 ], [ %v, %a30b ] + %b = shl i64 %w, i8 0 + %r283 = add i64 %b, 0 + %r286 = add i64 %b, 0 + %r288 = icmp slt i64 %r286, 0 + %v = add i64 %w, 0 + br i1 %r288, label %b188, label %a30b +a30b294: + %w1847 = phi i64 [ 0, %a30b294q ], [ %v1848, %a30b294 ] + %v1848 = add i64 %w1847, 0 + %u = icmp slt i64 %v1848, 0 + br i1 %u, label %a33b, label %a30b294 +a50b: + %r814 = add i32 %r14, 0 + %r815 = icmp slt i32 %r814, 0 + %r817 = or i1 %r61, %r815 + br i1 %r817, label %a57b, label %b820 +b341: + %w1874 = phi i64 [ 0, %a33b ], [ %v1880, %b463 ] + %d753 = bitcast i64 %w1874 to i64 + %r343 = add i64 %s661, 0 + %r346 = add i64 %r343, 0 + %r347 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r346 + %r348 = load float* %r347 + %r352 = add i64 %r343, 0 + %r353 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r352 + %r354 = load float* %r353 + %r362 = load float* bitcast ([128 x i64]* %i6000 to float*) + %r363 = add float 0.000000e+00, %r362 + %r370 = load float* bitcast ([128 x i64]* %i6000 to float*) + %r376 = icmp slt i64 %r16, 0 + br i1 %r376, label %b377, label %a35b +b377: + %d753p = phi i64 [ %d753, %b341 ], [ %r411, %a35b ] + %s761p = phi i64 [ %s761, %b341 ], [ 322, %a35b ] + %e784 = phi i64 [ 0, %b341 ], [ %r454, %a35b ] + %s794 = add i64 %d753p, 0 + %r462 = icmp slt i64 %e784, 0 + br i1 %r462, label %a35b465, label %b463 +a35b: + %w1865 = phi i64 [ 0, %b341 ], [ %v1866, %a35b ] + %e785 = shl i64 %w1865, i8 0 + %b1877 = mul i64 %w1865, 0 + %s795 = add i64 %b1877, 0 + %r399 = add float %r354, 0.000000e+00 + %r402 = add float %r370, 0.000000e+00 + %r403 = add float %r348, 0.000000e+00 + %r411 = add i64 %s795, 0 + %r431 = add float %r362, 0.000000e+00 + %r454 = add i64 %e785, 0 + %r457 = add i64 %e785, 0 + %r459 = icmp slt i64 %r457, 0 + %v1866 = add i64 %w1865, 0 + br i1 %r459, label %b377, label %a35b +b463: + %r506 = add i64 %d753, 0 + %r511 = sext i32 %r60 to i64 + %r512 = add i64 %r511, 0 + %r513 = icmp slt i64 %r506, 0 + %v1880 = add i64 %w1874, 0 + br i1 %r513, label %b341, label %b514 +a35b465: + %r469 = add i64 %s794, 0 + br label %b463 +b514: + %r525 = mul i64 %r17, 0 + %r533 = add i64 %r525, 0 + br label %b535 +b535: + %w1855 = phi i64 [ 0, %b514 ], [ %v1856, %b712 ] + %s923 = phi i64 [ 0, %b514 ], [ %r799, %b712 ] + %s933 = phi i64 [ %r533, %b514 ], [ %r795, %b712 ] + %r538 = add i64 %w1855, 0 + %r539 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r538 + %r540 = load float* %r539 + %r551 = load float* bitcast ([128 x i64]* %i6000 to float*) + %r562 = sub i64 %s933, 0 + %r564 = icmp slt i64 %r512, 0 + br i1 %r564, label %b565, label %a45b +b565: + %e944 = phi i64 [ 0, %b535 ], [ %r703, %a45b ] + %r711 = icmp slt i64 %e944, 0 + br i1 %r711, label %a45b714, label %b712 +a45b: + %w1852 = phi i64 [ 0, %b535 ], [ %v1853, %a45b ] + %e945 = shl i64 %w1852, i8 0 + %r609 = add i64 %r562, 0 + %r703 = add i64 %e945, 0 + %r706 = add i64 %e945, 0 + %r708 = icmp slt i64 %r706, 0 + %v1853 = add i64 %w1852, 0 + br i1 %r708, label %b565, label %a45b +b712: + %r795 = add i64 %r, 0 + %r799 = add i64 %s923, 0 + %r802 = add i64 %w1855, 0 + %r807 = icmp slt i64 %r802, 0 + %v1856 = add i64 %w1855, 0 + br i1 %r807, label %b535, label %a50b +a45b714: + %r717 = add i64 %e944, 0 + %r720 = add i64 %r717, 0 + %r721 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r720 + %r722 = load float* %r721 + %r726 = add i64 %r717, 0 + %r727 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r726 + %r728 = load float* %r727 + %r732 = add i64 %r717, 0 + %r733 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r732 + %r734 = load float* %r733 + %r738 = add i64 %r717, 0 + %r739 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r738 + %r740 = load float* %r739 + %r744 = add i64 %r717, 0 + %r745 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r744 + %r746 = load float* %r745 + %r750 = add i64 %r717, 0 + %r751 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r750 + %r752 = load float* %r751 + %r753 = add float %r752, %r746 + %r754 = add float %r728, %r722 + %r755 = add float %r734, %r754 + %r756 = add float %r755, %r740 + %r757 = add float %r753, %r756 + %r759 = add float %r757, %r540 + %r770 = add i64 %r717, 0 + %r771 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r770 + %r772 = load float* %r771 + %r776 = add i64 %r717, 0 + %r777 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r776 + %r778 = load float* %r777 + %r781 = add float %r363, %r772 + %r782 = add float %r781, %r778 + %r783 = add float %r551, %r782 + br label %b712 +a57b: + br i1 %r335, label %a66b, label %b1086 +b820: + %r823 = sext i32 %r2 to i64 + %r834 = sext i32 %r8 to i64 + %r844 = add i64 %r16, 0 + %r846 = sext i32 %r60 to i64 + %r847 = add i64 %r846, 0 + %r851 = load float* bitcast ([128 x i64]* %i6000 to float*) + %r856 = sub i64 %r, 0 + br label %b858 +b858: + %w1891 = phi i64 [ 0, %b820 ], [ %v1892, %b1016 ] + %s1193 = phi i64 [ 0, %b820 ], [ %r1068, %b1016 ] + %b1894 = mul i64 %r834, 0 + %b1896 = shl i64 %r823, i8 0 + %b1902 = mul i64 %w1891, 0 + %s1173 = add i64 %b1902, 0 + %r859 = add i64 %r856, 0 + %r862 = add i64 %w1891, 0 + %r863 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r862 + %r864 = load float* %r863 + %r868 = add i64 %w1891, 0 + %r869 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r868 + %r870 = load float* %r869 + %r873 = sub i64 %r859, 0 + %r876 = sub i64 %s1173, 0 + %r878 = icmp slt i64 %r847, 0 + br i1 %r878, label %b879, label %a53b +b879: + %e1204 = phi i64 [ 0, %b858 ], [ %r1007, %a53b ] + %r1015 = icmp slt i64 %e1204, 0 + br i1 %r1015, label %a53b1019q, label %b1016 +a53b1019q: + %b1888 = sub i64 %r846, 0 + %b1889 = add i64 %b1888, 0 + br label %a53b1019 +a53b: + %w1881 = phi i64 [ 0, %b858 ], [ %v1882, %a53b ] + %e1205 = shl i64 %w1881, i8 0 + %r1007 = add i64 %e1205, 0 + %r1010 = add i64 %e1205, 0 + %r1012 = icmp slt i64 %r1010, 0 + %v1882 = add i64 %w1881, 0 + br i1 %r1012, label %b879, label %a53b +b1016: + %r1068 = add i64 %s1193, 0 + %r1071 = add i64 %w1891, 0 + %r1073 = icmp slt i64 %r1071, %r844 + %v1892 = add i64 %w1891, 0 + br i1 %r1073, label %b858, label %a57b +a53b1019: + %w1885 = phi i64 [ 0, %a53b1019q ], [ %v1886, %a53b1019 ] + %r1022 = add i64 %r876, 0 + %r1024 = bitcast i8* %c2 to float* + %r1025 = add i64 %r1022, 0 + %r1026 = getelementptr float* %r1024, i64 %r1025 + %r1027 = load float* %r1026 + %r1032 = add i64 %r873, 0 + %r1033 = add i64 %r1032, 0 + %r1034 = getelementptr float* %r1024, i64 %r1033 + %r1035 = load float* %r1034 + %r1037 = bitcast i8* %c22010 to float* + %r1040 = getelementptr float* %r1037, i64 %r1025 + %r1044 = add float %r864, %r1035 + %r1046 = add float %r870, %r1027 + %r1047 = add float %r1044, %r1046 + %r1048 = add float %r851, %r1047 + %v1886 = add i64 %w1885, 0 + %u1890 = icmp slt i64 %v1886, %b1889 + br i1 %u1890, label %b1016, label %a53b1019 +a66b: + br i1 %r817, label %a93b, label %b1321 +b1086: + %r1089 = sext i32 %r2 to i64 + %r1090 = add i64 %r, 0 + %r1096 = mul i64 %r9, 0 + %r1101 = sext i32 %r8 to i64 + %r1104 = add i64 %r1096, 0 + %r1108 = sub i64 %r1104, 0 + %r1110 = sext i32 %r60 to i64 + %r1111 = add i64 %r1110, 0 + %r1113 = sext i32 %r14 to i64 + %r1114 = add i64 %r16, 0 + br label %b1117 +b1117: + %w1915 = phi i64 [ 0, %b1086 ], [ %v1957, %b1263 ] + %d1353 = bitcast i64 %w1915 to i64 + %r1120 = add i64 %s661, 0 + %r1121 = add i64 %r1120, 0 + %r1122 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r1121 + %r1123 = load float* %r1122 + %r1132 = bitcast i8* %c22012 to float* + %r1134 = getelementptr float* %r1132, i64 %w1915 + %r1135 = load float* %r1134 + %r1136 = add float %r1123, %r1135 + %r1138 = icmp slt i64 %r1114, 0 + br i1 %r1138, label %b1139, label %a63b +b1139: + %e1364 = phi i64 [ 0, %b1117 ], [ %r1254, %a63b ] + %p1998 = phi i64 [ %s761, %b1117 ], [ %r1216, %a63b ] + %r1108p = phi i64 [ %r1108, %b1117 ], [ %r1219, %a63b ] + %p2004 = phi i64 [ %d1353, %b1117 ], [ %r1090, %a63b ] + %s1374 = phi i64 [ 0, %b1117 ], [ %r1251, %a63b ] + %s1384 = add i64 %r1108p, 0 + %s1394 = add i64 %p1998, 0 + %r1262 = icmp slt i64 %e1364, %r1114 + br i1 %r1262, label %a63b1266q, label %b1263 +a63b1266q: + %b1947 = sub i64 %r1113, 0 + %b1948 = add i64 %b1947, 0 + br label %a63b1266 +a63b: + %w1904 = phi i64 [ 0, %b1117 ], [ %v1905, %a63b ] + %s1375 = phi i64 [ 0, %b1117 ], [ %r1251, %a63b ] + %b1906 = add i64 %r1089, 0 + %b1907 = mul i64 %r1101, 0 + %b1929 = mul i64 %w1904, 0 + %s1395 = add i64 %b1929, 0 + %e1365 = shl i64 %w1904, i8 0 + %r1163 = add i64 %r1090, 0 + %r1167 = add i64 %s1375, 0 + %r1191 = add i64 %r1163, 0 + %r1195 = add i64 %r1167, 0 + %r1216 = add i64 %s1395, 0 + %r1219 = add i64 %r1191, 0 + %r1223 = add i64 %r1195, 0 + %r1251 = add i64 %r1223, 0 + %r1254 = add i64 %e1365, 0 + %r1257 = add i64 %e1365, 0 + %r1259 = icmp slt i64 %r1257, %r1114 + %v1905 = add i64 %w1904, 0 + br i1 %r1259, label %b1139, label %a63b +b1263: + %r1306 = add i64 %d1353, 0 + %r1308 = icmp slt i64 %r1306, %r1111 + %v1957 = add i64 %w1915, 0 + br i1 %r1308, label %b1117, label %a66b +a63b1266: + %w1944 = phi i64 [ 0, %a63b1266q ], [ %v1945, %a63b1266 ] + %s1377 = phi i64 [ %s1374, %a63b1266q ], [ %r1297, %a63b1266 ] + %r1282 = add float %r1136, 0.000000e+00 + %r1297 = add i64 %s1377, 0 + %v1945 = add i64 %w1944, 0 + %u1949 = icmp slt i64 %v1945, %b1948 + br i1 %u1949, label %b1263, label %a63b1266 +a93b: + br i1 %r61, label %b1606, label %a97b +b1321: + %r1331 = mul i64 %r17, 0 + %r1339 = add i64 %r1331, 0 + br label %b1342 +b1342: + %w1960 = phi i64 [ 0, %b1321 ], [ %v1961, %b1582 ] + %s1523 = phi i64 [ %r1339, %b1321 ], [ %r1587, %b1582 ] + %s1563 = phi i64 [ 0, %b1321 ], [ %r1591, %b1582 ] + %d1533 = bitcast i64 %w1960 to i64 + %b1968 = mul i64 %w1960, 0 + %s1543 = add i64 %b1968, 0 + %r1345 = add i64 %s1523, 0 + %r1348 = sub i64 %r1345, 0 + %r1352 = add i64 %s1523, 0 + %r1355 = sub i64 %r1352, 0 + %r1370 = add i64 %d1533, 0 + %r1371 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r1370 + %r1372 = load float* %r1371 + br label %a74b +a74b: + %w1958 = phi i64 [ 0, %b1342 ], [ %v1959, %a74b ] + %r1379 = add i64 %s1543, 0 + %r1403 = add i64 %r1355, 0 + %r1422 = add i64 %r1348, 0 + %r1526 = add float %r1372, 0.000000e+00 + %r1573 = add i64 %w1958, 0 + %r1581 = icmp slt i64 %r1573, 0 + %v1959 = add i64 %w1958, 0 + br i1 %r1581, label %a74b, label %b1582 +b1582: + %r1587 = add i64 %r, 0 + %r1591 = add i64 %s1563, 0 + %r1596 = add i64 %d1533, 0 + %r1601 = icmp slt i64 %r1596, 0 + %v1961 = add i64 %w1960, 0 + br i1 %r1601, label %b1342, label %a93b +b1606: + %r1833 = add i64 %w1964, 0 + %r1840 = icmp slt i64 %r1833, 0 + %v1973 = add i64 %w1964, 0 + br i1 %r1840, label %a29b173, label %a109b +a97b: + %w1970 = phi i64 [ 0, %a93b ], [ %v1971, %a97b ] + %r1613 = add i64 %w1964, 0 + %r1614 = mul i64 %r1613, 0 + %r1622 = add i64 %r1614, 0 + %r1754 = bitcast i8* %r28 to float* + %r1756 = getelementptr float* %r1754, i64 %w1970 + %r1757 = load float* %r1756 + %r1761 = add i64 %r1622, 0 + %r1762 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r1761 + %r1763 = load float* %r1762 + %r1767 = add i64 %r1622, 0 + %r1768 = getelementptr float* bitcast ([128 x i64]* %i6000 to float*), i64 %r1767 + %r1772 = add float %r1763, 0.000000e+00 + %r1773 = add float %r1772, 0.000000e+00 + %r1809 = add float %r1757, 0.000000e+00 + %r1810 = add float %r1773, %r1809 + store float %r1810, float* %r1768 + %r1818 = add i64 %w1970, 0 + %r1826 = icmp slt i64 %r1818, 0 + %v1971 = add i64 %w1970, 0 + br i1 %r1826, label %a97b, label %b1606 +a109b: + ret void +} diff --git a/llvm/test/CodeGen/X86/and-or-fold.ll b/llvm/test/CodeGen/X86/and-or-fold.ll new file mode 100644 index 00000000000..3240bdf25ae --- /dev/null +++ b/llvm/test/CodeGen/X86/and-or-fold.ll @@ -0,0 +1,13 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep and | wc -l | grep 1 + +; The dag combiner should fold together (x&127)|(y&16711680) -> (x|y)&c1 +; in this case. +uint %test6(uint %x, ushort %y) { + %tmp1 = cast ushort %y to uint + %tmp2 = and uint %tmp1, 127 ; <uint> [#uses=1] + %tmp4 = shl uint %x, ubyte 16 ; <uint> [#uses=1] + %tmp5 = and uint %tmp4, 16711680 ; <uint> [#uses=1] + %tmp6 = or uint %tmp2, %tmp5 ; <uint> [#uses=1] + ret uint %tmp6 +} + diff --git a/llvm/test/CodeGen/X86/asm-global-imm.ll b/llvm/test/CodeGen/X86/asm-global-imm.ll new file mode 100644 index 00000000000..aebd4578448 --- /dev/null +++ b/llvm/test/CodeGen/X86/asm-global-imm.ll @@ -0,0 +1,29 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -relocation-model=static | grep 'test1 $_GV' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -relocation-model=static | grep 'test2 _GV' +; PR882 + +target datalayout = "e-p:32:32" +target endian = little +target pointersize = 32 +target triple = "i686-apple-darwin9.0.0d2" +%GV = weak global int 0 ; <int*> [#uses=2] +%str = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=1] + +implementation ; Functions: + +void %foo() { +entry: + tail call void asm sideeffect "test1 $0", "i,~{dirflag},~{fpsr},~{flags}"( int* %GV ) + tail call void asm sideeffect "test2 ${0:c}", "i,~{dirflag},~{fpsr},~{flags}"( int* %GV ) + ret void +} + + +void %unknown_bootoption() { +entry: + call void asm sideeffect "ud2\0A\09.word ${0:c}\0A\09.long ${1:c}\0A", +"i,i,~{dirflag},~{fpsr},~{flags}"( int 235, sbyte* getelementptr ([12 x sbyte]* +%str, int 0, uint 0) ) + ret void +} + diff --git a/llvm/test/CodeGen/X86/bitcast.ll b/llvm/test/CodeGen/X86/bitcast.ll new file mode 100644 index 00000000000..d7c78edb62f --- /dev/null +++ b/llvm/test/CodeGen/X86/bitcast.ll @@ -0,0 +1,24 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86-64 +; PR1033 + +long %test1(double %t) { + %u = bitcast double %t to long + ret long %u +} + +double %test2(long %t) { + %u = bitcast long %t to double + ret double %u +} + +int %test3(float %t) { + %u = bitcast float %t to int + ret int %u +} + +float %test4(int %t) { + %u = bitcast int %t to float + ret float %u +} diff --git a/llvm/test/CodeGen/X86/bswap.ll b/llvm/test/CodeGen/X86/bswap.ll new file mode 100644 index 00000000000..79467e0838b --- /dev/null +++ b/llvm/test/CodeGen/X86/bswap.ll @@ -0,0 +1,23 @@ +; bswap should be constant folded when it is passed a constant argument + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep bswapl | wc -l | grep 3 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | wc -l | grep 1 + +declare ushort %llvm.bswap.i16(ushort) +declare uint %llvm.bswap.i32(uint) +declare ulong %llvm.bswap.i64(ulong) + +ushort %W(ushort %A) { + %Z = call ushort %llvm.bswap.i16(ushort %A) + ret ushort %Z +} + +uint %X(uint %A) { + %Z = call uint %llvm.bswap.i32(uint %A) + ret uint %Z +} + +ulong %Y(ulong %A) { + %Z = call ulong %llvm.bswap.i64(ulong %A) + ret ulong %Z +} diff --git a/llvm/test/CodeGen/X86/cmp-test.ll b/llvm/test/CodeGen/X86/cmp-test.ll new file mode 100644 index 00000000000..7a7ec08d18b --- /dev/null +++ b/llvm/test/CodeGen/X86/cmp-test.ll @@ -0,0 +1,28 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep cmp | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep test | wc -l | grep 1 + +int %f1(int %X, int* %y) { + %tmp = load int* %y + %tmp = seteq int %tmp, 0 + br bool %tmp, label %ReturnBlock, label %cond_true + +cond_true: + ret int 1 + +ReturnBlock: + ret int 0 +} + +int %f2(int %X, int* %y) { + %tmp = load int* %y + %tmp1 = shl int %tmp, ubyte 3 + %tmp1 = seteq int %tmp1, 0 + br bool %tmp1, label %ReturnBlock, label %cond_true + +cond_true: + ret int 1 + +ReturnBlock: + ret int 0 +} diff --git a/llvm/test/CodeGen/X86/commute-two-addr.ll b/llvm/test/CodeGen/X86/commute-two-addr.ll new file mode 100644 index 00000000000..29c22c34a50 --- /dev/null +++ b/llvm/test/CodeGen/X86/commute-two-addr.ll @@ -0,0 +1,24 @@ +; The register allocator can commute two-address instructions to avoid +; insertion of register-register copies. + +; Make sure there are only 3 mov's for each testcase +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep 'mov ' | wc -l | grep 6 + + +target triple = "i686-pc-linux-gnu" + +%G = external global int + +declare void %ext(int) + +int %add_test(int %X, int %Y) { + %Z = add int %X, %Y ;; Last use of Y, but not of X. + store int %Z, int* %G + ret int %X +} + +int %xor_test(int %X, int %Y) { + %Z = xor int %X, %Y ;; Last use of Y, but not of X. + store int %Z, int* %G + ret int %X +} diff --git a/llvm/test/CodeGen/X86/compare-add.ll b/llvm/test/CodeGen/X86/compare-add.ll new file mode 100644 index 00000000000..866e36b17d5 --- /dev/null +++ b/llvm/test/CodeGen/X86/compare-add.ll @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep add +bool %X(int %X) { + %Y = add int %X, 14 + %Z = setne int %Y, 12345 + ret bool %Z +} + diff --git a/llvm/test/CodeGen/X86/compare_folding.llx b/llvm/test/CodeGen/X86/compare_folding.llx new file mode 100644 index 00000000000..652057e9bb7 --- /dev/null +++ b/llvm/test/CodeGen/X86/compare_folding.llx @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah | grep movsd | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah | grep ucomisd +declare bool %llvm.isunordered.f64(double,double) + +bool %test1(double %X, double %Y) { ;; Returns isunordered(X,Y) + %COM = call bool %llvm.isunordered.f64(double %X, double %Y) + ret bool %COM +} diff --git a/llvm/test/CodeGen/X86/darwin-no-dead-strip.ll b/llvm/test/CodeGen/X86/darwin-no-dead-strip.ll new file mode 100644 index 00000000000..8e671ffccdb --- /dev/null +++ b/llvm/test/CodeGen/X86/darwin-no-dead-strip.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc | grep no_dead_strip + +target endian = little +target pointersize = 32 +target triple = "i686-apple-darwin8.7.2" +%x = weak global int 0 ; <int*> [#uses=1] +%llvm.used = appending global [1 x sbyte*] [ sbyte* cast (int* %x to sbyte*) ] diff --git a/llvm/test/CodeGen/X86/dg.exp b/llvm/test/CodeGen/X86/dg.exp new file mode 100644 index 00000000000..142de8a6c8f --- /dev/null +++ b/llvm/test/CodeGen/X86/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm-dg.exp + +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version diff --git a/llvm/test/CodeGen/X86/div_const.ll b/llvm/test/CodeGen/X86/div_const.ll new file mode 100644 index 00000000000..326fd77e51b --- /dev/null +++ b/llvm/test/CodeGen/X86/div_const.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 365384439 + +uint %f9188_mul365384439_shift27(uint %A) { + %tmp1 = div uint %A, 1577682821 ; <uint> [#uses=1] + ret uint %tmp1 +} + diff --git a/llvm/test/CodeGen/X86/extend.ll b/llvm/test/CodeGen/X86/extend.ll new file mode 100644 index 00000000000..fdad7907642 --- /dev/null +++ b/llvm/test/CodeGen/X86/extend.ll @@ -0,0 +1,19 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep movzx | wc -l | grep 1 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep movsx | wc -l | grep 1 + +%G1 = internal global ubyte 0 ; <ubyte*> [#uses=1] +%G2 = internal global sbyte 0 ; <sbyte*> [#uses=1] + +implementation ; Functions: + +short %test1() { ;; one zext + %tmp.0 = load ubyte* %G1 ; <ubyte> [#uses=1] + %tmp.3 = cast ubyte %tmp.0 to short ; <short> [#uses=1] + ret short %tmp.3 +} + +short %test2() { ;; one sext + %tmp.0 = load sbyte* %G2 ; <sbyte> [#uses=1] + %tmp.3 = cast sbyte %tmp.0 to short ; <short> [#uses=1] + ret short %tmp.3 +} diff --git a/llvm/test/CodeGen/X86/extern_weak.ll b/llvm/test/CodeGen/X86/extern_weak.ll new file mode 100644 index 00000000000..853a7133102 --- /dev/null +++ b/llvm/test/CodeGen/X86/extern_weak.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=i686-apple-darwin | grep weak_reference | wc -l | grep 2 + +%Y = global int (sbyte*)* %X +declare extern_weak int %X(sbyte*) + +void %bar() { + tail call void (...)* %foo( ) + ret void +} + +declare extern_weak void %foo(...) diff --git a/llvm/test/CodeGen/X86/fabs.ll b/llvm/test/CodeGen/X86/fabs.ll new file mode 100644 index 00000000000..221f078f0fd --- /dev/null +++ b/llvm/test/CodeGen/X86/fabs.ll @@ -0,0 +1,21 @@ +; Make sure this testcase codegens to the fabs instruction, not a call to fabsf +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3 | grep 'fabs$' | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3 -enable-unsafe-fp-math | grep 'fabs$' | wc -l | grep 2 + +target endian = little +target pointersize = 32 + +declare float %fabsf(float) + +float %test1(float %X) { + %Y = call float %fabsf(float %X) + ret float %Y +} + +double %test2(double %X) { + %Y = setge double %X, -0.0 + %Z = sub double -0.0, %X + %Q = select bool %Y, double %X, double %Z + ret double %Q +} + diff --git a/llvm/test/CodeGen/X86/fast-cc-callee-pops.ll b/llvm/test/CodeGen/X86/fast-cc-callee-pops.ll new file mode 100644 index 00000000000..7d5df801239 --- /dev/null +++ b/llvm/test/CodeGen/X86/fast-cc-callee-pops.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel -enable-x86-fastcc -mcpu=yonah | grep 'ret 28' + +; Check that a fastcc function pops its stack variables before returning. + +fastcc void %func(long %X, long %Y, float %G, double %Z) { + ret void +} diff --git a/llvm/test/CodeGen/X86/fast-cc-merge-stack-adj.ll b/llvm/test/CodeGen/X86/fast-cc-merge-stack-adj.ll new file mode 100644 index 00000000000..e6cd0f0da94 --- /dev/null +++ b/llvm/test/CodeGen/X86/fast-cc-merge-stack-adj.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel -enable-x86-fastcc | grep 'add ESP, 8' + +target triple = "i686-pc-linux-gnu" + +declare fastcc void %func(int *%X, long %Y) + +fastcc void %caller(int, long) { + %X = alloca int + call fastcc void %func(int* %X, long 0) ;; not a tail call + ret void +} diff --git a/llvm/test/CodeGen/X86/fast-cc-pass-in-regs.ll b/llvm/test/CodeGen/X86/fast-cc-pass-in-regs.ll new file mode 100644 index 00000000000..ab6248e1951 --- /dev/null +++ b/llvm/test/CodeGen/X86/fast-cc-pass-in-regs.ll @@ -0,0 +1,16 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel -enable-x86-fastcc | grep 'mov EDX, 1' +; check that fastcc is passing stuff in regs. + +; Argument reg passing is disabled due to regalloc issues. FIXME! +; XFAIL: * + +declare fastcc long %callee(long) + +long %caller() { + %X = call fastcc long %callee(long 4294967299) ;; (1ULL << 32) + 3 + ret long %X +} + +fastcc long %caller2(long %X) { + ret long %X +} diff --git a/llvm/test/CodeGen/X86/fast-cc-tail-call.ll b/llvm/test/CodeGen/X86/fast-cc-tail-call.ll new file mode 100644 index 00000000000..b7799793b21 --- /dev/null +++ b/llvm/test/CodeGen/X86/fast-cc-tail-call.ll @@ -0,0 +1,8 @@ +; XFAIL: * +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel -enable-x86-fastcc | not grep call + +fastcc int %bar(int %X, int(double, int) *%FP) { + %Y = tail call fastcc int %FP(double 0.0, int %X) + ret int %Y +} + diff --git a/llvm/test/CodeGen/X86/fildll.ll b/llvm/test/CodeGen/X86/fildll.ll new file mode 100644 index 00000000000..711eedeaac5 --- /dev/null +++ b/llvm/test/CodeGen/X86/fildll.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att -mattr=-sse2 | grep fildll | wc -l | grep 2 + +fastcc double %sint64_to_fp(long %X) { + %R = cast long %X to double + ret double %R +} + +fastcc double %uint64_to_fp(ulong %X) { + %R = cast ulong %X to double + ret double %R +} diff --git a/llvm/test/CodeGen/X86/fp-immediate-shorten.ll b/llvm/test/CodeGen/X86/fp-immediate-shorten.ll new file mode 100644 index 00000000000..6acc2c2684e --- /dev/null +++ b/llvm/test/CodeGen/X86/fp-immediate-shorten.ll @@ -0,0 +1,5 @@ +;; Test that this FP immediate is stored in the constant pool as a float. + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3 | grep '.long.1123418112' + +double %D() { ret double 123.0 } diff --git a/llvm/test/CodeGen/X86/fp-stack-compare.ll b/llvm/test/CodeGen/X86/fp-stack-compare.ll new file mode 100644 index 00000000000..86286bd20eb --- /dev/null +++ b/llvm/test/CodeGen/X86/fp-stack-compare.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=i386 | grep fucomi.*st.[12] +; PR1012 + +float %foo(float *%col.2.0) { + %tmp = load float* %col.2.0 ; <float> [#uses=3] + %tmp16 = setlt float %tmp, 0.000000e+00 ; <bool> [#uses=1] + %tmp20 = sub float -0.000000e+00, %tmp ; <float> [#uses=1] + %iftmp.2.0 = select bool %tmp16, float %tmp20, float %tmp + ret float %iftmp.2.0 +} + diff --git a/llvm/test/CodeGen/X86/fp_constant_op.llx b/llvm/test/CodeGen/X86/fp_constant_op.llx new file mode 100644 index 00000000000..02c76a84f35 --- /dev/null +++ b/llvm/test/CodeGen/X86/fp_constant_op.llx @@ -0,0 +1,34 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep ST | not grep 'fadd\|fsub\|fdiv\|fmul' + +; Test that the load of the constant is folded into the operation. + +double %test_add(double %P) { + %tmp.1 = add double %P, 0x405EC00000000000 + ret double %tmp.1 +} + +double %test_mul(double %P) { + %tmp.1 = mul double %P, 0x405EC00000000000 + ret double %tmp.1 +} + +double %test_sub(double %P) { + %tmp.1 = sub double %P, 0x405EC00000000000 + ret double %tmp.1 +} + +double %test_subr(double %P) { + %tmp.1 = sub double 0x405EC00000000000, %P + ret double %tmp.1 +} + +double %test_div(double %P) { + %tmp.1 = div double %P, 0x405EC00000000000 + ret double %tmp.1 +} + +double %test_divr(double %P) { + %tmp.1 = div double 0x405EC00000000000, %P + ret double %tmp.1 +} + diff --git a/llvm/test/CodeGen/X86/fp_load_cast_fold.llx b/llvm/test/CodeGen/X86/fp_load_cast_fold.llx new file mode 100644 index 00000000000..b1346958ced --- /dev/null +++ b/llvm/test/CodeGen/X86/fp_load_cast_fold.llx @@ -0,0 +1,17 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep fild | not grep ESP +double %short(short* %P) { + %V = load short* %P + %V2 = cast short %V to double + ret double %V2 +} +double %int(int* %P) { + %V = load int* %P + %V2 = cast int %V to double + ret double %V2 +} +double %long(long* %P) { + %V = load long* %P + %V2 = cast long %V to double + ret double %V2 +} + diff --git a/llvm/test/CodeGen/X86/fp_load_fold.llx b/llvm/test/CodeGen/X86/fp_load_fold.llx new file mode 100644 index 00000000000..c3a00094dac --- /dev/null +++ b/llvm/test/CodeGen/X86/fp_load_fold.llx @@ -0,0 +1,40 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep ST | not grep 'fadd\|fsub\|fdiv\|fmul' + +; Test that the load of the memory location is folded into the operation. + + +double %test_add(double %X, double *%P) { + %Y = load double* %P + %R = add double %X, %Y + ret double %R +} + +double %test_mul(double %X, double *%P) { + %Y = load double* %P + %R = mul double %X, %Y + ret double %R +} + +double %test_sub(double %X, double *%P) { + %Y = load double* %P + %R = sub double %X, %Y + ret double %R +} + +double %test_subr(double %X, double *%P) { + %Y = load double* %P + %R = sub double %Y, %X + ret double %R +} + +double %test_div(double %X, double *%P) { + %Y = load double* %P + %R = div double %X, %Y + ret double %R +} + +double %test_divr(double %X, double *%P) { + %Y = load double* %P + %R = div double %Y, %X + ret double %R +} diff --git a/llvm/test/CodeGen/X86/imul-lea.ll b/llvm/test/CodeGen/X86/imul-lea.ll new file mode 100644 index 00000000000..9d6fd98e33f --- /dev/null +++ b/llvm/test/CodeGen/X86/imul-lea.ll @@ -0,0 +1,8 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep lea + +declare int %foo() +int %test() { + %tmp.0 = tail call int %foo( ) ; <int> [#uses=1] + %tmp.1 = mul int %tmp.0, 9 ; <int> [#uses=1] + ret int %tmp.1 +} diff --git a/llvm/test/CodeGen/X86/inline-asm.ll b/llvm/test/CodeGen/X86/inline-asm.ll new file mode 100644 index 00000000000..1e96efce3e4 --- /dev/null +++ b/llvm/test/CodeGen/X86/inline-asm.ll @@ -0,0 +1,14 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 + +int %test1() { + ; Dest is AX, dest type = i32. + %tmp4 = call int asm sideeffect "FROB $0", "={ax}"() + ret int %tmp4 +} + +void %test2(int %V) { + ; input is AX, in type = i32. + call void asm sideeffect "FROB $0", "{ax}"(int %V) + ret void +} + diff --git a/llvm/test/CodeGen/X86/isnan.llx b/llvm/test/CodeGen/X86/isnan.llx new file mode 100644 index 00000000000..fb02c1f5ddc --- /dev/null +++ b/llvm/test/CodeGen/X86/isnan.llx @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep call +declare bool %llvm.isunordered(double) + +bool %test_isnan(double %X) { + %R = call bool %llvm.isunordered(double %X, double %X) + ret bool %R +} diff --git a/llvm/test/CodeGen/X86/jump_sign.ll b/llvm/test/CodeGen/X86/jump_sign.ll new file mode 100644 index 00000000000..16bd7bc6276 --- /dev/null +++ b/llvm/test/CodeGen/X86/jump_sign.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep jns +int %f(int %X) { +entry: + %tmp1 = add int %X, 1 ; <int> [#uses=1] + %tmp = setlt int %tmp1, 0 ; <bool> [#uses=1] + br bool %tmp, label %cond_true, label %cond_next + +cond_true: ; preds = %entry + %tmp2 = tail call int (...)* %bar( ) ; <int> [#uses=0] + br label %cond_next + +cond_next: ; preds = %entry, %cond_true + %tmp3 = tail call int (...)* %baz( ) ; <int> [#uses=0] + ret int undef +} + +declare int %bar(...) + +declare int %baz(...) + diff --git a/llvm/test/CodeGen/X86/lea-2.ll b/llvm/test/CodeGen/X86/lea-2.ll new file mode 100644 index 00000000000..3bbd146915c --- /dev/null +++ b/llvm/test/CodeGen/X86/lea-2.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep 'lea EAX, DWORD PTR \[... + 4\*... - 5\]' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep add + +int %test1(int %A, int %B) { + %tmp1 = shl int %A, ubyte 2 ; <int> [#uses=1] + %tmp3 = add int %B, -5 ; <int> [#uses=1] + %tmp4 = add int %tmp3, %tmp1 ; <int> [#uses=1] + ret int %tmp4 +} + diff --git a/llvm/test/CodeGen/X86/lea.ll b/llvm/test/CodeGen/X86/lea.ll new file mode 100644 index 00000000000..675376b63f4 --- /dev/null +++ b/llvm/test/CodeGen/X86/lea.ll @@ -0,0 +1,7 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep orl +int %test(int %x) { + %tmp1 = shl int %x, ubyte 3 + %tmp2 = add int %tmp1, 7 + ret int %tmp2 +} diff --git a/llvm/test/CodeGen/X86/loop-hoist.ll b/llvm/test/CodeGen/X86/loop-hoist.ll new file mode 100644 index 00000000000..f85b5f89833 --- /dev/null +++ b/llvm/test/CodeGen/X86/loop-hoist.ll @@ -0,0 +1,29 @@ +; RUN: llvm-upgrade < %s | llvm-as | \ +; RUN: llc -relocation-model=dynamic-no-pic -mtriple=i686-apple-darwin8.7.2 |\ +; RUN: grep L_Arr.non_lazy_ptr && +; RUN: llvm-upgrade < %s | llvm-as | \ +; RUN: llc -relocation-model=dynamic-no-pic -mtriple=i686-apple-darwin8.7.2 |\ +; RUN: %prcontext L_Arr.non_lazy_ptr 1 | grep '4(%esp)' + +%Arr = external global [0 x int] ; <[0 x int]*> [#uses=2] + +implementation ; Functions: + +void %foo(int %N.in) { +entry: + %N = cast int %N.in to uint ; <uint> [#uses=1] + br label %cond_true + +cond_true: ; preds = %cond_true, %entry + %indvar = phi uint [ 0, %entry ], [ %indvar.next, %cond_true ] ; <uint> [#uses=3] + %i.0.0 = cast uint %indvar to int ; <int> [#uses=1] + %tmp = getelementptr [0 x int]* %Arr, int 0, int %i.0.0 + store int %i.0.0, int* %tmp + %indvar.next = add uint %indvar, 1 ; <uint> [#uses=2] + %exitcond = seteq uint %indvar.next, %N ; <bool> [#uses=1] + br bool %exitcond, label %return, label %cond_true + +return: ; preds = %cond_true, %entry + ret void +} + diff --git a/llvm/test/CodeGen/X86/loop-strength-reduce.ll b/llvm/test/CodeGen/X86/loop-strength-reduce.ll new file mode 100644 index 00000000000..b0f576622ba --- /dev/null +++ b/llvm/test/CodeGen/X86/loop-strength-reduce.ll @@ -0,0 +1,28 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 'A(' | wc -l | grep 1 +; +; Make sure the common loop invariant _A(reg) is hoisted up to preheader. + +%A = internal global [16 x [16 x int]] zeroinitializer, align 32 + +void %test(int %row, int %N.in) { +entry: + %N = cast int %N.in to uint + %tmp5 = setgt int %N.in, 0 + br bool %tmp5, label %cond_true, label %return + +cond_true: + %indvar = phi uint [ 0, %entry ], [ %indvar.next, %cond_true ] + %i.0.0 = cast uint %indvar to int + %tmp2 = add int %i.0.0, 1 + %tmp = getelementptr [16 x [16 x int]]* %A, int 0, int %row, int %tmp2 + store int 4, int* %tmp + %tmp5 = add int %i.0.0, 2 + %tmp7 = getelementptr [16 x [16 x int]]* %A, int 0, int %row, int %tmp5 + store int 5, int* %tmp7 + %indvar.next = add uint %indvar, 1 + %exitcond = seteq uint %indvar.next, %N + br bool %exitcond, label %return, label %cond_true + +return: + ret void +} diff --git a/llvm/test/CodeGen/X86/loop-strength-reduce2.ll b/llvm/test/CodeGen/X86/loop-strength-reduce2.ll new file mode 100644 index 00000000000..7ed394427ea --- /dev/null +++ b/llvm/test/CodeGen/X86/loop-strength-reduce2.ll @@ -0,0 +1,29 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=i686-apple-darwin -relocation-model=pic | not grep lea +; +; Make sure the PIC label flags2-"L1$pb" is not moved up to the preheader. + +%flags2 = internal global [8193 x sbyte] zeroinitializer, align 32 + +void %test(int %k, int %i) { +entry: + %i = bitcast int %i to uint + %k_addr.012 = shl int %i, ubyte 1 + %tmp14 = setgt int %k_addr.012, 8192 + br bool %tmp14, label %return, label %bb + +bb: + %indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ] + %tmp. = shl uint %i, ubyte 1 + %tmp.15 = mul uint %indvar, %i + %tmp.16 = add uint %tmp.15, %tmp. + %k_addr.0.0 = bitcast uint %tmp.16 to int + %tmp = getelementptr [8193 x sbyte]* %flags2, int 0, uint %tmp.16 + store sbyte 0, sbyte* %tmp + %k_addr.0 = add int %k_addr.0.0, %i + %tmp = setgt int %k_addr.0, 8192 + %indvar.next = add uint %indvar, 1 + br bool %tmp, label %return, label %bb + +return: + ret void +} diff --git a/llvm/test/CodeGen/X86/mul-shift-reassoc.ll b/llvm/test/CodeGen/X86/mul-shift-reassoc.ll new file mode 100644 index 00000000000..52d188d9430 --- /dev/null +++ b/llvm/test/CodeGen/X86/mul-shift-reassoc.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep lea +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep add + +int %test(int %X, int %Y) { + ; Push the shl through the mul to allow an LEA to be formed, instead + ; of using a shift and add separately. + %tmp.2 = shl int %X, ubyte 1 + %tmp.3 = mul int %tmp.2, %Y + %tmp.5 = add int %tmp.3, %Y + ret int %tmp.5 +} + diff --git a/llvm/test/CodeGen/X86/negatize_zero.ll b/llvm/test/CodeGen/X86/negatize_zero.ll new file mode 100644 index 00000000000..3328a6afec2 --- /dev/null +++ b/llvm/test/CodeGen/X86/negatize_zero.ll @@ -0,0 +1,6 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3 | grep fchs + + +double %T() { + ret double -1.0 ;; codegen as fld1/fchs, not as a load from cst pool +} diff --git a/llvm/test/CodeGen/X86/or-branch.ll b/llvm/test/CodeGen/X86/or-branch.ll new file mode 100644 index 00000000000..62f7455d53c --- /dev/null +++ b/llvm/test/CodeGen/X86/or-branch.ll @@ -0,0 +1,19 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep set + +void %foo(int %X, int %Y, int %Z) { +entry: + %tmp = tail call int (...)* %bar( ) ; <int> [#uses=0] + %tmp = seteq int %X, 0 ; <bool> [#uses=1] + %tmp3 = setlt int %Y, 5 ; <bool> [#uses=1] + %tmp4 = or bool %tmp3, %tmp ; <bool> [#uses=1] + br bool %tmp4, label %cond_true, label %UnifiedReturnBlock + +cond_true: ; preds = %entry + %tmp5 = tail call int (...)* %bar( ) ; <int> [#uses=0] + ret void + +UnifiedReturnBlock: ; preds = %entry + ret void +} + +declare int %bar(...) diff --git a/llvm/test/CodeGen/X86/overlap-add.ll b/llvm/test/CodeGen/X86/overlap-add.ll new file mode 100644 index 00000000000..a7150d21e36 --- /dev/null +++ b/llvm/test/CodeGen/X86/overlap-add.ll @@ -0,0 +1,27 @@ +;; X's live range extends beyond the shift, so the register allocator +;; cannot coalesce it with Y. Because of this, a copy needs to be +;; emitted before the shift to save the register value before it is +;; clobbered. However, this copy is not needed if the register +;; allocator turns the shift into an LEA. This also occurs for ADD. + +; Check that the shift gets turned into an LEA. + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov E.X, E.X' + +; FIXME: We need live variable information about flags to do this xform safely. :( +; XFAIL: * + +%G = external global int + +int %test1(int %X, int %Y) { + %Z = add int %X, %Y + volatile store int %Y, int* %G + volatile store int %Z, int* %G + ret int %X +} + +int %test2(int %X) { + %Z = add int %X, 1 ;; inc + volatile store int %Z, int* %G + ret int %X +} diff --git a/llvm/test/CodeGen/X86/overlap-shift.ll b/llvm/test/CodeGen/X86/overlap-shift.ll new file mode 100644 index 00000000000..14f3546cc16 --- /dev/null +++ b/llvm/test/CodeGen/X86/overlap-shift.ll @@ -0,0 +1,17 @@ +;; X's live range extends beyond the shift, so the register allocator +;; cannot coalesce it with Y. Because of this, a copy needs to be +;; emitted before the shift to save the register value before it is +;; clobbered. However, this copy is not needed if the register +;; allocator turns the shift into an LEA. This also occurs for ADD. + +; Check that the shift gets turned into an LEA. + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov E.X, E.X' + +%G = external global int + +int %test1(int %X) { + %Z = shl int %X, ubyte 2 + volatile store int %Z, int* %G + ret int %X +} diff --git a/llvm/test/CodeGen/X86/packed_struct.ll b/llvm/test/CodeGen/X86/packed_struct.ll new file mode 100644 index 00000000000..172d0812b9a --- /dev/null +++ b/llvm/test/CodeGen/X86/packed_struct.ll @@ -0,0 +1,38 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep "foos+5" && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep "foos+1" && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep "foos+9" && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep "bara+19" && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep "bara+4" + +; make sure we compute the correct offset for a packed structure + +;Note: codegen for this could change rendering the above checks wrong + +; ModuleID = 'foo.c' +target datalayout = "e-p:32:32" +target endian = little +target pointersize = 32 +target triple = "i686-pc-linux-gnu" + %struct.anon = type <{ sbyte, int, int, int }> +%foos = external global %struct.anon +%bara = weak global [4 x <{ int, sbyte }>] zeroinitializer + +implementation ; Functions: + +int %foo() { +entry: + %tmp = load int* getelementptr (%struct.anon* %foos, int 0, uint 1) + %tmp3 = load int* getelementptr (%struct.anon* %foos, int 0, uint 2) + %tmp6 = load int* getelementptr (%struct.anon* %foos, int 0, uint 3) + %tmp4 = add int %tmp3, %tmp + %tmp7 = add int %tmp4, %tmp6 + ret int %tmp7 +} + +sbyte %bar() { +entry: + %tmp = load sbyte* getelementptr([4 x <{ int, sbyte }>]* %bara, int 0, int 0, uint 1 ) + %tmp4 = load sbyte* getelementptr ([4 x <{ int, sbyte }>]* %bara, int 0, int 3, uint 1) + %tmp5 = add sbyte %tmp4, %tmp + ret sbyte %tmp5 +} diff --git a/llvm/test/CodeGen/X86/pic_jumptable.ll b/llvm/test/CodeGen/X86/pic_jumptable.ll new file mode 100644 index 00000000000..4c38fb80614 --- /dev/null +++ b/llvm/test/CodeGen/X86/pic_jumptable.ll @@ -0,0 +1,79 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -relocation-model=pic -march=x86 | not grep -F .text +target endian = little +target pointersize = 32 +target triple = "i386-linux-gnu" + +implementation ; Functions: + +declare void %_Z3bari( int ) + +linkonce void %_Z3fooILi1EEvi(int %Y) { +entry: + %Y_addr = alloca int ; <int*> [#uses=2] + "alloca point" = cast int 0 to int ; <int> [#uses=0] + store int %Y, int* %Y_addr + %tmp = load int* %Y_addr ; <int> [#uses=1] + switch int %tmp, label %bb10 [ + int 0, label %bb3 + int 1, label %bb + int 2, label %bb + int 3, label %bb + int 4, label %bb + int 5, label %bb + int 6, label %bb + int 7, label %bb + int 8, label %bb + int 9, label %bb + int 10, label %bb + int 12, label %bb1 + int 13, label %bb5 + int 14, label %bb6 + int 16, label %bb2 + int 17, label %bb4 + int 23, label %bb8 + int 27, label %bb7 + int 34, label %bb9 + ] + +bb: ; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry + br label %bb1 + +bb1: ; preds = %bb, %entry + br label %bb2 + +bb2: ; preds = %bb1, %entry + call void %_Z3bari( int 1 ) + br label %bb11 + +bb3: ; preds = %entry + br label %bb4 + +bb4: ; preds = %bb3, %entry + br label %bb5 + +bb5: ; preds = %bb4, %entry + br label %bb6 + +bb6: ; preds = %bb5, %entry + call void %_Z3bari( int 2 ) + br label %bb11 + +bb7: ; preds = %entry + br label %bb8 + +bb8: ; preds = %bb7, %entry + br label %bb9 + +bb9: ; preds = %bb8, %entry + call void %_Z3bari( int 3 ) + br label %bb11 + +bb10: ; preds = %entry + br label %bb11 + +bb11: ; preds = %bb10, %bb9, %bb6, %bb2 + br label %return + +return: ; preds = %bb11 + ret void +} diff --git a/llvm/test/CodeGen/X86/rdtsc.ll b/llvm/test/CodeGen/X86/rdtsc.ll new file mode 100644 index 00000000000..1473c775880 --- /dev/null +++ b/llvm/test/CodeGen/X86/rdtsc.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rdtsc && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86-64 | grep rdtsc + +declare ulong %llvm.readcyclecounter() + +ulong %foo() { +%tmp.1 = call ulong %llvm.readcyclecounter () +ret ulong %tmp.1 +} + diff --git a/llvm/test/CodeGen/X86/regpressure.ll b/llvm/test/CodeGen/X86/regpressure.ll new file mode 100644 index 00000000000..c3c681c30c7 --- /dev/null +++ b/llvm/test/CodeGen/X86/regpressure.ll @@ -0,0 +1,117 @@ +;; Both functions in this testcase should codegen to the same function, and +;; neither of them should require spilling anything to the stack. + +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats 2>&1 | not grep 'Number of register spills' + +;; This can be compiled to use three registers if the loads are not +;; folded into the multiplies, 2 registers otherwise. +int %regpressure1(int* %P) { + %A = load int* %P + %Bp = getelementptr int* %P, int 1 + %B = load int* %Bp + %s1 = mul int %A, %B + %Cp = getelementptr int* %P, int 2 + %C = load int* %Cp + %s2 = mul int %s1, %C + %Dp = getelementptr int* %P, int 3 + %D = load int* %Dp + %s3 = mul int %s2, %D + %Ep = getelementptr int* %P, int 4 + %E = load int* %Ep + %s4 = mul int %s3, %E + %Fp = getelementptr int* %P, int 5 + %F = load int* %Fp + %s5 = mul int %s4, %F + %Gp = getelementptr int* %P, int 6 + %G = load int* %Gp + %s6 = mul int %s5, %G + %Hp = getelementptr int* %P, int 7 + %H = load int* %Hp + %s7 = mul int %s6, %H + %Ip = getelementptr int* %P, int 8 + %I = load int* %Ip + %s8 = mul int %s7, %I + %Jp = getelementptr int* %P, int 9 + %J = load int* %Jp + %s9 = mul int %s8, %J + ret int %s9 +} + +;; This testcase should produce identical code to the test above. +int %regpressure2(int* %P) { + %A = load int* %P + %Bp = getelementptr int* %P, int 1 + %B = load int* %Bp + %Cp = getelementptr int* %P, int 2 + %C = load int* %Cp + %Dp = getelementptr int* %P, int 3 + %D = load int* %Dp + %Ep = getelementptr int* %P, int 4 + %E = load int* %Ep + %Fp = getelementptr int* %P, int 5 + %F = load int* %Fp + %Gp = getelementptr int* %P, int 6 + %G = load int* %Gp + %Hp = getelementptr int* %P, int 7 + %H = load int* %Hp + %Ip = getelementptr int* %P, int 8 + %I = load int* %Ip + %Jp = getelementptr int* %P, int 9 + %J = load int* %Jp + %s1 = mul int %A, %B + %s2 = mul int %s1, %C + %s3 = mul int %s2, %D + %s4 = mul int %s3, %E + %s5 = mul int %s4, %F + %s6 = mul int %s5, %G + %s7 = mul int %s6, %H + %s8 = mul int %s7, %I + %s9 = mul int %s8, %J + ret int %s9 +} + +;; adds should be the same as muls. +int %regpressure3(short* %P, bool %Cond, int* %Other) { + %A = load short* %P + %Bp = getelementptr short* %P, int 1 + %B = load short* %Bp + %Cp = getelementptr short* %P, int 2 + %C = load short* %Cp + %Dp = getelementptr short* %P, int 3 + %D = load short* %Dp + %Ep = getelementptr short* %P, int 4 + %E = load short* %Ep + %Fp = getelementptr short* %P, int 5 + %F = load short* %Fp + %Gp = getelementptr short* %P, int 6 + %G = load short* %Gp + %Hp = getelementptr short* %P, int 7 + %H = load short* %Hp + %Ip = getelementptr short* %P, int 8 + %I = load short* %Ip + %Jp = getelementptr short* %P, int 9 + %J = load short* %Jp + + ;; These casts prevent folding the loads into the adds. + %A = cast short %A to int + %B = cast short %B to int + %D = cast short %D to int + %C = cast short %C to int + %E = cast short %E to int + %F = cast short %F to int + %G = cast short %G to int + %H = cast short %H to int + %I = cast short %I to int + %J = cast short %J to int + %s1 = add int %A, %B + %s2 = add int %C, %s1 + %s3 = add int %D, %s2 + %s4 = add int %E, %s3 + %s5 = add int %F, %s4 + %s6 = add int %G, %s5 + %s7 = add int %H, %s6 + %s8 = add int %I, %s7 + %s9 = add int %J, %s8 + ret int %s9 +} + diff --git a/llvm/test/CodeGen/X86/rem.ll b/llvm/test/CodeGen/X86/rem.ll new file mode 100644 index 00000000000..209f831fc80 --- /dev/null +++ b/llvm/test/CodeGen/X86/rem.ll @@ -0,0 +1,23 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep div + +int %test1(int %X) { + %tmp1 = rem int %X, 255 + ret int %tmp1 +} + +int %test2(int %X) { + %tmp1 = rem int %X, 256 + ret int %tmp1 +} + +uint %test3(uint %X) { + %tmp1 = rem uint %X, 255 + ret uint %tmp1 +} + +uint %test4(uint %X) { + %tmp1 = rem uint %X, 256 ; just an and + ret uint %tmp1 +} + diff --git a/llvm/test/CodeGen/X86/rotate.ll b/llvm/test/CodeGen/X86/rotate.ll new file mode 100644 index 00000000000..acd22f5aef4 --- /dev/null +++ b/llvm/test/CodeGen/X86/rotate.ll @@ -0,0 +1,91 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep ro[rl] | wc -l | grep 12 + +uint %rotl32(uint %A, ubyte %Amt) { + %B = shl uint %A, ubyte %Amt + %Amt2 = sub ubyte 32, %Amt + %C = shr uint %A, ubyte %Amt2 + %D = or uint %B, %C + ret uint %D +} + +uint %rotr32(uint %A, ubyte %Amt) { + %B = shr uint %A, ubyte %Amt + %Amt2 = sub ubyte 32, %Amt + %C = shl uint %A, ubyte %Amt2 + %D = or uint %B, %C + ret uint %D +} + +uint %rotli32(uint %A) { + %B = shl uint %A, ubyte 5 + %C = shr uint %A, ubyte 27 + %D = or uint %B, %C + ret uint %D +} + +uint %rotri32(uint %A) { + %B = shr uint %A, ubyte 5 + %C = shl uint %A, ubyte 27 + %D = or uint %B, %C + ret uint %D +} + +ushort %rotl16(ushort %A, ubyte %Amt) { + %B = shl ushort %A, ubyte %Amt + %Amt2 = sub ubyte 16, %Amt + %C = shr ushort %A, ubyte %Amt2 + %D = or ushort %B, %C + ret ushort %D +} + +ushort %rotr16(ushort %A, ubyte %Amt) { + %B = shr ushort %A, ubyte %Amt + %Amt2 = sub ubyte 16, %Amt + %C = shl ushort %A, ubyte %Amt2 + %D = or ushort %B, %C + ret ushort %D +} + +ushort %rotli16(ushort %A) { + %B = shl ushort %A, ubyte 5 + %C = shr ushort %A, ubyte 11 + %D = or ushort %B, %C + ret ushort %D +} + +ushort %rotri16(ushort %A) { + %B = shr ushort %A, ubyte 5 + %C = shl ushort %A, ubyte 11 + %D = or ushort %B, %C + ret ushort %D +} + +ubyte %rotl8(ubyte %A, ubyte %Amt) { + %B = shl ubyte %A, ubyte %Amt + %Amt2 = sub ubyte 8, %Amt + %C = shr ubyte %A, ubyte %Amt2 + %D = or ubyte %B, %C + ret ubyte %D +} + +ubyte %rotr8(ubyte %A, ubyte %Amt) { + %B = shr ubyte %A, ubyte %Amt + %Amt2 = sub ubyte 8, %Amt + %C = shl ubyte %A, ubyte %Amt2 + %D = or ubyte %B, %C + ret ubyte %D +} + +ubyte %rotli8(ubyte %A) { + %B = shl ubyte %A, ubyte 5 + %C = shr ubyte %A, ubyte 3 + %D = or ubyte %B, %C + ret ubyte %D +} + +ubyte %rotri8(ubyte %A) { + %B = shr ubyte %A, ubyte 5 + %C = shl ubyte %A, ubyte 3 + %D = or ubyte %B, %C + ret ubyte %D +} diff --git a/llvm/test/CodeGen/X86/scalar_sse_minmax.ll b/llvm/test/CodeGen/X86/scalar_sse_minmax.ll new file mode 100644 index 00000000000..83401667edf --- /dev/null +++ b/llvm/test/CodeGen/X86/scalar_sse_minmax.ll @@ -0,0 +1,42 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse1,+sse2 | grep mins | wc -l | grep 3 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse1,+sse2 | grep maxs | wc -l | grep 2 + +declare bool %llvm.isunordered.f64( double %x, double %y ) +declare bool %llvm.isunordered.f32( float %x, float %y ) + +implementation + +float %min1(float %x, float %y) { + %tmp = setlt float %x, %y ; <bool> [#uses=1] + %retval = select bool %tmp, float %x, float %y ; <float> [#uses=1] + ret float %retval +} +double %min2(double %x, double %y) { + %tmp = setlt double %x, %y + %retval = select bool %tmp, double %x, double %y + ret double %retval +} + +float %max1(float %x, float %y) { + %tmp = setge float %x, %y ; <bool> [#uses=1] + %tmp2 = tail call bool %llvm.isunordered.f32( float %x, float %y ) + %tmp3 = or bool %tmp2, %tmp ; <bool> [#uses=1] + %retval = select bool %tmp3, float %x, float %y + ret float %retval +} + +double %max2(double %x, double %y) { + %tmp = setge double %x, %y ; <bool> [#uses=1] + %tmp2 = tail call bool %llvm.isunordered.f64( double %x, double %y ) + %tmp3 = or bool %tmp2, %tmp ; <bool> [#uses=1] + %retval = select bool %tmp3, double %x, double %y + ret double %retval +} + +<4 x float> %min3(float %tmp37) { + %tmp375 = insertelement <4 x float> undef, float %tmp37, uint 0 + %tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp375, <4 x float> < float 6.553500e+04, float undef, float undef, float undef > ) + ret <4 x float> %tmp48 +} + +declare <4 x float> %llvm.x86.sse.min.ss(<4 x float>, <4 x float>) diff --git a/llvm/test/CodeGen/X86/select.ll b/llvm/test/CodeGen/X86/select.ll new file mode 100644 index 00000000000..71f4742c08b --- /dev/null +++ b/llvm/test/CodeGen/X86/select.ll @@ -0,0 +1,64 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=pentium + +bool %boolSel(bool %A, bool %B, bool %C) { + %X = select bool %A, bool %B, bool %C + ret bool %X +} + +sbyte %byteSel(bool %A, sbyte %B, sbyte %C) { + %X = select bool %A, sbyte %B, sbyte %C + ret sbyte %X +} + +short %shortSel(bool %A, short %B, short %C) { + %X = select bool %A, short %B, short %C + ret short %X +} + +int %intSel(bool %A, int %B, int %C) { + %X = select bool %A, int %B, int %C + ret int %X +} + +long %longSel(bool %A, long %B, long %C) { + %X = select bool %A, long %B, long %C + ret long %X +} + +double %doubleSel(bool %A, double %B, double %C) { + %X = select bool %A, double %B, double %C + ret double %X +} + +sbyte %foldSel(bool %A, sbyte %B, sbyte %C) { + %Cond = setlt sbyte %B, %C + %X = select bool %Cond, sbyte %B, sbyte %C + ret sbyte %X +} + +int %foldSel2(bool %A, int %B, int %C) { + %Cond = seteq int %B, %C + %X = select bool %Cond, int %B, int %C + ret int %X +} + +int %foldSel2(bool %A, int %B, int %C, double %X, double %Y) { + %Cond = setlt double %X, %Y + %X = select bool %Cond, int %B, int %C + ret int %X +} + +float %foldSel3(bool %A, float %B, float %C, uint %X, uint %Y) { + %Cond = setlt uint %X, %Y + %X = select bool %Cond, float %B, float %C + ret float %X +} + +float %nofoldSel4(bool %A, float %B, float %C, int %X, int %Y) { + ; X86 doesn't have a cmov that reads the right flags for this! + %Cond = setlt int %X, %Y + %X = select bool %Cond, float %B, float %C + ret float %X +} + diff --git a/llvm/test/CodeGen/X86/setuge.ll b/llvm/test/CodeGen/X86/setuge.ll new file mode 100644 index 00000000000..0cdade2710d --- /dev/null +++ b/llvm/test/CodeGen/X86/setuge.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 'set' + +declare bool %llvm.isunordered.f32(float, float) + +float %cmp(float %A, float %B, float %C, float %D) { +entry: + %tmp.1 = call bool %llvm.isunordered.f32(float %A, float %B) + %tmp.2 = setge float %A, %B + %tmp.3 = or bool %tmp.1, %tmp.2 + %tmp.4 = select bool %tmp.3, float %C, float %D + ret float %tmp.4 +} diff --git a/llvm/test/CodeGen/X86/shift-coalesce.ll b/llvm/test/CodeGen/X86/shift-coalesce.ll new file mode 100644 index 00000000000..0945fe13ce3 --- /dev/null +++ b/llvm/test/CodeGen/X86/shift-coalesce.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep 'shld.*CL' && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov CL, BL' + +; PR687 + +ulong %foo(ulong %x, long* %X) { + %tmp.1 = load long* %X ; <long> [#uses=1] + %tmp.3 = cast long %tmp.1 to ubyte ; <ubyte> [#uses=1] + %tmp.4 = shl ulong %x, ubyte %tmp.3 ; <ulong> [#uses=1] + ret ulong %tmp.4 +} diff --git a/llvm/test/CodeGen/X86/shift-double.llx b/llvm/test/CodeGen/X86/shift-double.llx new file mode 100644 index 00000000000..41cf79da4c0 --- /dev/null +++ b/llvm/test/CodeGen/X86/shift-double.llx @@ -0,0 +1,30 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep sh[lr]d | wc -l | grep 5 + +long %test1(long %X, ubyte %C) { + %Y = shl long %X, ubyte %C + ret long %Y +} +long %test2(long %X, ubyte %C) { + %Y = shr long %X, ubyte %C + ret long %Y +} +ulong %test3(ulong %X, ubyte %C) { + %Y = shr ulong %X, ubyte %C + ret ulong %Y +} + +uint %test4(uint %A, uint %B, ubyte %C) { + %X = shl uint %A, ubyte %C + %Cv = sub ubyte 32, %C + %Y = shr uint %B, ubyte %Cv + %Z = or uint %Y, %X + ret uint %Z +} + +ushort %test5(ushort %A, ushort %B, ubyte %C) { + %X = shl ushort %A, ubyte %C + %Cv = sub ubyte 16, %C + %Y = shr ushort %B, ubyte %Cv + %Z = or ushort %Y, %X + ret ushort %Z +} diff --git a/llvm/test/CodeGen/X86/shift-folding.ll b/llvm/test/CodeGen/X86/shift-folding.ll new file mode 100644 index 00000000000..a1ea084201d --- /dev/null +++ b/llvm/test/CodeGen/X86/shift-folding.ll @@ -0,0 +1,19 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep 's[ah][rl]l' | wc -l | grep 1 + +int* %test1(int *%P, uint %X) { + %Y = shr uint %X, ubyte 2 + %P2 = getelementptr int* %P, uint %Y + ret int* %P2 +} + +int* %test2(int *%P, uint %X) { + %Y = shl uint %X, ubyte 2 + %P2 = getelementptr int* %P, uint %Y + ret int* %P2 +} + +int* %test3(int *%P, int %X) { + %Y = shr int %X, ubyte 2 + %P2 = getelementptr int* %P, int %Y + ret int* %P2 +} diff --git a/llvm/test/CodeGen/X86/shift-one.ll b/llvm/test/CodeGen/X86/shift-one.ll new file mode 100644 index 00000000000..a91cbbc5030 --- /dev/null +++ b/llvm/test/CodeGen/X86/shift-one.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 'leal' + +%x = external global int + +int %test() { + %tmp.0 = load int* %x + %tmp.1 = shl int %tmp.0, ubyte 1 + ret int %tmp.1 +} diff --git a/llvm/test/CodeGen/X86/sse-fcopysign.ll b/llvm/test/CodeGen/X86/sse-fcopysign.ll new file mode 100644 index 00000000000..50f6b9a1ccc --- /dev/null +++ b/llvm/test/CodeGen/X86/sse-fcopysign.ll @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not getp test + +define float %test1(float %a, float %b) { + %tmp = tail call float %copysignf( float %b, float %a ) + ret float %tmp +} + +define double %test2(double %a, float %b, float %c) { + %tmp1 = add float %b, %c + %tmp2 = fpext float %tmp1 to double + %tmp = tail call double %copysign( double %a, double %tmp2 ) + ret double %tmp +} + +declare float %copysignf(float, float) +declare double %copysign(double, double) diff --git a/llvm/test/CodeGen/X86/sse-load-ret.ll b/llvm/test/CodeGen/X86/sse-load-ret.ll new file mode 100644 index 00000000000..d5f4d19686b --- /dev/null +++ b/llvm/test/CodeGen/X86/sse-load-ret.ll @@ -0,0 +1,19 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah -enable-x86-sse && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah -enable-x86-sse | not grep movss +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah -enable-x86-sse | not grep xmm + +double %test1(double *%P) { + %X = load double* %P + ret double %X +} + +double %test2() { + ret double 1234.56 +} + +; FIXME: Todo +;double %test3(bool %B) { +; %C = select bool %B, double 123.412, double 523.01123123 +; ret double %C +;} + diff --git a/llvm/test/CodeGen/X86/store-fp-constant.ll b/llvm/test/CodeGen/X86/store-fp-constant.ll new file mode 100644 index 00000000000..679bff8c625 --- /dev/null +++ b/llvm/test/CodeGen/X86/store-fp-constant.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep rodata && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep literal +; +; Check that no FP constants in this testcase ends up in the +; constant pool. +%G = external global float + + +declare void %extfloat(float %F) +declare void %extdouble(double) + +implementation + +void %testfloatstore() { + call void %extfloat(float 1234.4) + call void %extdouble(double 1234.4123) + store float 13.0123, float* %G + ret void +} + diff --git a/llvm/test/CodeGen/X86/store-global-address.ll b/llvm/test/CodeGen/X86/store-global-address.ll new file mode 100644 index 00000000000..77e344d9599 --- /dev/null +++ b/llvm/test/CodeGen/X86/store-global-address.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep movl | wc -l | grep 1 + +%dst = global int 0 +%ptr = global int* null + +void %test() { + store int* %dst, int** %ptr + ret void +} diff --git a/llvm/test/CodeGen/X86/store_op_load_fold.ll b/llvm/test/CodeGen/X86/store_op_load_fold.ll new file mode 100644 index 00000000000..d3ad90984c0 --- /dev/null +++ b/llvm/test/CodeGen/X86/store_op_load_fold.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 'mov' +; +; Test the add and load are folded into the store instruction. + +%X = internal global short 0 + +void %foo() { + %tmp.0 = load short* %X + %tmp.3 = add short %tmp.0, 329 + store short %tmp.3, short* %X + ret void +} diff --git a/llvm/test/CodeGen/X86/store_op_load_fold2.ll b/llvm/test/CodeGen/X86/store_op_load_fold2.ll new file mode 100644 index 00000000000..c7f720ad901 --- /dev/null +++ b/llvm/test/CodeGen/X86/store_op_load_fold2.ll @@ -0,0 +1,42 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | grep 'and DWORD PTR' | wc -l | grep 2 + +target endian = little +target pointersize = 32 + + %struct.Macroblock = type { int, int, int, int, int, [8 x int], %struct.Macroblock*, %struct.Macroblock*, int, [2 x [4 x [4 x [2 x int]]]], [16 x sbyte], [16 x sbyte], int, long, [4 x int], [4 x int], long, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, short, double, int, int, int, int, int, int, int, int, int } + +implementation ; Functions: + +internal fastcc int %dct_chroma(int %uv, int %cr_cbp) { +entry: + br bool true, label %cond_true2732.preheader, label %cond_true129 + +cond_true129: ; preds = %entry + ret int 0 + +cond_true2732.preheader: ; preds = %bb2611 + %tmp2666 = getelementptr %struct.Macroblock* null, int 0, uint 13 ; <long*> [#uses=2] + %tmp2674 = cast int 0 to ubyte ; <ubyte> [#uses=1] + br bool true, label %cond_true2732.preheader.split.us, label %cond_true2732.preheader.split + +cond_true2732.preheader.split.us: ; preds = %cond_true2732.preheader + br bool true, label %cond_true2732.outer.us.us, label %cond_true2732.outer.us + +cond_true2732.outer.us.us: ; preds = %cond_true2732.preheader.split.us + %tmp2667.us.us = load long* %tmp2666 ; <long> [#uses=1] + %tmp2670.us.us = load long* null ; <long> [#uses=1] + %tmp2675.us.us = shl long %tmp2670.us.us, ubyte %tmp2674 ; <long> [#uses=1] + %tmp2675not.us.us = xor long %tmp2675.us.us, -1 ; <long> [#uses=1] + %tmp2676.us.us = and long %tmp2667.us.us, %tmp2675not.us.us ; <long> [#uses=1] + store long %tmp2676.us.us, long* %tmp2666 + ret int 0 + +cond_true2732.outer.us: ; preds = %cond_true2732.preheader.split.us + ret int 0 + +cond_true2732.preheader.split: ; preds = %cond_true2732.preheader + ret int 0 + +cond_next2752: ; preds = %bb2611 + ret int 0 +} diff --git a/llvm/test/CodeGen/X86/test-hidden.ll b/llvm/test/CodeGen/X86/test-hidden.ll new file mode 100644 index 00000000000..915c3e89a27 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-hidden.ll @@ -0,0 +1,20 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu | grep ".hidden" | wc -l | grep 2 && +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin8.8.0 | grep ".private_extern" | wc -l | grep 2 + +%struct.Person = type { i32 } +%a = hidden global i32 0 +%b = external global i32 + +implementation ; Functions: + +define weak hidden void %_ZN6Person13privateMethodEv(%struct.Person* %this) { + ret void +} + +declare void %function(i32) + +define weak void %_ZN6PersonC1Ei(%struct.Person* %this, i32 %_c) { + ret void +} + diff --git a/llvm/test/CodeGen/X86/test-load-fold.ll b/llvm/test/CodeGen/X86/test-load-fold.ll new file mode 100644 index 00000000000..847d91e03b6 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-load-fold.ll @@ -0,0 +1,29 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc + %struct._obstack_chunk = type { sbyte*, %struct._obstack_chunk*, [4 x sbyte] } + %struct.obstack = type { int, %struct._obstack_chunk*, sbyte*, sbyte*, sbyte*, int, int, %struct._obstack_chunk* (...)*, void (...)*, sbyte*, ubyte } +%stmt_obstack = external global %struct.obstack ; <%struct.obstack*> [#uses=1] + +implementation ; Functions: + +void %expand_start_bindings() { +entry: + br bool false, label %cond_true, label %cond_next + +cond_true: ; preds = %entry + %new_size.0.i = select bool false, int 0, int 0 ; <int> [#uses=1] + %tmp.i = load uint* cast (ubyte* getelementptr (%struct.obstack* %stmt_obstack, int 0, uint 10) to uint*) ; <uint> [#uses=1] + %tmp.i = cast uint %tmp.i to ubyte ; <ubyte> [#uses=1] + %tmp21.i = and ubyte %tmp.i, 1 ; <ubyte> [#uses=1] + %tmp22.i = seteq ubyte %tmp21.i, 0 ; <bool> [#uses=1] + br bool %tmp22.i, label %cond_false30.i, label %cond_true23.i + +cond_true23.i: ; preds = %cond_true + ret void + +cond_false30.i: ; preds = %cond_true + %tmp35.i = tail call %struct._obstack_chunk* null( int %new_size.0.i ) ; <%struct._obstack_chunk*> [#uses=0] + ret void + +cond_next: ; preds = %entry + ret void +} diff --git a/llvm/test/CodeGen/X86/test-pic-1.ll b/llvm/test/CodeGen/X86/test-pic-1.ll new file mode 100644 index 00000000000..a12e742db9f --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-1.ll @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOT | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 0 + +%ptr = external global i32* +%dst = external global i32 +%src = external global i32 + +define void %foo() { +entry: + store i32* %dst, i32** %ptr + %tmp.s = load i32* %src + store i32 %tmp.s, i32* %dst + ret void +} + diff --git a/llvm/test/CodeGen/X86/test-pic-2.ll b/llvm/test/CodeGen/X86/test-pic-2.ll new file mode 100644 index 00000000000..04fdbda4153 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-2.ll @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 4 + +%ptr = internal global i32* null +%dst = internal global i32 0 +%src = internal global i32 0 + +define void %foo() { +entry: + store i32* %dst, i32** %ptr + %tmp.s = load i32* %src + store i32 %tmp.s, i32* %dst + ret void +} + diff --git a/llvm/test/CodeGen/X86/test-pic-3.ll b/llvm/test/CodeGen/X86/test-pic-3.ll new file mode 100644 index 00000000000..726a53b2cd3 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-3.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 1 + +define void %bar() { +entry: + call void(...)* %foo() + br label %return +return: + ret void +} + +declare void %foo(...) diff --git a/llvm/test/CodeGen/X86/test-pic-4.ll b/llvm/test/CodeGen/X86/test-pic-4.ll new file mode 100644 index 00000000000..13abb2e1359 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-4.ll @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep "GOT" | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep "GOTOFF" | wc -l | grep 0 + +%pfoo = external global void(...)* + +define void %bar() { +entry: + %tmp = call void(...)*(...)* %afoo() + store void(...)* %tmp, void(...)** %pfoo + %tmp1 = load void(...)** %pfoo + call void(...)* %tmp1() + br label %return +return: + ret void +} + +declare void(...)* %afoo(...) diff --git a/llvm/test/CodeGen/X86/test-pic-5.ll b/llvm/test/CodeGen/X86/test-pic-5.ll new file mode 100644 index 00000000000..4517e0955a3 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-5.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 1 + +%ptr = external global i32* + +define void %foo() { +entry: + %ptr = malloc i32, i32 10 + ret void +} + diff --git a/llvm/test/CodeGen/X86/test-pic-cpool.ll b/llvm/test/CodeGen/X86/test-pic-cpool.ll new file mode 100644 index 00000000000..3911c698dce --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-cpool.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 2 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep CPI | wc -l | grep 4 + +define double %foo(i32 %a.u) { +entry: + %tmp = icmp eq i32 %a.u,0 + %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02 + ret double %retval +} + diff --git a/llvm/test/CodeGen/X86/test-pic-jtbl.ll b/llvm/test/CodeGen/X86/test-pic-jtbl.ll new file mode 100644 index 00000000000..ff3c4d68b35 --- /dev/null +++ b/llvm/test/CodeGen/X86/test-pic-jtbl.ll @@ -0,0 +1,57 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep _GLOBAL_OFFSET_TABLE_ && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep piclabel | wc -l | grep 3 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep PLT | wc -l | grep 13 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep GOTOFF | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic | grep JTI | wc -l | grep 15 + +define void %bar(i32 %n.u) { +entry: + switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] +bb: + tail call void(...)* %foo1() + ret void +bb1: + tail call void(...)* %foo2() + ret void +bb2: + tail call void(...)* %foo6() + ret void +bb3: + tail call void(...)* %foo3() + ret void +bb4: + tail call void(...)* %foo4() + ret void +bb5: + tail call void(...)* %foo5() + ret void +bb6: + tail call void(...)* %foo1() + ret void +bb7: + tail call void(...)* %foo2() + ret void +bb8: + tail call void(...)* %foo6() + ret void +bb9: + tail call void(...)* %foo3() + ret void +bb10: + tail call void(...)* %foo4() + ret void +bb11: + tail call void(...)* %foo5() + ret void +bb12: + tail call void(...)* %foo6() + ret void +} + +declare void %foo1(...) +declare void %foo2(...) +declare void %foo6(...) +declare void %foo3(...) +declare void %foo4(...) +declare void %foo5(...) diff --git a/llvm/test/CodeGen/X86/trunc-to-bool.ll b/llvm/test/CodeGen/X86/trunc-to-bool.ll new file mode 100644 index 00000000000..a9ac6c1b297 --- /dev/null +++ b/llvm/test/CodeGen/X86/trunc-to-bool.ll @@ -0,0 +1,62 @@ +; An integer truncation to i1 should be done with an and instruction to make +; sure only the LSBit survives. Test that this is the case both for a returned +; value and as the operand of a branch. +; RUN: llvm-as < %s | llc -march=x86 && +; RUN: llvm-as < %s | llc -march=x86 | grep '\(and\)\|\(test.*\$1\)' | \ +; RUN: wc -l | grep 6 + +define i1 %test1(i32 %X) zext { + %Y = trunc i32 %X to i1 + ret i1 %Y +} + +define i1 %test2(i32 %val, i32 %mask) { +entry: + %mask = trunc i32 %mask to i8 + %shifted = ashr i32 %val, i8 %mask + %anded = and i32 %shifted, 1 + %trunced = trunc i32 %anded to i1 + br i1 %trunced, label %ret_true, label %ret_false +ret_true: + ret i1 true +ret_false: + ret i1 false +} + +define i32 %test3(i8* %ptr) { + %val = load i8* %ptr + %tmp = trunc i8 %val to i1 + br i1 %tmp, label %cond_true, label %cond_false +cond_true: + ret i32 21 +cond_false: + ret i32 42 +} + +define i32 %test4(i8* %ptr) { + %tmp = ptrtoint i8* %ptr to i1 + br i1 %tmp, label %cond_true, label %cond_false +cond_true: + ret i32 21 +cond_false: + ret i32 42 +} + +define i32 %test5(float %f) { + %tmp = fptoui float %f to i1 + br i1 %tmp, label %cond_true, label %cond_false +cond_true: + ret i32 21 +cond_false: + ret i32 42 +} + +define i32 %test6(double %d) { + %tmp = fptosi double %d to i1 + br i1 %tmp, label %cond_true, label %cond_false +cond_true: + ret i32 21 +cond_false: + ret i32 42 +} + diff --git a/llvm/test/CodeGen/X86/vec_call.ll b/llvm/test/CodeGen/X86/vec_call.ll new file mode 100644 index 00000000000..9fcc11dbb68 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_call.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep 'subl.*60' +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep 'movdqa.*32' + +void %test() { + tail call void %xx( int 1, int 2, int 3, int 4, int 5, int 6, int 7, <2 x long> cast (<4 x int> < int 4, int 3, int 2, int 1 > to <2 x long>), <2 x long> cast (<4 x int> < int 8, int 7, int 6, int 5 > to <2 x long>), <2 x long> cast (<4 x int> < int 6, int 4, int 2, int 0 > to <2 x long>), <2 x long> cast (<4 x int> < int 8, int 4, int 2, int 1 > to <2 x long>), <2 x long> cast (<4 x int> < int 0, int 1, int 3, int 9 > to <2 x long>) ) + ret void +} + +declare void %xx(int, int, int, int, int, int, int, <2 x long>, <2 x long>, <2 x long>, <2 x long>, <2 x long>) diff --git a/llvm/test/CodeGen/X86/vec_clear.ll b/llvm/test/CodeGen/X86/vec_clear.ll new file mode 100644 index 00000000000..a43d67ccd23 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_clear.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | not grep and +<4 x float> %test(<4 x float>* %v1) { + %tmp = load <4 x float>* %v1 + %tmp15 = cast <4 x float> %tmp to <2 x long> + %tmp24 = and <2 x long> %tmp15, cast (<4 x int> < int 0, int 0, int -1, int -1 > to <2 x long>) + %tmp31 = cast <2 x long> %tmp24 to <4 x float> + ret <4 x float> %tmp31 +} diff --git a/llvm/test/CodeGen/X86/vec_extract.ll b/llvm/test/CodeGen/X86/vec_extract.ll new file mode 100644 index 00000000000..2f729ad244d --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_extract.ll @@ -0,0 +1,35 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movss | wc -l | grep 3 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movhlps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pshufd | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep unpckhpd | wc -l | grep 1 + +void %test1(<4 x float>* %F, float* %f) { + %tmp = load <4 x float>* %F + %tmp7 = add <4 x float> %tmp, %tmp + %tmp2 = extractelement <4 x float> %tmp7, uint 0 + store float %tmp2, float* %f + ret void +} + +float %test2(<4 x float>* %F, float* %f) { + %tmp = load <4 x float>* %F + %tmp7 = add <4 x float> %tmp, %tmp + %tmp2 = extractelement <4 x float> %tmp7, uint 2 + ret float %tmp2 +} + +void %test3(float* %R, <4 x float>* %P1) { + %X = load <4 x float>* %P1 + %tmp = extractelement <4 x float> %X, uint 3 + store float %tmp, float* %R + ret void +} + +double %test4(double %A) { + %tmp1 = call <2 x double> %foo() + %tmp2 = extractelement <2 x double> %tmp1, uint 1 + %tmp3 = add double %tmp2, %A + ret double %tmp3 +} + +declare <2 x double> %foo() diff --git a/llvm/test/CodeGen/X86/vec_ins_extract.ll b/llvm/test/CodeGen/X86/vec_ins_extract.ll new file mode 100644 index 00000000000..b2435063a5e --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_ins_extract.ll @@ -0,0 +1,53 @@ +; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl -instcombine | \ +; RUN: llc -march=x86 -mcpu=yonah && +; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl -instcombine | \ +; RUN: llc -march=x86 -mcpu=yonah | not grep sub.*esp + +; This checks that various insert/extract idiom work without going to the +; stack. + +void %test(<4 x float>* %F, float %f) { +entry: + %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2] + %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1] + %tmp10 = insertelement <4 x float> %tmp3, float %f, uint 0 ; <<4 x float>> [#uses=2] + %tmp6 = add <4 x float> %tmp10, %tmp10 ; <<4 x float>> [#uses=1] + store <4 x float> %tmp6, <4 x float>* %F + ret void +} + +void %test2(<4 x float>* %F, float %f) { +entry: + %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] + %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2] + %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1] + store <4 x float> %tmp3, <4 x float>* %G + %tmp = getelementptr <4 x float>* %G, int 0, int 2 ; <float*> [#uses=1] + store float %f, float* %tmp + %tmp4 = load <4 x float>* %G ; <<4 x float>> [#uses=2] + %tmp6 = add <4 x float> %tmp4, %tmp4 ; <<4 x float>> [#uses=1] + store <4 x float> %tmp6, <4 x float>* %F + ret void +} + +void %test3(<4 x float>* %F, float* %f) { +entry: + %G = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] + %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2] + %tmp3 = add <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1] + store <4 x float> %tmp3, <4 x float>* %G + %tmp = getelementptr <4 x float>* %G, int 0, int 2 ; <float*> [#uses=1] + %tmp = load float* %tmp ; <float> [#uses=1] + store float %tmp, float* %f + ret void +} + +void %test4(<4 x float>* %F, float* %f) { +entry: + %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2] + %tmp5.lhs = extractelement <4 x float> %tmp, uint 0 ; <float> [#uses=1] + %tmp5.rhs = extractelement <4 x float> %tmp, uint 0 ; <float> [#uses=1] + %tmp5 = add float %tmp5.lhs, %tmp5.rhs ; <float> [#uses=1] + store float %tmp5, float* %f + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_insert.ll b/llvm/test/CodeGen/X86/vec_insert.ll new file mode 100644 index 00000000000..fbe604d5a1e --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_insert.ll @@ -0,0 +1,19 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movss | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pinsrw | wc -l | grep 2 + +void %test(<4 x float>* %F, int %I) { + %tmp = load <4 x float>* %F + %f = cast int %I to float + %tmp1 = insertelement <4 x float> %tmp, float %f, uint 0 + %tmp18 = add <4 x float> %tmp1, %tmp1 + store <4 x float> %tmp18, <4 x float>* %F + ret void +} + +void %test2(<4 x float>* %F, int %I, float %g) { + %tmp = load <4 x float>* %F + %f = cast int %I to float + %tmp1 = insertelement <4 x float> %tmp, float %f, uint 2 + store <4 x float> %tmp1, <4 x float>* %F + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_return.ll b/llvm/test/CodeGen/X86/vec_return.ll new file mode 100644 index 00000000000..2b2d9540314 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_return.ll @@ -0,0 +1,5 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah + +<2 x double> %test() { + ret <2 x double> <double 0.0, double 0.0> +} diff --git a/llvm/test/CodeGen/X86/vec_select.ll b/llvm/test/CodeGen/X86/vec_select.ll new file mode 100644 index 00000000000..05f2a8cdd32 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_select.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse + +void %test(int %C, <4 x float>* %A, <4 x float>* %B) { + %tmp = load <4 x float>* %A + %tmp3 = load <4 x float>* %B + %tmp9 = mul <4 x float> %tmp3, %tmp3 + %tmp = seteq int %C, 0 + %iftmp.38.0 = select bool %tmp, <4 x float> %tmp9, <4 x float> %tmp + store <4 x float> %iftmp.38.0, <4 x float>* %A + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_set-2.ll b/llvm/test/CodeGen/X86/vec_set-2.ll new file mode 100644 index 00000000000..db748f289bd --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set-2.ll @@ -0,0 +1,23 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movss | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movd | wc -l | grep 1 + +<4 x float> %test1(float %a) { + %tmp = insertelement <4 x float> zeroinitializer, float %a, uint 0 + %tmp5 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 + %tmp6 = insertelement <4 x float> %tmp5, float 0.000000e+00, uint 2 + %tmp7 = insertelement <4 x float> %tmp6, float 0.000000e+00, uint 3 + ret <4 x float> %tmp7 +} + +<2 x long> %test(short %a) { + %tmp = insertelement <8 x short> zeroinitializer, short %a, uint 0 + %tmp6 = insertelement <8 x short> %tmp, short 0, uint 1 + %tmp8 = insertelement <8 x short> %tmp6, short 0, uint 2 + %tmp10 = insertelement <8 x short> %tmp8, short 0, uint 3 + %tmp12 = insertelement <8 x short> %tmp10, short 0, uint 4 + %tmp14 = insertelement <8 x short> %tmp12, short 0, uint 5 + %tmp16 = insertelement <8 x short> %tmp14, short 0, uint 6 + %tmp18 = insertelement <8 x short> %tmp16, short 0, uint 7 + %tmp19 = cast <8 x short> %tmp18 to <2 x long> + ret <2 x long> %tmp19 +} diff --git a/llvm/test/CodeGen/X86/vec_set-3.ll b/llvm/test/CodeGen/X86/vec_set-3.ll new file mode 100644 index 00000000000..5cb133c134b --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set-3.ll @@ -0,0 +1,16 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep shufps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pshufd | wc -l | grep 1 + +<4 x float> %test(float %a) { + %tmp = insertelement <4 x float> zeroinitializer, float %a, uint 1 + %tmp5 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 2 + %tmp6 = insertelement <4 x float> %tmp5, float 0.000000e+00, uint 3 + ret <4 x float> %tmp6 +} + +<2 x long> %test(int %a) { + %tmp7 = insertelement <4 x int> zeroinitializer, int %a, uint 2 + %tmp9 = insertelement <4 x int> %tmp7, int 0, uint 3 + %tmp10 = cast <4 x int> %tmp9 to <2 x long> + ret <2 x long> %tmp10 +} diff --git a/llvm/test/CodeGen/X86/vec_set-4.ll b/llvm/test/CodeGen/X86/vec_set-4.ll new file mode 100644 index 00000000000..745200fab92 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set-4.ll @@ -0,0 +1,24 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pinsrw | wc -l | grep 2 + +<2 x long> %test(short %a) { +entry: + %tmp10 = insertelement <8 x short> zeroinitializer, short %a, uint 3 ; <<8 x short>> [#uses=1] + %tmp12 = insertelement <8 x short> %tmp10, short 0, uint 4 ; <<8 x short>> [#uses=1] + %tmp14 = insertelement <8 x short> %tmp12, short 0, uint 5 ; <<8 x short>> [#uses=1] + %tmp16 = insertelement <8 x short> %tmp14, short 0, uint 6 ; <<8 x short>> [#uses=1] + %tmp18 = insertelement <8 x short> %tmp16, short 0, uint 7 ; <<8 x short>> [#uses=1] + %tmp19 = cast <8 x short> %tmp18 to <2 x long> ; <<2 x long>> [#uses=1] + ret <2 x long> %tmp19 +} + +<2 x long> %test(sbyte %a) { +entry: + %tmp24 = insertelement <16 x sbyte> zeroinitializer, sbyte %a, uint 10 + %tmp26 = insertelement <16 x sbyte> %tmp24, sbyte 0, uint 11 + %tmp28 = insertelement <16 x sbyte> %tmp26, sbyte 0, uint 12 + %tmp30 = insertelement <16 x sbyte> %tmp28, sbyte 0, uint 13 + %tmp32 = insertelement <16 x sbyte> %tmp30, sbyte 0, uint 14 + %tmp34 = insertelement <16 x sbyte> %tmp32, sbyte 0, uint 15 + %tmp35 = cast <16 x sbyte> %tmp34 to <2 x long> + ret <2 x long> %tmp35 +} diff --git a/llvm/test/CodeGen/X86/vec_set-5.ll b/llvm/test/CodeGen/X86/vec_set-5.ll new file mode 100644 index 00000000000..8761417a98a --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set-5.ll @@ -0,0 +1,28 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movlhps | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep unpcklps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep punpckldq | wc -l | grep 1 + +<4 x float> %test1(float %a, float %b) { + %tmp = insertelement <4 x float> zeroinitializer, float %a, uint 0 + %tmp6 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 + %tmp8 = insertelement <4 x float> %tmp6, float %b, uint 2 + %tmp9 = insertelement <4 x float> %tmp8, float 0.000000e+00, uint 3 + ret <4 x float> %tmp9 +} + +<4 x float> %test2(float %a, float %b) { + %tmp = insertelement <4 x float> zeroinitializer, float %a, uint 0 + %tmp7 = insertelement <4 x float> %tmp, float %b, uint 1 + %tmp8 = insertelement <4 x float> %tmp7, float 0.000000e+00, uint 2 + %tmp9 = insertelement <4 x float> %tmp8, float 0.000000e+00, uint 3 + ret <4 x float> %tmp9 +} + +<2 x long> %test3(int %a, int %b) { + %tmp = insertelement <4 x int> zeroinitializer, int %a, uint 0 + %tmp6 = insertelement <4 x int> %tmp, int %b, uint 1 + %tmp8 = insertelement <4 x int> %tmp6, int 0, uint 2 + %tmp10 = insertelement <4 x int> %tmp8, int 0, uint 3 + %tmp11 = cast <4 x int> %tmp10 to <2 x long> + ret <2 x long> %tmp11 +} diff --git a/llvm/test/CodeGen/X86/vec_set-6.ll b/llvm/test/CodeGen/X86/vec_set-6.ll new file mode 100644 index 00000000000..439febb801f --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set-6.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep unpcklps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep shufps | wc -l | grep 1 + +<4 x float> %test(float %a, float %b, float %c) { + %tmp = insertelement <4 x float> zeroinitializer, float %a, uint 1 + %tmp8 = insertelement <4 x float> %tmp, float %b, uint 2 + %tmp10 = insertelement <4 x float> %tmp8, float %c, uint 3 + ret <4 x float> %tmp10 +} diff --git a/llvm/test/CodeGen/X86/vec_set-7.ll b/llvm/test/CodeGen/X86/vec_set-7.ll new file mode 100644 index 00000000000..ab342df9055 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set-7.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movq | wc -l | grep 1 + +<2 x long> %test(<2 x long>* %p) { + %tmp = cast <2 x long>* %p to double* + %tmp = load double* %tmp + %tmp = insertelement <2 x double> undef, double %tmp, uint 0 + %tmp5 = insertelement <2 x double> %tmp, double 0.000000e+00, uint 1 + %tmp = cast <2 x double> %tmp5 to <2 x long> + ret <2 x long> %tmp +} diff --git a/llvm/test/CodeGen/X86/vec_set.ll b/llvm/test/CodeGen/X86/vec_set.ll new file mode 100644 index 00000000000..c190e41bd06 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_set.ll @@ -0,0 +1,14 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep punpckl | wc -l | grep 7 + +void %test(<8 x short>* %b, short %a0, short %a1, short %a2, short %a3, short %a4, short %a5, short %a6, short %a7) { + %tmp = insertelement <8 x short> zeroinitializer, short %a0, uint 0 + %tmp2 = insertelement <8 x short> %tmp, short %a1, uint 1 + %tmp4 = insertelement <8 x short> %tmp2, short %a2, uint 2 + %tmp6 = insertelement <8 x short> %tmp4, short %a3, uint 3 + %tmp8 = insertelement <8 x short> %tmp6, short %a4, uint 4 + %tmp10 = insertelement <8 x short> %tmp8, short %a5, uint 5 + %tmp12 = insertelement <8 x short> %tmp10, short %a6, uint 6 + %tmp14 = insertelement <8 x short> %tmp12, short %a7, uint 7 + store <8 x short> %tmp14, <8 x short>* %b + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-10.ll b/llvm/test/CodeGen/X86/vec_shuffle-10.ll new file mode 100644 index 00000000000..ccd19114174 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-10.ll @@ -0,0 +1,25 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep unpcklps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep unpckhps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | not grep 'sub.*esp' + +void %test(<4 x float>* %res, <4 x float>* %A, <4 x float>* %B) { + %tmp = load <4 x float>* %B ; <<4 x float>> [#uses=2] + %tmp3 = load <4 x float>* %A ; <<4 x float>> [#uses=2] + %tmp = extractelement <4 x float> %tmp3, uint 0 ; <float> [#uses=1] + %tmp7 = extractelement <4 x float> %tmp, uint 0 ; <float> [#uses=1] + %tmp8 = extractelement <4 x float> %tmp3, uint 1 ; <float> [#uses=1] + %tmp9 = extractelement <4 x float> %tmp, uint 1 ; <float> [#uses=1] + %tmp10 = insertelement <4 x float> undef, float %tmp, uint 0 ; <<4 x float>> [#uses=1] + %tmp11 = insertelement <4 x float> %tmp10, float %tmp7, uint 1 ; <<4 x float>> [#uses=1] + %tmp12 = insertelement <4 x float> %tmp11, float %tmp8, uint 2 ; <<4 x float>> [#uses=1] + %tmp13 = insertelement <4 x float> %tmp12, float %tmp9, uint 3 ; <<4 x float>> [#uses=1] + store <4 x float> %tmp13, <4 x float>* %res + ret void +} + +void %test2(<4 x float> %X, <4 x float>* %res) { + %tmp5 = shufflevector <4 x float> %X, <4 x float> undef, <4 x uint> < uint 2, uint 6, uint 3, uint 7 > + store <4 x float> %tmp5, <4 x float>* %res + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-2.ll b/llvm/test/CodeGen/X86/vec_shuffle-2.ll new file mode 100644 index 00000000000..dd4c269e075 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-2.ll @@ -0,0 +1,46 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pshufhw | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pshuflw | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movhps | wc -l | grep 1 + +void %test1(<2 x long>* %res, <2 x long>* %A) { + %tmp = load <2 x long>* %A + %tmp = cast <2 x long> %tmp to <8 x short> + %tmp0 = extractelement <8 x short> %tmp, uint 0 + %tmp1 = extractelement <8 x short> %tmp, uint 1 + %tmp2 = extractelement <8 x short> %tmp, uint 2 + %tmp3 = extractelement <8 x short> %tmp, uint 3 + %tmp4 = extractelement <8 x short> %tmp, uint 4 + %tmp5 = extractelement <8 x short> %tmp, uint 5 + %tmp6 = extractelement <8 x short> %tmp, uint 6 + %tmp7 = extractelement <8 x short> %tmp, uint 7 + %tmp8 = insertelement <8 x short> undef, short %tmp2, uint 0 + %tmp9 = insertelement <8 x short> %tmp8, short %tmp1, uint 1 + %tmp10 = insertelement <8 x short> %tmp9, short %tmp0, uint 2 + %tmp11 = insertelement <8 x short> %tmp10, short %tmp3, uint 3 + %tmp12 = insertelement <8 x short> %tmp11, short %tmp6, uint 4 + %tmp13 = insertelement <8 x short> %tmp12, short %tmp5, uint 5 + %tmp14 = insertelement <8 x short> %tmp13, short %tmp4, uint 6 + %tmp15 = insertelement <8 x short> %tmp14, short %tmp7, uint 7 + %tmp15 = cast <8 x short> %tmp15 to <2 x long> + store <2 x long> %tmp15, <2 x long>* %res + ret void +} + +void %test2(<4 x float>* %r, <2 x int>* %A) { + %tmp = load <4 x float>* %r + %tmp = cast <2 x int>* %A to double* + %tmp = load double* %tmp + %tmp = insertelement <2 x double> undef, double %tmp, uint 0 + %tmp5 = insertelement <2 x double> %tmp, double undef, uint 1 + %tmp6 = cast <2 x double> %tmp5 to <4 x float> + %tmp = extractelement <4 x float> %tmp, uint 0 + %tmp7 = extractelement <4 x float> %tmp, uint 1 + %tmp8 = extractelement <4 x float> %tmp6, uint 0 + %tmp9 = extractelement <4 x float> %tmp6, uint 1 + %tmp10 = insertelement <4 x float> undef, float %tmp, uint 0 + %tmp11 = insertelement <4 x float> %tmp10, float %tmp7, uint 1 + %tmp12 = insertelement <4 x float> %tmp11, float %tmp8, uint 2 + %tmp13 = insertelement <4 x float> %tmp12, float %tmp9, uint 3 + store <4 x float> %tmp13, <4 x float>* %r + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-3.ll b/llvm/test/CodeGen/X86/vec_shuffle-3.ll new file mode 100644 index 00000000000..d34a00646c7 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-3.ll @@ -0,0 +1,19 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movlhps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movhlps | wc -l | grep 1 + +<4 x float> %test1(<4 x float>* %x, <4 x float>* %y) { + %tmp = load <4 x float>* %y + %tmp5 = load <4 x float>* %x + %tmp9 = add <4 x float> %tmp5, %tmp + %tmp21 = sub <4 x float> %tmp5, %tmp + %tmp27 = shufflevector <4 x float> %tmp9, <4 x float> %tmp21, <4 x uint> < uint 0, uint 1, uint 4, uint 5 > + ret <4 x float> %tmp27 +} + +<4 x float> %movhl(<4 x float>* %x, <4 x float>* %y) { +entry: + %tmp = load <4 x float>* %y + %tmp3 = load <4 x float>* %x + %tmp4 = shufflevector <4 x float> %tmp3, <4 x float> %tmp, <4 x uint> < uint 2, uint 3, uint 6, uint 7 > + ret <4 x float> %tmp4 +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-4.ll b/llvm/test/CodeGen/X86/vec_shuffle-4.ll new file mode 100644 index 00000000000..7632992fee4 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-4.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep shuf | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | not grep unpck +void %test(<4 x float>* %res, <4 x float>* %A, <4 x float>* %B, <4 x float>* %C) { + %tmp3 = load <4 x float>* %B + %tmp5 = load <4 x float>* %C + %tmp11 = shufflevector <4 x float> %tmp3, <4 x float> %tmp5, <4 x uint> < uint 1, uint 4, uint 1, uint 5 > + store <4 x float> %tmp11, <4 x float>* %res + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-5.ll b/llvm/test/CodeGen/X86/vec_shuffle-5.ll new file mode 100644 index 00000000000..b94769b1699 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-5.ll @@ -0,0 +1,12 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movhlps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep shufps | wc -l | grep 1 + +void %test() { + %tmp1 = load <4 x float>* null + %tmp2 = shufflevector <4 x float> %tmp1, <4 x float> < float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00 >, <4 x uint> < uint 0, uint 1, uint 6, uint 7 > + %tmp3 = shufflevector <4 x float> %tmp1, <4 x float> zeroinitializer, <4 x uint> < uint 2, uint 3, uint 6, uint 7 > + %tmp4 = add <4 x float> %tmp2, %tmp3 + store <4 x float> %tmp4, <4 x float>* null + ret void +} + diff --git a/llvm/test/CodeGen/X86/vec_shuffle-6.ll b/llvm/test/CodeGen/X86/vec_shuffle-6.ll new file mode 100644 index 00000000000..92e141d8317 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-6.ll @@ -0,0 +1,43 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movapd | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movaps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movups | wc -l | grep 2 + +target triple = "i686-apple-darwin" + +%x = global [4 x int] [ int 1, int 2, int 3, int 4 ] + +<2 x long> %test1() { + %tmp = load int* getelementptr ([4 x int]* %x, int 0, int 0) + %tmp3 = load int* getelementptr ([4 x int]* %x, int 0, int 1) + %tmp5 = load int* getelementptr ([4 x int]* %x, int 0, int 2) + %tmp7 = load int* getelementptr ([4 x int]* %x, int 0, int 3) + %tmp = insertelement <4 x int> undef, int %tmp, uint 0 + %tmp13 = insertelement <4 x int> %tmp, int %tmp3, uint 1 + %tmp14 = insertelement <4 x int> %tmp13, int %tmp5, uint 2 + %tmp15 = insertelement <4 x int> %tmp14, int %tmp7, uint 3 + %tmp16 = cast <4 x int> %tmp15 to <2 x long> + ret <2 x long> %tmp16 +} + +<4 x float> %test2(int %dummy, float %a, float %b, float %c, float %d) { + %tmp = insertelement <4 x float> undef, float %a, uint 0 + %tmp11 = insertelement <4 x float> %tmp, float %b, uint 1 + %tmp12 = insertelement <4 x float> %tmp11, float %c, uint 2 + %tmp13 = insertelement <4 x float> %tmp12, float %d, uint 3 + ret <4 x float> %tmp13 +} + +<4 x float> %test3(float %a, float %b, float %c, float %d) { + %tmp = insertelement <4 x float> undef, float %a, uint 0 + %tmp11 = insertelement <4 x float> %tmp, float %b, uint 1 + %tmp12 = insertelement <4 x float> %tmp11, float %c, uint 2 + %tmp13 = insertelement <4 x float> %tmp12, float %d, uint 3 + ret <4 x float> %tmp13 +} + +<2 x double> %test4(double %a, double %b) { + %tmp = insertelement <2 x double> undef, double %a, uint 0 + %tmp7 = insertelement <2 x double> %tmp, double %b, uint 1 + ret <2 x double> %tmp7 +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-7.ll b/llvm/test/CodeGen/X86/vec_shuffle-7.ll new file mode 100644 index 00000000000..bd978836c88 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-7.ll @@ -0,0 +1,10 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep xorps | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | not grep shufps + +void %test() { + cast <4 x int> zeroinitializer to <4 x float> + shufflevector <4 x float> %0, <4 x float> zeroinitializer, <4 x uint> zeroinitializer + store <4 x float> %1, <4 x float>* null + unreachable +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-8.ll b/llvm/test/CodeGen/X86/vec_shuffle-8.ll new file mode 100644 index 00000000000..13e8b9c22a2 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-8.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | not grep shufps + +void %test(<4 x float>* %res, <4 x float>* %A) { + %tmp1 = load <4 x float>* %A + %tmp2 = shufflevector <4 x float> %tmp1, <4 x float> undef, <4 x uint> < uint 0, uint 5, uint 6, uint 7 > + store <4 x float> %tmp2, <4 x float>* %res + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle-9.ll b/llvm/test/CodeGen/X86/vec_shuffle-9.ll new file mode 100644 index 00000000000..a9b325a77b5 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle-9.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep punpck | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | not grep pextrw + +<4 x int> %test(sbyte** %ptr) { +entry: + %tmp = load sbyte** %ptr + %tmp = cast sbyte* %tmp to float* + %tmp = load float* %tmp + %tmp = insertelement <4 x float> undef, float %tmp, uint 0 + %tmp9 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 + %tmp10 = insertelement <4 x float> %tmp9, float 0.000000e+00, uint 2 + %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, uint 3 + %tmp21 = cast <4 x float> %tmp11 to <16 x sbyte> + %tmp22 = shufflevector <16 x sbyte> %tmp21, <16 x sbyte> zeroinitializer, <16 x uint> < uint 0, uint 16, uint 1, uint 17, uint 2, uint 18, uint 3, uint 19, uint 4, uint 20, uint 5, uint 21, uint 6, uint 22, uint 7, uint 23 > + %tmp31 = cast <16 x sbyte> %tmp22 to <8 x short> + %tmp = shufflevector <8 x short> zeroinitializer, <8 x short> %tmp31, <8 x uint> < uint 0, uint 8, uint 1, uint 9, uint 2, uint 10, uint 3, uint 11 > + %tmp36 = cast <8 x short> %tmp to <4 x int> + ret <4 x int> %tmp36 +} diff --git a/llvm/test/CodeGen/X86/vec_shuffle.ll b/llvm/test/CodeGen/X86/vec_shuffle.ll new file mode 100644 index 00000000000..65aafe54b32 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_shuffle.ll @@ -0,0 +1,43 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep shufp | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movups | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pshufhw | wc -l | grep 1 + +void %test_v4sf(<4 x float>* %P, float %X, float %Y) { + %tmp = insertelement <4 x float> zeroinitializer, float %X, uint 0 + %tmp2 = insertelement <4 x float> %tmp, float %X, uint 1 + %tmp4 = insertelement <4 x float> %tmp2, float %Y, uint 2 + %tmp6 = insertelement <4 x float> %tmp4, float %Y, uint 3 + store <4 x float> %tmp6, <4 x float>* %P + ret void +} + +void %test_v2sd(<2 x double>* %P, double %X, double %Y) { + %tmp = insertelement <2 x double> zeroinitializer, double %X, uint 0 + %tmp2 = insertelement <2 x double> %tmp, double %Y, uint 1 + store <2 x double> %tmp2, <2 x double>* %P + ret void +} + +void %test_v8i16(<2 x long>* %res, <2 x long>* %A) { + %tmp = load <2 x long>* %A + %tmp = cast <2 x long> %tmp to <8 x short> + %tmp = extractelement <8 x short> %tmp, uint 0 + %tmp1 = extractelement <8 x short> %tmp, uint 1 + %tmp2 = extractelement <8 x short> %tmp, uint 2 + %tmp3 = extractelement <8 x short> %tmp, uint 3 + %tmp4 = extractelement <8 x short> %tmp, uint 6 + %tmp5 = extractelement <8 x short> %tmp, uint 5 + %tmp6 = extractelement <8 x short> %tmp, uint 4 + %tmp7 = extractelement <8 x short> %tmp, uint 7 + %tmp8 = insertelement <8 x short> undef, short %tmp, uint 0 + %tmp9 = insertelement <8 x short> %tmp8, short %tmp1, uint 1 + %tmp10 = insertelement <8 x short> %tmp9, short %tmp2, uint 2 + %tmp11 = insertelement <8 x short> %tmp10, short %tmp3, uint 3 + %tmp12 = insertelement <8 x short> %tmp11, short %tmp4, uint 4 + %tmp13 = insertelement <8 x short> %tmp12, short %tmp5, uint 5 + %tmp14 = insertelement <8 x short> %tmp13, short %tmp6, uint 6 + %tmp15 = insertelement <8 x short> %tmp14, short %tmp7, uint 7 + %tmp15 = cast <8 x short> %tmp15 to <2 x long> + store <2 x long> %tmp15, <2 x long>* %res + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_splat-2.ll b/llvm/test/CodeGen/X86/vec_splat-2.ll new file mode 100644 index 00000000000..a874500f3da --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_splat-2.ll @@ -0,0 +1,26 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep pshufd | wc -l | grep 1 + +void %test(<2 x long>* %P, sbyte %x) { + %tmp = insertelement <16 x sbyte> zeroinitializer, sbyte %x, uint 0 ; <<16 x sbyte>> [#uses=1] + %tmp36 = insertelement <16 x sbyte> %tmp, sbyte %x, uint 1 + %tmp38 = insertelement <16 x sbyte> %tmp36, sbyte %x, uint 2 + %tmp40 = insertelement <16 x sbyte> %tmp38, sbyte %x, uint 3 + %tmp42 = insertelement <16 x sbyte> %tmp40, sbyte %x, uint 4 + %tmp44 = insertelement <16 x sbyte> %tmp42, sbyte %x, uint 5 + %tmp46 = insertelement <16 x sbyte> %tmp44, sbyte %x, uint 6 + %tmp48 = insertelement <16 x sbyte> %tmp46, sbyte %x, uint 7 + %tmp50 = insertelement <16 x sbyte> %tmp48, sbyte %x, uint 8 + %tmp52 = insertelement <16 x sbyte> %tmp50, sbyte %x, uint 9 + %tmp54 = insertelement <16 x sbyte> %tmp52, sbyte %x, uint 10 + %tmp56 = insertelement <16 x sbyte> %tmp54, sbyte %x, uint 11 + %tmp58 = insertelement <16 x sbyte> %tmp56, sbyte %x, uint 12 + %tmp60 = insertelement <16 x sbyte> %tmp58, sbyte %x, uint 13 + %tmp62 = insertelement <16 x sbyte> %tmp60, sbyte %x, uint 14 + %tmp64 = insertelement <16 x sbyte> %tmp62, sbyte %x, uint 15 + %tmp68 = load <2 x long>* %P + %tmp71 = cast <2 x long> %tmp68 to <16 x sbyte> + %tmp73 = add <16 x sbyte> %tmp71, %tmp64 + %tmp73 = cast <16 x sbyte> %tmp73 to <2 x long> + store <2 x long> %tmp73, <2 x long>* %P + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_splat.ll b/llvm/test/CodeGen/X86/vec_splat.ll new file mode 100644 index 00000000000..bc0ae0327d6 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_splat.ll @@ -0,0 +1,22 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep shufps && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse3 | grep movddup + +void %test_v4sf(<4 x float>* %P, <4 x float>* %Q, float %X) { + %tmp = insertelement <4 x float> zeroinitializer, float %X, uint 0 + %tmp2 = insertelement <4 x float> %tmp, float %X, uint 1 + %tmp4 = insertelement <4 x float> %tmp2, float %X, uint 2 + %tmp6 = insertelement <4 x float> %tmp4, float %X, uint 3 + %tmp8 = load <4 x float>* %Q + %tmp10 = mul <4 x float> %tmp8, %tmp6 + store <4 x float> %tmp10, <4 x float>* %P + ret void +} + +void %test_v2sd(<2 x double>* %P, <2 x double>* %Q, double %X) { + %tmp = insertelement <2 x double> zeroinitializer, double %X, uint 0 + %tmp2 = insertelement <2 x double> %tmp, double %X, uint 1 + %tmp4 = load <2 x double>* %Q + %tmp6 = mul <2 x double> %tmp4, %tmp2 + store <2 x double> %tmp6, <2 x double>* %P + ret void +} diff --git a/llvm/test/CodeGen/X86/vec_ss_load_fold.ll b/llvm/test/CodeGen/X86/vec_ss_load_fold.ll new file mode 100644 index 00000000000..38eb1d1f2e1 --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_ss_load_fold.ll @@ -0,0 +1,46 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse,+sse2 | grep minss | grep CPI | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse,+sse2 | grep CPI | not grep movss + +target endian = little +target pointersize = 32 +target triple = "i686-apple-darwin8.7.2" + +implementation ; Functions: + +ushort %test1(float %f) { + %tmp = insertelement <4 x float> undef, float %f, uint 0 ; <<4 x float>> [#uses=1] + %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 ; <<4 x float>> [#uses=1] + %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, uint 2 ; <<4 x float>> [#uses=1] + %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, uint 3 ; <<4 x float>> [#uses=1] + %tmp28 = tail call <4 x float> %llvm.x86.sse.sub.ss( <4 x float> %tmp12, <4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1] + %tmp37 = tail call <4 x float> %llvm.x86.sse.mul.ss( <4 x float> %tmp28, <4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1] + %tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp37, <4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1] + %tmp59 = tail call <4 x float> %llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1] + %tmp = tail call int %llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <int> [#uses=1] + %tmp69 = cast int %tmp to ushort ; <ushort> [#uses=1] + ret ushort %tmp69 +} + +ushort %test2(float %f) { + %tmp28 = sub float %f, 1.000000e+00 ; <float> [#uses=1] + %tmp37 = mul float %tmp28, 5.000000e-01 ; <float> [#uses=1] + %tmp375 = insertelement <4 x float> undef, float %tmp37, uint 0 ; <<4 x float>> [#uses=1] + %tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp375, <4 x float> < float 6.553500e+04, float undef, float undef, float undef > ) ; <<4 x float>> [#uses=1] + %tmp59 = tail call <4 x float> %llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> < float 0.000000e+00, float undef, float undef, float undef > ) ; <<4 x float>> [#uses=1] + %tmp = tail call int %llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <int> [#uses=1] + %tmp69 = cast int %tmp to ushort ; <ushort> [#uses=1] + ret ushort %tmp69 +} + + +declare <4 x float> %llvm.x86.sse.sub.ss(<4 x float>, <4 x float>) + +declare <4 x float> %llvm.x86.sse.mul.ss(<4 x float>, <4 x float>) + +declare <4 x float> %llvm.x86.sse.min.ss(<4 x float>, <4 x float>) + +declare <4 x float> %llvm.x86.sse.max.ss(<4 x float>, <4 x float>) + +declare int %llvm.x86.sse.cvttss2si(<4 x float>) + + diff --git a/llvm/test/CodeGen/X86/vec_zero.ll b/llvm/test/CodeGen/X86/vec_zero.ll new file mode 100644 index 00000000000..f976fc1834e --- /dev/null +++ b/llvm/test/CodeGen/X86/vec_zero.ll @@ -0,0 +1,15 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep xorps | wc -l | grep 2 + +void %foo(<4 x float> *%P) { + %T = load <4 x float> * %P + %S = add <4 x float> zeroinitializer, %T + store <4 x float> %S, <4 x float>* %P + ret void +} + +void %bar(<4 x int> *%P) { + %T = load <4 x int> * %P + %S = add <4 x int> zeroinitializer, %T + store <4 x int> %S, <4 x int>* %P + ret void +} diff --git a/llvm/test/CodeGen/X86/weak.ll b/llvm/test/CodeGen/X86/weak.ll new file mode 100644 index 00000000000..1397b191e45 --- /dev/null +++ b/llvm/test/CodeGen/X86/weak.ll @@ -0,0 +1,3 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 +%a = extern_weak global int +%b = global int* %a diff --git a/llvm/test/CodeGen/X86/x86-64-asm.ll b/llvm/test/CodeGen/X86/x86-64-asm.ll new file mode 100644 index 00000000000..0814684bcd0 --- /dev/null +++ b/llvm/test/CodeGen/X86/x86-64-asm.ll @@ -0,0 +1,15 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc +; PR1029 + +target datalayout = "e-p:64:64" +target endian = little +target pointersize = 64 +target triple = "x86_64-unknown-linux-gnu" + +implementation ; Functions: + +void %frame_dummy() { +entry: + %tmp1 = tail call void (sbyte*)* (void (sbyte*)*)* asm "", "=r,0,~{dirflag},~{fpsr},~{flags}"( void (sbyte*)* null ) ; <void (sbyte*)*> [#uses=0] + ret void +} diff --git a/llvm/test/CodeGen/X86/x86-64-mem.ll b/llvm/test/CodeGen/X86/x86-64-mem.ll new file mode 100644 index 00000000000..4af16bb0419 --- /dev/null +++ b/llvm/test/CodeGen/X86/x86-64-mem.ll @@ -0,0 +1,36 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin | grep GOTPCREL | wc -l | grep 4 && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin | grep rip | wc -l | grep 6 && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin | grep movq | wc -l | grep 6 && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin | grep leaq | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin -relocation-model=static | grep rip | wc -l | grep 4 && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin -relocation-model=static | grep movl | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=x86_64-apple-darwin -relocation-model=static | grep movq | wc -l | grep 2 + +%ptr = external global int* +%src = external global [0 x int] +%dst = external global [0 x int] +%lptr = internal global int* null +%ldst = internal global [500 x int] zeroinitializer, align 32 +%lsrc = internal global [500 x int] zeroinitializer, align 32 +%bsrc = internal global [500000 x int] zeroinitializer, align 32 +%bdst = internal global [500000 x int] zeroinitializer, align 32 + +void %test1() { + %tmp = load int* getelementptr ([0 x int]* %src, int 0, int 0) + store int %tmp, int* getelementptr ([0 x int]* %dst, int 0, int 0) + ret void +} + +void %test2() { + store int* getelementptr ([0 x int]* %dst, int 0, int 0), int** %ptr + ret void +} + +void %test3() { + store int* getelementptr ([500 x int]* %ldst, int 0, int 0), int** %lptr + br label %return + +return: + ret void +} diff --git a/llvm/test/CodeGen/X86/xmm-r64.ll b/llvm/test/CodeGen/X86/xmm-r64.ll new file mode 100644 index 00000000000..596e5c99782 --- /dev/null +++ b/llvm/test/CodeGen/X86/xmm-r64.ll @@ -0,0 +1,11 @@ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86-64 + +<4 x int> %test() { + %tmp1039 = call <4 x int> %llvm.x86.sse2.psll.d( <4 x int> zeroinitializer, <4 x int> zeroinitializer ) ; <<4 x int>> [#uses=1] + %tmp1040 = cast <4 x int> %tmp1039 to <2 x long> ; <<2 x long>> [#uses=1] + %tmp1048 = add <2 x long> %tmp1040, zeroinitializer ; <<2 x long>> [#uses=1] + %tmp1048 = cast <2 x long> %tmp1048 to <4 x int> ; <<4 x int>> [#uses=1] + ret <4 x int> %tmp1048 +} + +declare <4 x int> %llvm.x86.sse2.psll.d(<4 x int>, <4 x int>) |