From: Colin LeMahieu Date: Tue, 3 Feb 2015 20:40:52 +0000 (+0000) Subject: [Hexagon] Converting XTYPE/SHIFT intrinsics. Cleaning out old intrinsic patterns... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3c159ed1a096db27f1af77e8a4abbd40d9989af0;p=oota-llvm.git [Hexagon] Converting XTYPE/SHIFT intrinsics. Cleaning out old intrinsic patterns and updating tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228026 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/IntrinsicsHexagon.td b/include/llvm/IR/IntrinsicsHexagon.td index 6f9237e35a1..b5669569727 100644 --- a/include/llvm/IR/IntrinsicsHexagon.td +++ b/include/llvm/IR/IntrinsicsHexagon.td @@ -4810,3 +4810,21 @@ Hexagon_di_di_Intrinsic<"HEXAGON_S2_interleave">; // def int_hexagon_S2_deinterleave : Hexagon_di_di_Intrinsic<"HEXAGON_S2_deinterleave">; + +def llvm_ptr32_ty : LLVMPointerType; +def llvm_ptr64_ty : LLVMPointerType; + +// Mark locked loads as read/write to prevent any accidental reordering. +def int_hexagon_L2_loadw_locked : +Hexagon_Intrinsic<"HEXAGON_L2_loadw_locked", [llvm_i32_ty], [llvm_ptr32_ty], + [IntrReadWriteArgMem, NoCapture<0>]>; +def int_hexagon_L4_loadd_locked : +Hexagon_Intrinsic<"HEXAGON_L4_loadd_locked", [llvm_i64_ty], [llvm_ptr64_ty], + [IntrReadWriteArgMem, NoCapture<0>]>; + +def int_hexagon_S2_storew_locked : +Hexagon_Intrinsic<"HEXAGON_S2_storew_locked", [llvm_i32_ty], + [llvm_ptr32_ty, llvm_i32_ty], [IntrReadWriteArgMem, NoCapture<0>]>; +def int_hexagon_S4_stored_locked : +Hexagon_Intrinsic<"HEXAGON_S4_stored_locked", [llvm_i32_ty], + [llvm_ptr64_ty, llvm_i64_ty], [IntrReadWriteArgMem, NoCapture<0>]>; diff --git a/lib/Target/Hexagon/HexagonInstrInfoV3.td b/lib/Target/Hexagon/HexagonInstrInfoV3.td index 0f2fd84cd45..c1ddb3a7c56 100644 --- a/lib/Target/Hexagon/HexagonInstrInfoV3.td +++ b/lib/Target/Hexagon/HexagonInstrInfoV3.td @@ -224,6 +224,12 @@ def M2_vrcmpys_s1_h: T_vrcmpRaw<"hi", 0b101>; def M2_vrcmpys_s1_l: T_vrcmpRaw<"lo", 0b111>; } +// Assembler mapped to M2_vrcmpys_s1_h or M2_vrcmpys_s1_l +let hasSideEffects = 0 in +def M2_vrcmpys_s1 + : MInst<(outs DoubleRegs:$Rdd), (ins DoubleRegs:$Rss, IntRegs:$Rt), + "$Rdd=vrcmpys($Rss,$Rt):<<1:sat">; + // Vector reduce complex multiply by scalar with accumulation. let Defs = [USR_OVF], hasSideEffects = 0 in class T_vrcmpys_accMajOp>: @@ -250,11 +256,25 @@ def M2_vrcmpys_acc_s1_h: T_vrcmpys_acc<"hi", 0b101>; def M2_vrcmpys_acc_s1_l: T_vrcmpys_acc<"lo", 0b111>; } +// Assembler mapped to M2_vrcmpys_acc_s1_h or M2_vrcmpys_acc_s1_l + +def M2_vrcmpys_acc_s1 + : MInst <(outs DoubleRegs:$dst), + (ins DoubleRegs:$dst2, DoubleRegs:$src1, IntRegs:$src2), + "$dst += vrcmpys($src1, $src2):<<1:sat", [], + "$dst2 = $dst">; + let isCodeGenOnly = 0 in { def M2_vrcmpys_s1rp_h : T_MType_vrcmpy <"vrcmpys", 0b101, 0b110, 1>; def M2_vrcmpys_s1rp_l : T_MType_vrcmpy <"vrcmpys", 0b101, 0b111, 0>; } +// Assembler mapped to M2_vrcmpys_s1rp_h or M2_vrcmpys_s1rp_l +def M2_vrcmpys_s1rp + : MInst <(outs IntRegs:$Rd), (ins DoubleRegs:$Rss, IntRegs:$Rt), + "$Rd=vrcmpys($Rss,$Rt):<<1:rnd:sat">; + + // S2_cabacdecbin: Cabac decode bin. let Defs = [P0], isPredicateLate = 1, Itinerary = S_3op_tc_1_SLOT23, isCodeGenOnly = 0 in diff --git a/lib/Target/Hexagon/HexagonInstrInfoV5.td b/lib/Target/Hexagon/HexagonInstrInfoV5.td index 9b8d9d6c2a8..13d3ef96235 100644 --- a/lib/Target/Hexagon/HexagonInstrInfoV5.td +++ b/lib/Target/Hexagon/HexagonInstrInfoV5.td @@ -808,6 +808,10 @@ def S5_vasrhrnd : SInst <(outs DoubleRegs:$Rdd), let Inst{4-0} = Rdd; } +def S5_vasrhrnd_goodsyntax + : SInst <(outs DoubleRegs:$Rdd), (ins DoubleRegs:$Rss, u4Imm:$u4), + "$Rdd = vasrh($Rss,#$u4):rnd">, Requires<[HasV5T]>; + // Floating point reciprocal square root approximation let Uses = [USR], isPredicateLate = 1, isFP = 1, hasSideEffects = 0, hasNewValue = 1, opNewValue = 0, diff --git a/lib/Target/Hexagon/HexagonIntrinsics.td b/lib/Target/Hexagon/HexagonIntrinsics.td index b84d9d3b0a0..cfb8551a91d 100644 --- a/lib/Target/Hexagon/HexagonIntrinsics.td +++ b/lib/Target/Hexagon/HexagonIntrinsics.td @@ -1136,7 +1136,6 @@ def : T_R_pat ; def : T_R_pat ; def : T_R_pat ; - // Vector saturate and pack def : T_R_pat ; def : T_R_pat ; @@ -1164,6 +1163,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 ; @@ -1201,599 +1203,60 @@ 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))]>; +/******************************************************************** +* STYPE/VH * +*********************************************************************/ -// -// SInst classes. -// +// Vector absolute value halfwords with and without saturation +// Rdd64=vabsh(Rss64)[:sat] +def : T_P_pat ; +def : T_P_pat ; -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))]>; +// 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 ; -// -// MInst classes. -// +/******************************************************************** +* STYPE/VW * +*********************************************************************/ -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))]>; +// Vector absolute value words with and without saturation +def : T_P_pat ; +def : T_P_pat ; -// -// 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">; +// Vector shift words by immediate. +// Rdd64=[vasrw/vlsrw|vaslw](Rss64,u5) +def : T_PI_pat ; +def : T_PI_pat ; +def : T_PI_pat ; -/******************************************************************** -* STYPE/VH * -*********************************************************************/ +// 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 ; -// 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>; +// Vector shift words with truncate and pack +def : T_PR_pat ; -/******************************************************************** -* STYPE/VW * -*********************************************************************/ +def : T_R_pat; +def : T_R_pat; -// 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>; +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))))>; include "HexagonIntrinsicsV3.td" include "HexagonIntrinsicsV4.td" diff --git a/lib/Target/Hexagon/HexagonIntrinsicsV3.td b/lib/Target/Hexagon/HexagonIntrinsicsV3.td index f24aa96097b..6152cb09882 100644 --- a/lib/Target/Hexagon/HexagonIntrinsicsV3.td +++ b/lib/Target/Hexagon/HexagonIntrinsicsV3.td @@ -11,26 +11,13 @@ // //===----------------------------------------------------------------------===// +// Vector reduce complex multiply real or imaginary +def : T_PR_pat ; +def : T_PPR_pat; +def : T_PR_pat ; - - -// MTYPE / COMPLEX / Vector reduce complex multiply real or imaginary. -def Hexagon_M2_vrcmpys_s1: - di_MInst_disi_s1_sat <"vrcmpys", int_hexagon_M2_vrcmpys_s1>; -def Hexagon_M2_vrcmpys_acc_s1: - di_MInst_didisi_acc_s1_sat <"vrcmpys", int_hexagon_M2_vrcmpys_acc_s1>; -def Hexagon_M2_vrcmpys_s1rp: - si_MInst_disi_s1_rnd_sat <"vrcmpys", int_hexagon_M2_vrcmpys_s1rp>; - - -/******************************************************************** -* MTYPE/VB * -*********************************************************************/ - -// MTYPE / VB / Vector reduce add unsigned bytes. -def Hexagon_M2_vradduh: - si_MInst_didi <"vradduh", int_hexagon_M2_vradduh>; - +// Vector reduce add unsigned halfwords +def : T_PP_pat; def: T_RP_pat; def: T_PP_pat; diff --git a/lib/Target/Hexagon/HexagonIntrinsicsV5.td b/lib/Target/Hexagon/HexagonIntrinsicsV5.td index 390e9100300..60e6b1eb447 100644 --- a/lib/Target/Hexagon/HexagonIntrinsicsV5.td +++ b/lib/Target/Hexagon/HexagonIntrinsicsV5.td @@ -1,4 +1,4 @@ -//===- HexagonIntrinsicsV5.td - V4 Instruction intrinsics --*- tablegen -*-===// +//===- HexagonIntrinsicsV5.td - V5 Instruction intrinsics --*- tablegen -*-===// // // The LLVM Compiler Infrastructure // @@ -7,6 +7,32 @@ // //===----------------------------------------------------------------------===// +//Rdd[+]=vrmpybsu(Rss,Rtt) +//Rdd[+]=vrmpybuu(Rss,Rtt) +let Predicates = [HasV5T] in { +def : T_PP_pat ; +def : T_PP_pat ; + +def : T_PP_pat ; + +def : T_PPP_pat ; +def : T_PPP_pat ; +//Rxx+=vdmpybsu(Rss,Rtt):sat +def : T_PPP_pat ; + +// Vector multiply bytes +// Rdd=vmpyb[s]u(Rs,Rt) +def : T_RR_pat ; +def : T_RR_pat ; + +// Rxx+=vmpyb[s]u(Rs,Rt) +def : T_PRR_pat ; +def : T_PRR_pat ; + +// Rd=vaddhub(Rss,Rtt):sat +def : T_PP_pat ; +} + def : T_FF_pat; def : T_FF_pat; def : T_FF_pat; @@ -30,6 +56,8 @@ def : T_PI_pat ; +def : T_PI_pat ; + def : T_FFF_pat ; def : T_FFF_pat ; def : T_FFF_pat ; @@ -81,53 +109,3 @@ def : T_D_pat ; def : T_D_pat ; def : T_D_pat ; def : T_D_pat ; - -class qi_ALU64_dfdf - : ALU64_rr<(outs PredRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, $src2)")), - [(set PredRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>; - -class qi_ALU64_dfu5 - : ALU64_ri<(outs PredRegs:$dst), (ins DoubleRegs:$src1, u5Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set PredRegs:$dst, (IntID DoubleRegs:$src1, imm:$src2))]>; - -class qi_SInst_sfsf - : 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_sfu5 - : MInst<(outs PredRegs:$dst), (ins IntRegs:$src1, u5Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")), - [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>; - -class di_MInst_diu4_rnd - : MInst<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, u4Imm:$src2), - !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2):rnd")), - [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, imm:$src2))]>; - -def HEXAGON_M5_vrmpybuu: - di_MInst_didi <"vrmpybu", int_hexagon_M5_vrmpybuu>; -def HEXAGON_M5_vrmacbuu: - di_MInst_dididi_acc <"vrmpybu", int_hexagon_M5_vrmacbuu>; -def HEXAGON_M5_vrmpybsu: - di_MInst_didi <"vrmpybsu", int_hexagon_M5_vrmpybsu>; -def HEXAGON_M5_vrmacbsu: - di_MInst_dididi_acc <"vrmpybsu", int_hexagon_M5_vrmacbsu>; -def HEXAGON_M5_vmpybuu: - di_MInst_sisi <"vmpybu", int_hexagon_M5_vmpybuu>; -def HEXAGON_M5_vmpybsu: - di_MInst_sisi <"vmpybsu", int_hexagon_M5_vmpybsu>; -def HEXAGON_M5_vmacbuu: - di_MInst_disisi_acc <"vmpybu", int_hexagon_M5_vmacbuu>; -def HEXAGON_M5_vmacbsu: - di_MInst_disisi_acc <"vmpybsu", int_hexagon_M5_vmacbsu>; -def HEXAGON_M5_vdmpybsu: - di_MInst_didi_sat <"vdmpybsu", int_hexagon_M5_vdmpybsu>; -def HEXAGON_M5_vdmacbsu: - di_MInst_dididi_acc_sat <"vdmpybsu", int_hexagon_M5_vdmacbsu>; -def HEXAGON_A5_vaddhubs: - si_SInst_didi_sat <"vaddhub", int_hexagon_A5_vaddhubs>; -def HEXAGON_S5_vasrhrnd_goodsyntax: - di_MInst_diu4_rnd <"vasrh", int_hexagon_S5_vasrhrnd_goodsyntax>; diff --git a/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll b/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll index 40d9b6b6045..4a11112d73a 100644 --- a/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll +++ b/test/CodeGen/Hexagon/intrinsics/xtype_alu.ll @@ -1,4 +1,4 @@ -; RUN: llc -march=hexagon -O0 < %s | FileCheck %s +; RUN: llc -march=hexagon -mcpu=hexagonv5 -O0 < %s | FileCheck %s ; Hexagon Programmer's Reference Manual 11.10.1 XTYPE/ALU ; Absolute value doubleword diff --git a/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll b/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll index 5ed761a613f..6409e4e10ca 100644 --- a/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll +++ b/test/CodeGen/Hexagon/intrinsics/xtype_mpy.ll @@ -1,4 +1,4 @@ -; RUN: llc -march=hexagon -O0 < %s | FileCheck %s +; RUN: llc -march=hexagon -mcpu=hexagonv5 -O0 < %s | FileCheck %s ; Hexagon Programmer's Reference Manual 11.10.5 XTYPE/MPY ; Multiply and use lower result diff --git a/test/CodeGen/Hexagon/intrinsics/xtype_shift.ll b/test/CodeGen/Hexagon/intrinsics/xtype_shift.ll index 9917d770f70..c84999bf94f 100644 --- a/test/CodeGen/Hexagon/intrinsics/xtype_shift.ll +++ b/test/CodeGen/Hexagon/intrinsics/xtype_shift.ll @@ -633,3 +633,91 @@ define i32 @S2_asl_r_r_sat(i32 %a, i32 %b) { ret i32 %z } ; CHECK: r0 = asl(r0, r1):sat + +; Vector shift halfwords by immediate +declare i64 @llvm.hexagon.S2.asr.i.vh(i64, i32) +define i64 @S2_asr_i_vh(i64 %a) { + %z = call i64 @llvm.hexagon.S2.asr.i.vh(i64 %a, i32 0) + ret i64 %z +} +; CHECK: r1:0 = vasrh(r1:0, #0) + +declare i64 @llvm.hexagon.S2.lsr.i.vh(i64, i32) +define i64 @S2_lsr_i_vh(i64 %a) { + %z = call i64 @llvm.hexagon.S2.lsr.i.vh(i64 %a, i32 0) + ret i64 %z +} +; CHECK: r1:0 = vlsrh(r1:0, #0) + +declare i64 @llvm.hexagon.S2.asl.i.vh(i64, i32) +define i64 @S2_asl_i_vh(i64 %a) { + %z = call i64 @llvm.hexagon.S2.asl.i.vh(i64 %a, i32 0) + ret i64 %z +} +; CHECK: r1:0 = vaslh(r1:0, #0) + +; Vector shift halfwords by register +declare i64 @llvm.hexagon.S2.asr.r.vh(i64, i32) +define i64 @S2_asr_r_vh(i64 %a, i32 %b) { + %z = call i64 @llvm.hexagon.S2.asr.r.vh(i64 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vasrh(r1:0, r2) + +declare i64 @llvm.hexagon.S2.lsr.r.vh(i64, i32) +define i64 @S2_lsr_r_vh(i64 %a, i32 %b) { + %z = call i64 @llvm.hexagon.S2.lsr.r.vh(i64 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vlsrh(r1:0, r2) + +declare i64 @llvm.hexagon.S2.asl.r.vh(i64, i32) +define i64 @S2_asl_r_vh(i64 %a, i32 %b) { + %z = call i64 @llvm.hexagon.S2.asl.r.vh(i64 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vaslh(r1:0, r2) + +declare i64 @llvm.hexagon.S2.lsl.r.vh(i64, i32) +define i64 @S2_lsl_r_vh(i64 %a, i32 %b) { + %z = call i64 @llvm.hexagon.S2.lsl.r.vh(i64 %a, i32 %b) + ret i64 %z +} +; CHECK: r1:0 = vlslh(r1:0, r2) + +; Vector shift words by immediate +declare i64 @llvm.hexagon.S2.asr.i.vw(i64, i32) +define i64 @S2_asr_i_vw(i64 %a) { + %z = call i64 @llvm.hexagon.S2.asr.i.vw(i64 %a, i32 0) + ret i64 %z +} +; CHECK: r1:0 = vasrw(r1:0, #0) + +declare i64 @llvm.hexagon.S2.lsr.i.vw(i64, i32) +define i64 @S2_lsr_i_vw(i64 %a) { + %z = call i64 @llvm.hexagon.S2.lsr.i.vw(i64 %a, i32 0) + ret i64 %z +} +; CHECK: r1:0 = vlsrw(r1:0, #0) + +declare i64 @llvm.hexagon.S2.asl.i.vw(i64, i32) +define i64 @S2_asl_i_vw(i64 %a) { + %z = call i64 @llvm.hexagon.S2.asl.i.vw(i64 %a, i32 0) + ret i64 %z +} +; CHECK: r1:0 = vaslw(r1:0, #0) + +; Vector shift words by with truncate and pack +declare i32 @llvm.hexagon.S2.asr.i.svw.trun(i64, i32) +define i32 @S2_asr_i_svw_trun(i64 %a) { + %z = call i32 @llvm.hexagon.S2.asr.i.svw.trun(i64 %a, i32 0) + ret i32 %z +} +; CHECK: r0 = vasrw(r1:0, #0) + +declare i32 @llvm.hexagon.S2.asr.r.svw.trun(i64, i32) +define i32 @S2_asr_r_svw_trun(i64 %a, i32 %b) { + %z = call i32 @llvm.hexagon.S2.asr.r.svw.trun(i64 %a, i32 %b) + ret i32 %z +} +; CHECK: r0 = vasrw(r1:0, r2)