Skip to content

Commit 392d079

Browse files
committed
[X86] Fix typo: QWORD alignment is greater than or equal to 8, not greater than 8
Align(8) is QWORD aligned, but this was checking to see if alignment was greater than that, when it should have been checking for being greater than OR EQUAL to Align(8). This bug was introduced in commit 6a6af30 during the transition to the Align type.
1 parent 5d3b5f6 commit 392d079

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Target/X86/X86SelectionDAGInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
8080
uint64_t Val = ValC->getZExtValue() & 255;
8181

8282
// If the value is a constant, then we can potentially use larger sets.
83-
if (Alignment > Align(2)) {
83+
if (Alignment >= Align(4)) {
8484
// DWORD aligned
8585
AVT = MVT::i32;
8686
ValReg = X86::EAX;
8787
Val = (Val << 8) | Val;
8888
Val = (Val << 16) | Val;
89-
if (Subtarget.is64Bit() && Alignment > Align(8)) { // QWORD aligned
89+
if (Subtarget.is64Bit() && Alignment >= Align(8)) { // QWORD aligned
9090
AVT = MVT::i64;
9191
ValReg = X86::RAX;
9292
Val = (Val << 32) | Val;

llvm/test/CodeGen/X86/memset-minsize.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ entry:
139139
define void @small_memset_to_rep_stos_64(ptr %ptr) minsize nounwind {
140140
; CHECK-LABEL: small_memset_to_rep_stos_64:
141141
; CHECK: # %bb.0: # %entry
142-
; CHECK-NEXT: pushq $32
142+
; CHECK-NEXT: pushq $16
143143
; CHECK-NEXT: popq %rcx
144144
; CHECK-NEXT: xorl %eax, %eax
145-
; CHECK-NEXT: rep;stosl %eax, %es:(%rdi)
145+
; CHECK-NEXT: rep;stosq %rax, %es:(%rdi)
146146
; CHECK-NEXT: retq
147147
entry:
148148
call void @llvm.memset.p0.i64(ptr align 8 %ptr, i8 0, i64 128, i1 false)

0 commit comments

Comments
 (0)