blob: 16bf7c5a38c9bdd9a529190af8c73150ad7ca5e4 [file] [log] [blame]
Chris Lattner0ece9a12010-05-31 17:27:17 +00001; RUN: llc < %s -march=x86-64 | FileCheck %s
Rafael Espindola068317b2007-09-28 12:53:01 +00002
Chris Lattner0ece9a12010-05-31 17:27:17 +00003declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
Rafael Espindola068317b2007-09-28 12:53:01 +00004
Chris Lattner0ece9a12010-05-31 17:27:17 +00005
6; Variable memcpy's should lower to calls.
7define i8* @test1(i8* %a, i8* %b, i64 %n) nounwind {
Rafael Espindola068317b2007-09-28 12:53:01 +00008entry:
Chris Lattner0ece9a12010-05-31 17:27:17 +00009 tail call void @llvm.memcpy.p0i8.p0i8.i64( i8* %a, i8* %b, i64 %n, i32 1, i1 0 )
Rafael Espindola068317b2007-09-28 12:53:01 +000010 ret i8* %a
Chris Lattner0ece9a12010-05-31 17:27:17 +000011
12; CHECK: test1:
13; CHECK: memcpy
Rafael Espindola068317b2007-09-28 12:53:01 +000014}
15
Chris Lattner0ece9a12010-05-31 17:27:17 +000016; Variable memcpy's should lower to calls.
17define i8* @test2(i64* %a, i64* %b, i64 %n) nounwind {
Rafael Espindola068317b2007-09-28 12:53:01 +000018entry:
19 %tmp14 = bitcast i64* %a to i8*
20 %tmp25 = bitcast i64* %b to i8*
Chris Lattner0ece9a12010-05-31 17:27:17 +000021 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp14, i8* %tmp25, i64 %n, i32 8, i1 0 )
Rafael Espindola068317b2007-09-28 12:53:01 +000022 ret i8* %tmp14
Chris Lattner0ece9a12010-05-31 17:27:17 +000023
24; CHECK: test2:
25; CHECK: memcpy
Rafael Espindola068317b2007-09-28 12:53:01 +000026}
Chris Lattner0ece9a12010-05-31 17:27:17 +000027