1 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=core2 | FileCheck %s -check-prefix=LINUX
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=DARWIN
4 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
7 ; Variable memcpy's should lower to calls.
8 define i8* @test1(i8* %a, i8* %b, i64 %n) nounwind {
10 tail call void @llvm.memcpy.p0i8.p0i8.i64( i8* %a, i8* %b, i64 %n, i32 1, i1 0 )
17 ; Variable memcpy's should lower to calls.
18 define i8* @test2(i64* %a, i64* %b, i64 %n) nounwind {
20 %tmp14 = bitcast i64* %a to i8*
21 %tmp25 = bitcast i64* %b to i8*
22 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp14, i8* %tmp25, i64 %n, i32 8, i1 0 )
29 ; Large constant memcpy's should lower to a call when optimizing for size.
32 ; On the other hand, Darwin's definition of -Os is optimizing for size without
33 ; hurting performance so it should just ignore optsize when expanding memcpy.
35 define void @test3(i8* nocapture %A, i8* nocapture %B) nounwind optsize noredzone {
37 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %A, i8* %B, i64 64, i32 1, i1 false)
62 ; Large constant memcpy's should be inlined when not optimizing for size.
63 define void @test4(i8* nocapture %A, i8* nocapture %B) nounwind noredzone {
65 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %A, i8* %B, i64 64, i32 1, i1 false)