mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[X86] Don't imply -mprfchw when -m3dnow is specified. Enable prefetchw in the backend with 3dnow feature.
The PREFETCHW instruction was originally part of the 3DNow. But it was given its own CPUID bit on later CPUs just before 3DNow was deprecated. We were setting the -mprfchw flag if -m3dnow was passed or the CPU supported 3dnow unless -mno-prfchw was passed. But -march=native on a CPU without the PRFCHW CPUID bit set will pass -mno-prfchw. So -march=k8 will behave differently than -march=native on a K8 for example. So remove this implicit setting from the frontend and instead enable the backend to use PREFETCHW if 3dnow OR prfchw is enabled. Also enable PRFCHW flag on amdfam10/barcelona which seems to be where this CPUID bit was introduced. That CPU also supported 3dnow.
This commit is contained in:
parent
04d445ab83
commit
174fc0dbbe
@ -847,6 +847,7 @@ def ProcessorFeatures {
|
|||||||
FeatureFXSR,
|
FeatureFXSR,
|
||||||
FeatureNOPL,
|
FeatureNOPL,
|
||||||
FeatureCMPXCHG16B,
|
FeatureCMPXCHG16B,
|
||||||
|
FeaturePRFCHW,
|
||||||
FeatureLZCNT,
|
FeatureLZCNT,
|
||||||
FeaturePOPCNT,
|
FeaturePOPCNT,
|
||||||
FeatureSlowSHLD,
|
FeatureSlowSHLD,
|
||||||
|
@ -928,11 +928,10 @@ def HasRTM : Predicate<"Subtarget->hasRTM()">;
|
|||||||
def HasADX : Predicate<"Subtarget->hasADX()">;
|
def HasADX : Predicate<"Subtarget->hasADX()">;
|
||||||
def HasSHA : Predicate<"Subtarget->hasSHA()">;
|
def HasSHA : Predicate<"Subtarget->hasSHA()">;
|
||||||
def HasSGX : Predicate<"Subtarget->hasSGX()">;
|
def HasSGX : Predicate<"Subtarget->hasSGX()">;
|
||||||
def HasPRFCHW : Predicate<"Subtarget->hasPRFCHW()">;
|
|
||||||
def HasRDSEED : Predicate<"Subtarget->hasRDSEED()">;
|
def HasRDSEED : Predicate<"Subtarget->hasRDSEED()">;
|
||||||
def HasSSEPrefetch : Predicate<"Subtarget->hasSSEPrefetch()">;
|
def HasSSEPrefetch : Predicate<"Subtarget->hasSSEPrefetch()">;
|
||||||
def NoSSEPrefetch : Predicate<"!Subtarget->hasSSEPrefetch()">;
|
def NoSSEPrefetch : Predicate<"!Subtarget->hasSSEPrefetch()">;
|
||||||
def HasPrefetchW : Predicate<"Subtarget->hasPRFCHW()">;
|
def HasPrefetchW : Predicate<"Subtarget->hasPrefetchW()">;
|
||||||
def HasPREFETCHWT1 : Predicate<"Subtarget->hasPREFETCHWT1()">;
|
def HasPREFETCHWT1 : Predicate<"Subtarget->hasPREFETCHWT1()">;
|
||||||
def HasLAHFSAHF : Predicate<"Subtarget->hasLAHFSAHF()">;
|
def HasLAHFSAHF : Predicate<"Subtarget->hasLAHFSAHF()">;
|
||||||
def HasMWAITX : Predicate<"Subtarget->hasMWAITX()">;
|
def HasMWAITX : Predicate<"Subtarget->hasMWAITX()">;
|
||||||
|
@ -647,8 +647,15 @@ public:
|
|||||||
bool hasRTM() const { return HasRTM; }
|
bool hasRTM() const { return HasRTM; }
|
||||||
bool hasADX() const { return HasADX; }
|
bool hasADX() const { return HasADX; }
|
||||||
bool hasSHA() const { return HasSHA; }
|
bool hasSHA() const { return HasSHA; }
|
||||||
bool hasPRFCHW() const { return HasPRFCHW || HasPREFETCHWT1; }
|
bool hasPRFCHW() const { return HasPRFCHW; }
|
||||||
bool hasPREFETCHWT1() const { return HasPREFETCHWT1; }
|
bool hasPREFETCHWT1() const { return HasPREFETCHWT1; }
|
||||||
|
bool hasPrefetchW() const {
|
||||||
|
// The PREFETCHW instruction was added with 3DNow but later CPUs gave it
|
||||||
|
// its own CPUID bit as part of deprecating 3DNow. Intel eventually added
|
||||||
|
// it and KNL has another that prefetches to L2 cache. We assume the
|
||||||
|
// L1 version exists if the L2 version does.
|
||||||
|
return has3DNow() || hasPRFCHW() || hasPREFETCHWT1();
|
||||||
|
}
|
||||||
bool hasSSEPrefetch() const {
|
bool hasSSEPrefetch() const {
|
||||||
// We implicitly enable these when we have a write prefix supporting cache
|
// We implicitly enable these when we have a write prefix supporting cache
|
||||||
// level OR if we have prfchw, but don't already have a read prefetch from
|
// level OR if we have prfchw, but don't already have a read prefetch from
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
; RUN: llc < %s -mtriple=i686-- -mattr=-sse,+prefetchwt1 | FileCheck %s -check-prefix=PREFETCHWT1
|
; RUN: llc < %s -mtriple=i686-- -mattr=-sse,+prefetchwt1 | FileCheck %s -check-prefix=PREFETCHWT1
|
||||||
; RUN: llc < %s -mtriple=i686-- -mattr=-sse,+3dnow,+prefetchwt1 | FileCheck %s -check-prefix=PREFETCHWT1
|
; RUN: llc < %s -mtriple=i686-- -mattr=-sse,+3dnow,+prefetchwt1 | FileCheck %s -check-prefix=PREFETCHWT1
|
||||||
; RUN: llc < %s -mtriple=i686-- -mattr=+3dnow | FileCheck %s -check-prefix=3DNOW
|
; RUN: llc < %s -mtriple=i686-- -mattr=+3dnow | FileCheck %s -check-prefix=3DNOW
|
||||||
; RUN: llc < %s -mtriple=i686-- -mattr=+3dnow,+prfchw | FileCheck %s -check-prefix=PRFCHW3DNOW
|
; RUN: llc < %s -mtriple=i686-- -mattr=+3dnow,+prfchw | FileCheck %s -check-prefix=3DNOW
|
||||||
|
|
||||||
; Rules:
|
; Rules:
|
||||||
; 3dnow by itself get you just the single prefetch instruction with no hints
|
; 3dnow by itself get you just the single prefetch instruction with no hints
|
||||||
@ -68,24 +68,11 @@ define void @t(i8* %ptr) nounwind {
|
|||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetch (%eax)
|
||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetch (%eax)
|
||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetch (%eax)
|
||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetchw (%eax)
|
||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetchw (%eax)
|
||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetchw (%eax)
|
||||||
; 3DNOW-NEXT: prefetch (%eax)
|
; 3DNOW-NEXT: prefetchw (%eax)
|
||||||
; 3DNOW-NEXT: retl
|
; 3DNOW-NEXT: retl
|
||||||
;
|
|
||||||
; PRFCHW3DNOW-LABEL: t:
|
|
||||||
; PRFCHW3DNOW: # %bb.0: # %entry
|
|
||||||
; PRFCHW3DNOW-NEXT: movl {{[0-9]+}}(%esp), %eax
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetch (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetch (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetch (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetch (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetchw (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetchw (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetchw (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: prefetchw (%eax)
|
|
||||||
; PRFCHW3DNOW-NEXT: retl
|
|
||||||
entry:
|
entry:
|
||||||
tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 1, i32 1 )
|
tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 1, i32 1 )
|
||||||
tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 2, i32 1 )
|
tail call void @llvm.prefetch( i8* %ptr, i32 0, i32 2, i32 1 )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user