Skip to content

Commit

Permalink
[X86] Add MMX nontemporal store pattern
Browse files Browse the repository at this point in the history
As noticed on #98505 - try to reduce codegen diffs until we're ready to drop MMX entirely
  • Loading branch information
RKSimon committed Jul 23, 2024
1 parent b97bc56 commit 25952ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions llvm/lib/Target/X86/X86InstrMMX.td
Original file line number Diff line number Diff line change
Expand Up @@ -576,3 +576,13 @@ def : Pat<(x86mmx (MMX_X86movdq2q
(bc_v2i64 (v4i32 (X86cvttp2si (v2f64 VR128:$src)))))),
(MMX_CVTTPD2PIrr VR128:$src)>;
}

let AddedComplexity = 400 in { // Prefer non-temporal version

// Non-temporal store (no alignment required).
let Predicates = [HasMMX] in {
def : Pat<(nontemporalstore (x86mmx VR64:$src), addr:$dst),
(MMX_MOVNTQmr addr:$dst, VR64:$src)>;
}

} // AddedComplexity
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/X86/nontemporal.ll
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ define void @test_mmx(ptr nocapture %a0, ptr nocapture %a1) {
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movq (%ecx), %mm0
; X86-NEXT: psrlq $3, %mm0
; X86-NEXT: movq %mm0, (%eax)
; X86-NEXT: movntq %mm0, (%eax)
; X86-NEXT: retl
;
; X64-LABEL: test_mmx:
; X64: # %bb.0: # %entry
; X64-NEXT: movq (%rdi), %mm0
; X64-NEXT: psrlq $3, %mm0
; X64-NEXT: movq %mm0, (%rsi)
; X64-NEXT: movntq %mm0, (%rsi)
; X64-NEXT: retq
entry:
%0 = load x86_mmx, ptr %a0
Expand Down

0 comments on commit 25952ec

Please sign in to comment.