From: Colin LeMahieu Date: Tue, 3 Feb 2015 19:15:11 +0000 (+0000) Subject: [Hexagon] Adding missing vector multiply instruction encodings. Converting multiply... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6217146dce813640056927011f97ad2590ba9a4a;p=oota-llvm.git [Hexagon] Adding missing vector multiply instruction encodings. Converting multiply intrinsics and updating tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228010 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/HexagonInstrInfo.td b/lib/Target/Hexagon/HexagonInstrInfo.td index b415bf88627..6b8bc766983 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.td +++ b/lib/Target/Hexagon/HexagonInstrInfo.td @@ -2862,6 +2862,10 @@ def A2_vrsadub: T_XTYPE_Vect <"vrsadub", 0b010, 0b010, 0>; def A2_vrsadub_acc: T_XTYPE_Vect_acc <"vrsadub", 0b010, 0b010, 0>; } +// Vector absolute difference words: Rdd=vabsdiffw(Rtt,Rss) +let isCodeGenOnly = 0 in +def M2_vabsdiffw: T_XTYPE_Vect_diff<0b001, "vabsdiffw">; + // Vector absolute difference: Rdd=vabsdiffh(Rtt,Rss) let isCodeGenOnly = 0 in def M2_vabsdiffh: T_XTYPE_Vect_diff<0b011, "vabsdiffh">; @@ -2951,6 +2955,22 @@ def M2_mmachs_rs1: T_M2_vmpy_acc_sat <"vmpywoh", 0b101, 0b111, 1, 1>; def M2_mmachs_rs0: T_M2_vmpy_acc_sat <"vmpywoh", 0b001, 0b111, 0, 1>; } +// Vector multiply word by unsigned half with accumulation +// Rxx+=vmpyw[eo]uh(Rss,Rtt)[:<<1][:rnd]:sat +let isCodeGenOnly = 0 in { +def M2_mmaculs_s1: T_M2_vmpy_acc_sat <"vmpyweuh", 0b110, 0b101, 1, 0>; +def M2_mmaculs_s0: T_M2_vmpy_acc_sat <"vmpyweuh", 0b010, 0b101, 0, 0>; +def M2_mmaculs_rs1: T_M2_vmpy_acc_sat <"vmpyweuh", 0b111, 0b101, 1, 1>; +def M2_mmaculs_rs0: T_M2_vmpy_acc_sat <"vmpyweuh", 0b011, 0b101, 0, 1>; +} + +let isCodeGenOnly = 0 in { +def M2_mmacuhs_s1: T_M2_vmpy_acc_sat <"vmpywouh", 0b110, 0b111, 1, 0>; +def M2_mmacuhs_s0: T_M2_vmpy_acc_sat <"vmpywouh", 0b010, 0b111, 0, 0>; +def M2_mmacuhs_rs1: T_M2_vmpy_acc_sat <"vmpywouh", 0b111, 0b111, 1, 1>; +def M2_mmacuhs_rs0: T_M2_vmpy_acc_sat <"vmpywouh", 0b011, 0b111, 0, 1>; +} + // Vector multiply even halfwords with accumulation // Rxx+=vmpyeh(Rss,Rtt)[:<<1][:sat] let isCodeGenOnly = 0 in { diff --git a/lib/Target/Hexagon/HexagonIntrinsics.td b/lib/Target/Hexagon/HexagonIntrinsics.td index 419c21e309f..8f3171719a6 100644 --- a/lib/Target/Hexagon/HexagonIntrinsics.td +++ b/lib/Target/Hexagon/HexagonIntrinsics.td @@ -345,6 +345,52 @@ def : T_PP_pat ; def : T_PP_pat ; def : T_PP_pat ; +// Vector dual multiply: Rdd=vdmpy(Rss,Rtt)[:<<1]:sat +def : T_PP_pat ; +def : T_PP_pat ; + +// Vector multiply even halfwords: Rdd=vmpyeh(Rss,Rtt)[:<<1]:sat +def : T_PP_pat ; +def : T_PP_pat ; + +//Rdd=vmpywoh(Rss,Rtt)[:<<1][:rnd]:sat +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +//Rdd=vmpyweh(Rss,Rtt)[:<<1][:rnd]:sat +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +//Rdd=vmpywouh(Rss,Rtt)[:<<1][:rnd]:sat +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +//Rdd=vmpyweuh(Rss,Rtt)[:<<1][:rnd]:sat +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// Vector reduce add unsigned bytes: Rdd32[+]=vrmpybu(Rss32,Rtt32) +def : T_PP_pat ; +def : T_PPP_pat ; + +// Vector sum of absolute differences unsigned bytes: Rdd=vrsadub(Rss,Rtt) +def : T_PP_pat ; +def : T_PPP_pat ; + +// Vector absolute difference: Rdd=vabsdiffh(Rtt,Rss) +def : T_PP_pat ; + +// Vector absolute difference words: Rdd=vabsdiffw(Rtt,Rss) +def : T_PP_pat ; + // Vector reduce complex multiply real or imaginary: // Rdd[+]=vrcmpy[ir](Rss,Rtt[*]) def : T_PP_pat ; @@ -362,6 +408,43 @@ def : T_PPP_pat ; def : T_PP_pat ; def : T_PPP_pat ; +//===----------------------------------------------------------------------===// +// Vector Multipy with accumulation +//===----------------------------------------------------------------------===// + +// Vector multiply word by signed half with accumulation +// Rxx+=vmpyw[eo]h(Rss,Rtt)[:<<1][:rnd]:sat +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; + +// Vector multiply word by unsigned half with accumulation +// Rxx+=vmpyw[eo]uh(Rss,Rtt)[:<<1][:rnd]:sat +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; + +// Vector multiply even halfwords with accumulation +// Rxx+=vmpyeh(Rss,Rtt)[:<<1][:sat] +def : T_PPP_pat ; +def : T_PPP_pat ; +def : T_PPP_pat ; + +// Vector dual multiply with accumulation +// Rxx+=vdmpy(Rss,Rtt)[:sat] +def : T_PPP_pat ; +def : T_PPP_pat ; + // Vector complex multiply real or imaginary with accumulation // Rxx+=vcmpy[ir](Rss,Rtt):sat def : T_PPP_pat ; @@ -784,6 +867,11 @@ def : T_RR_pat ; def : T_RR_pat ; def : T_RR_pat ; +// Vector multiply halfwords +// Rdd=vmpyh(Rs,Rt)[:<<1]:sat +def : T_RR_pat ; +def : T_RR_pat ; + // Rxx[+-]= mpy[u](Rs,Rt) def : T_PRR_pat ; def : T_PRR_pat ; @@ -806,6 +894,11 @@ def : T_PRR_pat ; def : T_PRR_pat ; def : T_PRR_pat ; +// Rxx+=vmpyh(Rs,Rt)[:<<1][:sat] +def : T_PRR_pat ; +def : T_PRR_pat ; +def : T_PRR_pat ; + /******************************************************************** * CR * *********************************************************************/ @@ -848,6 +941,19 @@ class MType_R32_pat : Pat <(IntID IntRegs:$src1, IntRegs:$src2), (OutputInst IntRegs:$src1, IntRegs:$src2)>; +// Vector dual multiply with round and pack + +def : Pat <(int_hexagon_M2_vdmpyrs_s0 DoubleRegs:$src1, DoubleRegs:$src2), + (M2_vdmpyrs_s0 DoubleRegs:$src1, DoubleRegs:$src2)>; + +def : Pat <(int_hexagon_M2_vdmpyrs_s1 DoubleRegs:$src1, DoubleRegs:$src2), + (M2_vdmpyrs_s1 DoubleRegs:$src1, DoubleRegs:$src2)>; + +// Vector multiply halfwords with round and pack + +def : MType_R32_pat ; +def : MType_R32_pat ; + // Multiply and use lower result def : MType_R32_pat ; def : T_RI_pat; @@ -946,6 +1052,15 @@ def: T_RR_pat; def: T_RI_pat; def: T_RR_pat; +/******************************************************************** +* STYPE/COMPLEX * +*********************************************************************/ +// Vector Complex conjugate +def : T_P_pat ; + +// Vector Complex rotate +def : T_PR_pat ; + /******************************************************************** * STYPE/SHIFT * *********************************************************************/ @@ -1542,191 +1657,6 @@ class di_LDInstPI_diu4 [], "$src1 = $dst">; - -// ALU64 / VB / Vector maximum/minimum unsigned bytes. -def HEXAGON_A2_vmaxub: - di_ALU64_didi <"vmaxub", int_hexagon_A2_vmaxub>; -def HEXAGON_A2_vminub: - di_ALU64_didi <"vminub", int_hexagon_A2_vminub>; - -// ALU64 / VB / Vector subtract unsigned bytes. -def HEXAGON_A2_vsubub: - di_ALU64_didi <"vsubub", int_hexagon_A2_vsubub>; -def HEXAGON_A2_vsububs: - di_ALU64_didi_sat <"vsubub", int_hexagon_A2_vsububs>; - -/******************************************************************** -* MTYPE/ALU * -*********************************************************************/ - -// MTYPE / ALU / Vector absolute difference. -def HEXAGON_M2_vabsdiffh: - di_MInst_didi <"vabsdiffh",int_hexagon_M2_vabsdiffh>; -def HEXAGON_M2_vabsdiffw: - di_MInst_didi <"vabsdiffw",int_hexagon_M2_vabsdiffw>; - -/******************************************************************** -* MTYPE/MPYH * -*********************************************************************/ - -// MTYPE / MPYH / Multiply word by half (32x16). -//Rdd[+]=vmpywoh(Rss,Rtt)[:<<1][:rnd][:sat] -//Rdd[+]=vmpyweh(Rss,Rtt)[:<<1][:rnd][:sat] -def HEXAGON_M2_mmpyl_rs1: - di_MInst_didi_s1_rnd_sat <"vmpyweh", int_hexagon_M2_mmpyl_rs1>; -def HEXAGON_M2_mmpyl_s1: - di_MInst_didi_s1_sat <"vmpyweh", int_hexagon_M2_mmpyl_s1>; -def HEXAGON_M2_mmpyl_rs0: - di_MInst_didi_rnd_sat <"vmpyweh", int_hexagon_M2_mmpyl_rs0>; -def HEXAGON_M2_mmpyl_s0: - di_MInst_didi_sat <"vmpyweh", int_hexagon_M2_mmpyl_s0>; -def HEXAGON_M2_mmpyh_rs1: - di_MInst_didi_s1_rnd_sat <"vmpywoh", int_hexagon_M2_mmpyh_rs1>; -def HEXAGON_M2_mmpyh_s1: - di_MInst_didi_s1_sat <"vmpywoh", int_hexagon_M2_mmpyh_s1>; -def HEXAGON_M2_mmpyh_rs0: - di_MInst_didi_rnd_sat <"vmpywoh", int_hexagon_M2_mmpyh_rs0>; -def HEXAGON_M2_mmpyh_s0: - di_MInst_didi_sat <"vmpywoh", int_hexagon_M2_mmpyh_s0>; -def HEXAGON_M2_mmacls_rs1: - di_MInst_dididi_acc_s1_rnd_sat <"vmpyweh", int_hexagon_M2_mmacls_rs1>; -def HEXAGON_M2_mmacls_s1: - di_MInst_dididi_acc_s1_sat <"vmpyweh", int_hexagon_M2_mmacls_s1>; -def HEXAGON_M2_mmacls_rs0: - di_MInst_dididi_acc_rnd_sat <"vmpyweh", int_hexagon_M2_mmacls_rs0>; -def HEXAGON_M2_mmacls_s0: - di_MInst_dididi_acc_sat <"vmpyweh", int_hexagon_M2_mmacls_s0>; -def HEXAGON_M2_mmachs_rs1: - di_MInst_dididi_acc_s1_rnd_sat <"vmpywoh", int_hexagon_M2_mmachs_rs1>; -def HEXAGON_M2_mmachs_s1: - di_MInst_dididi_acc_s1_sat <"vmpywoh", int_hexagon_M2_mmachs_s1>; -def HEXAGON_M2_mmachs_rs0: - di_MInst_dididi_acc_rnd_sat <"vmpywoh", int_hexagon_M2_mmachs_rs0>; -def HEXAGON_M2_mmachs_s0: - di_MInst_dididi_acc_sat <"vmpywoh", int_hexagon_M2_mmachs_s0>; - -// MTYPE / MPYH / Multiply word by unsigned half (32x16). -//Rdd[+]=vmpywouh(Rss,Rtt)[:<<1][:rnd][:sat] -//Rdd[+]=vmpyweuh(Rss,Rtt)[:<<1][:rnd][:sat] -def HEXAGON_M2_mmpyul_rs1: - di_MInst_didi_s1_rnd_sat <"vmpyweuh", int_hexagon_M2_mmpyul_rs1>; -def HEXAGON_M2_mmpyul_s1: - di_MInst_didi_s1_sat <"vmpyweuh", int_hexagon_M2_mmpyul_s1>; -def HEXAGON_M2_mmpyul_rs0: - di_MInst_didi_rnd_sat <"vmpyweuh", int_hexagon_M2_mmpyul_rs0>; -def HEXAGON_M2_mmpyul_s0: - di_MInst_didi_sat <"vmpyweuh", int_hexagon_M2_mmpyul_s0>; -def HEXAGON_M2_mmpyuh_rs1: - di_MInst_didi_s1_rnd_sat <"vmpywouh", int_hexagon_M2_mmpyuh_rs1>; -def HEXAGON_M2_mmpyuh_s1: - di_MInst_didi_s1_sat <"vmpywouh", int_hexagon_M2_mmpyuh_s1>; -def HEXAGON_M2_mmpyuh_rs0: - di_MInst_didi_rnd_sat <"vmpywouh", int_hexagon_M2_mmpyuh_rs0>; -def HEXAGON_M2_mmpyuh_s0: - di_MInst_didi_sat <"vmpywouh", int_hexagon_M2_mmpyuh_s0>; -def HEXAGON_M2_mmaculs_rs1: - di_MInst_dididi_acc_s1_rnd_sat <"vmpyweuh", int_hexagon_M2_mmaculs_rs1>; -def HEXAGON_M2_mmaculs_s1: - di_MInst_dididi_acc_s1_sat <"vmpyweuh", int_hexagon_M2_mmaculs_s1>; -def HEXAGON_M2_mmaculs_rs0: - di_MInst_dididi_acc_rnd_sat <"vmpyweuh", int_hexagon_M2_mmaculs_rs0>; -def HEXAGON_M2_mmaculs_s0: - di_MInst_dididi_acc_sat <"vmpyweuh", int_hexagon_M2_mmaculs_s0>; -def HEXAGON_M2_mmacuhs_rs1: - di_MInst_dididi_acc_s1_rnd_sat <"vmpywouh", int_hexagon_M2_mmacuhs_rs1>; -def HEXAGON_M2_mmacuhs_s1: - di_MInst_dididi_acc_s1_sat <"vmpywouh", int_hexagon_M2_mmacuhs_s1>; -def HEXAGON_M2_mmacuhs_rs0: - di_MInst_dididi_acc_rnd_sat <"vmpywouh", int_hexagon_M2_mmacuhs_rs0>; -def HEXAGON_M2_mmacuhs_s0: - di_MInst_dididi_acc_sat <"vmpywouh", int_hexagon_M2_mmacuhs_s0>; - -/******************************************************************** -* MTYPE/VB * -*********************************************************************/ - -// MTYPE / VB / Vector reduce add unsigned bytes. -def HEXAGON_A2_vraddub: - di_MInst_didi <"vraddub", int_hexagon_A2_vraddub>; -def HEXAGON_A2_vraddub_acc: - di_MInst_dididi_acc <"vraddub", int_hexagon_A2_vraddub_acc>; - -// MTYPE / VB / Vector sum of absolute differences unsigned bytes. -def HEXAGON_A2_vrsadub: - di_MInst_didi <"vrsadub", int_hexagon_A2_vrsadub>; -def HEXAGON_A2_vrsadub_acc: - di_MInst_dididi_acc <"vrsadub", int_hexagon_A2_vrsadub_acc>; - -/******************************************************************** -* MTYPE/VH * -*********************************************************************/ - -// MTYPE / VH / Vector dual multiply. -def HEXAGON_M2_vdmpys_s1: - di_MInst_didi_s1_sat <"vdmpy", int_hexagon_M2_vdmpys_s1>; -def HEXAGON_M2_vdmpys_s0: - di_MInst_didi_sat <"vdmpy", int_hexagon_M2_vdmpys_s0>; -def HEXAGON_M2_vdmacs_s1: - di_MInst_dididi_acc_s1_sat <"vdmpy", int_hexagon_M2_vdmacs_s1>; -def HEXAGON_M2_vdmacs_s0: - di_MInst_dididi_acc_sat <"vdmpy", int_hexagon_M2_vdmacs_s0>; - -// MTYPE / VH / Vector dual multiply with round and pack. -def HEXAGON_M2_vdmpyrs_s0: - si_MInst_didi_rnd_sat <"vdmpy", int_hexagon_M2_vdmpyrs_s0>; -def HEXAGON_M2_vdmpyrs_s1: - si_MInst_didi_s1_rnd_sat <"vdmpy", int_hexagon_M2_vdmpyrs_s1>; - -// MTYPE / VH / Vector multiply even halfwords. -def HEXAGON_M2_vmpy2es_s1: - di_MInst_didi_s1_sat <"vmpyeh", int_hexagon_M2_vmpy2es_s1>; -def HEXAGON_M2_vmpy2es_s0: - di_MInst_didi_sat <"vmpyeh", int_hexagon_M2_vmpy2es_s0>; -def HEXAGON_M2_vmac2es: - di_MInst_dididi_acc <"vmpyeh", int_hexagon_M2_vmac2es>; -def HEXAGON_M2_vmac2es_s1: - di_MInst_dididi_acc_s1_sat <"vmpyeh", int_hexagon_M2_vmac2es_s1>; -def HEXAGON_M2_vmac2es_s0: - di_MInst_dididi_acc_sat <"vmpyeh", int_hexagon_M2_vmac2es_s0>; - -// MTYPE / VH / Vector multiply halfwords. -def HEXAGON_M2_vmpy2s_s0: - di_MInst_sisi_sat <"vmpyh", int_hexagon_M2_vmpy2s_s0>; -def HEXAGON_M2_vmpy2s_s1: - di_MInst_sisi_s1_sat <"vmpyh", int_hexagon_M2_vmpy2s_s1>; -def HEXAGON_M2_vmac2: - di_MInst_disisi_acc <"vmpyh", int_hexagon_M2_vmac2>; -def HEXAGON_M2_vmac2s_s0: - di_MInst_disisi_acc_sat <"vmpyh", int_hexagon_M2_vmac2s_s0>; -def HEXAGON_M2_vmac2s_s1: - di_MInst_disisi_acc_s1_sat <"vmpyh", int_hexagon_M2_vmac2s_s1>; - -// MTYPE / VH / Vector multiply halfwords with round and pack. -def HEXAGON_M2_vmpy2s_s0pack: - si_MInst_sisi_rnd_sat <"vmpyh", int_hexagon_M2_vmpy2s_s0pack>; -def HEXAGON_M2_vmpy2s_s1pack: - si_MInst_sisi_s1_rnd_sat <"vmpyh", int_hexagon_M2_vmpy2s_s1pack>; - -// MTYPE / VH / Vector reduce multiply halfwords. -// Rxx32+=vrmpyh(Rss32,Rtt32) -def HEXAGON_M2_vrmpy_s0: - di_MInst_didi <"vrmpyh", int_hexagon_M2_vrmpy_s0>; -def HEXAGON_M2_vrmac_s0: - di_MInst_dididi_acc <"vrmpyh", int_hexagon_M2_vrmac_s0>; - -/******************************************************************** -* STYPE/COMPLEX * -*********************************************************************/ - -// STYPE / COMPLEX / Vector Complex conjugate. -def HEXAGON_A2_vconj: - di_SInst_di_sat <"vconj", int_hexagon_A2_vconj>; - -// STYPE / COMPLEX / Vector Complex rotate. -def HEXAGON_S2_vcrotate: - di_SInst_disi <"vcrotate",int_hexagon_S2_vcrotate>; - - /******************************************************************** * STYPE/PERM * *********************************************************************/ diff --git a/lib/Target/Hexagon/HexagonIntrinsicsV4.td b/lib/Target/Hexagon/HexagonIntrinsicsV4.td index f93d0e8c540..556e19d2cc0 100644 --- a/lib/Target/Hexagon/HexagonIntrinsicsV4.td +++ b/lib/Target/Hexagon/HexagonIntrinsicsV4.td @@ -12,6 +12,38 @@ // 80-V9418-12 Rev. A // June 15, 2010 +// Vector reduce multiply word by signed half (32x16) +//Rdd=vrmpyweh(Rss,Rtt)[:<<1] +def : T_PP_pat ; +def : T_PP_pat ; + +//Rdd=vrmpywoh(Rss,Rtt)[:<<1] +def : T_PP_pat ; +def : T_PP_pat ; + +//Rdd+=vrmpyweh(Rss,Rtt)[:<<1] +def : T_PPP_pat ; +def : T_PPP_pat ; + +//Rdd=vrmpywoh(Rss,Rtt)[:<<1] +def : T_PPP_pat ; +def : T_PPP_pat ; + +// Vector multiply halfwords, signed by unsigned +// Rdd=vmpyhsu(Rs,Rt)[:<<1]:sat +def : T_RR_pat ; +def : T_RR_pat ; + +// Rxx+=vmpyhsu(Rs,Rt)[:<<1]:sat +def : T_PRR_pat ; +def : T_PRR_pat ; + +// Vector polynomial multiply halfwords +// Rdd=vpmpyh(Rs,Rt) +def : T_RR_pat ; +// Rxx[^]=vpmpyh(Rs,Rt) +def : T_PRR_pat ; + // Polynomial multiply words // Rdd=pmpyw(Rs,Rt) def : T_RR_pat ; diff --git a/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll b/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll index f9c93970894..5ed761a613f 100644 --- a/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll +++ b/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll @@ -37,6 +37,120 @@ define i32 @M4_mpyrr_addr(i32 %a, i32 %b, i32 %c) { } ; CHECK: r1 = add(r0, mpyi(r1, r2)) +; Vector multiply word by signed half (32x16) +declare i64 @llvm.hexagon.M2.mmpyl.s0(i64, i64) +define i64 @M2_mmpyl_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyl.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M2.mmpyl.s1(i64, i64) +define i64 @M2_mmpyl_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyl.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweh(r1:0, r3:2):<<1:sat + +declare i64 @llvm.hexagon.M2.mmpyh.s0(i64, i64) +define i64 @M2_mmpyh_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyh.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywoh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M2.mmpyh.s1(i64, i64) +define i64 @M2_mmpyh_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyh.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywoh(r1:0, r3:2):<<1:sat + +declare i64 @llvm.hexagon.M2.mmpyl.rs0(i64, i64) +define i64 @M2_mmpyl_rs0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyl.rs0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweh(r1:0, r3:2):rnd:sat + +declare i64 @llvm.hexagon.M2.mmpyl.rs1(i64, i64) +define i64 @M2_mmpyl_rs1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyl.rs1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweh(r1:0, r3:2):<<1:rnd:sat + +declare i64 @llvm.hexagon.M2.mmpyh.rs0(i64, i64) +define i64 @M2_mmpyh_rs0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyh.rs0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywoh(r1:0, r3:2):rnd:sat + +declare i64 @llvm.hexagon.M2.mmpyh.rs1(i64, i64) +define i64 @M2_mmpyh_rs1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyh.rs1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywoh(r1:0, r3:2):<<1:rnd:sat + +; Vector multiply word by unsigned half (32x16) +declare i64 @llvm.hexagon.M2.mmpyul.s0(i64, i64) +define i64 @M2_mmpyul_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyul.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweuh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M2.mmpyul.s1(i64, i64) +define i64 @M2_mmpyul_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyul.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweuh(r1:0, r3:2):<<1:sat + +declare i64 @llvm.hexagon.M2.mmpyuh.s0(i64, i64) +define i64 @M2_mmpyuh_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyuh.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywouh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M2.mmpyuh.s1(i64, i64) +define i64 @M2_mmpyuh_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyuh.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywouh(r1:0, r3:2):<<1:sat + +declare i64 @llvm.hexagon.M2.mmpyul.rs0(i64, i64) +define i64 @M2_mmpyul_rs0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyul.rs0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweuh(r1:0, r3:2):rnd:sat + +declare i64 @llvm.hexagon.M2.mmpyul.rs1(i64, i64) +define i64 @M2_mmpyul_rs1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyul.rs1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyweuh(r1:0, r3:2):<<1:rnd:sat + +declare i64 @llvm.hexagon.M2.mmpyuh.rs0(i64, i64) +define i64 @M2_mmpyuh_rs0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyuh.rs0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywouh(r1:0, r3:2):rnd:sat + +declare i64 @llvm.hexagon.M2.mmpyuh.rs1(i64, i64) +define i64 @M2_mmpyuh_rs1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.mmpyuh.rs1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpywouh(r1:0, r3:2):<<1:rnd:sat + ; Multiply signed halfwords declare i64 @llvm.hexagon.M2.mpyd.ll.s0(i32, i32) define i64 @M2_mpyd_ll_s0(i32 %a, i32 %b) { @@ -1006,6 +1120,63 @@ define i64 @M4_pmpyw_acc(i64 %a, i32 %b, i32 %c) { } ; CHECK: r1:0 ^= pmpyw(r2, r3) +; Vector reduce multiply word by signed half +declare i64 @llvm.hexagon.M4.vrmpyoh.s0(i64, i64) +define i64 @M4_vrmpyoh_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M4.vrmpyoh.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpywoh(r1:0, r3:2) + +declare i64 @llvm.hexagon.M4.vrmpyoh.s1(i64, i64) +define i64 @M4_vrmpyoh_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M4.vrmpyoh.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpywoh(r1:0, r3:2):<<1 + +declare i64 @llvm.hexagon.M4.vrmpyeh.s0(i64, i64) +define i64 @M4_vrmpyeh_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M4.vrmpyeh.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpyweh(r1:0, r3:2) + +declare i64 @llvm.hexagon.M4.vrmpyeh.s1(i64, i64) +define i64 @M4_vrmpyeh_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M4.vrmpyeh.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpyweh(r1:0, r3:2):<<1 + +declare i64 @llvm.hexagon.M4.vrmpyoh.acc.s0(i64, i64, i64) +define i64 @M4_vrmpyoh_acc_s0(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M4.vrmpyoh.acc.s0(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpywoh(r3:2, r5:4) + +declare i64 @llvm.hexagon.M4.vrmpyoh.acc.s1(i64, i64, i64) +define i64 @M4_vrmpyoh_acc_s1(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M4.vrmpyoh.acc.s1(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpywoh(r3:2, r5:4):<<1 + +declare i64 @llvm.hexagon.M4.vrmpyeh.acc.s0(i64, i64, i64) +define i64 @M4_vrmpyeh_acc_s0(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M4.vrmpyeh.acc.s0(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpyweh(r3:2, r5:4) + +declare i64 @llvm.hexagon.M4.vrmpyeh.acc.s1(i64, i64, i64) +define i64 @M4_vrmpyeh_acc_s1(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M4.vrmpyeh.acc.s1(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpyweh(r3:2, r5:4):<<1 + ; Multiply and use upper result declare i32 @llvm.hexagon.M2.dpmpyss.rnd.s0(i32, i32) define i32 @M2_dpmpyss_rnd_s0(i32 %a, i32 %b) { @@ -1133,3 +1304,222 @@ define i64 @M2_dpmpyuu_nac_s0(i64 %a, i32 %b, i32 %c) { ret i64 %z } ; CHECK: r1:0 -= mpyu(r2, r3) + +; Vector dual multiply +declare i64 @llvm.hexagon.M2.vdmpys.s0(i64, i64) +define i64 @M2_vdmpys_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vdmpys.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vdmpy(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M2.vdmpys.s1(i64, i64) +define i64 @M2_vdmpys_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vdmpys.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vdmpy(r1:0, r3:2):<<1:sat + +; Vector reduce multiply bytes +declare i64 @llvm.hexagon.M5.vrmpybuu(i64, i64) +define i64 @M5_vrmpybuu(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M5.vrmpybuu(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpybu(r1:0, r3:2) + +declare i64 @llvm.hexagon.M5.vrmpybsu(i64, i64) +define i64 @M5_vrmpybsu(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M5.vrmpybsu(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpybsu(r1:0, r3:2) + +declare i64 @llvm.hexagon.M5.vrmacbuu(i64, i64, i64) +define i64 @M5_vrmacbuu(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M5.vrmacbuu(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpybu(r3:2, r5:4) + +declare i64 @llvm.hexagon.M5.vrmacbsu(i64, i64, i64) +define i64 @M5_vrmacbsu(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M5.vrmacbsu(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpybsu(r3:2, r5:4) + +; Vector dual multiply signed by unsigned bytes +declare i64 @llvm.hexagon.M5.vdmpybsu(i64, i64) +define i64 @M5_vdmpybsu(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M5.vdmpybsu(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vdmpybsu(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M5.vdmacbsu(i64, i64, i64) +define i64 @M5_vdmacbsu(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M5.vdmacbsu(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vdmpybsu(r3:2, r5:4):sat + +; Vector multiply even halfwords +declare i64 @llvm.hexagon.M2.vmpy2es.s0(i64, i64) +define i64 @M2_vmpy2es_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vmpy2es.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyeh(r1:0, r3:2):sat + +declare i64 @llvm.hexagon.M2.vmpy2es.s1(i64, i64) +define i64 @M2_vmpy2es_s1(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vmpy2es.s1(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyeh(r1:0, r3:2):<<1:sat + +declare i64 @llvm.hexagon.M2.vmac2es(i64, i64, i64) +define i64 @M2_vmac2es(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2es(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyeh(r3:2, r5:4) + +declare i64 @llvm.hexagon.M2.vmac2es.s0(i64, i64, i64) +define i64 @M2_vmac2es_s0(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2es.s0(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyeh(r3:2, r5:4):sat + +declare i64 @llvm.hexagon.M2.vmac2es.s1(i64, i64, i64) +define i64 @M2_vmac2es_s1(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2es.s1(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyeh(r3:2, r5:4):<<1:sat + +; Vector multiply halfwords +declare i64 @llvm.hexagon.M2.vmpy2s.s0(i32, i32) +define i64 @M2_vmpy2s_s0(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M2.vmpy2s.s0(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyh(r0, r1):sat + +declare i64 @llvm.hexagon.M2.vmpy2s.s1(i32, i32) +define i64 @M2_vmpy2s_s1(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M2.vmpy2s.s1(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyh(r0, r1):<<1:sat + +declare i64 @llvm.hexagon.M2.vmac2(i64, i32, i32) +define i64 @M2_vmac2(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyh(r2, r3) + +declare i64 @llvm.hexagon.M2.vmac2s.s0(i64, i32, i32) +define i64 @M2_vmac2s_s0(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2s.s0(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyh(r2, r3):sat + +declare i64 @llvm.hexagon.M2.vmac2s.s1(i64, i32, i32) +define i64 @M2_vmac2s_s1(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2s.s1(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyh(r2, r3):<<1:sat + +; Vector multiply halfwords signed by unsigned +declare i64 @llvm.hexagon.M2.vmpy2su.s0(i32, i32) +define i64 @M2_vmpy2su_s0(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M2.vmpy2su.s0(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyhsu(r0, r1):sat + +declare i64 @llvm.hexagon.M2.vmpy2su.s1(i32, i32) +define i64 @M2_vmpy2su_s1(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M2.vmpy2su.s1(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpyhsu(r0, r1):<<1:sat + +declare i64 @llvm.hexagon.M2.vmac2su.s0(i64, i32, i32) +define i64 @M2_vmac2su_s0(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2su.s0(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyhsu(r2, r3):sat + +declare i64 @llvm.hexagon.M2.vmac2su.s1(i64, i32, i32) +define i64 @M2_vmac2su_s1(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M2.vmac2su.s1(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpyhsu(r2, r3):<<1:sat + +; Vector reduce multiply halfwords +declare i64 @llvm.hexagon.M2.vrmpy.s0(i64, i64) +define i64 @M2_vrmpy_s0(i64 %a, i64 %b) { + %z = call i64 @llvm.hexagon.M2.vrmpy.s0(i64 %a, i64 %b) + ret i64 %z +} +; CHECK: r1:0 = vrmpyh(r1:0, r3:2) + +declare i64 @llvm.hexagon.M2.vrmac.s0(i64, i64, i64) +define i64 @M2_vrmac_s0(i64 %a, i64 %b, i64 %c) { + %z = call i64 @llvm.hexagon.M2.vrmac.s0(i64 %a, i64 %b, i64 %c) + ret i64 %z +} +; CHECK: r1:0 += vrmpyh(r3:2, r5:4) + +; Vector multiply bytes +declare i64 @llvm.hexagon.M5.vmpybsu(i32, i32) +define i64 @M2_vmpybsu(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M5.vmpybsu(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpybsu(r0, r1) + +declare i64 @llvm.hexagon.M5.vmpybuu(i32, i32) +define i64 @M2_vmpybuu(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M5.vmpybuu(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vmpybu(r0, r1) + +declare i64 @llvm.hexagon.M5.vmacbuu(i64, i32, i32) +define i64 @M2_vmacbuu(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M5.vmacbuu(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpybu(r2, r3) + +declare i64 @llvm.hexagon.M5.vmacbsu(i64, i32, i32) +define i64 @M2_vmacbsu(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M5.vmacbsu(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 += vmpybsu(r2, r3) + +; Vector polynomial multiply halfwords +declare i64 @llvm.hexagon.M4.vpmpyh(i32, i32) +define i64 @M4_vpmpyh(i32 %a, i32 %b) { + %z = call i64 @llvm.hexagon.M4.vpmpyh(i32 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vpmpyh(r0, r1) + +declare i64 @llvm.hexagon.M4.vpmpyh.acc(i64, i32, i32) +define i64 @M4_vpmpyh_acc(i64 %a, i32 %b, i32 %c) { + %z = call i64 @llvm.hexagon.M4.vpmpyh.acc(i64 %a, i32 %b, i32 %c) + ret i64 %z +} +; CHECK: r1:0 ^= vpmpyh(r2, r3) diff --git a/test/MC/Disassembler/Hexagon/xtype_alu.txt b/test/MC/Disassembler/Hexagon/xtype_alu.txt index d44787d69f5..03d0f0518a3 100644 --- a/test/MC/Disassembler/Hexagon/xtype_alu.txt +++ b/test/MC/Disassembler/Hexagon/xtype_alu.txt @@ -219,6 +219,10 @@ 0x10 0xd4 0x7e 0xe8 # CHECK: r17:16 = vabsdiffh(r21:20, r31:30) +# Vector absolute difference words +0x10 0xd4 0x3e 0xe8 +# CHECK: r17:16 = vabsdiffw(r21:20, r31:30) + # Vector add halfwords 0x50 0xde 0x14 0xd3 # CHECK: r17:16 = vaddh(r21:20, r31:30) diff --git a/test/MC/Disassembler/Hexagon/xtype_mpy.txt b/test/MC/Disassembler/Hexagon/xtype_mpy.txt index 970c379f35f..ada32162a81 100644 --- a/test/MC/Disassembler/Hexagon/xtype_mpy.txt +++ b/test/MC/Disassembler/Hexagon/xtype_mpy.txt @@ -42,6 +42,22 @@ # CHECK: r17:16 = vmpywoh(r21:20, r31:30):rnd:sat 0xf0 0xde 0xb4 0xe8 # CHECK: r17:16 = vmpywoh(r21:20, r31:30):<<1:rnd:sat +0xb0 0xde 0x14 0xea +# CHECK: r17:16 += vmpyweh(r21:20, r31:30):sat +0xb0 0xde 0x94 0xea +# CHECK: r17:16 += vmpyweh(r21:20, r31:30):<<1:sat +0xf0 0xde 0x14 0xea +# CHECK: r17:16 += vmpywoh(r21:20, r31:30):sat +0xf0 0xde 0x94 0xea +# CHECK: r17:16 += vmpywoh(r21:20, r31:30):<<1:sat +0xb0 0xde 0x34 0xea +# CHECK: r17:16 += vmpyweh(r21:20, r31:30):rnd:sat +0xb0 0xde 0xb4 0xea +# CHECK: r17:16 += vmpyweh(r21:20, r31:30):<<1:rnd:sat +0xf0 0xde 0x34 0xea +# CHECK: r17:16 += vmpywoh(r21:20, r31:30):rnd:sat +0xf0 0xde 0xb4 0xea +# CHECK: r17:16 += vmpywoh(r21:20, r31:30):<<1:rnd:sat # Vector multiply word by unsigned half (32x16) 0xb0 0xde 0x54 0xe8 @@ -60,6 +76,22 @@ # CHECK: r17:16 = vmpywouh(r21:20, r31:30):rnd:sat 0xf0 0xde 0xf4 0xe8 # CHECK: r17:16 = vmpywouh(r21:20, r31:30):<<1:rnd:sat +0xb0 0xde 0x54 0xea +# CHECK: r17:16 += vmpyweuh(r21:20, r31:30):sat +0xb0 0xde 0xd4 0xea +# CHECK: r17:16 += vmpyweuh(r21:20, r31:30):<<1:sat +0xf0 0xde 0x54 0xea +# CHECK: r17:16 += vmpywouh(r21:20, r31:30):sat +0xf0 0xde 0xd4 0xea +# CHECK: r17:16 += vmpywouh(r21:20, r31:30):<<1:sat +0xb0 0xde 0x74 0xea +# CHECK: r17:16 += vmpyweuh(r21:20, r31:30):rnd:sat +0xb0 0xde 0xf4 0xea +# CHECK: r17:16 += vmpyweuh(r21:20, r31:30):<<1:rnd:sat +0xf0 0xde 0x74 0xea +# CHECK: r17:16 += vmpywouh(r21:20, r31:30):rnd:sat +0xf0 0xde 0xf4 0xea +# CHECK: r17:16 += vmpywouh(r21:20, r31:30):<<1:rnd:sat # Multiply signed halfwords 0x10 0xdf 0x95 0xe4