From f45d5e71d3e1ef9d565815850681719418a99d19 Mon Sep 17 00:00:00 2001 From: Qiu Chaofan Date: Sat, 9 Oct 2021 10:12:10 +0800 Subject: [PATCH] [APFloat] Set size of PPCDoubleDouble to 128 566690b0 uses size information in float semantics, but PPCDoubleDouble left them empty. As follow-up, we can consider remove PPCDoubleDoubleLegacy and fill other fields in the future. Reviewed By: foad Differential Revision: https://reviews.llvm.org/D111398 --- llvm/lib/Support/APFloat.cpp | 2 +- llvm/test/Transforms/InstCombine/bitcast-store.ll | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index c456a5c86bada7..4b75c9db852639 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -92,7 +92,7 @@ namespace llvm { Note: we need to make the value different from semBogus as otherwise an unsafe optimization may collapse both values to a single address, and we heavily rely on them having distinct addresses. */ - static const fltSemantics semPPCDoubleDouble = {-1, 0, 0, 0}; + static const fltSemantics semPPCDoubleDouble = {-1, 0, 0, 128}; /* These are legacy semantics for the fallback, inaccrurate implementation of IBM double-double, if the accurate semPPCDoubleDouble doesn't handle the diff --git a/llvm/test/Transforms/InstCombine/bitcast-store.ll b/llvm/test/Transforms/InstCombine/bitcast-store.ll index bad4d9e19a353a..27a6c177a27334 100644 --- a/llvm/test/Transforms/InstCombine/bitcast-store.ll +++ b/llvm/test/Transforms/InstCombine/bitcast-store.ll @@ -47,6 +47,16 @@ entry: ret void } +; CHECK-LABEL: @ppcf128_ones_store +; CHECK: store ppc_fp128 0xMFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, ppc_fp128* %dest, align 16 +define void @ppcf128_ones_store(ppc_fp128* %dest) { +entry: + %int = or i128 0, 340282366920938463463374607431768211455 ; 128 ones + %val = bitcast i128 %int to ppc_fp128 + store ppc_fp128 %val, ppc_fp128* %dest, align 16 + ret void +} + !0 = !{!1} !1 = !{!1, !2} !2 = !{!2}