From 34bbb24ce7702658cdc4e9d34a650e169716c39e Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 7 Jun 2018 11:13:34 -0700 Subject: [PATCH] meson: Add support for ppc assembly/optimizations v2: - Use -mpower8-vector in compiler test for altivec - rename altivec option to power8 - reword power8 option description to be more clear, originally I had made it a boolean, but replaced it with an auto option. Signed-off-by: Dylan Baker Reviewed-by: Eric Engestrom Reviewed-by: Matt Turner --- meson.build | 31 +++++++++++++++++++++++++++---- meson_options.txt | 7 +++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index c78d34098ff..0fab01fe530 100644 --- a/meson.build +++ b/meson.build @@ -605,13 +605,34 @@ if with_gallium_st_nine endif endif +if get_option('power8') != 'false' + if host_machine.cpu_family() == 'ppc64le' + if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.8') + error('Altivec is not supported with gcc version < 4.8.') + endif + if cc.compiles(''' + #include + int main() { + vector unsigned char r; + vector unsigned int v = vec_splat_u32 (1); + r = __builtin_vec_vgbbd ((vector unsigned char) v); + return 0; + }''', + args : '-mpower8-vector', + name : 'POWER8 intrinsics') + pre_args += ['-D_ARCH_PWR8', '-mpower8-vector'] + elif get_option('power8') == 'true' + error('POWER8 intrinsic support required but not found.') + endif + endif +endif + _opencl = get_option('gallium-opencl') if _opencl != 'disabled' if not with_gallium error('OpenCL Clover implementation requires at least one gallium driver.') endif - # TODO: alitvec? dep_clc = dependency('libclc') with_gallium_opencl = true with_opencl_icd = _opencl == 'icd' @@ -839,8 +860,6 @@ if not cc.links('''#include pre_args += '-DMISSING_64_BIT_ATOMICS' endif -# TODO: endian -# TODO: powr8 # TODO: shared/static? Is this even worth doing? # When cross compiling we generally need to turn off the use of assembly, @@ -870,7 +889,6 @@ endif with_asm_arch = '' if with_asm - # TODO: SPARC and PPC if host_machine.cpu_family() == 'x86' if system_has_kms_drm with_asm_arch = 'x86' @@ -901,6 +919,11 @@ if with_asm with_asm_arch = 'sparc' pre_args += ['-DUSE_SPARC_ASM'] endif + elif host_machine.cpu_family() == 'ppc64le' + if system_has_kms_drm + with_asm_arch = 'ppc64le' + pre_args += ['-DUSE_PPC64LE_ASM'] + endif endif endif diff --git a/meson_options.txt b/meson_options.txt index 28e92509198..bfe2290868f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -304,3 +304,10 @@ option( choices : ['freedreno', 'glsl', 'intel', 'nir', 'nouveau', 'all'], description : 'List of tools to build.', ) +option( + 'power8', + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], + description : 'Enable power8 optimizations.', +)