mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
TargetLoweringBase: Followup to r321035
I missed some prefixes and the fact that on AArch64 we use "bzero" instead of "__bzero" as on X86 when doing my refactoring in r321035. Improve tests for bzero. llvm-svn: 321046
This commit is contained in:
parent
dbb949be3c
commit
f51f69bd75
@ -130,8 +130,9 @@ void TargetLoweringBase::InitLibcalls(const Triple &TT) {
|
||||
setLibcallName(RTLIB::FPROUND_F32_F16, "__truncsfhf2");
|
||||
|
||||
// Darwin 10 and higher has an optimized __bzero.
|
||||
if (!TT.isMacOSX() || !TT.isMacOSXVersionLT(10, 6) || TT.isArch64Bit())
|
||||
setLibcallName(RTLIB::BZERO, "__bzero");
|
||||
if (!TT.isMacOSX() || !TT.isMacOSXVersionLT(10, 6) || TT.isArch64Bit()) {
|
||||
setLibcallName(RTLIB::BZERO, TT.isAArch64() ? "bzero" : "__bzero");
|
||||
}
|
||||
|
||||
if (darwinHasSinCos(TT)) {
|
||||
setLibcallName(RTLIB::SINCOS_STRET_F32, "__sincosf_stret");
|
||||
|
@ -4,9 +4,10 @@
|
||||
; RUN: FileCheck --check-prefix=CHECK-LINUX --check-prefix=CHECK %s
|
||||
; <rdar://problem/14199482> ARM64: Calls to bzero() replaced with calls to memset()
|
||||
|
||||
; CHECK: @fct1
|
||||
; CHECK-LABEL: fct1:
|
||||
; For small size (<= 256), we do not change memset to bzero.
|
||||
; CHECK: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _memset
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct1(i8* nocapture %ptr) {
|
||||
entry:
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %ptr, i8 0, i64 256, i32 1, i1 false)
|
||||
@ -15,20 +16,20 @@ entry:
|
||||
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1)
|
||||
|
||||
; CHECK: @fct2
|
||||
; CHECK-LABEL: fct2:
|
||||
; When the size is bigger than 256, change into bzero.
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _bzero
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct2(i8* nocapture %ptr) {
|
||||
entry:
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %ptr, i8 0, i64 257, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @fct3
|
||||
; CHECK-LABEL: fct3:
|
||||
; For unknown size, change to bzero.
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _bzero
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct3(i8* nocapture %ptr, i32 %unknown) {
|
||||
entry:
|
||||
%conv = sext i32 %unknown to i64
|
||||
@ -36,9 +37,10 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @fct4
|
||||
; CHECK-LABEL: fct4:
|
||||
; Size <= 256, no change.
|
||||
; CHECK: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _memset
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct4(i8* %ptr) {
|
||||
entry:
|
||||
%tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false)
|
||||
@ -50,10 +52,10 @@ declare i8* @__memset_chk(i8*, i32, i64, i64)
|
||||
|
||||
declare i64 @llvm.objectsize.i64(i8*, i1)
|
||||
|
||||
; CHECK: @fct5
|
||||
; CHECK-LABEL: fct5:
|
||||
; Size > 256, change.
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _bzero
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct5(i8* %ptr) {
|
||||
entry:
|
||||
%tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false)
|
||||
@ -61,10 +63,10 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @fct6
|
||||
; CHECK-LABEL: fct6:
|
||||
; Size = unknown, change.
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _bzero
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct6(i8* %ptr, i32 %unknown) {
|
||||
entry:
|
||||
%conv = sext i32 %unknown to i64
|
||||
@ -76,9 +78,10 @@ entry:
|
||||
; Next functions check that memset is not turned into bzero
|
||||
; when the set constant is non-zero, whatever the given size.
|
||||
|
||||
; CHECK: @fct7
|
||||
; CHECK-LABEL: fct7:
|
||||
; memset with something that is not a zero, no change.
|
||||
; CHECK: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _memset
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct7(i8* %ptr) {
|
||||
entry:
|
||||
%tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false)
|
||||
@ -86,9 +89,10 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @fct8
|
||||
; CHECK-LABEL: fct8:
|
||||
; memset with something that is not a zero, no change.
|
||||
; CHECK: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _memset
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct8(i8* %ptr) {
|
||||
entry:
|
||||
%tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false)
|
||||
@ -96,9 +100,10 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: @fct9
|
||||
; CHECK-LABEL: fct9:
|
||||
; memset with something that is not a zero, no change.
|
||||
; CHECK: memset
|
||||
; CHECK-DARWIN: {{b|bl}} _memset
|
||||
; CHECK-LINUX: {{b|bl}} memset
|
||||
define void @fct9(i8* %ptr, i32 %unknown) {
|
||||
entry:
|
||||
%conv = sext i32 %unknown to i64
|
||||
|
@ -1,7 +1,10 @@
|
||||
; RUN: llc < %s -mtriple=i386-apple-darwin10 | grep __bzero
|
||||
; RUN: llc < %s -mtriple=i386-apple-darwin10 | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
|
||||
|
||||
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
|
||||
|
||||
; CHECK-LABEL: foo:
|
||||
; CHECK: {{calll|callq}} ___bzero
|
||||
define void @foo(i8* %p, i32 %len) {
|
||||
call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 %len, i32 1, i1 false)
|
||||
ret void
|
||||
|
Loading…
x
Reference in New Issue
Block a user