[llvm-dev] Complex proposal v2

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 3 08:59:57 PDT 2019


> -----Original Message-----
> From: David Greene <dag at cray.com>
> Sent: Tuesday, September 3, 2019 9:43 AM
> To: Krzysztof Parzyszek <kparzysz at quicinc.com>; llvm-dev at lists.llvm.org
> Subject: [EXT] Re: [llvm-dev] Complex proposal v2
>
> [...]
> Do you mean return a struct containing two vectors or something else?
> If a struct, we'd have to define a new built-in struct type then, right?
> Are there other examples of intrinsics (or instructions) that return pairs?
>
> I agree that a single intrinsic would be better.  I couldn't think of a good
> way to do it though.

Yes, that's what I meant.

Hexagon has a few intrinsics that return multiple values:

multiclass Hexagon_custom_circ_ld_Intrinsic<LLVMType ElTy> {
  def NAME#_pci : Hexagon_NonGCC_Intrinsic<
    [ElTy, llvm_ptr_ty],
    [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty],
    [IntrArgMemOnly, NoCapture<3>]>;
  def NAME#_pcr : Hexagon_NonGCC_Intrinsic<
    [ElTy, llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_ptr_ty],
    [IntrArgMemOnly, NoCapture<2>]>;
}

(see include/llvm/IR/IntrinsicsHexagon.td)

In C/C++ they are expressed as taking extra parameters (Tools/clang/test/CodeGen/builtins-hexagon-circ.c).  I think it could work for vectors as well (if they can't be declared as returning a struct outright).

-Krzysztof



More information about the llvm-dev mailing list