mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Upgrade intrinsic function calls manually.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32137 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ae8e54af9d
commit
2e7e4f2e01
@ -3,7 +3,7 @@
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
declare void %llvm.memset(sbyte*, ubyte, ulong, uint)
|
||||
declare void %llvm.memset.i64(sbyte*, ubyte, ulong, uint)
|
||||
|
||||
bool %l12_l94_bc_divide_endif_2E_3_2E_ce(int* %tmp.71.reload, uint %scale2.1.3, uint %extra.0, %typedef.bc_struct* %n1, %typedef.bc_struct* %n2, int* %tmp.92.reload, uint %tmp.94.reload, int* %tmp.98.reload, uint %tmp.100.reload, sbyte** %tmp.112.out, uint* %tmp.157.out, sbyte** %tmp.158.out) {
|
||||
newFuncRoot:
|
||||
@ -12,6 +12,6 @@ newFuncRoot:
|
||||
%tmp.123 = add uint %tmp.122, %tmp.100.reload ; <uint> [#uses=2]
|
||||
%tmp.112 = malloc sbyte, uint %tmp.123 ; <sbyte*> [#uses=3]
|
||||
%tmp.137 = cast uint %tmp.123 to ulong ; <ulong> [#uses=1]
|
||||
tail call void %llvm.memset( sbyte* %tmp.112, ubyte 0, ulong %tmp.137, uint 0 )
|
||||
tail call void %llvm.memset.i64( sbyte* %tmp.112, ubyte 0, ulong %tmp.137, uint 0 )
|
||||
ret bool true
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep movs
|
||||
declare sbyte* %llvm.memcpy(sbyte* %A, sbyte* %B, uint %amt, uint %align)
|
||||
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
|
||||
@ -7,17 +7,17 @@ declare sbyte* %llvm.memcpy(sbyte* %A, sbyte* %B, uint %amt, uint %align)
|
||||
|
||||
void %main() {
|
||||
; dword copy
|
||||
call sbyte* %llvm.memcpy(sbyte* cast (int* getelementptr ([1000 x int]* %A, long 0, long 0) to sbyte*),
|
||||
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 sbyte* %llvm.memcpy(sbyte* cast (int* getelementptr ([1000 x int]* %A, long 0, long 0) to sbyte*),
|
||||
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 sbyte* %llvm.memcpy(sbyte* cast (int* getelementptr ([1000 x int]* %A, long 0, long 0) to sbyte*),
|
||||
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
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
implementation
|
||||
|
||||
declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint)
|
||||
declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint)
|
||||
|
||||
void %foo() {
|
||||
%Blah = alloca [58 x sbyte] ; <[58 x sbyte]*> [#uses=2]
|
||||
%tmp.0 = getelementptr [58 x sbyte]* %Blah, int 0, int 0 ; <sbyte*> [#uses=1]
|
||||
call void %llvm.memcpy( sbyte* %tmp.0, sbyte* getelementptr ([58 x sbyte]* %G1, int 0, int 0), uint 58, uint 1 )
|
||||
call void %llvm.memcpy.i32( sbyte* %tmp.0, sbyte* getelementptr ([58 x sbyte]* %G1, int 0, int 0), uint 58, uint 1 )
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis
|
||||
|
||||
declare void %llvm.memmove(sbyte*, sbyte*, uint, uint)
|
||||
declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint)
|
||||
declare void %llvm.memset(sbyte*, ubyte, uint, uint)
|
||||
declare void %llvm.memmove.i32(sbyte*, sbyte*, uint, uint)
|
||||
declare void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint)
|
||||
declare void %llvm.memset.i32(sbyte*, ubyte, uint, uint)
|
||||
|
||||
%X = global sbyte 0
|
||||
%Y = global sbyte 12
|
||||
|
||||
void %zero_byte_test() {
|
||||
; These process zero bytes, so they are a noop.
|
||||
call void %llvm.memmove(sbyte* %X, sbyte* %Y, uint 0, uint 100)
|
||||
call void %llvm.memcpy(sbyte* %X, sbyte* %Y, uint 0, uint 100)
|
||||
call void %llvm.memset(sbyte* %X, ubyte 123, uint 0, uint 100)
|
||||
call void %llvm.memmove.i32(sbyte* %X, sbyte* %Y, uint 0, uint 100)
|
||||
call void %llvm.memcpy.i32(sbyte* %X, sbyte* %Y, uint 0, uint 100)
|
||||
call void %llvm.memset.i32(sbyte* %X, ubyte 123, uint 0, uint 100)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
; Test that the StrCatOptimizer works correctly
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls -disable-output &&
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | llvm-dis | not grep 'call.*llvm.memcpy'
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | llvm-dis | not grep 'call.*llvm.memcpy.i32'
|
||||
|
||||
declare sbyte* %llvm.memcpy(sbyte*,sbyte*,int,int)
|
||||
declare void %llvm.memcpy.i32(sbyte*,sbyte*,uint,uint)
|
||||
%h = constant [2 x sbyte] c"h\00"
|
||||
%hel = constant [4 x sbyte] c"hel\00"
|
||||
%hello_u = constant [8 x sbyte] c"hello_u\00"
|
||||
@ -15,8 +15,8 @@ int %main () {
|
||||
%hello_u_p = getelementptr [8 x sbyte]* %hello_u, int 0, int 0
|
||||
%target = alloca [1024 x sbyte]
|
||||
%target_p = getelementptr [1024 x sbyte]* %target, int 0, int 0
|
||||
call sbyte* %llvm.memcpy(sbyte* %target_p, sbyte* %h_p, int 2, int 2)
|
||||
call sbyte* %llvm.memcpy(sbyte* %target_p, sbyte* %hel_p, int 4, int 4)
|
||||
call sbyte* %llvm.memcpy(sbyte* %target_p, sbyte* %hello_u_p, int 8, int 8)
|
||||
call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %h_p, uint 2, uint 2)
|
||||
call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %hel_p, uint 4, uint 4)
|
||||
call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %hello_u_p, uint 8, uint 8)
|
||||
ret int 0
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
; Test that the StrCatOptimizer works correctly
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls -disable-output &&
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | llvm-dis | not grep 'call.*llvm.memmove'
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | llvm-dis | not grep 'call.*llvm.memmove.i32'
|
||||
|
||||
declare sbyte* %llvm.memmove(sbyte*,sbyte*,int,int)
|
||||
declare void %llvm.memmove.i32(sbyte*,sbyte*,uint,uint)
|
||||
%h = constant [2 x sbyte] c"h\00"
|
||||
%hel = constant [4 x sbyte] c"hel\00"
|
||||
%hello_u = constant [8 x sbyte] c"hello_u\00"
|
||||
@ -15,8 +15,8 @@ int %main () {
|
||||
%hello_u_p = getelementptr [8 x sbyte]* %hello_u, int 0, int 0
|
||||
%target = alloca [1024 x sbyte]
|
||||
%target_p = getelementptr [1024 x sbyte]* %target, int 0, int 0
|
||||
call sbyte* %llvm.memmove(sbyte* %target_p, sbyte* %h_p, int 2, int 2)
|
||||
call sbyte* %llvm.memmove(sbyte* %target_p, sbyte* %hel_p, int 4, int 4)
|
||||
call sbyte* %llvm.memmove(sbyte* %target_p, sbyte* %hello_u_p, int 8, int 8)
|
||||
call void %llvm.memmove.i32(sbyte* %target_p, sbyte* %h_p, uint 2, uint 2)
|
||||
call void %llvm.memmove.i32(sbyte* %target_p, sbyte* %hel_p, uint 4, uint 4)
|
||||
call void %llvm.memmove.i32(sbyte* %target_p, sbyte* %hello_u_p, uint 8, uint 8)
|
||||
ret int 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user