From ddfe9b6d7dff1d0e357a751229dec2db81a2267c Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Wed, 9 Mar 2016 21:37:44 +0100 Subject: [PATCH 1/3] Define AVX comparison intrinsics This defines `_mm256_cmp_pd` and `_mm256_cmp_ps`. Intel reference: https://software.intel.com/en-us/node/524075. --- src/etc/platform-intrinsics/x86/avx.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/etc/platform-intrinsics/x86/avx.json b/src/etc/platform-intrinsics/x86/avx.json index 08524fbd6dd..0625ac63bf1 100644 --- a/src/etc/platform-intrinsics/x86/avx.json +++ b/src/etc/platform-intrinsics/x86/avx.json @@ -15,6 +15,13 @@ "ret": "f(32-64)", "args": ["s8SPc"] }, + { + "intrinsic": "256_cmp_{0.data_type}", + "width": [256], + "llvm": "cmp.{1.data_type}.256", + "ret": "f(32-64)", + "args": ["0", "0", "s8S"] + }, { "intrinsic": "256_cvtepi32_pd", "width": [256], From e1489caf0b1796db5dc5bc9946db0453838366ea Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Fri, 11 Mar 2016 16:22:11 +0100 Subject: [PATCH 2/3] Define AVX blend intrinsics This defines the `_mm256_blendv_pd` and `_mm256_blendv_ps` intrinsics. The `_mm256_blend_pd` and `_mm256_blend_ps` intrinsics are not available as LLVM intrinsics. In Clang they are implemented using the shufflevector builtin. Intel reference: https://software.intel.com/en-us/node/524070. --- src/etc/platform-intrinsics/x86/avx.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/etc/platform-intrinsics/x86/avx.json b/src/etc/platform-intrinsics/x86/avx.json index 0625ac63bf1..05a4721aed8 100644 --- a/src/etc/platform-intrinsics/x86/avx.json +++ b/src/etc/platform-intrinsics/x86/avx.json @@ -8,6 +8,13 @@ "ret": "f(32-64)", "args": ["0", "0"] }, + { + "intrinsic": "256_blendv_{0.data_type}", + "width": [256], + "llvm": "blendv.{0.data_type}.256", + "ret": "f(32-64)", + "args": ["0", "0", "0"] + }, { "intrinsic": "256_broadcast_{0.data_type}", "width": [256], From a394d50490bc1f73afeed1d408f6153d267851b2 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Sun, 13 Mar 2016 15:09:46 +0100 Subject: [PATCH 3/3] Regenerate x86 platform intrinsics The exact command used was: $ cd src/etc/platform-intrinsics/x86 $ python2 ../generator.py --format compiler-defs -i info.json \ sse.json sse2.json sse3.json ssse3.json sse41.json sse42.json \ avx.json avx2.json fma.json \ > ../../../librustc_platform_intrinsics/x86.rs --- src/librustc_platform_intrinsics/x86.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/librustc_platform_intrinsics/x86.rs b/src/librustc_platform_intrinsics/x86.rs index d8aaf151267..c5d3e414c7c 100644 --- a/src/librustc_platform_intrinsics/x86.rs +++ b/src/librustc_platform_intrinsics/x86.rs @@ -498,6 +498,16 @@ pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option { output: v(f(64), 4), definition: Named("llvm.x86.avx.addsub.pd.256") }, + "256_blendv_ps" => Intrinsic { + inputs: vec![v(f(32), 8), v(f(32), 8), v(f(32), 8)], + output: v(f(32), 8), + definition: Named("llvm.x86.avx.blendv.ps.256") + }, + "256_blendv_pd" => Intrinsic { + inputs: vec![v(f(64), 4), v(f(64), 4), v(f(64), 4)], + output: v(f(64), 4), + definition: Named("llvm.x86.avx.blendv.pd.256") + }, "256_broadcast_ps" => Intrinsic { inputs: vec![p(true, i(8), None)], output: v(f(32), 8), @@ -508,6 +518,16 @@ pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option { output: v(f(64), 4), definition: Named("llvm.x86.avx.vbroadcastf128.pd.256") }, + "256_cmp_ps" => Intrinsic { + inputs: vec![v(f(32), 8), v(f(32), 8), i(8)], + output: v(f(32), 8), + definition: Named("llvm.x86.avx.cmp.ps.256") + }, + "256_cmp_pd" => Intrinsic { + inputs: vec![v(f(64), 4), v(f(64), 4), i(8)], + output: v(f(64), 4), + definition: Named("llvm.x86.avx.cmp.pd.256") + }, "256_cvtepi32_pd" => Intrinsic { inputs: vec![v(i(32), 4)], output: v(f(64), 4),