ARM test cases contributed by Apple.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-01-19 09:20:23 +00:00
parent a8e2989ece
commit 02b985c50f
47 changed files with 955 additions and 211 deletions

View File

@ -0,0 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
%struct.layer_data = type { int, [2048 x ubyte], ubyte*, [16 x ubyte], uint, ubyte*, int, int, [64 x int], [64 x int], [64 x int], [64 x int], int, int, int, int, int, int, int, int, int, int, int, int, [12 x [64 x short]] }
%ld = external global %struct.layer_data*
void %main() {
entry:
br bool false, label %bb169.i, label %cond_true11
bb169.i:
ret void
cond_true11:
%tmp.i32 = load %struct.layer_data** %ld
%tmp3.i35 = getelementptr %struct.layer_data* %tmp.i32, int 0, uint 1, int 2048
%tmp.i36 = getelementptr %struct.layer_data* %tmp.i32, int 0, uint 2
store ubyte* %tmp3.i35, ubyte** %tmp.i36
store ubyte* %tmp3.i35, ubyte** null
ret void
}

View File

@ -1,8 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bne &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bge &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bcs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bcc
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bhs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep blo
void %f1(int %a, int %b, int* %v) {
entry:

View File

@ -0,0 +1,25 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | not grep bx
void %test(int %Ptr, ubyte* %L) {
entry:
br label %bb1
bb:
%tmp7 = getelementptr ubyte* %L, uint %indvar
store ubyte 0, ubyte* %tmp7
%indvar.next = add uint %indvar, 1
br label %bb1
bb1:
%indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ]
%i.0 = cast uint %indvar to int
%Ptr_addr.0 = sub int %Ptr, %i.0
%tmp12 = seteq int %i.0, %Ptr
%tmp12.not = xor bool %tmp12, true
%bothcond = and bool %tmp12.not, false
br bool %bothcond, label %bb, label %bb18
bb18:
ret void
}

View File

