X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FHexagon%2FHexagonIntrinsics.td;h=4275230ba7176b6a69d3a8a379dd0e4c63af0d55;hb=a036cd4093db1ee19b9ab51cb1e6b26bfe69ac3c;hp=8f3171719a65024bfa9250ec41d46001e65019b1;hpb=6217146dce813640056927011f97ad2590ba9a4a;p=oota-llvm.git diff --git a/lib/Target/Hexagon/HexagonIntrinsics.td b/lib/Target/Hexagon/HexagonIntrinsics.td index 8f3171719a6..4275230ba71 100644 --- a/lib/Target/Hexagon/HexagonIntrinsics.td +++ b/lib/Target/Hexagon/HexagonIntrinsics.td @@ -109,6 +109,10 @@ class T_PRR_pat : Pat <(IntID I64:$Rs, I32:$Rt, I32:$Ru), (MI DoubleRegs:$Rs, I32:$Rt, I32:$Ru)>; +class T_PPQ_pat + : Pat <(IntID I64:$Rs, I64:$Rt, (i32 PredRegs:$Ru)), + (MI DoubleRegs:$Rs, DoubleRegs:$Rt, PredRegs:$Ru)>; + class T_PR_pat : Pat <(IntID I64:$Rs, I32:$Rt), (MI DoubleRegs:$Rs, I32:$Rt)>; @@ -645,23 +649,23 @@ def : T_PPR_pat ; * ALU32/ALU * *********************************************************************/ def : T_RR_pat; -def : T_RI_pat; +def : T_RI_pat; def : T_RR_pat; -def : T_IR_pat; +def : T_IR_pat; def : T_RR_pat; -def : T_RI_pat; +def : T_RI_pat; def : T_RR_pat; -def : T_RI_pat; +def : T_RI_pat; def : T_RR_pat; def : T_RR_pat; // Assembler mapped from Rd32=not(Rs32) to Rd32=sub(#-1,Rs32) def : Pat <(int_hexagon_A2_not (I32:$Rs)), - (SUB_ri -1, IntRegs:$Rs)>; + (A2_subri -1, IntRegs:$Rs)>; // Assembler mapped from Rd32=neg(Rs32) to Rd32=sub(#0,Rs32) def : Pat <(int_hexagon_A2_neg IntRegs:$Rs), - (SUB_ri 0, IntRegs:$Rs)>; + (A2_subri 0, IntRegs:$Rs)>; // Transfer immediate def : Pat <(int_hexagon_A2_tfril (I32:$Rs), u16_0ImmPred:$Is), @@ -686,16 +690,15 @@ def: T_RR_pat; def: T_RR_pat; def: T_RR_pat; -def: T_II_pat; +def: T_II_pat; -def: Pat<(i32 (int_hexagon_C2_mux (I32:$Rp), (I32:$Rs), - (I32:$Rt))), +def: Pat<(i32 (int_hexagon_C2_mux (I32:$Rp), (I32:$Rs), (I32:$Rt))), (i32 (C2_mux (C2_tfrrp IntRegs:$Rp), IntRegs:$Rs, IntRegs:$Rt))>; // Mux -def : T_QRI_pat; -def : T_QIR_pat; -def : T_QII_pat; +def : T_QRI_pat; +def : T_QIR_pat; +def : T_QII_pat; // Shift halfword def : T_R_pat; @@ -716,17 +719,17 @@ def : T_RR_pat; def : T_RR_pat; def : T_RR_pat; -def : T_RI_pat; -def : T_RI_pat; -def : T_RI_pat; +def : T_RI_pat; +def : T_RI_pat; +def : T_RI_pat; -def : Pat <(i32 (int_hexagon_C2_cmpgei (I32:$src1), s8ExtPred:$src2)), +def : Pat <(i32 (int_hexagon_C2_cmpgei (I32:$src1), s32ImmPred:$src2)), (i32 (C2_cmpgti (I32:$src1), - (DEC_CONST_SIGNED s8ExtPred:$src2)))>; + (DEC_CONST_SIGNED s32ImmPred:$src2)))>; -def : Pat <(i32 (int_hexagon_C2_cmpgeui (I32:$src1), u8ExtPred:$src2)), +def : Pat <(i32 (int_hexagon_C2_cmpgeui (I32:$src1), u32ImmPred:$src2)), (i32 (C2_cmpgtui (I32:$src1), - (DEC_CONST_UNSIGNED u8ExtPred:$src2)))>; + (DEC_CONST_UNSIGNED u32ImmPred:$src2)))>; // The instruction, Pd=cmp.geu(Rs, #u8) -> Pd=cmp.eq(Rs,Rs) when #u8 == 0. def : Pat <(i32 (int_hexagon_C2_cmpgeui (I32:$src1), 0)), @@ -1002,9 +1005,23 @@ def: T_RR_pat; def: T_RI_pat; def: T_RR_pat; +// Vector shuffle +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; +def : T_PP_pat ; + +// Vector truncate +def : T_PP_pat ; +def : T_PP_pat ; + // Linear feedback-shift Iteration. def : T_PP_pat ; +// Vector splice +def : T_PPQ_pat ; +def : T_PPI_pat ; + // Shift by immediate and add def : T_RRI_pat; @@ -1061,6 +1078,35 @@ def : T_P_pat ; // Vector Complex rotate def : T_PR_pat ; +/******************************************************************** +* STYPE/PERM * +*********************************************************************/ + +// Vector saturate without pack +def : T_P_pat ; +def : T_P_pat ; +def : T_P_pat ; +def : T_P_pat ; + +/******************************************************************** +* STYPE/PRED * +*********************************************************************/ + +// Predicate transfer +def: Pat<(i32 (int_hexagon_C2_tfrpr (I32:$Rs))), + (i32 (C2_tfrpr (C2_tfrrp (I32:$Rs))))>; +def: Pat<(i32 (int_hexagon_C2_tfrrp (I32:$Rs))), + (i32 (C2_tfrpr (C2_tfrrp (I32:$Rs))))>; + +// Mask generate from predicate +def: Pat<(i64 (int_hexagon_C2_mask (I32:$Rs))), + (i64 (C2_mask (C2_tfrrp (I32:$Rs))))>; + +// Viterbi pack even and odd predicate bits +def: Pat<(i32 (int_hexagon_C2_vitpack (I32:$Rs), (I32:$Rt))), + (i32 (C2_vitpack (C2_tfrrp (I32:$Rs)), + (C2_tfrrp (I32:$Rt))))>; + /******************************************************************** * STYPE/SHIFT * *********************************************************************/ @@ -1082,9 +1128,27 @@ def : T_RR_pat ; def : T_RR_pat ; def : T_RR_pat ; +def : T_R_pat ; +def : T_R_pat ; +def : T_R_pat ; +def : T_R_pat ; +def : T_R_pat ; def : T_R_pat ; +// Vector saturate and pack +def : T_R_pat ; +def : T_R_pat ; +def : T_P_pat ; +def : T_P_pat ; +def : T_P_pat ; +def : T_P_pat ; + +def : T_P_pat ; +def : T_P_pat ; +def : T_P_pat ; +def : T_P_pat ; def : T_R_pat ; +def : T_R_pat ; def : T_R_pat ; def : T_R_pat ; @@ -1098,6 +1162,9 @@ def : T_R_pat ; def : T_R_pat ; def : T_R_pat ; +// Vector arithmetic shift right by immediate with truncate and pack. +def : T_PI_pat; + def : T_RI_pat ; def : T_RI_pat ; def : T_RI_pat ; @@ -1135,706 +1202,84 @@ def : S2op_tableidx_pat ; -// -// ALU 32 types. -// - -class qi_ALU32_sisi - : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class qi_ALU32_sis10 - : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, s10Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>; - -class qi_ALU32_sis8 - : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, s8Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>; - -class qi_ALU32_siu8 - : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, u8Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>; - -class qi_ALU32_siu9 - : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, u9Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>; - -class si_ALU32_qisisi - : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2, - IntRegs:$src3), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2, $src3)")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2, - IntRegs:$src3))]>; - -class si_ALU32_sisi - : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class si_ALU32_sisi_sat - : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):sat")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class si_ALU32_sisi_rnd - : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):rnd")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_ALU64_di - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "$src")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src))]>; - -// -// ALU 64 types. -// - -class di_ALU64_didi - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_ALU64_qididi - : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src1, DoubleRegs:$src2, - DoubleRegs:$src3), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2, $src3)")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1, DoubleRegs:$src2, - DoubleRegs:$src3))]>; - -class di_ALU64_didi_sat - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_ALU64_didi_rnd - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):rnd")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_ALU64_didi_crnd - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):crnd")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_ALU64_didi_rnd_sat - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):rnd:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_ALU64_didi_crnd_sat - : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):crnd:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class qi_ALU64_didi - : ALU64_rr<(outs PredRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set PredRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -// -// SInst classes. -// - -class qi_SInst_qi - : SInst<(outs PredRegs:$dst), (ins IntRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src)")), - [(set PredRegs:$dst, (IntID IntRegs:$src))]>; - -class qi_SInst_qi_pxfer - : SInst<(outs PredRegs:$dst), (ins IntRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "$src")), - [(set PredRegs:$dst, (IntID IntRegs:$src))]>; - -class qi_SInst_qiqi - : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class qi_SInst_qiqi_neg - : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, !$src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_SInst_di - : SInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src))]>; - -class di_SInst_di_sat - : SInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src))]>; - -class si_SInst_di - : SInst<(outs IntRegs:$dst), (ins DoubleRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src)")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src))]>; - -class si_SInst_di_sat - : SInst<(outs IntRegs:$dst), (ins DoubleRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src):sat")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src))]>; - -class di_SInst_disi - : SInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, IntRegs:$src2))]>; - -class di_SInst_didi - : SInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -class di_SInst_si - : SInst<(outs DoubleRegs:$dst), (ins IntRegs:$src1), - !strconcat("$dst = ", !strconcat(opc , "($src1)")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1))]>; - -class si_SInst_diu5 - : SInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, u5Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, imm:$src2))]>; - -class si_SInst_disi - : SInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, IntRegs:$src2))]>; - -class si_SInst_si - : SInst<(outs IntRegs:$dst), (ins IntRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src)")), - [(set IntRegs:$dst, (IntID IntRegs:$src))]>; - -class di_SInst_qi - : SInst<(outs DoubleRegs:$dst), (ins IntRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "($src)")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src))]>; - -class si_SInst_qi - : SInst<(outs IntRegs:$dst), (ins IntRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "$src")), - [(set IntRegs:$dst, (IntID IntRegs:$src))]>; - -class si_SInst_qiqi - : SInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class qi_SInst_si - : SInst<(outs PredRegs:$dst), (ins IntRegs:$src), - !strconcat("$dst = ", !strconcat(opc , "$src")), - [(set PredRegs:$dst, (IntID IntRegs:$src))]>; - -class di_SInst_didiqi - : SInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2, - IntRegs:$src3), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2, $src3)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2, - IntRegs:$src3))]>; - -class di_SInst_didiu3 - : SInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2, - u3Imm:$src3), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2, #$src3)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2, - imm:$src3))]>; - - -// -// MInst classes. -// - -class di_MInst_disisi_acc - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_nac - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst -= ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_acc_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , "($src1, $src2):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_nac_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst -= ", !strconcat(opc , "($src1, $src2):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_acc_sat_conj - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , "($src1, $src2*):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_nac_sat_conj - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst -= ", !strconcat(opc , "($src1, $src2*):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_nac_s1_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst -= ", !strconcat(opc , - "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_acc_s1_sat_conj - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , - "($src1, $src2*):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_nac_s1_sat_conj - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst -= ", !strconcat(opc , - "($src1, $src2*):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_didi - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_MInst_didi_conj - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2*)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_MInst_sisi_s1_sat_conj - : MInst<(outs DoubleRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2*):<<1:sat")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_didi_s1_rnd_sat - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2):<<1:rnd:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_MInst_didi_sat - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class di_MInst_didi_rnd_sat - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2):rnd:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class si_SInst_didi_sat - : SInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):sat")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -class si_SInst_disi_s1_rnd_sat - : MInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2):<<1:rnd:sat")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, IntRegs:$src2))]>; - -class si_MInst_sisi_s1_rnd_sat - : MInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2):<<1:rnd:sat")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class si_MInst_sisi_rnd_sat_conj - : MInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2*):rnd:sat")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class si_MInst_sisi_s1_rnd_sat_conj - : MInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2*):<<1:rnd:sat")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class si_MInst_sisi_rnd_sat - : MInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2):rnd:sat")), - [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_sisi - : MInst<(outs DoubleRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_sisi_sat - : MInst<(outs DoubleRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):sat")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_sisi_sat_conj - : MInst<(outs DoubleRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2*):sat")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_sisi_s1_sat - : MInst<(outs DoubleRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_didi_s1_sat - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, - DoubleRegs:$src2))]>; - -class si_MInst_didi_s1_rnd_sat - : MInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , - "($src1, $src2):<<1:rnd:sat")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -class si_MInst_didi_rnd_sat - : MInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):rnd:sat")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -class di_MInst_dididi_acc_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, - DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , "($src1, $src2):sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_dididi_acc_rnd_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, DoubleRegs:$src1, - DoubleRegs:$src2), - !strconcat("$dst += ", - !strconcat(opc , "($src1, $src2):rnd:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_dididi_acc_s1 - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2), - !strconcat("$dst += ", - !strconcat(opc , "($src1, $src2):<<1")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - - -class di_MInst_dididi_acc_s1_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2), - !strconcat("$dst += ", - !strconcat(opc , "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_dididi_acc_s1_rnd_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, DoubleRegs:$src1, - DoubleRegs:$src2), - !strconcat("$dst += ", - !strconcat(opc , "($src1, $src2):<<1:rnd:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_dididi_acc - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, DoubleRegs:$src1, - DoubleRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , "($src1, $src2)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_dididi_acc_conj - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, DoubleRegs:$src1, - DoubleRegs:$src2), - !strconcat("$dst += ", !strconcat(opc , "($src1, $src2*)")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - DoubleRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disisi_acc_s1_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2), - !strconcat("$dst += ", - !strconcat(opc , "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, IntRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class di_MInst_disi_s1_sat - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, IntRegs:$src2))]>; - -class di_MInst_didisi_acc_s1_sat - : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, DoubleRegs:$src1, - IntRegs:$src2), - !strconcat("$dst += ", - !strconcat(opc , "($src1, $src2):<<1:sat")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, - DoubleRegs:$src1, - IntRegs:$src2))], - "$dst2 = $dst">; - -class si_MInst_disi_s1_rnd_sat - : MInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, IntRegs:$src2), - !strconcat("$dst = ", - !strconcat(opc , "($src1, $src2):<<1:rnd:sat")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, IntRegs:$src2))]>; - -class si_MInst_didi - : MInst<(outs IntRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set IntRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -// -// LDInst classes. -// -let mayLoad = 1, hasSideEffects = 0 in -class di_LDInstPI_diu4 - : LDInstPI<(outs IntRegs:$dst, DoubleRegs:$dst2), - (ins IntRegs:$src1, IntRegs:$src2, CtrRegs:$src3, s4Imm:$offset), - "$dst2 = memd($src1++#$offset:circ($src3))", - [], - "$src1 = $dst">; - /******************************************************************** -* STYPE/PERM * +* STYPE/VH * *********************************************************************/ -// STYPE / PERM / Vector align. -// Need custom lowering -def HEXAGON_S2_valignib: - di_SInst_didiu3 <"valignb", int_hexagon_S2_valignib>; -def HEXAGON_S2_valignrb: - di_SInst_didiqi <"valignb", int_hexagon_S2_valignrb>; - -// STYPE / PERM / Vector round and pack. -def HEXAGON_S2_vrndpackwh: - si_SInst_di <"vrndwh", int_hexagon_S2_vrndpackwh>; -def HEXAGON_S2_vrndpackwhs: - si_SInst_di_sat <"vrndwh", int_hexagon_S2_vrndpackwhs>; - -// STYPE / PERM / Vector saturate and pack. -def HEXAGON_S2_svsathb: - si_SInst_si <"vsathb", int_hexagon_S2_svsathb>; -def HEXAGON_S2_vsathb: - si_SInst_di <"vsathb", int_hexagon_S2_vsathb>; -def HEXAGON_S2_svsathub: - si_SInst_si <"vsathub", int_hexagon_S2_svsathub>; -def HEXAGON_S2_vsathub: - si_SInst_di <"vsathub", int_hexagon_S2_vsathub>; -def HEXAGON_S2_vsatwh: - si_SInst_di <"vsatwh", int_hexagon_S2_vsatwh>; -def HEXAGON_S2_vsatwuh: - si_SInst_di <"vsatwuh", int_hexagon_S2_vsatwuh>; - -// STYPE / PERM / Vector saturate without pack. -def HEXAGON_S2_vsathb_nopack: - di_SInst_di <"vsathb", int_hexagon_S2_vsathb_nopack>; -def HEXAGON_S2_vsathub_nopack: - di_SInst_di <"vsathub", int_hexagon_S2_vsathub_nopack>; -def HEXAGON_S2_vsatwh_nopack: - di_SInst_di <"vsatwh", int_hexagon_S2_vsatwh_nopack>; -def HEXAGON_S2_vsatwuh_nopack: - di_SInst_di <"vsatwuh", int_hexagon_S2_vsatwuh_nopack>; - -// STYPE / PERM / Vector shuffle. -def HEXAGON_S2_shuffeb: - di_SInst_didi <"shuffeb", int_hexagon_S2_shuffeb>; -def HEXAGON_S2_shuffeh: - di_SInst_didi <"shuffeh", int_hexagon_S2_shuffeh>; -def HEXAGON_S2_shuffob: - di_SInst_didi <"shuffob", int_hexagon_S2_shuffob>; -def HEXAGON_S2_shuffoh: - di_SInst_didi <"shuffoh", int_hexagon_S2_shuffoh>; - -// STYPE / PERM / Vector splat bytes. -def HEXAGON_S2_vsplatrb: - si_SInst_si <"vsplatb", int_hexagon_S2_vsplatrb>; - -// STYPE / PERM / Vector splat halfwords. -def HEXAGON_S2_vsplatrh: - di_SInst_si <"vsplath", int_hexagon_S2_vsplatrh>; - -// STYPE / PERM / Vector splice. -def Hexagon_S2_vsplicerb: - di_SInst_didiqi <"vspliceb",int_hexagon_S2_vsplicerb>; -def Hexagon_S2_vspliceib: - di_SInst_didiu3 <"vspliceb",int_hexagon_S2_vspliceib>; - -// STYPE / PERM / Sign extend. -def HEXAGON_S2_vsxtbh: - di_SInst_si <"vsxtbh", int_hexagon_S2_vsxtbh>; -def HEXAGON_S2_vsxthw: - di_SInst_si <"vsxthw", int_hexagon_S2_vsxthw>; - -// STYPE / PERM / Truncate. -def HEXAGON_S2_vtrunehb: - si_SInst_di <"vtrunehb",int_hexagon_S2_vtrunehb>; -def HEXAGON_S2_vtrunohb: - si_SInst_di <"vtrunohb",int_hexagon_S2_vtrunohb>; -def HEXAGON_S2_vtrunewh: - di_SInst_didi <"vtrunewh",int_hexagon_S2_vtrunewh>; -def HEXAGON_S2_vtrunowh: - di_SInst_didi <"vtrunowh",int_hexagon_S2_vtrunowh>; - -// STYPE / PERM / Zero extend. -def HEXAGON_S2_vzxtbh: - di_SInst_si <"vzxtbh", int_hexagon_S2_vzxtbh>; -def HEXAGON_S2_vzxthw: - di_SInst_si <"vzxthw", int_hexagon_S2_vzxthw>; +// Vector absolute value halfwords with and without saturation +// Rdd64=vabsh(Rss64)[:sat] +def : T_P_pat ; +def : T_P_pat ; + +// Vector shift halfwords by immediate +// Rdd64=[vaslh/vasrh/vlsrh](Rss64,u4) +def : T_PI_pat ; +def : T_PI_pat ; +def : T_PI_pat ; +// Vector shift halfwords by register +// Rdd64=[vaslw/vasrw/vlslw/vlsrw](Rss64,Rt32) +def : T_PR_pat ; +def : T_PR_pat ; +def : T_PR_pat ; +def : T_PR_pat ; /******************************************************************** -* STYPE/PRED * +* STYPE/VW * *********************************************************************/ -// STYPE / PRED / Mask generate from predicate. -def HEXAGON_C2_mask: - di_SInst_qi <"mask", int_hexagon_C2_mask>; +// Vector absolute value words with and without saturation +def : T_P_pat ; +def : T_P_pat ; -// STYPE / PRED / Predicate transfer. -def HEXAGON_C2_tfrpr: - si_SInst_qi <"", int_hexagon_C2_tfrpr>; -def HEXAGON_C2_tfrrp: - qi_SInst_si <"", int_hexagon_C2_tfrrp>; +// Vector shift words by immediate. +// Rdd64=[vasrw/vlsrw|vaslw](Rss64,u5) +def : T_PI_pat ; +def : T_PI_pat ; +def : T_PI_pat ; -// STYPE / PRED / Viterbi pack even and odd predicate bits. -def HEXAGON_C2_vitpack: - si_SInst_qiqi <"vitpack",int_hexagon_C2_vitpack>; +// Vector shift words by register. +// Rdd64=[vasrw/vlsrw|vaslw|vlslw](Rss64,Rt32) +def : T_PR_pat ; +def : T_PR_pat ; +def : T_PR_pat ; +def : T_PR_pat ; +// Vector shift words with truncate and pack -/******************************************************************** -* STYPE/VH * -*********************************************************************/ +def : T_PR_pat ; -// STYPE / VH / Vector absolute value halfwords. -// Rdd64=vabsh(Rss64) -def HEXAGON_A2_vabsh: - di_SInst_di <"vabsh", int_hexagon_A2_vabsh>; -def HEXAGON_A2_vabshsat: - di_SInst_di_sat <"vabsh", int_hexagon_A2_vabshsat>; - -// STYPE / VH / Vector shift halfwords by immediate. -// Rdd64=v[asl/asr/lsr]h(Rss64,Rt32) -def HEXAGON_S2_asl_i_vh: - di_SInst_disi <"vaslh", int_hexagon_S2_asl_i_vh>; -def HEXAGON_S2_asr_i_vh: - di_SInst_disi <"vasrh", int_hexagon_S2_asr_i_vh>; -def HEXAGON_S2_lsr_i_vh: - di_SInst_disi <"vlsrh", int_hexagon_S2_lsr_i_vh>; - -// STYPE / VH / Vector shift halfwords by register. -// Rdd64=v[asl/asr/lsl/lsr]w(Rss64,Rt32) -def HEXAGON_S2_asl_r_vh: - di_SInst_disi <"vaslh", int_hexagon_S2_asl_r_vh>; -def HEXAGON_S2_asr_r_vh: - di_SInst_disi <"vasrh", int_hexagon_S2_asr_r_vh>; -def HEXAGON_S2_lsl_r_vh: - di_SInst_disi <"vlslh", int_hexagon_S2_lsl_r_vh>; -def HEXAGON_S2_lsr_r_vh: - di_SInst_disi <"vlsrh", int_hexagon_S2_lsr_r_vh>; +def : T_R_pat; +def : T_R_pat; +def: Pat<(i32 (int_hexagon_S2_storew_locked (I32:$Rs), (I32:$Rt))), + (i32 (C2_tfrpr (S2_storew_locked (I32:$Rs), (I32:$Rt))))>; +def: Pat<(i32 (int_hexagon_S4_stored_locked (I32:$Rs), (I64:$Rt))), + (i32 (C2_tfrpr (S4_stored_locked (I32:$Rs), (I64:$Rt))))>; /******************************************************************** -* STYPE/VW * +* ST *********************************************************************/ -// STYPE / VW / Vector absolute value words. -def HEXAGON_A2_vabsw: - di_SInst_di <"vabsw", int_hexagon_A2_vabsw>; -def HEXAGON_A2_vabswsat: - di_SInst_di_sat <"vabsw", int_hexagon_A2_vabswsat>; - -// STYPE / VW / Vector shift words by immediate. -// Rdd64=v[asl/vsl]w(Rss64,Rt32) -def HEXAGON_S2_asl_i_vw: - di_SInst_disi <"vaslw", int_hexagon_S2_asl_i_vw>; -def HEXAGON_S2_asr_i_vw: - di_SInst_disi <"vasrw", int_hexagon_S2_asr_i_vw>; -def HEXAGON_S2_lsr_i_vw: - di_SInst_disi <"vlsrw", int_hexagon_S2_lsr_i_vw>; - -// STYPE / VW / Vector shift words by register. -// Rdd64=v[asl/vsl]w(Rss64,Rt32) -def HEXAGON_S2_asl_r_vw: - di_SInst_disi <"vaslw", int_hexagon_S2_asl_r_vw>; -def HEXAGON_S2_asr_r_vw: - di_SInst_disi <"vasrw", int_hexagon_S2_asr_r_vw>; -def HEXAGON_S2_lsl_r_vw: - di_SInst_disi <"vlslw", int_hexagon_S2_lsl_r_vw>; -def HEXAGON_S2_lsr_r_vw: - di_SInst_disi <"vlsrw", int_hexagon_S2_lsr_r_vw>; - -// STYPE / VW / Vector shift words with truncate and pack. -def HEXAGON_S2_asr_r_svw_trun: - si_SInst_disi <"vasrw", int_hexagon_S2_asr_r_svw_trun>; -def HEXAGON_S2_asr_i_svw_trun: - si_SInst_diu5 <"vasrw", int_hexagon_S2_asr_i_svw_trun>; - -// LD / Circular loads. -def HEXAGON_circ_ldd: - di_LDInstPI_diu4 <"circ_ldd", int_hexagon_circ_ldd>; +class T_stb_pat + : Pat<(IntID I32:$Rs, Val:$Rt, I32:$Ru), + (MI I32:$Rs, Val:$Rt, I32:$Ru)>; + +def : T_stb_pat ; +def : T_stb_pat ; +def : T_stb_pat ; +def : T_stb_pat ; +def : T_stb_pat ; + +class T_stc_pat + : Pat<(IntID I32:$Rs, Val:$Rt, I32:$Ru, Imm:$s), + (MI I32:$Rs, Val:$Rt, I32:$Ru, Imm:$s)>; + +def: T_stc_pat; +def: T_stc_pat; +def: T_stc_pat; +def: T_stc_pat; +def: T_stc_pat; include "HexagonIntrinsicsV3.td" include "HexagonIntrinsicsV4.td"