Skip to content

Commit 1d56138

Browse files
committed
[X86] X86FixupVectorConstants - create f32/f64 broadcast constants if the source constant data was f32/f64
This partially reverts 33819f3 - the asm comments become a lot messier in #73509 - we're better off ensuring the constant data is the correct type in DAG
1 parent 4949fb7 commit 1d56138

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

llvm/lib/Target/X86/X86FixupVectorConstants.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,17 @@ static Constant *rebuildSplatableConstant(const Constant *C,
212212
SmallVector<uint32_t> RawBits;
213213
for (unsigned I = 0; I != SplatBitWidth; I += 32)
214214
RawBits.push_back(Splat->extractBits(32, I).getZExtValue());
215-
if (SclTy->isFloatingPointTy())
216-
return ConstantDataVector::getFP(Type::getFloatTy(Ctx), RawBits);
215+
if (SclTy->isFloatTy())
216+
return ConstantDataVector::getFP(SclTy, RawBits);
217217
return ConstantDataVector::get(Ctx, RawBits);
218218
}
219219

220220
// Fallback to i64 / double.
221221
SmallVector<uint64_t> RawBits;
222222
for (unsigned I = 0; I != SplatBitWidth; I += 64)
223223
RawBits.push_back(Splat->extractBits(64, I).getZExtValue());
224-
if (SclTy->isFloatingPointTy())
225-
return ConstantDataVector::getFP(Type::getDoubleTy(Ctx), RawBits);
224+
if (SclTy->isDoubleTy())
225+
return ConstantDataVector::getFP(SclTy, RawBits);
226226
return ConstantDataVector::get(Ctx, RawBits);
227227
}
228228

llvm/test/CodeGen/X86/combine-concatvectors.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ define void @concat_of_broadcast_v2f64_v4f64() {
4848
; AVX1-NEXT: movl $1091567616, 30256(%rax) # imm = 0x41100000
4949
; AVX1-NEXT: movabsq $4294967297, %rcx # imm = 0x100000001
5050
; AVX1-NEXT: movq %rcx, 46348(%rax)
51-
; AVX1-NEXT: vbroadcastss {{.*#+}} ymm0 = [1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0,1.0E+0]
51+
; AVX1-NEXT: vbroadcastss {{.*#+}} ymm0 = [1065353216,1065353216,1065353216,1065353216,1065353216,1065353216,1065353216,1065353216]
5252
; AVX1-NEXT: vmovups %ymm0, 48296(%rax)
5353
; AVX1-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
5454
; AVX1-NEXT: vmovsd %xmm0, 47372(%rax)

0 commit comments

Comments
 (0)