@ -1,20 +1,17 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep bl &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep blx
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep 'mov lr, pc' &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5t | grep 'blx'
%t = weak global int ()* null
declare void %g(int, int, int, int)
void %f() {
entry:
call void %g( int 1, int 2, int 3, int 4 )
call fastcc void %h()
ret void
}
declare void %g(int, int, int, int)
declare fastcc void %h()
void %g(void (...)* %g) {
entry:
%g_c = cast void (...)* %g to void ()*
call void %g_c( )
void %g() {
%tmp = load int ()** %t
%tmp = tail call int %tmp( )
ret void
}

9
test/CodeGen/ARM/clz.ll Normal file
View File

@ -0,0 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5t | grep "clz"
declare uint %llvm.ctlz.i32(uint)
uint %test(uint %x) {
%tmp.1 = call uint %llvm.ctlz.i32( uint %x )
ret uint %tmp.1
}

View File

@ -0,0 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6,+vfp2 | grep fcmpes
void %test3(float* %glob, int %X) {
entry:
%tmp = load float* %glob ; <float> [#uses=1]
%tmp2 = getelementptr float* %glob, int 2 ; <float*> [#uses=1]
%tmp3 = load float* %tmp2 ; <float> [#uses=1]
%tmp = setgt float %tmp, %tmp3 ; <bool> [#uses=1]
br bool %tmp, label %cond_true, label %UnifiedReturnBlock
cond_true: ; preds = %entry
%tmp = tail call int (...)* %bar( ) ; <int> [#uses=0]
ret void
UnifiedReturnBlock: ; preds = %entry
ret void
}
declare int %bar(...)

View File

@ -1,15 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -o %t.s -f &&
; RUN: grep "mov r0, #0" %t.s | wc -l | grep 1 &&
; RUN: grep "mov r0, #255" %t.s | wc -l | grep 1 &&
; RUN: grep "mov r0, #256" %t.s | wc -l | grep 1 &&
; RUN: grep "mov r0, #1" %t.s | wc -l | grep 2 &&
; RUN: grep "orr r0, r0, #256" %t.s | wc -l | grep 1 &&
; RUN: grep "mov r0, #-1073741761" %t.s | wc -l | grep 1 &&
; RUN: grep "mov r0, #1008" %t.s | wc -l | grep 1 &&
; RUN: grep "cmp r0, #65536" %t.s | wc -l | grep 1 &&
; RUN: grep "\.comm.*a,4,4" %t.s | wc -l | grep 1
%a = internal global int 0
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #0" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #255$" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0.*256" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "orr.*256" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, .*-1073741761" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, .*1008" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "cmp r0, #1, 16" | wc -l | grep 1
uint %f1() {
ret uint 0
@ -36,7 +32,6 @@ uint %f6() {
}
void %f7(uint %a) {
entry:
%b = setgt uint %a, 65536
br bool %b, label %r, label %r

View File

@ -1,6 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -o %t.s -f &&
; RUN: grep '\.section \.ctors,"aw",.progbits' %t.s | grep % &&
; RUN: grep '\.section \.dtors,"aw",.progbits' %t.s | grep %
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep '\.mod_init_func' &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep '\.mod_term_func' &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep '\.section \.ctors,"aw",.progbits' &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep '\.section \.dtors,"aw",.progbits'
%llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_init } ] ; <[1 x { int, void ()* }]*> [#uses=0]
%llvm.global_dtors = appending global [1 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %__mf_fini } ] ; <[1 x { int, void ()* }]*> [#uses=0]

View File

@ -1,21 +1,19 @@
; RUN: llvm-as < %s | llc -march=arm
; RUN: llvm-as < fcopysign.ll | llc -march=arm &&
; RUN: llvm-as < fcopysign.ll | llc -march=arm | grep bic | wc -l | grep 2 &&
; RUN: llvm-as < fcopysign.ll | llc -march=arm -mattr=+v6,+vfp2 &&
; RUN: llvm-as < fcopysign.ll | llc -march=arm -mattr=+v6,+vfp2 | grep fneg | wc -l | grep 2
define csretcc void %__divsc3({ float, float }* %agg.result, float %a, float %b, float %c, float %d) {
entry:
br i1 false, label %bb, label %cond_next375
bb: ; preds = %entry
%tmp81 = tail call float %copysignf( float 0x7FF0000000000000, float %c ) ; <float> [#uses=1]
%tmp87 = mul float %tmp81, %b ; <float> [#uses=1]
br label %cond_next375
cond_next375: ; preds = %bb, %entry
%y.1 = phi float [ %tmp87, %bb ], [ 0.000000e+00, %entry ] ; <float> [#uses=0]
ret void
define float %test1(float %x, double %y) {
%tmp = fpext float %x to double
%tmp2 = tail call double %copysign( double %tmp, double %y )
%tmp2 = fptrunc double %tmp2 to float
ret float %tmp2
}
declare float %fabsf(float)
define double %test2(double %x, float %y) {
%tmp = fpext float %y to double
%tmp2 = tail call double %copysign( double %x, double %tmp )
ret double %tmp2
}
declare i1 %llvm.isunordered.f32(float, float)
declare float %copysignf(float, float)
declare double %copysign(double, double)

View File

@ -1,13 +1,40 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmsr &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmrs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmrrd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmdrr &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fldd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep flds &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fstd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fsts &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1065353216"
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmsr | wc -l | grep 4 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitos &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmrs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitod &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmrrd | wc -l | grep 5 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmdrr | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fldd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep flds &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitod &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitos &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep 1065353216
float %f(int %a) {
entry:
%tmp = cast int %a to float ; <float> [#uses=1]
ret float %tmp
}
double %g(int %a) {
entry:
%tmp = cast int %a to double ; <double> [#uses=1]
ret double %tmp
}
double %uint_to_double(uint %a) {
entry:
%tmp = cast uint %a to double
ret double %tmp
}
float %uint_to_float(uint %a) {
entry:
%tmp = cast uint %a to float
ret float %tmp
}
double %h(double* %v) {
@ -16,12 +43,6 @@ entry:
ret double %tmp
}
float %h(float* %v) {
entry:
%tmp = load float* %v ; <double> [#uses=1]
ret float %tmp
}
float %h() {
entry:
ret float 1.000000e+00
@ -40,15 +61,3 @@ entry:
declare void %f4(double)
declare double %f5()
void %f6(float %a, float* %b) {
entry:
store float %a, float* %b
ret void
}
void %f7(double %a, double* %b) {
entry:
store double %a, double* %b
ret void
}

View File

@ -1,12 +1,14 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fadds &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep faddd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmuls &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fmuld &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fnegs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fnegd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fdivs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fdivd
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fadds &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep faddd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmuls &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmuld &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fnegs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fnegd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fdivs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fdivd
float %f1(float %a, float %b) {
entry:

View File

@ -1,12 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movmi &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep moveq &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movgt &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movge &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movls &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movne &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcmps &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcmpd
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movmi &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep moveq &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movgt &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movge &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep movne &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcmped | wc -l | grep 1
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcmpes | wc -l | grep 6
int %f1(float %a) {
entry:

View File

@ -1,6 +1,6 @@
; RUN: llvm-as < %s | llc -march=arm &&
; RUN: llvm-as < %s | llc -march=arm | grep moveq &&
; RUN: llvm-as < %s | llc -march=arm | grep movvs
; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep movvs
define i32 %f7(float %a, float %b) {
entry:

View File

@ -1,14 +1,14 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcvtsd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fcvtds &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftosis &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftouis &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftosid &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ftouid &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fsitos &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fsitod &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fuitos &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep fuitod
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcvtsd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcvtds &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftosizs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftouizs &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftosizd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep ftouizd &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitos &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fsitod &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitos &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuitod
float %f1(double %x) {
entry:

View File

@ -1,7 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #0" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "flds.*\[" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "fsts.*\[" | wc -l | grep 1
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep "flds.*\[" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep "fsts.*\[" | wc -l | grep 1
float %f1(float %a) {
entry:

View File

@ -1,12 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mov | wc -l | grep 1
%str = internal constant [12 x sbyte] c"Hello World\00" ; <[12 x sbyte]*> [#uses=1]
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep mov | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin | grep mov | wc -l | grep 2
implementation ; Functions:
%str = internal constant [12 x sbyte] c"Hello World\00"
int %main() {
entry:
%tmp = call int %puts( sbyte* getelementptr ([12 x sbyte]* %str, int 0, uint 0) ) ; <int> [#uses=0]
%tmp = call int %puts( sbyte* getelementptr ([12 x sbyte]* %str, int 0, uint 0) )
ret int 0
}

18
test/CodeGen/ARM/imm.ll Normal file
View File

@ -0,0 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | not grep CPI
int %test1(int %A) {
%B = add int %A, -268435441 ; 0xF000000F
ret int %B
}
int %test2() {
ret int 65533
}
int %test3(int %A) {
%B = or int %A, 65533
ret int %B
}

View File

@ -0,0 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6
uint %test1(uint %tmp54) {
%tmp56 = tail call uint asm "uxtb16 $0,$1", "=r,r"( uint %tmp54 )
ret uint %tmp56
}
void %test2() {
%tmp1 = call long asm "ldmia $1!, {$0, ${0:H}}", "=r,==r,1"( int** null, int* null )
%tmp1 = cast long %tmp1 to ulong
%tmp2 = shr ulong %tmp1, ubyte 32
%tmp3 = cast ulong %tmp2 to int
%tmp4 = call int asm "pkhbt $0, $1, $2, lsl #16", "=r,r,r"( int 0, int %tmp3 )
ret void
}

View File

@ -0,0 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep mov | wc -l | grep 2
int %test(int %x) {
%tmp = cast int %x to short
%tmp2 = tail call int %f( int 1, short %tmp )
ret int %tmp2
}
declare int %f(int, short)

View File

@ -0,0 +1,12 @@
; RUN: llvm-as < %s | llc -march=arm &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb
define void %test1() {
%tmp = alloca [ 64 x i32 ] , align 4
ret void
}
define void %test2() {
%tmp = alloca [ 4168 x i8 ] , align 4
ret void
}

32
test/CodeGen/ARM/ldm.ll Normal file
View File

@ -0,0 +1,32 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldmia" | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldmib" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldmfd sp\!" | wc -l | grep 3
%X = external global [0 x int]
int %t1() {
%tmp = load int* getelementptr ([0 x int]* %X, int 0, int 0)
%tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 1)
%tmp4 = tail call int %f1( int %tmp, int %tmp3 )
ret int %tmp4
}
int %t2() {
%tmp = load int* getelementptr ([0 x int]* %X, int 0, int 2)
%tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 3)
%tmp5 = load int* getelementptr ([0 x int]* %X, int 0, int 4)
%tmp6 = tail call int %f2( int %tmp, int %tmp3, int %tmp5 )
ret int %tmp6
}
int %t3() {
%tmp = load int* getelementptr ([0 x int]* %X, int 0, int 1)
%tmp3 = load int* getelementptr ([0 x int]* %X, int 0, int 2)
%tmp5 = load int* getelementptr ([0 x int]* %X, int 0, int 3)
%tmp6 = tail call int %f2( int %tmp, int %tmp3, int %tmp5 )
ret int %tmp6
}
declare int %f1(int, int)
declare int %f2(int, int, int)

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr r0.*#0" | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr r0" | wc -l | grep 3 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr r0.*#4092" | wc -l | grep 1
int %f1(int* %v) {

View File

@ -0,0 +1,29 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrb" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrsb" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrh" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldrsh" | wc -l | grep 1
int %test1(ubyte* %v) {
%tmp = load ubyte* %v
%tmp1 = cast ubyte %tmp to int
ret int %tmp1
}
int %test2(ushort* %v) {
%tmp = load ushort* %v
%tmp1 = cast ushort %tmp to int
ret int %tmp1
}
int %test3(sbyte* %v) {
%tmp = load sbyte* %v
%tmp1 = cast sbyte %tmp to int
ret int %tmp1
}
int %test4(short* %v) {
%tmp = load short* %v
%tmp1 = cast short %tmp to int
ret int %tmp1
}

View File

@ -0,0 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr.*\[.*]," | wc -l | grep 1
int %test(int %a, int %b, int %c) {
%tmp1 = mul int %a, %b
%tmp2 = cast int %tmp1 to int*
%tmp3 = load int* %tmp2
%tmp4 = sub int %tmp1, %c
%tmp5 = mul int %tmp4, %tmp3
ret int %tmp5
}

View File

@ -0,0 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "ldr.*\!" | wc -l | grep 2
int *%test1(int *%X, int *%dest) {
%Y = getelementptr int* %X, int 4
%A = load int* %Y
store int %A, int* %dest
ret int* %Y
}
int %test2(int %a, int %b, int %c) {
%tmp1 = sub int %a, %b
%tmp2 = cast int %tmp1 to int*
%tmp3 = load int* %tmp2
%tmp4 = sub int %tmp1, %c
%tmp5 = add int %tmp4, %tmp3
ret int %tmp5
}

View File

@ -0,0 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin -relocation-model=dynamic-no-pic | grep "L_G$non_lazy_ptr" | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-apple-darwin -relocation-model=pic | grep "ldr.*pc" | wc -l | grep 1
%G = external global int
int %test1() {
%tmp = load int* %G
ret int %tmp
}

View File

@ -1,13 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r1, #0" | wc -l | grep 4 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r0, #-2147483648" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-2147483648" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r1, #-2147483648" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\-2147483648" | wc -l | grep 3 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn" | wc -l | grep 3 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adds" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adcs" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "subs" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "sbcs" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adc" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep "subs" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "sbc" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "smull" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "umull" | wc -l | grep 1

View File

@ -0,0 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
long %foo0(long %A, ulong %B) {
%tmp = cast long %A to ulong ; <ulong> [#uses=1]
%tmp2 = shr ulong %B, ubyte 1 ; <ulong> [#uses=1]
%tmp3 = sub ulong %tmp, %tmp2 ; <ulong> [#uses=1]
%tmp3 = cast ulong %tmp3 to long ; <long> [#uses=1]
ret long %tmp3
}

View File

@ -1,14 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mul r0, r12, r0" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mul r0, r1, r0" | wc -l | grep 1
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mul | wc -l | grep 2
int %mul1(int %u) {
int %f1(int %u) {
entry:
%tmp = mul int %u, %u;
ret int %tmp
}
int %mul2(int %u, int %v) {
int %f2(int %u, int %v) {
entry:
%tmp = mul int %u, %v;
ret int %tmp

23
test/CodeGen/ARM/mulhi.ll Normal file
View File

@ -0,0 +1,23 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep smmul | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep umull | wc -l | grep 1
int %smulhi(int %x, int %y) {
%tmp = cast int %x to ulong ; <ulong> [#uses=1]
%tmp1 = cast int %y to ulong ; <ulong> [#uses=1]
%tmp2 = mul ulong %tmp1, %tmp ; <ulong> [#uses=1]
%tmp3 = shr ulong %tmp2, ubyte 32 ; <ulong> [#uses=1]
%tmp3 = cast ulong %tmp3 to int ; <int> [#uses=1]
ret int %tmp3
}
int %umulhi(uint %x, uint %y) {
%tmp = cast uint %x to ulong ; <ulong> [#uses=1]
%tmp1 = cast uint %y to ulong ; <ulong> [#uses=1]
%tmp2 = mul ulong %tmp1, %tmp ; <ulong> [#uses=1]
%tmp3 = shr ulong %tmp2, ubyte 32 ; <ulong> [#uses=1]
%tmp3 = cast ulong %tmp3 to int ; <int> [#uses=1]
ret int %tmp3
}

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 7
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 8
int %f1() {
entry:
@ -12,12 +12,12 @@ entry:
ret int %tmpnot
}
;int %f3(int %a) {
;entry:
; %tmp1 = shl int %a, ubyte 2 ; <int> [#uses=1]
; %tmp1not = xor int %tmp1, -1 ; <int> [#uses=1]
; ret int %tmp1not
;}
int %f3(int %a) {
entry:
%tmp1 = shl int %a, ubyte 2 ; <int> [#uses=1]
%tmp1not = xor int %tmp1, -1 ; <int> [#uses=1]
ret int %tmp1not
}
int %f4(int %a, ubyte %b) {
entry:
@ -26,12 +26,12 @@ entry:
ret int %tmp3not
}
;uint %f5(uint %a) {
;entry:
; %tmp1 = lshr uint %a, ubyte 2 ; <uint> [#uses=1]
; %tmp1not = xor uint %tmp1, 4294967295 ; <uint> [#uses=1]
; ret uint %tmp1not
;}
uint %f5(uint %a) {
entry:
%tmp1 = lshr uint %a, ubyte 2 ; <uint> [#uses=1]
%tmp1not = xor uint %tmp1, 4294967295 ; <uint> [#uses=1]
ret uint %tmp1not
}
uint %f6(uint %a, ubyte %b) {
entry:
@ -40,12 +40,12 @@ entry:
ret uint %tmp2not
}
;int %f7(int %a) {
;entry:
; %tmp1 = ashr int %a, ubyte 2 ; <int> [#uses=1]
; %tmp1not = xor int %tmp1, -1 ; <int> [#uses=1]
; ret int %tmp1not
;}
int %f7(int %a) {
entry:
%tmp1 = ashr int %a, ubyte 2 ; <int> [#uses=1]
%tmp1not = xor int %tmp1, -1 ; <int> [#uses=1]
ret int %tmp1not
}
int %f8(int %a, ubyte %b) {
entry:

77
test/CodeGen/ARM/pack.ll Normal file
View File

@ -0,0 +1,77 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep pkhbt | wc -l | grep 5 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep pkhtb | wc -l | grep 4
implementation ; Functions:
int %test1(int %X, int %Y) {
%tmp1 = and int %X, 65535 ; <int> [#uses=1]
%tmp4 = shl int %Y, ubyte 16 ; <int> [#uses=1]
%tmp5 = or int %tmp4, %tmp1 ; <int> [#uses=1]
ret int %tmp5
}
int %test1a(int %X, int %Y) {
%tmp19 = and int %X, 65535 ; <int> [#uses=1]
%tmp37 = shl int %Y, ubyte 16 ; <int> [#uses=1]
%tmp5 = or int %tmp37, %tmp19 ; <int> [#uses=1]
ret int %tmp5
}
int %test2(int %X, int %Y) {
%tmp1 = and int %X, 65535 ; <int> [#uses=1]
%tmp3 = shl int %Y, ubyte 12 ; <int> [#uses=1]
%tmp4 = and int %tmp3, -65536 ; <int> [#uses=1]
%tmp57 = or int %tmp4, %tmp1 ; <int> [#uses=1]
ret int %tmp57
}
int %test3(int %X, int %Y) {
%tmp19 = and int %X, 65535 ; <int> [#uses=1]
%tmp37 = shl int %Y, ubyte 18 ; <int> [#uses=1]
%tmp5 = or int %tmp37, %tmp19 ; <int> [#uses=1]
ret int %tmp5
}
int %test4(int %X, int %Y) {
%tmp1 = and int %X, 65535 ; <int> [#uses=1]
%tmp3 = and int %Y, -65536 ; <int> [#uses=1]
%tmp46 = or int %tmp3, %tmp1 ; <int> [#uses=1]
ret int %tmp46
}
int %test5(int %X, int %Y) {
%tmp17 = and int %X, -65536 ; <int> [#uses=1]
%tmp2 = cast int %Y to uint ; <uint> [#uses=1]
%tmp4 = shr uint %tmp2, ubyte 16 ; <uint> [#uses=1]
%tmp4 = cast uint %tmp4 to int ; <int> [#uses=1]
%tmp5 = or int %tmp4, %tmp17 ; <int> [#uses=1]
ret int %tmp5
}
int %test5a(int %X, int %Y) {
%tmp110 = and int %X, -65536 ; <int> [#uses=1]
%Y = cast int %Y to uint ; <uint> [#uses=1]
%tmp37 = shr uint %Y, ubyte 16 ; <uint> [#uses=1]
%tmp39 = cast uint %tmp37 to int ; <int> [#uses=1]
%tmp5 = or int %tmp39, %tmp110 ; <int> [#uses=1]
ret int %tmp5
}
int %test6(int %X, int %Y) {
%tmp1 = and int %X, -65536 ; <int> [#uses=1]
%Y = cast int %Y to uint ; <uint> [#uses=1]
%tmp37 = shr uint %Y, ubyte 12 ; <uint> [#uses=1]
%tmp38 = cast uint %tmp37 to int ; <int> [#uses=1]
%tmp4 = and int %tmp38, 65535 ; <int> [#uses=1]
%tmp59 = or int %tmp4, %tmp1 ; <int> [#uses=1]
ret int %tmp59
}
int %test7(int %X, int %Y) {
%tmp1 = and int %X, -65536 ; <int> [#uses=1]
%tmp3 = shr int %Y, ubyte 18 ; <int> [#uses=1]
%tmp4 = and int %tmp3, 65535 ; <int> [#uses=1]
%tmp57 = or int %tmp4, %tmp1 ; <int> [#uses=1]
ret int %tmp57
}

4
test/CodeGen/ARM/ret0.ll Normal file
View File

@ -0,0 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
int %test() {
ret int 0
}

30
test/CodeGen/ARM/rev.ll Normal file
View File

@ -0,0 +1,30 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep rev16 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep revsh
int %test1(uint %X) {
%tmp1 = shr uint %X, ubyte 8 ; <uint> [#uses=1]
%tmp1 = cast uint %tmp1 to int ; <int> [#uses=2]
%X15 = cast uint %X to int ; <int> [#uses=1]
%tmp4 = shl int %X15, ubyte 8 ; <int> [#uses=2]
%tmp2 = and int %tmp1, 16711680 ; <int> [#uses=1]
%tmp5 = and int %tmp4, -16777216 ; <int> [#uses=1]
%tmp9 = and int %tmp1, 255 ; <int> [#uses=1]
%tmp13 = and int %tmp4, 65280 ; <int> [#uses=1]
%tmp6 = or int %tmp5, %tmp2 ; <int> [#uses=1]
%tmp10 = or int %tmp6, %tmp13 ; <int> [#uses=1]
%tmp14 = or int %tmp10, %tmp9 ; <int> [#uses=1]
ret int %tmp14
}
int %test2(uint %X) { ; revsh
%tmp1 = shr uint %X, ubyte 8 ; <uint> [#uses=1]
%tmp1 = cast uint %tmp1 to short ; <short> [#uses=1]
%tmp3 = cast uint %X to short ; <short> [#uses=1]
%tmp2 = and short %tmp1, 255 ; <short> [#uses=1]
%tmp4 = shl short %tmp3, ubyte 8 ; <short> [#uses=1]
%tmp5 = or short %tmp2, %tmp4 ; <short> [#uses=1]
%tmp5 = cast short %tmp5 to int ; <int> [#uses=1]
ret int %tmp5
}

View File

@ -1,6 +1,6 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "__DTOR_END__:" &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | \
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | grep "__DTOR_END__:" &&
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=arm-linux | \
; RUN: grep '.section .dtors,"aw",.progbits'
%__DTOR_END__ = internal global [1 x int] zeroinitializer, section ".dtors"

View File

@ -1,49 +1,63 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep moveq | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movgt | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movlt | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movle | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movls | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep movhi | wc -l | grep 1
; RUN: llvm-as < %s | llc -march=arm &&
; RUN: llvm-as < %s | llc -march=arm | grep moveq | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm | grep movgt | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm | grep movlt | wc -l | grep 3 &&
; RUN: llvm-as < %s | llc -march=arm | grep movle | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm | grep movls | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm | grep movhi | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 | grep fcpydmi | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep beq | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bgt | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep blt | wc -l | grep 3 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep ble | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bls | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep bhi | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | grep __ltdf2
int %f1(int %a) {
define i32 %f1(i32 %a.s) {
entry:
%tmp = seteq int %a, 4 ; <bool> [#uses=1]
%tmp1 = select bool %tmp, int 2, int 3
ret int %tmp1
%tmp = icmp eq i32 %a.s, 4
%tmp1.s = select i1 %tmp, i32 2, i32 3
ret i32 %tmp1.s
}
int %f2(int %a) {
define i32 %f2(i32 %a.s) {
entry:
%tmp = setgt int %a, 4 ; <bool> [#uses=1]
%tmp1 = select bool %tmp, int 2, int 3
ret int %tmp1
%tmp = icmp sgt i32 %a.s, 4
%tmp1.s = select i1 %tmp, i32 2, i32 3
ret i32 %tmp1.s
}
int %f3(int %a, int %b) {
define i32 %f3(i32 %a.s, i32 %b.s) {
entry:
%tmp = setlt int %a, %b ; <bool> [#uses=1]
%tmp1 = select bool %tmp, int 2, int 3
ret int %tmp1
%tmp = icmp slt i32 %a.s, %b.s
%tmp1.s = select i1 %tmp, i32 2, i32 3
ret i32 %tmp1.s
}
int %f4(int %a, int %b) {
define i32 %f4(i32 %a.s, i32 %b.s) {
entry:
%tmp = setle int %a, %b ; <bool> [#uses=1]
%tmp1 = select bool %tmp, int 2, int 3
ret int %tmp1
%tmp = icmp sle i32 %a.s, %b.s
%tmp1.s = select i1 %tmp, i32 2, i32 3
ret i32 %tmp1.s
}
int %f5(uint %a, uint %b) {
define i32 %f5(i32 %a.u, i32 %b.u) {
entry:
%tmp = setle uint %a, %b ; <bool> [#uses=1]
%tmp1 = select bool %tmp, int 2, int 3
ret int %tmp1
%tmp = icmp ule i32 %a.u, %b.u
%tmp1.s = select i1 %tmp, i32 2, i32 3
ret i32 %tmp1.s
}
int %f6(uint %a, uint %b) {
define i32 %f6(i32 %a.u, i32 %b.u) {
entry:
%tmp = setgt uint %a, %b ; <bool> [#uses=1]
%tmp1 = select bool %tmp, int 2, int 3
ret int %tmp1
%tmp = icmp ugt i32 %a.u, %b.u
%tmp1.s = select i1 %tmp, i32 2, i32 3
ret i32 %tmp1.s
}
define double %f7(double %a, double %b) {
%tmp = fcmp olt double %a, 1.234e+00
%tmp1 = select i1 %tmp, double -1.000e+00, double %b
ret double %tmp1
}

View File

@ -0,0 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep 'add r0, r0, r1, lsl r2' &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep 'bic r0, r0, r1, asr r2'
int %test1(int %X, int %Y, ubyte %sh) {
%A = shl int %Y, ubyte %sh
%B = add int %X, %A
ret int %B
}
int %test2(int %X, int %Y, ubyte %sh) {
%A = shr int %Y, ubyte %sh
%B = xor int %A, -1
%C = and int %X, %B
ret int %C
}

32
test/CodeGen/ARM/smul.ll Normal file
View File

@ -0,0 +1,32 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | grep "smulbt" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | grep "smultt" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v5TE | grep "smlabt" | wc -l | grep 1
%x = weak global short 0
%y = weak global short 0
int %f1(int %y) {
%tmp = load short* %x
%tmp1 = add short %tmp, 2
%tmp2 = cast short %tmp1 to int
%tmp3 = shr int %y, ubyte 16
%tmp4 = mul int %tmp2, %tmp3
ret int %tmp4
}
int %f2(int %x, int %y) {
%tmp1 = shr int %x, ubyte 16
%tmp3 = shr int %y, ubyte 16
%tmp4 = mul int %tmp3, %tmp1
ret int %tmp4
}
int %f3(int %a, short %x, int %y) {
%tmp = cast short %x to int
%tmp2 = shr int %y, ubyte 16
%tmp3 = mul int %tmp2, %tmp
%tmp5 = add int %tmp3, %a
ret int %tmp5
}

View File

@ -0,0 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "strh .*\[.*], #-4" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "str .*\[.*]," | wc -l | grep 1
short %test1(int *%X, short *%A) {
%Y = load int* %X
%tmp1 = cast int %Y to short
store short %tmp1, short* %A
%tmp2 = cast short* %A to short
%tmp3 = sub short %tmp2, 4
ret short %tmp3
}
int %test2(int *%X, int *%A) {
%Y = load int* %X
store int %Y, int* %A
%tmp1 = cast int* %A to int
%tmp2 = sub int %tmp1, 4
ret int %tmp2
}

View File

@ -0,0 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "str.*\!" | wc -l | grep 2
void %test1(int *%X, int *%A, int **%dest) {
%B = load int* %A
%Y = getelementptr int* %X, int 4
store int %B, int* %Y
store int* %Y, int** %dest
ret void
}
short *%test2(short *%X, int *%A) {
%B = load int* %A
%Y = getelementptr short* %X, int 4
%tmp = cast int %B to short
store short %tmp, short* %Y
ret short* %Y
}

View File

@ -0,0 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "strb" | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "strh" | wc -l | grep 1
void %test1(int %v, short* %ptr) {
%tmp = cast int %v to short
store short %tmp, short* %ptr
ret void
}
void %test2(int %v, ubyte* %ptr) {
%tmp = cast int %v to ubyte
store ubyte %tmp, ubyte* %ptr
ret void
}

View File

@ -0,0 +1,22 @@
; RUN: llvm-as < %s | llc -march=arm &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "sxtb" | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "sxtab" | wc -l | grep 1
define i8 %test1(i32 %A) sext {
%B = lshr i32 %A, i8 8
%C = shl i32 %A, i8 24
%D = or i32 %B, %C
%E = trunc i32 %D to i8
ret i8 %E
}
define i32 %test2(i32 %A, i32 %X) sext {
%B = lshr i32 %A, i8 8
%C = shl i32 %A, i8 24
%D = or i32 %B, %C
%E = trunc i32 %D to i8
%F = sext i8 %E to i32
%G = add i32 %F, %X
ret i32 %G
}

View File

@ -0,0 +1,11 @@
; RUN: llvm-as < %s | llc -march=arm -enable-thumb &&
; RUN: llvm-as < %s | llc -march=arm -enable-thumb | not grep CPI
define i32 %test1() {
ret i32 1000
}
define i32 %test2() {
ret i32 -256
}

View File

@ -0,0 +1,26 @@
; RUN: llvm-as < %s | llc -march=arm &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "uxtb" | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "uxtab" | wc -l | grep 1 &&
; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep "uxth" | wc -l | grep 1
define i8 %test1(i32 %A.u) zext {
%B.u = trunc i32 %A.u to i8
ret i8 %B.u
}
define i32 %test2(i32 %A.u, i32 %B.u) zext {
%C.u = trunc i32 %B.u to i8
%D.u = zext i8 %C.u to i32
%E.u = add i32 %A.u, %D.u
ret i32 %E.u
}
define i32 %test3(i32 %A.u) zext {
%B.u = lshr i32 %A.u, i8 8
%C.u = shl i32 %A.u, i8 24
%D.u = or i32 %B.u, %C.u
%E.u = trunc i32 %D.u to i16
%F.u = zext i16 %E.u to i32
ret i32 %F.u
}

75
test/CodeGen/ARM/uxtb.ll Normal file
View File

@ -0,0 +1,75 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep uxt | wc -l | grep 10
uint %test1(uint %x) {
%tmp1 = and uint %x, 16711935 ; <uint> [#uses=1]
ret uint %tmp1
}
uint %test2(uint %x) {
%tmp1 = shr uint %x, ubyte 8 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 16711935 ; <uint> [#uses=1]
ret uint %tmp2
}
uint %test3(uint %x) {
%tmp1 = shr uint %x, ubyte 8 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 16711935 ; <uint> [#uses=1]
ret uint %tmp2
}
uint %test4(uint %x) {
%tmp1 = shr uint %x, ubyte 8 ; <uint> [#uses=1]
%tmp6 = and uint %tmp1, 16711935 ; <uint> [#uses=1]
ret uint %tmp6
}
uint %test5(uint %x) {
%tmp1 = shr uint %x, ubyte 8 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 16711935 ; <uint> [#uses=1]
ret uint %tmp2
}
uint %test6(uint %x) {
%tmp1 = shr uint %x, ubyte 16 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 255 ; <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
}
uint %test7(uint %x) {
%tmp1 = shr uint %x, ubyte 16 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 255 ; <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
}
uint %test8(uint %x) {
%tmp1 = shl uint %x, ubyte 8 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 16711680 ; <uint> [#uses=1]
%tmp5 = shr uint %x, ubyte 24 ; <uint> [#uses=1]
%tmp6 = or uint %tmp2, %tmp5 ; <uint> [#uses=1]
ret uint %tmp6
}
uint %test9(uint %x) {
%tmp1 = shr uint %x, ubyte 24 ; <uint> [#uses=1]
%tmp4 = shl uint %x, ubyte 8 ; <uint> [#uses=1]
%tmp5 = and uint %tmp4, 16711680 ; <uint> [#uses=1]
%tmp6 = or uint %tmp5, %tmp1 ; <uint> [#uses=1]
ret uint %tmp6
}
uint %test10(uint %p0) {
%tmp1 = shr uint %p0, ubyte 7 ; <uint> [#uses=1]
%tmp2 = and uint %tmp1, 16253176 ; <uint> [#uses=2]
%tmp4 = shr uint %tmp2, ubyte 5 ; <uint> [#uses=1]
%tmp5 = and uint %tmp4, 458759 ; <uint> [#uses=1]
%tmp7 = or uint %tmp5, %tmp2 ; <uint> [#uses=1]
ret uint %tmp7
}

View File

@ -1,51 +1,33 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm
%str = internal constant [7 x ubyte] c"%d %d\0A\00" ; <[7 x ubyte]*> [#uses=1]
%str = internal constant [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]
implementation ; Functions:
void %f(int %a_arg, ...) {
void %f(int %a, ...) {
entry:
%a = cast int %a_arg to uint ; <uint> [#uses=1]
%l1 = alloca sbyte*, align 4 ; <sbyte**> [#uses=5]
%l2 = alloca sbyte*, align 4 ; <sbyte**> [#uses=4]
%memtmp = alloca sbyte* ; <sbyte**> [#uses=2]
call void %llvm.va_start( sbyte** %l1 )
%tmp22 = seteq int %a_arg, 0 ; <bool> [#uses=1]
%tmp23 = volatile load sbyte** %l1 ; <sbyte*> [#uses=2]
br bool %tmp22, label %bb8, label %bb
%va = alloca sbyte*, align 4 ; <sbyte**> [#uses=4]
call void %llvm.va_start( sbyte** %va )
br label %bb
bb: ; preds = %bb, %entry
%indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ] ; <uint> [#uses=1]
%tmp.0 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; <sbyte*> [#uses=2]
%tmp2 = getelementptr sbyte* %tmp.0, int 4 ; <sbyte*> [#uses=1]
volatile store sbyte* %tmp2, sbyte** %l1
%tmp3 = cast sbyte* %tmp.0 to int* ; <int*> [#uses=1]
%tmp = load int* %tmp3 ; <int> [#uses=1]
%tmp = volatile load sbyte** %l1 ; <sbyte*> [#uses=2]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=2]
%exitcond = seteq uint %indvar.next, %a ; <bool> [#uses=1]
br bool %exitcond, label %bb8, label %bb
%a_addr.0 = phi int [ %a, %entry ], [ %tmp5, %bb ] ; <int> [#uses=2]
%tmp = volatile load sbyte** %va ; <sbyte*> [#uses=2]
%tmp2 = getelementptr sbyte* %tmp, int 4 ; <sbyte*> [#uses=1]
volatile store sbyte* %tmp2, sbyte** %va
%tmp5 = add int %a_addr.0, -1 ; <int> [#uses=1]
%tmp = seteq int %a_addr.0, 1 ; <bool> [#uses=1]
br bool %tmp, label %bb7, label %bb
bb8: ; preds = %bb, %entry
%p1.0.1 = phi int [ undef, %entry ], [ %tmp, %bb ] ; <int> [#uses=1]
%tmp.1 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; <sbyte*> [#uses=1]
store sbyte* %tmp.1, sbyte** %memtmp
call void %llvm.va_copy( sbyte** %l2, sbyte** %memtmp )
%tmp10 = volatile load sbyte** %l2 ; <sbyte*> [#uses=2]
%tmp12 = getelementptr sbyte* %tmp10, int 4 ; <sbyte*> [#uses=1]
volatile store sbyte* %tmp12, sbyte** %l2
%tmp13 = cast sbyte* %tmp10 to int* ; <int*> [#uses=1]
%tmp14 = load int* %tmp13 ; <int> [#uses=1]
%tmp17 = call int (ubyte*, ...)* %printf( ubyte* getelementptr ([7 x ubyte]* %str, int 0, uint 0), int %p1.0.1, int %tmp14 ) ; <int> [#uses=0]
call void %llvm.va_end( sbyte** %l1 )
call void %llvm.va_end( sbyte** %l2 )
bb7: ; preds = %bb
%tmp3 = cast sbyte* %tmp to int* ; <int*> [#uses=1]
%tmp = load int* %tmp3 ; <int> [#uses=1]
%tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %tmp ) ; <int> [#uses=0]
call void %llvm.va_end( sbyte** %va )
ret void
}
declare void %llvm.va_start(sbyte**)
declare void %llvm.va_copy(sbyte**, sbyte**)
declare int %printf(ubyte*, ...)
declare int %printf(sbyte*, ...)
declare void %llvm.va_end(sbyte**)

143
test/CodeGen/ARM/vfp.ll Normal file
View File

@ -0,0 +1,143 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fabs | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fmscs | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcvt | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fuito | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fto.i | wc -l | grep 4 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep bmi | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep bgt | wc -l | grep 1 &&
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+vfp2 | grep fcmpezs | wc -l | grep 1
void %test(float *%P, double* %D) {
%A = load float* %P
%B = load double* %D
store float %A, float* %P
store double %B, double* %D
ret void
}
declare float %fabsf(float)
declare double %fabs(double)
void %test_abs(float *%P, double* %D) {
%a = load float* %P
%b = call float %fabsf(float %a)
store float %b, float* %P
%A = load double* %D
%B = call double %fabs(double %A)
store double %B, double* %D
ret void
}
void %test_add(float *%P, double* %D) {
%a = load float* %P
%b = add float %a, %a
store float %b, float* %P
%A = load double* %D
%B = add double %A, %A
store double %B, double* %D
ret void
}
void %test_ext_round(float *%P, double* %D) {
%a = load float* %P
%b = cast float %a to double
%A = load double* %D
%B = cast double %A to float
store double %b, double* %D
store float %B, float* %P
ret void
}
void %test_fma(float *%P1, float* %P2, float *%P3) {
%a1 = load float* %P1
%a2 = load float* %P2
%a3 = load float* %P3
%X = mul float %a1, %a2
%Y = sub float %X, %a3
store float %Y, float* %P1
ret void
}
int %test_ftoi(float *%P1) {
%a1 = load float* %P1
%b1 = cast float %a1 to int
ret int %b1
}
uint %test_ftou(float *%P1) {
%a1 = load float* %P1
%b1 = cast float %a1 to uint
ret uint %b1
}
int %test_dtoi(double *%P1) {
%a1 = load double* %P1
%b1 = cast double %a1 to int
ret int %b1
}
uint %test_dtou(double *%P1) {
%a1 = load double* %P1
%b1 = cast double %a1 to uint
ret uint %b1
}
void %test_utod(double *%P1, uint %X) {
%b1 = cast uint %X to double
store double %b1, double* %P1
ret void
}
void %test_utod2(double *%P1, ubyte %X) {
%b1 = cast ubyte %X to double
store double %b1, double* %P1
ret void
}
void %test_cmp(float* %glob, int %X) {
entry:
%tmp = load float* %glob ; <float> [#uses=2]
%tmp3 = getelementptr float* %glob, int 2 ; <float*> [#uses=1]
%tmp4 = load float* %tmp3 ; <float> [#uses=2]
%tmp = seteq float %tmp, %tmp4 ; <bool> [#uses=1]
%tmp5 = tail call bool %llvm.isunordered.f32( float %tmp, float %tmp4 ) ; <bool> [#uses=1]
%tmp6 = or bool %tmp, %tmp5 ; <bool> [#uses=1]
br bool %tmp6, label %cond_true, label %cond_false
cond_true: ; preds = %entry
%tmp = tail call int (...)* %bar( ) ; <int> [#uses=0]
ret void
cond_false: ; preds = %entry
%tmp7 = tail call int (...)* %baz( ) ; <int> [#uses=0]
ret void
}
declare bool %llvm.isunordered.f32(float, float)
declare int %bar(...)
declare int %baz(...)
void %test_cmpfp0(float* %glob, int %X) {
entry:
%tmp = load float* %glob ; <float> [#uses=1]
%tmp = setgt float %tmp, 0.000000e+00 ; <bool> [#uses=1]
br bool %tmp, label %cond_true, label %cond_false
cond_true: ; preds = %entry
%tmp = tail call int (...)* %bar( ) ; <int> [#uses=0]
ret void
cond_false: ; preds = %entry
%tmp1 = tail call int (...)* %baz( ) ; <int> [#uses=0]
ret void
}