Skip to content

Commit 25952ec

Browse files
committed
[X86] Add MMX nontemporal store pattern
As noticed on llvm#98505 - try to reduce codegen diffs until we're ready to drop MMX entirely
1 parent b97bc56 commit 25952ec

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

llvm/lib/Target/X86/X86InstrMMX.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,3 +576,13 @@ def : Pat<(x86mmx (MMX_X86movdq2q
576576
(bc_v2i64 (v4i32 (X86cvttp2si (v2f64 VR128:$src)))))),
577577
(MMX_CVTTPD2PIrr VR128:$src)>;
578578
}
579+
580+
let AddedComplexity = 400 in { // Prefer non-temporal version
581+
582+
// Non-temporal store (no alignment required).
583+
let Predicates = [HasMMX] in {
584+
def : Pat<(nontemporalstore (x86mmx VR64:$src), addr:$dst),
585+
(MMX_MOVNTQmr addr:$dst, VR64:$src)>;
586+
}
587+
588+
} // AddedComplexity

llvm/test/CodeGen/X86/nontemporal.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ define void @test_mmx(ptr nocapture %a0, ptr nocapture %a1) {
183183
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
184184
; X86-NEXT: movq (%ecx), %mm0
185185
; X86-NEXT: psrlq $3, %mm0
186-
; X86-NEXT: movq %mm0, (%eax)
186+
; X86-NEXT: movntq %mm0, (%eax)
187187
; X86-NEXT: retl
188188
;
189189
; X64-LABEL: test_mmx:
190190
; X64: # %bb.0: # %entry
191191
; X64-NEXT: movq (%rdi), %mm0
192192
; X64-NEXT: psrlq $3, %mm0
193-
; X64-NEXT: movq %mm0, (%rsi)
193+
; X64-NEXT: movntq %mm0, (%rsi)
194194
; X64-NEXT: retq
195195
entry:
196196
%0 = load x86_mmx, ptr %a0

0 commit comments

Comments
 (0)