//===- IntrinsicsSystemZ.td - Defines SystemZ intrinsics ---*- tablegen -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines all of the SystemZ-specific intrinsics. // //===----------------------------------------------------------------------===// class SystemZUnaryConv : ClangBuiltin<"__builtin_s390_" # name>, Intrinsic<[result], [arg], [IntrNoMem]>; class SystemZUnary : SystemZUnaryConv; class SystemZUnaryConvCC : Intrinsic<[result, llvm_i32_ty], [arg], [IntrNoMem]>; class SystemZUnaryCC : SystemZUnaryConvCC; class SystemZBinaryConv : ClangBuiltin<"__builtin_s390_" # name>, Intrinsic<[result], [arg, arg], [IntrNoMem]>; class SystemZBinary : SystemZBinaryConv; class SystemZBinaryInt : ClangBuiltin<"__builtin_s390_" # name>, Intrinsic<[type], [type, llvm_i32_ty], [IntrNoMem]>; class SystemZBinaryConvCC : Intrinsic<[result, llvm_i32_ty], [arg, arg], [IntrNoMem]>; class SystemZBinaryConvIntCC : Intrinsic<[result, llvm_i32_ty], [arg, llvm_i32_ty], [IntrNoMem, ImmArg>]>; class SystemZBinaryCC : SystemZBinaryConvCC; class SystemZTernaryConv : ClangBuiltin<"__builtin_s390_" # name>, Intrinsic<[result], [arg, arg, result], [IntrNoMem]>; class SystemZTernaryConvCC : Intrinsic<[result, llvm_i32_ty], [arg, arg, result], [IntrNoMem]>; class SystemZTernary : SystemZTernaryConv; class SystemZTernaryInt : ClangBuiltin<"__builtin_s390_" # name>, Intrinsic<[type], [type, type, llvm_i32_ty], [IntrNoMem, ImmArg>]>; class SystemZTernaryIntCC : Intrinsic<[type, llvm_i32_ty], [type, type, llvm_i32_ty], [IntrNoMem, ImmArg>]>; class SystemZQuaternaryInt : ClangBuiltin<"__builtin_s390_" # name>, Intrinsic<[type], [type, type, type, llvm_i32_ty], [IntrNoMem, ImmArg>]>; class SystemZQuaternaryIntCC : Intrinsic<[type, llvm_i32_ty], [type, type, type, llvm_i32_ty], [IntrNoMem, ImmArg>]>; multiclass SystemZUnaryExtBHF { def b : SystemZUnaryConv; def h : SystemZUnaryConv; def f : SystemZUnaryConv; } multiclass SystemZUnaryExtBHWF { def b : SystemZUnaryConv; def hw : SystemZUnaryConv; def f : SystemZUnaryConv; } multiclass SystemZUnaryBHF { def b : SystemZUnary; def h : SystemZUnary; def f : SystemZUnary; } multiclass SystemZUnaryBHFG : SystemZUnaryBHF { def g : SystemZUnary; } multiclass SystemZUnaryCCBHF { def bs : SystemZUnaryCC; def hs : SystemZUnaryCC; def fs : SystemZUnaryCC; } multiclass SystemZBinaryTruncHFG { def h : SystemZBinaryConv; def f : SystemZBinaryConv; def g : SystemZBinaryConv; } multiclass SystemZBinaryTruncCCHFG { def hs : SystemZBinaryConvCC; def fs : SystemZBinaryConvCC; def gs : SystemZBinaryConvCC; } multiclass SystemZBinaryExtBHF { def b : SystemZBinaryConv; def h : SystemZBinaryConv; def f : SystemZBinaryConv; } multiclass SystemZBinaryExtBHFG : SystemZBinaryExtBHF { def g : SystemZBinaryConv; } multiclass SystemZBinaryBHF { def b : SystemZBinary; def h : SystemZBinary; def f : SystemZBinary; } multiclass SystemZBinaryBHFG : SystemZBinaryBHF { def g : SystemZBinary; } multiclass SystemZBinaryIntBHFG { def b : SystemZBinaryInt; def h : SystemZBinaryInt; def f : SystemZBinaryInt; def g : SystemZBinaryInt; } multiclass SystemZBinaryCCBHF { def bs : SystemZBinaryCC; def hs : SystemZBinaryCC; def fs : SystemZBinaryCC; } multiclass SystemZCompareBHFG { def bs : SystemZBinaryCC; def hs : SystemZBinaryCC; def fs : SystemZBinaryCC; def gs : SystemZBinaryCC; } multiclass SystemZTernaryExtBHF { def b : SystemZTernaryConv; def h : SystemZTernaryConv; def f : SystemZTernaryConv; } multiclass SystemZTernaryExtBHFG : SystemZTernaryExtBHF { def g : SystemZTernaryConv; } multiclass SystemZTernaryBHF { def b : SystemZTernary; def h : SystemZTernary; def f : SystemZTernary; } multiclass SystemZTernaryIntBHF { def b : SystemZTernaryInt; def h : SystemZTernaryInt; def f : SystemZTernaryInt; } multiclass SystemZTernaryIntCCBHF { def bs : SystemZTernaryIntCC; def hs : SystemZTernaryIntCC; def fs : SystemZTernaryIntCC; } multiclass SystemZQuaternaryIntBHF { def b : SystemZQuaternaryInt; def h : SystemZQuaternaryInt; def f : SystemZQuaternaryInt; } multiclass SystemZQuaternaryIntBHFG : SystemZQuaternaryIntBHF { def g : SystemZQuaternaryInt; } multiclass SystemZQuaternaryIntCCBHF { def bs : SystemZQuaternaryIntCC; def hs : SystemZQuaternaryIntCC; def fs : SystemZQuaternaryIntCC; } //===----------------------------------------------------------------------===// // // Transactional-execution intrinsics // //===----------------------------------------------------------------------===// let TargetPrefix = "s390" in { def int_s390_tbegin : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrNoDuplicate, IntrWriteMem]>; def int_s390_tbegin_nofloat : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrNoDuplicate, IntrWriteMem]>; def int_s390_tbeginc : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrNoDuplicate, IntrWriteMem]>; def int_s390_tabort : Intrinsic<[], [llvm_i64_ty], [IntrNoReturn, Throws, IntrWriteMem]>; def int_s390_tend : ClangBuiltin<"__builtin_tend">, Intrinsic<[llvm_i32_ty], []>; def int_s390_etnd : ClangBuiltin<"__builtin_tx_nesting_depth">, Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>; def int_s390_ntstg : Intrinsic<[], [llvm_i64_ty, llvm_ptr64_ty], [IntrArgMemOnly, IntrWriteMem]>; def int_s390_ppa_txassist : ClangBuiltin<"__builtin_tx_assist">, Intrinsic<[], [llvm_i32_ty]>; } //===----------------------------------------------------------------------===// // // Vector intrinsics // //===----------------------------------------------------------------------===// let TargetPrefix = "s390" in { def int_s390_lcbb : ClangBuiltin<"__builtin_s390_lcbb">, Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vlbb : ClangBuiltin<"__builtin_s390_vlbb">, Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrReadMem, IntrArgMemOnly, ImmArg>]>; def int_s390_vll : ClangBuiltin<"__builtin_s390_vll">, Intrinsic<[llvm_v16i8_ty], [llvm_i32_ty, llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>; def int_s390_vpdi : ClangBuiltin<"__builtin_s390_vpdi">, Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vperm : ClangBuiltin<"__builtin_s390_vperm">, Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>; defm int_s390_vpks : SystemZBinaryTruncHFG<"vpks">; defm int_s390_vpks : SystemZBinaryTruncCCHFG; defm int_s390_vpkls : SystemZBinaryTruncHFG<"vpkls">; defm int_s390_vpkls : SystemZBinaryTruncCCHFG; def int_s390_vstl : ClangBuiltin<"__builtin_s390_vstl">, Intrinsic<[], [llvm_v16i8_ty, llvm_i32_ty, llvm_ptr_ty], [IntrArgMemOnly, IntrWriteMem]>; defm int_s390_vupl : SystemZUnaryExtBHWF<"vupl">; defm int_s390_vupll : SystemZUnaryExtBHF<"vupll">; defm int_s390_vuph : SystemZUnaryExtBHF<"vuph">; defm int_s390_vuplh : SystemZUnaryExtBHF<"vuplh">; defm int_s390_vacc : SystemZBinaryBHFG<"vacc">; def int_s390_vaq : SystemZBinary<"vaq", llvm_v16i8_ty>; def int_s390_vacq : SystemZTernary<"vacq", llvm_v16i8_ty>; def int_s390_vaccq : SystemZBinary<"vaccq", llvm_v16i8_ty>; def int_s390_vacccq : SystemZTernary<"vacccq", llvm_v16i8_ty>; defm int_s390_vavg : SystemZBinaryBHFG<"vavg">; defm int_s390_vavgl : SystemZBinaryBHFG<"vavgl">; def int_s390_vcksm : SystemZBinary<"vcksm", llvm_v4i32_ty>; defm int_s390_vgfm : SystemZBinaryExtBHFG<"vgfm">; defm int_s390_vgfma : SystemZTernaryExtBHFG<"vgfma">; defm int_s390_vmah : SystemZTernaryBHF<"vmah">; defm int_s390_vmalh : SystemZTernaryBHF<"vmalh">; defm int_s390_vmae : SystemZTernaryExtBHF<"vmae">; defm int_s390_vmale : SystemZTernaryExtBHF<"vmale">; defm int_s390_vmao : SystemZTernaryExtBHF<"vmao">; defm int_s390_vmalo : SystemZTernaryExtBHF<"vmalo">; defm int_s390_vmh : SystemZBinaryBHF<"vmh">; defm int_s390_vmlh : SystemZBinaryBHF<"vmlh">; defm int_s390_vme : SystemZBinaryExtBHF<"vme">; defm int_s390_vmle : SystemZBinaryExtBHF<"vmle">; defm int_s390_vmo : SystemZBinaryExtBHF<"vmo">; defm int_s390_vmlo : SystemZBinaryExtBHF<"vmlo">; defm int_s390_verllv : SystemZBinaryBHFG<"verllv">; defm int_s390_verll : SystemZBinaryIntBHFG<"verll">; defm int_s390_verim : SystemZQuaternaryIntBHFG<"verim">; def int_s390_vsl : SystemZBinary<"vsl", llvm_v16i8_ty>; def int_s390_vslb : SystemZBinary<"vslb", llvm_v16i8_ty>; def int_s390_vsra : SystemZBinary<"vsra", llvm_v16i8_ty>; def int_s390_vsrab : SystemZBinary<"vsrab", llvm_v16i8_ty>; def int_s390_vsrl : SystemZBinary<"vsrl", llvm_v16i8_ty>; def int_s390_vsrlb : SystemZBinary<"vsrlb", llvm_v16i8_ty>; def int_s390_vsldb : ClangBuiltin<"__builtin_s390_vsldb">, Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; defm int_s390_vscbi : SystemZBinaryBHFG<"vscbi">; def int_s390_vsq : SystemZBinary<"vsq", llvm_v16i8_ty>; def int_s390_vsbiq : SystemZTernary<"vsbiq", llvm_v16i8_ty>; def int_s390_vscbiq : SystemZBinary<"vscbiq", llvm_v16i8_ty>; def int_s390_vsbcbiq : SystemZTernary<"vsbcbiq", llvm_v16i8_ty>; def int_s390_vsumb : SystemZBinaryConv<"vsumb", llvm_v4i32_ty, llvm_v16i8_ty>; def int_s390_vsumh : SystemZBinaryConv<"vsumh", llvm_v4i32_ty, llvm_v8i16_ty>; def int_s390_vsumgh : SystemZBinaryConv<"vsumgh", llvm_v2i64_ty, llvm_v8i16_ty>; def int_s390_vsumgf : SystemZBinaryConv<"vsumgf", llvm_v2i64_ty, llvm_v4i32_ty>; def int_s390_vsumqf : SystemZBinaryConv<"vsumqf", llvm_v16i8_ty, llvm_v4i32_ty>; def int_s390_vsumqg : SystemZBinaryConv<"vsumqg", llvm_v16i8_ty, llvm_v2i64_ty>; def int_s390_vtm : SystemZBinaryConv<"vtm", llvm_i32_ty, llvm_v16i8_ty>; defm int_s390_vceq : SystemZCompareBHFG; defm int_s390_vch : SystemZCompareBHFG; defm int_s390_vchl : SystemZCompareBHFG; defm int_s390_vfae : SystemZTernaryIntBHF<"vfae">; defm int_s390_vfae : SystemZTernaryIntCCBHF; defm int_s390_vfaez : SystemZTernaryIntBHF<"vfaez">; defm int_s390_vfaez : SystemZTernaryIntCCBHF; defm int_s390_vfee : SystemZBinaryBHF<"vfee">; defm int_s390_vfee : SystemZBinaryCCBHF; defm int_s390_vfeez : SystemZBinaryBHF<"vfeez">; defm int_s390_vfeez : SystemZBinaryCCBHF; defm int_s390_vfene : SystemZBinaryBHF<"vfene">; defm int_s390_vfene : SystemZBinaryCCBHF; defm int_s390_vfenez : SystemZBinaryBHF<"vfenez">; defm int_s390_vfenez : SystemZBinaryCCBHF; defm int_s390_vistr : SystemZUnaryBHF<"vistr">; defm int_s390_vistr : SystemZUnaryCCBHF; defm int_s390_vstrc : SystemZQuaternaryIntBHF<"vstrc">; defm int_s390_vstrc : SystemZQuaternaryIntCCBHF; defm int_s390_vstrcz : SystemZQuaternaryIntBHF<"vstrcz">; defm int_s390_vstrcz : SystemZQuaternaryIntCCBHF; def int_s390_vfcedbs : SystemZBinaryConvCC; def int_s390_vfchdbs : SystemZBinaryConvCC; def int_s390_vfchedbs : SystemZBinaryConvCC; def int_s390_vftcidb : SystemZBinaryConvIntCC; def int_s390_vfidb : Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoMem, ImmArg>, ImmArg>]>; // Instructions from the Vector Enhancements Facility 1 def int_s390_vbperm : SystemZBinaryConv<"vbperm", llvm_v2i64_ty, llvm_v16i8_ty>; def int_s390_vmslg : ClangBuiltin<"__builtin_s390_vmslg">, Intrinsic<[llvm_v16i8_ty], [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vfmaxdb : Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vfmindb : Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vfmaxsb : Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vfminsb : Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vfcesbs : SystemZBinaryConvCC; def int_s390_vfchsbs : SystemZBinaryConvCC; def int_s390_vfchesbs : SystemZBinaryConvCC; def int_s390_vftcisb : SystemZBinaryConvIntCC; def int_s390_vfisb : Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoMem, ImmArg>, ImmArg>]>; // Instructions from the Vector Packed Decimal Facility def int_s390_vlrl : ClangBuiltin<"__builtin_s390_vlrl">, Intrinsic<[llvm_v16i8_ty], [llvm_i32_ty, llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>; def int_s390_vstrl : ClangBuiltin<"__builtin_s390_vstrl">, Intrinsic<[], [llvm_v16i8_ty, llvm_i32_ty, llvm_ptr_ty], [IntrArgMemOnly, IntrWriteMem]>; // Instructions from the Vector Enhancements Facility 2 def int_s390_vsld : ClangBuiltin<"__builtin_s390_vsld">, Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vsrd : ClangBuiltin<"__builtin_s390_vsrd">, Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vstrsb : SystemZTernaryConvCC; def int_s390_vstrsh : SystemZTernaryConvCC; def int_s390_vstrsf : SystemZTernaryConvCC; def int_s390_vstrszb : SystemZTernaryConvCC; def int_s390_vstrszh : SystemZTernaryConvCC; def int_s390_vstrszf : SystemZTernaryConvCC; // Instructions from the NNP-assist Facility def int_s390_vclfnhs : ClangBuiltin<"__builtin_s390_vclfnhs">, Intrinsic<[llvm_v4f32_ty], [llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vclfnls : ClangBuiltin<"__builtin_s390_vclfnls">, Intrinsic<[llvm_v4f32_ty], [llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vcrnfs : ClangBuiltin<"__builtin_s390_vcrnfs">, Intrinsic<[llvm_v8i16_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vcfn : ClangBuiltin<"__builtin_s390_vcfn">, Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; def int_s390_vcnf : ClangBuiltin<"__builtin_s390_vcnf">, Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem, ImmArg>]>; } //===----------------------------------------------------------------------===// // // Misc intrinsics // //===----------------------------------------------------------------------===// let TargetPrefix = "s390" in { def int_s390_sfpc : ClangBuiltin<"__builtin_s390_sfpc">, Intrinsic<[], [llvm_i32_ty], []>; def int_s390_efpc : ClangBuiltin<"__builtin_s390_efpc">, Intrinsic<[llvm_i32_ty], [], []>; def int_s390_tdc : Intrinsic<[llvm_i32_ty], [llvm_anyfloat_ty, llvm_i64_ty], [IntrNoMem]>; }