mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
[ARM64] Prefer generation of bzero on Darwin only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
68a7a88223
commit
b378cacf1d
@ -90,8 +90,11 @@ ARM64Subtarget::ClassifyGlobalReference(const GlobalValue *GV,
|
||||
/// memset with zero passed as the second argument. Otherwise it
|
||||
/// returns null.
|
||||
const char *ARM64Subtarget::getBZeroEntry() const {
|
||||
// At the moment, always prefer bzero.
|
||||
return "bzero";
|
||||
// Prefer bzero on Darwin only.
|
||||
if(isTargetDarwin())
|
||||
return "bzero";
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ARM64Subtarget::overrideSchedPolicy(MachineSchedPolicy &Policy,
|
||||
|
@ -1,4 +1,7 @@
|
||||
; RUN: llc %s -march arm64 -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=arm64-apple-darwin -o - | \
|
||||
; RUN: FileCheck --check-prefix=CHECK-DARWIN --check-prefix=CHECK %s
|
||||
; RUN: llc %s -mtriple=arm64-linux-gnu -o - | \
|
||||
; RUN: FileCheck --check-prefix=CHECK-LINUX --check-prefix=CHECK %s
|
||||
; <rdar://problem/14199482> ARM64: Calls to bzero() replaced with calls to memset()
|
||||
|
||||
; CHECK: @fct1
|
||||
@ -14,7 +17,8 @@ declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1)
|
||||
|
||||
; CHECK: @fct2
|
||||
; When the size is bigger than 256, change into bzero.
|
||||
; CHECK: bzero
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: 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)
|
||||
@ -23,7 +27,8 @@ entry:
|
||||
|
||||
; CHECK: @fct3
|
||||
; For unknown size, change to bzero.
|
||||
; CHECK: bzero
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
define void @fct3(i8* nocapture %ptr, i32 %unknown) {
|
||||
entry:
|
||||
%conv = sext i32 %unknown to i64
|
||||
@ -47,7 +52,8 @@ declare i64 @llvm.objectsize.i64(i8*, i1)
|
||||
|
||||
; CHECK: @fct5
|
||||
; Size > 256, change.
|
||||
; CHECK: bzero
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
define void @fct5(i8* %ptr) {
|
||||
entry:
|
||||
%tmp = tail call i64 @llvm.objectsize.i64(i8* %ptr, i1 false)
|
||||
@ -57,7 +63,8 @@ entry:
|
||||
|
||||
; CHECK: @fct6
|
||||
; Size = unknown, change.
|
||||
; CHECK: bzero
|
||||
; CHECK-DARWIN: bzero
|
||||
; CHECK-LINUX: memset
|
||||
define void @fct6(i8* %ptr, i32 %unknown) {
|
||||
entry:
|
||||
%conv = sext i32 %unknown to i64
|
||||
|
Loading…
x
Reference in New Issue
Block a user