Skip to content

Commit 8b78ea5

Browse files
committed
Add support for Vector Average on PowerPC
1 parent 19c4bdb commit 8b78ea5

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/etc/platform-intrinsics/powerpc.json

+7
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@
114114
"llvm": "vmulo{0.kind}{1.data_type_short}",
115115
"ret": "i(16-32)",
116116
"args": ["0N", "1"]
117+
},
118+
{
119+
"intrinsic": "avg{0.kind}{0.data_type_short}",
120+
"width": [128],
121+
"llvm": "vavg{0.kind}{0.data_type_short}",
122+
"ret": "i(8-32)",
123+
"args": ["0", "0"]
117124
}
118125
]
119126
}

src/librustc_platform_intrinsics/powerpc.rs

+30
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,36 @@ pub fn find(name: &str) -> Option<Intrinsic> {
252252
output: &::U32x4,
253253
definition: Named("llvm.ppc.altivec.vmulouh")
254254
},
255+
"_vec_avgsb" => Intrinsic {
256+
inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS },
257+
output: &::I8x16,
258+
definition: Named("llvm.ppc.altivec.vavgsb")
259+
},
260+
"_vec_avgub" => Intrinsic {
261+
inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS },
262+
output: &::U8x16,
263+
definition: Named("llvm.ppc.altivec.vavgub")
264+
},
265+
"_vec_avgsh" => Intrinsic {
266+
inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS },
267+
output: &::I16x8,
268+
definition: Named("llvm.ppc.altivec.vavgsh")
269+
},
270+
"_vec_avguh" => Intrinsic {
271+
inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS },
272+
output: &::U16x8,
273+
definition: Named("llvm.ppc.altivec.vavguh")
274+
},
275+
"_vec_avgsw" => Intrinsic {
276+
inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS },
277+
output: &::I32x4,
278+
definition: Named("llvm.ppc.altivec.vavgsw")
279+
},
280+
"_vec_avguw" => Intrinsic {
281+
inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS },
282+
output: &::U32x4,
283+
definition: Named("llvm.ppc.altivec.vavguw")
284+
},
255285
_ => return None,
256286
})
257287
}

0 commit comments

Comments
 (0)