[llvm] [X86] Fix typo: QWORD alignment is greater than 4, not 8 (PR #87819)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 5 15:12:23 PDT 2024
https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/87819
>From 89108b7c2ea0d8416e3a3d86ac0ceede480d91dc Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Fri, 5 Apr 2024 15:48:32 -0400
Subject: [PATCH 1/2] [X86] Pre-commit tests (NFC)
---
llvm/test/CodeGen/X86/memset-minsize.ll | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/llvm/test/CodeGen/X86/memset-minsize.ll b/llvm/test/CodeGen/X86/memset-minsize.ll
index 76d2928db3a9e9..0c15d7a1d0af16 100644
--- a/llvm/test/CodeGen/X86/memset-minsize.ll
+++ b/llvm/test/CodeGen/X86/memset-minsize.ll
@@ -136,4 +136,18 @@ entry:
ret void
}
+define void @small_memset_to_rep_stos_64(ptr %ptr) minsize nounwind {
+; CHECK-LABEL: small_memset_to_rep_stos_64:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: pushq $32
+; CHECK-NEXT: popq %rcx
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: rep;stosl %eax, %es:(%rdi)
+; CHECK-NEXT: retq
+entry:
+ call void @llvm.memset.p0.i64(ptr align 8 %ptr, i8 0, i64 128, i1 false)
+ ret void
+}
+
declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)
+declare void @llvm.memset.inline.p0.i64(ptr nocapture writeonly, i8, i64, i1)
>From 67bab24fa41b469d26020cdb1c29d7d1244058aa Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Fri, 5 Apr 2024 17:09:02 -0400
Subject: [PATCH 2/2] [X86] Fix typo: QWORD alignment is greater than 4, not 8
Align(8) is QWORD aligned, but this was checking to see f alignment was higher than that, which it is not.
---
llvm/lib/Target/X86/X86SelectionDAGInfo.cpp | 2 +-
llvm/test/CodeGen/X86/memset-minsize.ll | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp b/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
index 7c630a2b0da080..bc5cb5934454ce 100644
--- a/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
+++ b/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp
@@ -86,7 +86,7 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
ValReg = X86::EAX;
Val = (Val << 8) | Val;
Val = (Val << 16) | Val;
- if (Subtarget.is64Bit() && Alignment > Align(8)) { // QWORD aligned
+ if (Subtarget.is64Bit() && Alignment > Align(4)) { // QWORD aligned
AVT = MVT::i64;
ValReg = X86::RAX;
Val = (Val << 32) | Val;
diff --git a/llvm/test/CodeGen/X86/memset-minsize.ll b/llvm/test/CodeGen/X86/memset-minsize.ll
index 0c15d7a1d0af16..cc0f2156262bba 100644
--- a/llvm/test/CodeGen/X86/memset-minsize.ll
+++ b/llvm/test/CodeGen/X86/memset-minsize.ll
@@ -139,10 +139,10 @@ entry:
define void @small_memset_to_rep_stos_64(ptr %ptr) minsize nounwind {
; CHECK-LABEL: small_memset_to_rep_stos_64:
; CHECK: # %bb.0: # %entry
-; CHECK-NEXT: pushq $32
+; CHECK-NEXT: pushq $16
; CHECK-NEXT: popq %rcx
; CHECK-NEXT: xorl %eax, %eax
-; CHECK-NEXT: rep;stosl %eax, %es:(%rdi)
+; CHECK-NEXT: rep;stosq %rax, %es:(%rdi)
; CHECK-NEXT: retq
entry:
call void @llvm.memset.p0.i64(ptr align 8 %ptr, i8 0, i64 128, i1 false)
@@ -150,4 +150,3 @@ entry:
}
declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)
-declare void @llvm.memset.inline.p0.i64(ptr nocapture writeonly, i8, i64, i1)
More information about the llvm-commits
mailing list