[LLVM][CodeGen][X86] Make printConstant's output for vector ConstantFP match that of ConstantVector. (#172679)
This commit is contained in:
parent
5f84dfff53
commit
cba7bb9d2f
@ -1565,10 +1565,16 @@ static void printConstant(const Constant *COp, unsigned BitWidth,
|
||||
printConstant(CI->getValue(), CS, PrintZero);
|
||||
} else if (auto *CF = dyn_cast<ConstantFP>(COp)) {
|
||||
if (auto VTy = dyn_cast<FixedVectorType>(CF->getType())) {
|
||||
for (unsigned I = 0, E = VTy->getNumElements(); I != E; ++I) {
|
||||
if (I != 0)
|
||||
CS << ',';
|
||||
printConstant(CF->getValueAPF(), CS, PrintZero);
|
||||
unsigned EltBits = VTy->getScalarSizeInBits();
|
||||
unsigned E = std::min(BitWidth / EltBits, VTy->getNumElements());
|
||||
if ((BitWidth % EltBits) == 0) {
|
||||
for (unsigned I = 0; I != E; ++I) {
|
||||
if (I != 0)
|
||||
CS << ",";
|
||||
printConstant(CF->getValueAPF(), CS, PrintZero);
|
||||
}
|
||||
} else {
|
||||
CS << "?";
|
||||
}
|
||||
} else
|
||||
printConstant(CF->getValueAPF(), CS, PrintZero);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=CHECK,AVX1
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,AVX2
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx -use-constant-fp-for-fixed-length-splat | FileCheck %s --check-prefixes=CHECK,AVX1
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 -use-constant-fp-for-fixed-length-splat | FileCheck %s --check-prefixes=CHECK,AVX2
|
||||
|
||||
define void @PR32957(ptr %in, ptr %out) {
|
||||
; CHECK-LABEL: PR32957:
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
|
||||
; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=x86_64-- -use-constant-fp-for-fixed-length-splat | FileCheck %s
|
||||
|
||||
define void @PR131389(ptr %p) {
|
||||
; CHECK-LABEL: PR131389:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user