From 381cbe499483f73ec4eecc0345c156e8bdf951ae Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 4 Aug 2017 00:19:58 +0000 Subject: [PATCH] Add support for Vector Add Saturated on PowerPC --- src/etc/platform-intrinsics/powerpc.json | 7 +++++ src/librustc_platform_intrinsics/powerpc.rs | 30 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/etc/platform-intrinsics/powerpc.json b/src/etc/platform-intrinsics/powerpc.json index e7810109f3f..7805bb1057d 100644 --- a/src/etc/platform-intrinsics/powerpc.json +++ b/src/etc/platform-intrinsics/powerpc.json @@ -86,6 +86,13 @@ "llvm": "vsubcuw", "ret": "u32", "args": ["0", "0"] + }, + { + "intrinsic": "add{0.kind}{0.data_type_short}s", + "width": [128], + "llvm": "vadd{0.kind}{0.data_type_short}s", + "ret": "i(8-32)", + "args": ["0", "0"] } ] } diff --git a/src/librustc_platform_intrinsics/powerpc.rs b/src/librustc_platform_intrinsics/powerpc.rs index eb47595f4b0..0c686997eda 100644 --- a/src/librustc_platform_intrinsics/powerpc.rs +++ b/src/librustc_platform_intrinsics/powerpc.rs @@ -177,6 +177,36 @@ pub fn find(name: &str) -> Option { output: &::U32x4, definition: Named("llvm.ppc.altivec.vsubcuw") }, + "_vec_addsbs" => Intrinsic { + inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, + output: &::I8x16, + definition: Named("llvm.ppc.altivec.vaddsbs") + }, + "_vec_addubs" => Intrinsic { + inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, + output: &::U8x16, + definition: Named("llvm.ppc.altivec.vaddubs") + }, + "_vec_addshs" => Intrinsic { + inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, + output: &::I16x8, + definition: Named("llvm.ppc.altivec.vaddshs") + }, + "_vec_adduhs" => Intrinsic { + inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, + output: &::U16x8, + definition: Named("llvm.ppc.altivec.vadduhs") + }, + "_vec_addsws" => Intrinsic { + inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, + output: &::I32x4, + definition: Named("llvm.ppc.altivec.vaddsws") + }, + "_vec_adduws" => Intrinsic { + inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, + output: &::U32x4, + definition: Named("llvm.ppc.altivec.vadduws") + }, _ => return None, }) }