Index: clang/include/clang/Basic/BuiltinsPPC.def =================================================================== --- clang/include/clang/Basic/BuiltinsPPC.def +++ clang/include/clang/Basic/BuiltinsPPC.def @@ -306,6 +306,22 @@ BUILTIN(__builtin_altivec_vclrlb, "V16cV16cUi", "") BUILTIN(__builtin_altivec_vclrrb, "V16cV16cUi", "") +// P10 Vector insert built-ins +BUILTIN(__builtin_altivec_vinsblx, "V16UcULLiULLi", "") +BUILTIN(__builtin_altivec_vinsbrx, "V16UcULLiULLi", "") +BUILTIN(__builtin_altivec_vinshlx, "V8UsULLiULLi", "") +BUILTIN(__builtin_altivec_vinshrx, "V8UsULLiULLi", "") +BUILTIN(__builtin_altivec_vinswlx, "V4UiULLiULLi", "") +BUILTIN(__builtin_altivec_vinswrx, "V4UiULLiULLi", "") +BUILTIN(__builtin_altivec_vinsdlx, "V2ULLiULLiULLi", "") +BUILTIN(__builtin_altivec_vinsdrx, "V2ULLiULLiULLi", "") +BUILTIN(__builtin_altivec_vinsbvlx, "V16UcULLiV16Uc", "") +BUILTIN(__builtin_altivec_vinsbvrx, "V16UcULLiV16Uc", "") +BUILTIN(__builtin_altivec_vinshvlx, "V8UsULLiV8Us", "") +BUILTIN(__builtin_altivec_vinshvrx, "V8UsULLiV8Us", "") +BUILTIN(__builtin_altivec_vinswvlx, "V4UiULLiV4Ui", "") +BUILTIN(__builtin_altivec_vinswvrx, "V4UiULLiV4Ui", "") + // VSX built-ins. BUILTIN(__builtin_vsx_lxvd2x, "V2divC*", "") Index: clang/lib/Headers/altivec.h =================================================================== --- clang/lib/Headers/altivec.h +++ clang/lib/Headers/altivec.h @@ -16830,6 +16830,136 @@ return __builtin_altivec_vclrrb((vector signed char)__a, __n); #endif } + +/* vec_insertl */ + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsbrx(__c, __a); +#else + return __builtin_altivec_vinsblx(__c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshrx(__c, __a); +#else + return __builtin_altivec_vinshlx(__c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswrx(__c, __a); +#else + return __builtin_altivec_vinswlx(__c, __a); +#endif +} + +static __inline__ vector unsigned long long __ATTRS_o_ai vec_insertl( + unsigned long long __a, vector unsigned long long __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsdrx(__c, __a); +#else + return __builtin_altivec_vinsdlx(__c, __a); +#endif +} + +static __inline__ vector unsigned char __ATTRS_o_ai vec_insertl( + vector unsigned char __a, vector unsigned char __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsbvrx(__c, __a); +#else + return __builtin_altivec_vinsbvlx(__c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai vec_insertl( + vector unsigned short __a, vector unsigned short __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshvrx(__c, __a); +#else + return __builtin_altivec_vinshvlx(__c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai vec_insertl( + vector unsigned int __a, vector unsigned int __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswvrx(__c, __a); +#else + return __builtin_altivec_vinswvlx(__c, __a); +#endif +} + +/* vec_inserth */ + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsblx(__c, __a); +#else + return __builtin_altivec_vinsbrx(__c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshlx(__c, __a); +#else + return __builtin_altivec_vinshrx(__c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswlx(__c, __a); +#else + return __builtin_altivec_vinswrx(__c, __a); +#endif +} + +static __inline__ vector unsigned long long __ATTRS_o_ai vec_inserth( + unsigned long long __a, vector unsigned long long __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsdlx(__c, __a); +#else + return __builtin_altivec_vinsdrx(__c, __a); +#endif +} + +static __inline__ vector unsigned char __ATTRS_o_ai vec_inserth( + vector unsigned char __a, vector unsigned char __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsbvlx(__c, __a); +#else + return __builtin_altivec_vinsbvrx(__c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai vec_inserth( + vector unsigned short __a, vector unsigned short __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshvlx(__c, __a); +#else + return __builtin_altivec_vinshvrx(__c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai vec_inserth( + vector unsigned int __a, vector unsigned int __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswvlx(__c, __a); +#else + return __builtin_altivec_vinswvrx(__c, __a); +#endif +} #endif /* __POWER10_VECTOR__ */ #undef __ATTRS_o_ai Index: clang/test/CodeGen/builtins-ppc-p10vector.c =================================================================== --- clang/test/CodeGen/builtins-ppc-p10vector.c +++ clang/test/CodeGen/builtins-ppc-p10vector.c @@ -3,14 +3,25 @@ // RUN: -target-cpu pwr10 -triple powerpc64le-unknown-unknown -emit-llvm %s \ // RUN: -o - | FileCheck %s +// RUN: %clang_cc1 -target-feature +vsx -target-feature +altivec \ +// RUN: -target-cpu pwr10 -triple powerpc64-unknown-unknown -emit-llvm %s \ +// RUN: -o - | FileCheck %s -check-prefix=CHECK-BE + +// RUN: %clang_cc1 -target-feature +vsx -target-feature +altivec \ +// RUN: -target-cpu pwr10 -triple powerpc64le-unknown-unknown -emit-llvm %s \ +// RUN: -o - | FileCheck %s -check-prefix=CHECK-LE + #include vector signed char vsca; -vector unsigned char vuca; -vector unsigned short vusa; -vector unsigned int vuia; +vector unsigned char vuca, vucb; +vector unsigned short vusa, vusb; +vector unsigned int vuia, vuib; vector unsigned long long vulla, vullb; -unsigned int uia; +unsigned int uia, uib; +unsigned char uca; +unsigned short usa; +unsigned long long ulla; vector unsigned long long test_vpdepd(void) { // CHECK: @llvm.ppc.altivec.vpdepd(<2 x i64> @@ -79,3 +90,115 @@ // CHECK-LE-NEXT: ret <16 x i8> return vec_clrr(vuca, uia); } + +vector unsigned char test_vec_insertl_uc(void) { + // CHECK-BE: @llvm.ppc.altivec.vinsblx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <16 x i8> + // CHECK-LE: @llvm.ppc.altivec.vinsbrx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <16 x i8> + return vec_insertl(uca, vuca, uia); +} + +vector unsigned short test_vec_insertl_us(void) { + // CHECK-BE: @llvm.ppc.altivec.vinshlx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <8 x i16> + // CHECK-LE: @llvm.ppc.altivec.vinshrx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <8 x i16> + return vec_insertl(usa, vusa, uia); +} + +vector unsigned int test_vec_insertl_ui(void) { + // CHECK-BE: @llvm.ppc.altivec.vinswlx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <4 x i32> + // CHECK-LE: @llvm.ppc.altivec.vinswrx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <4 x i32> + return vec_insertl(uib, vuia, uia); +} + +vector unsigned long long test_vec_insertl_ul(void) { + // CHECK-BE: @llvm.ppc.altivec.vinsdlx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <2 x i64> + // CHECK-LE: @llvm.ppc.altivec.vinsdrx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <2 x i64> + return vec_insertl(ulla, vulla, uia); +} + +vector unsigned char test_vec_insertl_ucv(void) { + // CHECK-BE: @llvm.ppc.altivec.vinsbvlx(i64 %{{.+}}, <16 x i8> + // CHECK-BE-NEXT: ret <16 x i8> + // CHECK-LE: @llvm.ppc.altivec.vinsbvrx(i64 %{{.+}}, <16 x i8> + // CHECK-LE-NEXT: ret <16 x i8> + return vec_insertl(vuca, vucb, uia); +} + +vector unsigned short test_vec_insertl_usv(void) { + // CHECK-BE: @llvm.ppc.altivec.vinshvlx(i64 %{{.+}}, <8 x i16> + // CHECK-BE-NEXT: ret <8 x i16> + // CHECK-LE: @llvm.ppc.altivec.vinshvrx(i64 %{{.+}}, <8 x i16> + // CHECK-LE-NEXT: ret <8 x i16> + return vec_insertl(vusa, vusb, uia); +} + +vector unsigned int test_vec_insertl_uiv(void) { + // CHECK-BE: @llvm.ppc.altivec.vinswvlx(i64 %{{.+}}, <4 x i32> + // CHECK-BE-NEXT: ret <4 x i32> + // CHECK-LE: @llvm.ppc.altivec.vinswvrx(i64 %{{.+}}, <4 x i32> + // CHECK-LE-NEXT: ret <4 x i32> + return vec_insertl(vuia, vuib, uia); +} + +vector unsigned char test_vec_inserth_uc(void) { + // CHECK-BE: @llvm.ppc.altivec.vinsbrx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <16 x i8> + // CHECK-LE: @llvm.ppc.altivec.vinsblx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <16 x i8> + return vec_inserth(uca, vuca, uia); +} + +vector unsigned short test_vec_inserth_us(void) { + // CHECK-BE: @llvm.ppc.altivec.vinshrx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <8 x i16> + // CHECK-LE: @llvm.ppc.altivec.vinshlx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <8 x i16> + return vec_inserth(usa, vusa, uia); +} + +vector unsigned int test_vec_inserth_ui(void) { + // CHECK-BE: @llvm.ppc.altivec.vinswrx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <4 x i32> + // CHECK-LE: @llvm.ppc.altivec.vinswlx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <4 x i32> + return vec_inserth(uib, vuia, uia); +} + +vector unsigned long long test_vec_inserth_ul(void) { + // CHECK-BE: @llvm.ppc.altivec.vinsdrx(i64 %{{.+}}, i64 + // CHECK-BE-NEXT: ret <2 x i64> + // CHECK-LE: @llvm.ppc.altivec.vinsdlx(i64 %{{.+}}, i64 + // CHECK-LE-NEXT: ret <2 x i64> + return vec_inserth(ulla, vulla, uia); +} + +vector unsigned char test_vec_inserth_ucv(void) { + // CHECK-BE: @llvm.ppc.altivec.vinsbvrx(i64 %{{.+}}, <16 x i8> + // CHECK-BE-NEXT: ret <16 x i8> + // CHECK-LE: @llvm.ppc.altivec.vinsbvlx(i64 %{{.+}}, <16 x i8> + // CHECK-LE-NEXT: ret <16 x i8> + return vec_inserth(vuca, vucb, uia); +} + +vector unsigned short test_vec_inserth_usv(void) { + // CHECK-BE: @llvm.ppc.altivec.vinshvrx(i64 %{{.+}}, <8 x i16> + // CHECK-BE-NEXT: ret <8 x i16> + // CHECK-LE: @llvm.ppc.altivec.vinshvlx(i64 %{{.+}}, <8 x i16> + // CHECK-LE-NEXT: ret <8 x i16> + return vec_inserth(vusa, vusb, uia); +} + +vector unsigned int test_vec_inserth_uiv(void) { + // CHECK-BE: @llvm.ppc.altivec.vinswvrx(i64 %{{.+}}, <4 x i32> + // CHECK-BE-NEXT: ret <4 x i32> + // CHECK-LE: @llvm.ppc.altivec.vinswvlx(i64 %{{.+}}, <4 x i32> + // CHECK-LE-NEXT: ret <4 x i32> + return vec_inserth(vuia, vuib, uia); +} Index: llvm/include/llvm/IR/IntrinsicsPowerPC.td =================================================================== --- llvm/include/llvm/IR/IntrinsicsPowerPC.td +++ llvm/include/llvm/IR/IntrinsicsPowerPC.td @@ -425,6 +425,50 @@ def int_ppc_altivec_vclrrb : GCCBuiltin<"__builtin_altivec_vclrrb">, Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>; + + //P10 Vector Insert + def int_ppc_altivec_vinsblx : GCCBuiltin<"__builtin_altivec_vinsblx">, + Intrinsic<[llvm_v16i8_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinsbrx : GCCBuiltin<"__builtin_altivec_vinsbrx">, + Intrinsic<[llvm_v16i8_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinshlx : GCCBuiltin<"__builtin_altivec_vinshlx">, + Intrinsic<[llvm_v8i16_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinshrx : GCCBuiltin<"__builtin_altivec_vinshrx">, + Intrinsic<[llvm_v8i16_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinswlx : GCCBuiltin<"__builtin_altivec_vinswlx">, + Intrinsic<[llvm_v4i32_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinswrx : GCCBuiltin<"__builtin_altivec_vinswrx">, + Intrinsic<[llvm_v4i32_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinsdlx : GCCBuiltin<"__builtin_altivec_vinsdlx">, + Intrinsic<[llvm_v2i64_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinsdrx : GCCBuiltin<"__builtin_altivec_vinsdrx">, + Intrinsic<[llvm_v2i64_ty], [llvm_i64_ty, llvm_i64_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinsbvlx : GCCBuiltin<"__builtin_altivec_vinsbvlx">, + Intrinsic<[llvm_v16i8_ty], [llvm_i64_ty, llvm_v16i8_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinsbvrx : GCCBuiltin<"__builtin_altivec_vinsbvrx">, + Intrinsic<[llvm_v16i8_ty], [llvm_i64_ty, llvm_v16i8_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinshvlx : GCCBuiltin<"__builtin_altivec_vinshvlx">, + Intrinsic<[llvm_v8i16_ty], [llvm_i64_ty, llvm_v8i16_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinshvrx : GCCBuiltin<"__builtin_altivec_vinshvrx">, + Intrinsic<[llvm_v8i16_ty], [llvm_i64_ty, llvm_v8i16_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinswvlx : GCCBuiltin<"__builtin_altivec_vinswvlx">, + Intrinsic<[llvm_v4i32_ty], [llvm_i64_ty, llvm_v4i32_ty], + [IntrNoMem]>; + def int_ppc_altivec_vinswvrx : GCCBuiltin<"__builtin_altivec_vinswvrx">, + Intrinsic<[llvm_v4i32_ty], [llvm_i64_ty, llvm_v4i32_ty], + [IntrNoMem]>; } // Vector average. Index: llvm/lib/Target/PowerPC/PPCInstrPrefix.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrPrefix.td +++ llvm/lib/Target/PowerPC/PPCInstrPrefix.td @@ -552,6 +552,74 @@ "vclrrb $vD, $vA, $rB", IIC_VecGeneral, [(set v16i8:$vD, (int_ppc_altivec_vclrrb v16i8:$vA, i32:$rB))]>; + def VINSBVLX : + VXForm_1 + <15, (outs vrrc:$vD), (ins g8rc:$rA, vrrc:$vB), + "vinsbvlx $vD, $rA, $vB", IIC_VecGeneral, + [(set v16i8:$vD, (int_ppc_altivec_vinsbvlx + i64:$rA, v16i8:$vB))]>; + def VINSBVRX : + VXForm_1 + <271, (outs vrrc:$vD), (ins g8rc:$rA, vrrc:$vB), + "vinsbvrx $vD, $rA, $vB", IIC_VecGeneral, + [(set v16i8:$vD, (int_ppc_altivec_vinsbvrx + i64:$rA, v16i8:$vB))]>; + def VINSHVLX : + VXForm_1 + <79, (outs vrrc:$vD), (ins g8rc:$rA, vrrc:$vB), + "vinshvlx $vD, $rA, $vB", IIC_VecGeneral, + [(set v8i16:$vD, (int_ppc_altivec_vinshvlx + i64:$rA, v8i16:$vB))]>; + def VINSHVRX : + VXForm_1 + <335, (outs vrrc:$vD), (ins g8rc:$rA, vrrc:$vB), + "vinshvrx $vD, $rA, $vB", IIC_VecGeneral, + [(set v8i16:$vD, (int_ppc_altivec_vinshvrx + i64:$rA, v8i16:$vB))]>; + def VINSWVLX : + VXForm_1 + <143, (outs vrrc:$vD), (ins g8rc:$rA, vrrc:$vB), + "vinswvlx $vD, $rA, $vB", IIC_VecGeneral, + [(set v4i32:$vD, (int_ppc_altivec_vinswvlx + i64:$rA, v4i32:$vB))]>; + def VINSWVRX : + VXForm_1 + <399, (outs vrrc:$vD), (ins g8rc:$rA, vrrc:$vB), + "vinswvrx $vD, $rA, $vB", IIC_VecGeneral, + [(set v4i32:$vD, (int_ppc_altivec_vinswvrx + i64:$rA, v4i32:$vB))]>; + def VINSBLX : VXForm_1<527, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinsblx $vD, $rA, $rB", IIC_VecGeneral, + [(set v16i8:$vD, (int_ppc_altivec_vinsblx + i64:$rA, i64:$rB))]>; + def VINSBRX : VXForm_1<783, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinsbrx $vD, $rA, $rB", IIC_VecGeneral, + [(set v16i8:$vD, (int_ppc_altivec_vinsbrx + i64:$rA, i64:$rB))]>; + def VINSHLX : VXForm_1<591, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinshlx $vD, $rA, $rB", IIC_VecGeneral, + [(set v8i16:$vD, (int_ppc_altivec_vinshlx + i64:$rA, i64:$rB))]>; + def VINSHRX : VXForm_1<847, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinshrx $vD, $rA, $rB", IIC_VecGeneral, + [(set v8i16:$vD, (int_ppc_altivec_vinshrx + i64:$rA, i64:$rB))]>; + def VINSWLX : VXForm_1<655, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinswlx $vD, $rA, $rB", IIC_VecGeneral, + [(set v4i32:$vD, (int_ppc_altivec_vinswlx + i64:$rA, i64:$rB))]>; + def VINSWRX : VXForm_1<911, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinswrx $vD, $rA, $rB", IIC_VecGeneral, + [(set v4i32:$vD, (int_ppc_altivec_vinswrx + i64:$rA, i64:$rB))]>; + def VINSDLX : VXForm_1<719, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinsdlx $vD, $rA, $rB", IIC_VecGeneral, + [(set v2i64:$vD, (int_ppc_altivec_vinsdlx + i64:$rA, i64:$rB))]>; + def VINSDRX : VXForm_1<975, (outs vrrc:$vD), (ins g8rc:$rA, g8rc:$rB), + "vinsdrx $vD, $rA, $rB", IIC_VecGeneral, + [(set v2i64:$vD, (int_ppc_altivec_vinsdrx + i64:$rA, i64:$rB))]>; } //---------------------------- Anonymous Patterns ----------------------------// Index: llvm/test/CodeGen/PowerPC/p10-permute-ops.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/PowerPC/p10-permute-ops.ll @@ -0,0 +1,160 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -verify-machineinstrs -ppc-asm-full-reg-names -mcpu=pwr10 \ +; RUN: -ppc-vsr-nums-as-vr -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s + +; RUN: llc -verify-machineinstrs -ppc-asm-full-reg-names -mcpu=pwr10 \ +; RUN: -ppc-vsr-nums-as-vr -mtriple=powerpc64-unknown-unknown < %s | FileCheck %s + +define <16 x i8> @testVINSBLX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSBLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinsblx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsblx(i64 %a, i64 %b) + ret <16 x i8> %0 +} +declare <16 x i8> @llvm.ppc.altivec.vinsblx(i64, i64) + +define <16 x i8> @testVINSBRX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSBRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinsbrx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbrx(i64 %a, i64 %b) + ret <16 x i8> %0 +} +declare <16 x i8> @llvm.ppc.altivec.vinsbrx(i64, i64) + +define <8 x i16> @testVINSHLX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSHLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinshlx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshlx(i64 %a, i64 %b) + ret <8 x i16> %0 +} +declare <8 x i16> @llvm.ppc.altivec.vinshlx(i64, i64) + +define <8 x i16> @testVINSHRX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSHRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinshrx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshrx(i64 %a, i64 %b) + ret <8 x i16> %0 +} +declare <8 x i16> @llvm.ppc.altivec.vinshrx(i64, i64) + +define <4 x i32> @testVINSWLX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSWLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinswlx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswlx(i64 %a, i64 %b) + ret <4 x i32> %0 +} +declare <4 x i32> @llvm.ppc.altivec.vinswlx(i64, i64) + +define <4 x i32> @testVINSWRX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSWRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinswrx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswrx(i64 %a, i64 %b) + ret <4 x i32> %0 +} +declare <4 x i32> @llvm.ppc.altivec.vinswrx(i64, i64) + +define <2 x i64> @testVINSDLX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSDLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinsdlx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <2 x i64> @llvm.ppc.altivec.vinsdlx(i64 %a, i64 %b) + ret <2 x i64> %0 +} +declare <2 x i64> @llvm.ppc.altivec.vinsdlx(i64, i64) + +define <2 x i64> @testVINSDRX(i64 %a, i64 %b) { +; CHECK-LABEL: testVINSDRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinsdrx v2, r3, r4 +; CHECK-NEXT: blr +entry: + %0 = tail call <2 x i64> @llvm.ppc.altivec.vinsdrx(i64 %a, i64 %b) + ret <2 x i64> %0 +} +declare <2 x i64> @llvm.ppc.altivec.vinsdrx(i64, i64) + +define <16 x i8> @testVINSBVLX(i64 %a, <16 x i8> %b) { +; CHECK-LABEL: testVINSBVLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinsbvlx v2, r3, v2 +; CHECK-NEXT: blr +entry: + %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbvlx(i64 %a, <16 x i8> %b) + ret <16 x i8> %0 +} +declare <16 x i8> @llvm.ppc.altivec.vinsbvlx(i64, <16 x i8>) + +define <16 x i8> @testVINSBVRX(i64 %a, <16 x i8> %b) { +; CHECK-LABEL: testVINSBVRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinsbvrx v2, r3, v2 +; CHECK-NEXT: blr +entry: + %0 = tail call <16 x i8> @llvm.ppc.altivec.vinsbvrx(i64 %a, <16 x i8> %b) + ret <16 x i8> %0 +} +declare <16 x i8> @llvm.ppc.altivec.vinsbvrx(i64, <16 x i8>) + +define <8 x i16> @testVINSHVLX(i64 %a, <8 x i16> %b) { +; CHECK-LABEL: testVINSHVLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinshvlx v2, r3, v2 +; CHECK-NEXT: blr +entry: + %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshvlx(i64 %a, <8 x i16> %b) + ret <8 x i16> %0 +} +declare <8 x i16> @llvm.ppc.altivec.vinshvlx(i64, <8 x i16>) + +define <8 x i16> @testVINSHVRX(i64 %a, <8 x i16> %b) { +; CHECK-LABEL: testVINSHVRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinshvrx v2, r3, v2 +; CHECK-NEXT: blr +entry: + %0 = tail call <8 x i16> @llvm.ppc.altivec.vinshvrx(i64 %a, <8 x i16> %b) + ret <8 x i16> %0 +} +declare <8 x i16> @llvm.ppc.altivec.vinshvrx(i64, <8 x i16>) + +define <4 x i32> @testVINSWVLX(i64 %a, <4 x i32> %b) { +; CHECK-LABEL: testVINSWVLX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinswvlx v2, r3, v2 +; CHECK-NEXT: blr +entry: + %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswvlx(i64 %a, <4 x i32> %b) + ret <4 x i32> %0 +} +declare <4 x i32> @llvm.ppc.altivec.vinswvlx(i64, <4 x i32>) + +define <4 x i32> @testVINSWVRX(i64 %a, <4 x i32> %b) { +; CHECK-LABEL: testVINSWVRX: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vinswvrx v2, r3, v2 +; CHECK-NEXT: blr +entry: + %0 = tail call <4 x i32> @llvm.ppc.altivec.vinswvrx(i64 %a, <4 x i32> %b) + ret <4 x i32> %0 +} +declare <4 x i32> @llvm.ppc.altivec.vinswvrx(i64, <4 x i32>) Index: llvm/test/MC/Disassembler/PowerPC/p10insts.txt =================================================================== --- llvm/test/MC/Disassembler/PowerPC/p10insts.txt +++ llvm/test/MC/Disassembler/PowerPC/p10insts.txt @@ -30,3 +30,45 @@ # CHECK: vclrrb 1, 4, 3 0x10 0x24 0x19 0xcd + +# CHECK: vinsbvlx 1, 3, 5 +0x10 0x23 0x28 0x0f + +# CHECK: vinsbvrx 1, 3, 5 +0x10 0x23 0x29 0x0f + +# CHECK: vinshvlx 1, 3, 5 +0x10 0x23 0x28 0x4f + +# CHECK: vinshvrx 1, 3, 5 +0x10 0x23 0x29 0x4f + +# CHECK: vinswvlx 1, 3, 5 +0x10 0x23 0x28 0x8f + +# CHECK: vinswvrx 1, 3, 5 +0x10 0x23 0x29 0x8f + +# CHECK: vinsblx 1, 2, 3 +0x10 0x22 0x1a 0x0f + +# CHECK: vinsbrx 1, 2, 3 +0x10 0x22 0x1b 0x0f + +# CHECK: vinshlx 1, 2, 3 +0x10 0x22 0x1a 0x4f + +# CHECK: vinshrx 1, 2, 3 +0x10 0x22 0x1b 0x4f + +# CHECK: vinswlx 1, 2, 3 +0x10 0x22 0x1a 0x8f + +# CHECK: vinswrx 1, 2, 3 +0x10 0x22 0x1b 0x8f + +# CHECK: vinsdlx 1, 2, 3 +0x10 0x22 0x1a 0xcf + +# CHECK: vinsdrx 1, 2, 3 +0x10 0x22 0x1b 0xcf Index: llvm/test/MC/PowerPC/p10.s =================================================================== --- llvm/test/MC/PowerPC/p10.s +++ llvm/test/MC/PowerPC/p10.s @@ -33,3 +33,45 @@ # CHECK-BE: vclrrb 1, 4, 3 # encoding: [0x10,0x24,0x19,0xcd] # CHECK-LE: vclrrb 1, 4, 3 # encoding: [0xcd,0x19,0x24,0x10] vclrrb 1, 4, 3 +# CHECK-BE: vinsbvlx 1, 3, 5 # encoding: [0x10,0x23,0x28,0x0f] +# CHECK-LE: vinsbvlx 1, 3, 5 # encoding: [0x0f,0x28,0x23,0x10] + vinsbvlx 1, 3, 5 +# CHECK-BE: vinsbvrx 1, 3, 5 # encoding: [0x10,0x23,0x29,0x0f] +# CHECK-LE: vinsbvrx 1, 3, 5 # encoding: [0x0f,0x29,0x23,0x10] + vinsbvrx 1, 3, 5 +# CHECK-BE: vinshvlx 1, 3, 5 # encoding: [0x10,0x23,0x28,0x4f] +# CHECK-LE: vinshvlx 1, 3, 5 # encoding: [0x4f,0x28,0x23,0x10] + vinshvlx 1, 3, 5 +# CHECK-BE: vinshvrx 1, 3, 5 # encoding: [0x10,0x23,0x29,0x4f] +# CHECK-LE: vinshvrx 1, 3, 5 # encoding: [0x4f,0x29,0x23,0x10] + vinshvrx 1, 3, 5 +# CHECK-BE: vinswvlx 1, 3, 5 # encoding: [0x10,0x23,0x28,0x8f] +# CHECK-LE: vinswvlx 1, 3, 5 # encoding: [0x8f,0x28,0x23,0x10] + vinswvlx 1, 3, 5 +# CHECK-BE: vinswvrx 1, 3, 5 # encoding: [0x10,0x23,0x29,0x8f] +# CHECK-LE: vinswvrx 1, 3, 5 # encoding: [0x8f,0x29,0x23,0x10] + vinswvrx 1, 3, 5 +# CHECK-BE: vinsblx 1, 2, 3 # encoding: [0x10,0x22,0x1a,0x0f] +# CHECK-LE: vinsblx 1, 2, 3 # encoding: [0x0f,0x1a,0x22,0x10] + vinsblx 1, 2, 3 +# CHECK-BE: vinsbrx 1, 2, 3 # encoding: [0x10,0x22,0x1b,0x0f] +# CHECK-LE: vinsbrx 1, 2, 3 # encoding: [0x0f,0x1b,0x22,0x10] + vinsbrx 1, 2, 3 +# CHECK-BE: vinshlx 1, 2, 3 # encoding: [0x10,0x22,0x1a,0x4f] +# CHECK-LE: vinshlx 1, 2, 3 # encoding: [0x4f,0x1a,0x22,0x10] + vinshlx 1, 2, 3 +# CHECK-BE: vinshrx 1, 2, 3 # encoding: [0x10,0x22,0x1b,0x4f] +# CHECK-LE: vinshrx 1, 2, 3 # encoding: [0x4f,0x1b,0x22,0x10] + vinshrx 1, 2, 3 +# CHECK-BE: vinswlx 1, 2, 3 # encoding: [0x10,0x22,0x1a,0x8f] +# CHECK-LE: vinswlx 1, 2, 3 # encoding: [0x8f,0x1a,0x22,0x10] + vinswlx 1, 2, 3 +# CHECK-BE: vinswrx 1, 2, 3 # encoding: [0x10,0x22,0x1b,0x8f] +# CHECK-LE: vinswrx 1, 2, 3 # encoding: [0x8f,0x1b,0x22,0x10] + vinswrx 1, 2, 3 +# CHECK-BE: vinsdlx 1, 2, 3 # encoding: [0x10,0x22,0x1a,0xcf] +# CHECK-LE: vinsdlx 1, 2, 3 # encoding: [0xcf,0x1a,0x22,0x10] + vinsdlx 1, 2, 3 +# CHECK-BE: vinsdrx 1, 2, 3 # encoding: [0x10,0x22,0x1b,0xcf] +# CHECK-LE: vinsdrx 1, 2, 3 # encoding: [0xcf,0x1b,0x22,0x10] + vinsdrx 1, 2, 3