diff options
author | Doug Nazar <nazard@nazar.ca> | 2019-08-28 10:23:31 -0400 |
---|---|---|
committer | Doug Nazar <nazard@nazar.ca> | 2019-09-08 18:13:48 -0400 |
commit | a999325abea6a5549d60d99ddeb0271d2aa00235 (patch) | |
tree | 2fd161cf5a51b4fe9fa235ccd77d42a3ebe336d8 /orc/orcprogram-altivec.c | |
parent | 00dc4a44a71e7519035196a47fdd45ae460e6dd1 (diff) | |
download | orc-a999325abea6a5549d60d99ddeb0271d2aa00235.tar.gz |
powerpc: Fix cpu feature detection
Fix meson cpu family detection.
Actually call cpu detection from progam init.
Add VSX & v2.07 checks for linux with options to diable.
Add display of target flags & cache sizes.
Diffstat (limited to 'orc/orcprogram-altivec.c')
-rw-r--r-- | orc/orcprogram-altivec.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/orc/orcprogram-altivec.c b/orc/orcprogram-altivec.c index fb3e0a5..659115e 100644 --- a/orc/orcprogram-altivec.c +++ b/orc/orcprogram-altivec.c @@ -17,6 +17,7 @@ void orc_compiler_powerpc_register_rules (OrcTarget *target); static void orc_compiler_powerpc_init (OrcCompiler *compiler); static unsigned int orc_compiler_powerpc_get_default_flags (void); static void orc_compiler_powerpc_assemble (OrcCompiler *compiler); +static const char* powerpc_get_flag_name (int shift); static void @@ -79,7 +80,7 @@ static OrcTarget altivec_target = { 0, NULL, NULL, - NULL, + powerpc_get_flag_name, orc_powerpc_flush_cache }; @@ -87,6 +88,14 @@ static OrcTarget altivec_target = { void orc_powerpc_init (void) { +#ifdef HAVE_POWERPC + powerpc_detect_cpu_flags (); + + if (!(orc_powerpc_cpu_flags & ORC_TARGET_POWERPC_ALTIVEC)) { + altivec_target.executable = FALSE; + } +#endif + orc_target_register (&altivec_target); orc_compiler_powerpc_register_rules (&altivec_target); @@ -104,9 +113,31 @@ orc_compiler_powerpc_get_default_flags (void) flags |= ORC_TARGET_POWERPC_LE; #endif +#ifdef HAVE_POWERPC + flags |= orc_powerpc_cpu_flags; +#else + flags |= ORC_TARGET_POWERPC_ALTIVEC; + flags |= ORC_TARGET_POWERPC_VSX; + flags |= ORC_TARGET_POWERPC_V207; +#endif + return flags; } +static const char * +powerpc_get_flag_name (int shift) +{ + static const char *flags[] = { + "64bit", "le", "altivec", "vsx", "v2.07" + }; + + if (shift >= 0 && shift < sizeof(flags)/sizeof(flags[0])) { + return flags[shift]; + } + + return NULL; +} + static void orc_compiler_powerpc_init (OrcCompiler *compiler) { |