File: prefetch.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (88 lines) | stat: -rw-r--r-- 4,023 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=i686-- -mattr=+sse | FileCheck %s --check-prefix=SSE
; RUN: llc < %s -mtriple=i686-- -mattr=+avx | FileCheck %s --check-prefix=SSE
; RUN: llc < %s -mtriple=i686-- -mattr=+sse,+prfchw | FileCheck %s -check-prefix=PRFCHWSSE
; RUN: llc < %s -mtriple=i686-- -mattr=+prfchw | FileCheck %s -check-prefix=PRFCHWSSE
; RUN: llc < %s -mtriple=i686-- -mcpu=slm | FileCheck %s -check-prefix=PRFCHWSSE
; RUN: llc < %s -mtriple=i686-- -mcpu=btver2 | FileCheck %s -check-prefix=PRFCHWSSE
; RUN: llc < %s -mtriple=i686-- -mcpu=btver2 -mattr=-prfchw | FileCheck %s -check-prefix=SSE
; 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=+3dnow | FileCheck %s -check-prefix=3DNOW
; RUN: llc < %s -mtriple=i686-- -mattr=+3dnow,+prfchw | FileCheck %s -check-prefix=3DNOW

; Rules:
; 3dnow by itself get you just the single prefetch instruction with no hints
; sse provides prefetch0/1/2/nta
; supporting prefetchw, but not 3dnow implicitly provides prefetcht0/1/2/nta regardless of sse setting as we need something to fall back to for the non-write hint.
; supporting prefetchwt1 implies prefetcht0/1/2/nta and prefetchw regardless of other settings. this allows levels for non-write and gives us an instruction for write+T0
; 3dnow prefetch instruction will only get used if you have no other prefetch instructions enabled

; rdar://10538297

define void @t(ptr %ptr) nounwind  {
; SSE-LABEL: t:
; SSE:       # %bb.0: # %entry
; SSE-NEXT:    movl {{[0-9]+}}(%esp), %eax
; SSE-NEXT:    prefetcht2 (%eax)
; SSE-NEXT:    prefetcht1 (%eax)
; SSE-NEXT:    prefetcht0 (%eax)
; SSE-NEXT:    prefetchnta (%eax)
; SSE-NEXT:    prefetcht2 (%eax)
; SSE-NEXT:    prefetcht1 (%eax)
; SSE-NEXT:    prefetcht0 (%eax)
; SSE-NEXT:    prefetchnta (%eax)
; SSE-NEXT:    retl
;
; PRFCHWSSE-LABEL: t:
; PRFCHWSSE:       # %bb.0: # %entry
; PRFCHWSSE-NEXT:    movl {{[0-9]+}}(%esp), %eax
; PRFCHWSSE-NEXT:    prefetcht2 (%eax)
; PRFCHWSSE-NEXT:    prefetcht1 (%eax)
; PRFCHWSSE-NEXT:    prefetcht0 (%eax)
; PRFCHWSSE-NEXT:    prefetchnta (%eax)
; PRFCHWSSE-NEXT:    prefetchw (%eax)
; PRFCHWSSE-NEXT:    prefetchw (%eax)
; PRFCHWSSE-NEXT:    prefetchw (%eax)
; PRFCHWSSE-NEXT:    prefetchw (%eax)
; PRFCHWSSE-NEXT:    retl
;
; PREFETCHWT1-LABEL: t:
; PREFETCHWT1:       # %bb.0: # %entry
; PREFETCHWT1-NEXT:    movl {{[0-9]+}}(%esp), %eax
; PREFETCHWT1-NEXT:    prefetcht2 (%eax)
; PREFETCHWT1-NEXT:    prefetcht1 (%eax)
; PREFETCHWT1-NEXT:    prefetcht0 (%eax)
; PREFETCHWT1-NEXT:    prefetchnta (%eax)
; PREFETCHWT1-NEXT:    prefetchwt1 (%eax)
; PREFETCHWT1-NEXT:    prefetchwt1 (%eax)
; PREFETCHWT1-NEXT:    prefetchw (%eax)
; PREFETCHWT1-NEXT:    prefetchwt1 (%eax)
; PREFETCHWT1-NEXT:    retl
;
; 3DNOW-LABEL: t:
; 3DNOW:       # %bb.0: # %entry
; 3DNOW-NEXT:    movl {{[0-9]+}}(%esp), %eax
; 3DNOW-NEXT:    prefetch (%eax)
; 3DNOW-NEXT:    prefetch (%eax)
; 3DNOW-NEXT:    prefetch (%eax)
; 3DNOW-NEXT:    prefetch (%eax)
; 3DNOW-NEXT:    prefetchw (%eax)
; 3DNOW-NEXT:    prefetchw (%eax)
; 3DNOW-NEXT:    prefetchw (%eax)
; 3DNOW-NEXT:    prefetchw (%eax)
; 3DNOW-NEXT:    retl
entry:
	tail call void @llvm.prefetch( ptr %ptr, i32 0, i32 1, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 0, i32 2, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 0, i32 3, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 0, i32 0, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 1, i32 1, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 1, i32 2, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 1, i32 3, i32 1 )
	tail call void @llvm.prefetch( ptr %ptr, i32 1, i32 0, i32 1 )
	ret void
}

declare void @llvm.prefetch(ptr, i32, i32, i32) nounwind