[x86] fix assert with horizontal math + broadcast of vector (PR43402)
[llvm-core.git] / lib / Target / RISCV / MCTargetDesc / RISCVMCAsmInfo.cpp
blob089a2def4c210e03fdb495ae77986a9f8c1529ea
1 //===-- RISCVMCAsmInfo.cpp - RISCV Asm properties -------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the declarations of the RISCVMCAsmInfo properties.
11 //===----------------------------------------------------------------------===//
13 #include "RISCVMCAsmInfo.h"
14 #include "MCTargetDesc/RISCVMCExpr.h"
15 #include "llvm/ADT/Triple.h"
16 #include "llvm/BinaryFormat/Dwarf.h"
17 #include "llvm/MC/MCStreamer.h"
18 using namespace llvm;
20 void RISCVMCAsmInfo::anchor() {}
22 RISCVMCAsmInfo::RISCVMCAsmInfo(const Triple &TT) {
23 CodePointerSize = CalleeSaveStackSlotSize = TT.isArch64Bit() ? 8 : 4;
24 CommentString = "#";
25 AlignmentIsInBytes = false;
26 SupportsDebugInformation = true;
27 ExceptionsType = ExceptionHandling::DwarfCFI;
28 Data16bitsDirective = "\t.half\t";
29 Data32bitsDirective = "\t.word\t";
32 const MCExpr *RISCVMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
33 unsigned Encoding,
34 MCStreamer &Streamer) const {
35 if (!(Encoding & dwarf::DW_EH_PE_pcrel))
36 return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
38 // The default symbol subtraction results in an ADD/SUB relocation pair.
39 // Processing this relocation pair is problematic when linker relaxation is
40 // enabled, so we follow binutils in using the R_RISCV_32_PCREL relocation
41 // for the FDE initial location.
42 MCContext &Ctx = Streamer.getContext();
43 const MCExpr *ME =
44 MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
45 assert(Encoding & dwarf::DW_EH_PE_sdata4 && "Unexpected encoding");
46 return RISCVMCExpr::create(ME, RISCVMCExpr::VK_RISCV_32_PCREL, Ctx);