forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X86][1/2] Support PREFETCHI instructions
For more details about these instructions, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D136040
- Loading branch information
1 parent
859b614
commit 62ca791
Showing
22 changed files
with
203 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/*===---- prfchiintrin.h - PREFETCHI intrinsic -----------------------------=== | ||
* | ||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
* See https://llvm.org/LICENSE.txt for license information. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
* | ||
*===-----------------------------------------------------------------------=== | ||
*/ | ||
|
||
#ifndef __PRFCHIINTRIN_H | ||
#define __PRFCHIINTRIN_H | ||
|
||
#ifdef __x86_64__ | ||
|
||
/* Define the default attributes for the functions in this file. */ | ||
#define __DEFAULT_FN_ATTRS \ | ||
__attribute__((__always_inline__, __nodebug__, __target__("prefetchi"))) | ||
|
||
/// Loads an instruction sequence containing the specified memory address into | ||
/// all level cache. | ||
/// | ||
/// Note that the effect of this intrinsic is dependent on the processor | ||
/// implementation. | ||
/// | ||
/// \headerfile <x86intrin.h> | ||
/// | ||
/// This intrinsic corresponds to the \c PREFETCHIT0 instruction. | ||
/// | ||
/// \param __P | ||
/// A pointer specifying the memory address to be prefetched. | ||
static __inline__ void __DEFAULT_FN_ATTRS | ||
_m_prefetchit0(volatile const void *__P) { | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wcast-qual" | ||
__builtin_ia32_prefetchi((const void *)__P, 3 /* _MM_HINT_T0 */); | ||
#pragma clang diagnostic pop | ||
} | ||
|
||
/// Loads an instruction sequence containing the specified memory address into | ||
/// all but the first-level cache. | ||
/// | ||
/// Note that the effect of this intrinsic is dependent on the processor | ||
/// implementation. | ||
/// | ||
/// \headerfile <x86intrin.h> | ||
/// | ||
/// This intrinsic corresponds to the \c PREFETCHIT1 instruction. | ||
/// | ||
/// \param __P | ||
/// A pointer specifying the memory address to be prefetched. | ||
static __inline__ void __DEFAULT_FN_ATTRS | ||
_m_prefetchit1(volatile const void *__P) { | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wcast-qual" | ||
__builtin_ia32_prefetchi((const void *)__P, 2 /* _MM_HINT_T1 */); | ||
#pragma clang diagnostic pop | ||
} | ||
#endif /* __x86_64__ */ | ||
#undef __DEFAULT_FN_ATTRS | ||
|
||
#endif /* __PRFCHWINTRIN_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -target-feature +prefetchi -emit-llvm -o - %s | FileCheck %s | ||
|
||
|
||
#include <x86intrin.h> | ||
|
||
void test_m_prefetch_it0(void *p) { | ||
return _m_prefetchit0(p); | ||
// CHECK-LABEL: define{{.*}} void @test_m_prefetch_it0 | ||
// CHECK: call void @llvm.prefetch.p0(ptr {{.*}}, i32 0, i32 3, i32 0) | ||
} | ||
|
||
void test_m_prefetch_it1(void *p) { | ||
return _m_prefetchit1(p); | ||
// CHECK-LABEL: define{{.*}} void @test_m_prefetch_it1 | ||
// CHECK: call void @llvm.prefetch.p0(ptr {{.*}}, i32 0, i32 2, i32 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc < %s -mtriple=x86_64-- -mattr=+prefetchi | FileCheck %s | ||
|
||
define dso_local void @t(ptr %ptr) nounwind { | ||
; CHECK-LABEL: t: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: prefetchit1 (%rdi) | ||
; CHECK-NEXT: prefetchit0 (%rdi) | ||
; CHECK-NEXT: prefetchit1 t(%rip) | ||
; CHECK-NEXT: prefetchit0 ext(%rip) | ||
; CHECK-NEXT: retq | ||
entry: | ||
tail call void @llvm.prefetch(ptr %ptr, i32 0, i32 2, i32 0) | ||
tail call void @llvm.prefetch(ptr %ptr, i32 0, i32 3, i32 0) | ||
tail call void @llvm.prefetch(ptr @t, i32 0, i32 2, i32 0) | ||
tail call void @llvm.prefetch(ptr @ext, i32 0, i32 3, i32 0) | ||
ret void | ||
} | ||
|
||
declare dso_local void @ext() nounwind | ||
declare void @llvm.prefetch(ptr, i32, i32, i32) nounwind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters