From 0c1d639911cbdcd5299c77e5e38f794b37431a7c Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Mon, 16 May 2016 11:15:46 +0200 Subject: [PATCH] (iOS) Buildfix --- audio/audio_utils.c | 2 +- .../conversion/float_to_s16_neon.S | 10 ++-- .../RetroArch_iOS.xcodeproj/project.pbxproj | 8 +++ pkg/apple/float_to_s16_neon.S | 56 +++++++++++++++++++ 4 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 pkg/apple/float_to_s16_neon.S diff --git a/audio/audio_utils.c b/audio/audio_utils.c index 6d7f520e4c..d3bacbaf13 100644 --- a/audio/audio_utils.c +++ b/audio/audio_utils.c @@ -267,7 +267,7 @@ void audio_convert_init_simd(void) #if defined(__ARM_NEON__) && !defined(VITA) audio_convert_s16_to_float_arm = (cpu & RETRO_SIMD_NEON) ? audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C; - audio_convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ? + convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ? convert_float_to_s16_neon : convert_float_to_s16_C; #endif } diff --git a/libretro-common/conversion/float_to_s16_neon.S b/libretro-common/conversion/float_to_s16_neon.S index 3c6e2a75ac..b3b5b943e3 100644 --- a/libretro-common/conversion/float_to_s16_neon.S +++ b/libretro-common/conversion/float_to_s16_neon.S @@ -19,11 +19,11 @@ #endif .align 4 -.globl audio_convert_float_s16_asm -.globl _audio_convert_float_s16_asm -# audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples) -audio_convert_float_s16_asm: -_audio_convert_float_s16_asm: +.globl convert_float_s16_asm +.globl _convert_float_s16_asm +# convert_float_s16_asm(int16_t *out, const float *in, size_t samples) +convert_float_s16_asm: +_convert_float_s16_asm: # Hacky way to get a constant of 2^15. # ((2^4)^2)^2 * 0.5 = 2^15 vmov.f32 q8, #16.0 diff --git a/pkg/apple/RetroArch_iOS.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS.xcodeproj/project.pbxproj index dea2b6e637..ab915b5769 100644 --- a/pkg/apple/RetroArch_iOS.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS.xcodeproj/project.pbxproj @@ -64,6 +64,9 @@ 5040F0511AE47EE2006F6972 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5040F04F1AE47ED4006F6972 /* libz.dylib */; }; 5041BAF41A9D40D000A77A33 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963C3C33186E3DED00A6EB1E /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 50521A441AA23BF500185CC9 /* griffin_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 50521A431AA23BF500185CC9 /* griffin_objc.m */; }; + 507E056B1CE9C67500E023D3 /* float_to_s16_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 507E056A1CE9C67500E023D3 /* float_to_s16_neon.S */; }; + 507E056C1CE9C69300E023D3 /* float_to_s16_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 507E056A1CE9C67500E023D3 /* float_to_s16_neon.S */; }; + 507E056D1CE9C69400E023D3 /* float_to_s16_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 507E056A1CE9C67500E023D3 /* float_to_s16_neon.S */; }; 50C3B1AE1AB1107200F478D3 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50C3B1AD1AB1107100F478D3 /* QuartzCore.framework */; }; 50CCC828185E0E7D001F5BC8 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */; }; 50D00E8E19D117C400EBA71E /* cc_resampler_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */; }; @@ -95,6 +98,7 @@ 503700AE1ACA18E400A51A37 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = SOURCE_ROOT; }; 5040F04F1AE47ED4006F6972 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 50521A431AA23BF500185CC9 /* griffin_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = griffin_objc.m; path = ../../griffin/griffin_objc.m; sourceTree = SOURCE_ROOT; }; + 507E056A1CE9C67500E023D3 /* float_to_s16_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = float_to_s16_neon.S; path = "../../libretro-common/conversion/float_to_s16_neon.S"; sourceTree = SOURCE_ROOT; }; 50C3B1AD1AB1107100F478D3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 50CCC827185E0E7D001F5BC8 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = cc_resampler_neon.S; path = ../../audio/drivers_resampler/cc_resampler_neon.S; sourceTree = SOURCE_ROOT; }; @@ -203,6 +207,7 @@ 96AFAE1A16C1D4EA009DE44C = { isa = PBXGroup; children = ( + 507E056A1CE9C67500E023D3 /* float_to_s16_neon.S */, 83D632D719ECFCC4009E3161 /* Assets */, 50D00E8D19D117C400EBA71E /* cc_resampler_neon.S */, 96AFAE9C16C1D976009DE44C /* core */, @@ -438,6 +443,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 507E056D1CE9C69400E023D3 /* float_to_s16_neon.S in Sources */, 0FDA2A721BE1AFA800F2B5DA /* cc_resampler_neon.S in Sources */, 0FDA2A731BE1AFA800F2B5DA /* griffin_objc.m in Sources */, 0FDA2A741BE1AFA800F2B5DA /* audio_utils_neon.S in Sources */, @@ -450,6 +456,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 507E056C1CE9C69300E023D3 /* float_to_s16_neon.S in Sources */, 503700881ACA18E400A51A37 /* cc_resampler_neon.S in Sources */, 503700891ACA18E400A51A37 /* griffin_objc.m in Sources */, 5037008A1ACA18E400A51A37 /* audio_utils_neon.S in Sources */, @@ -462,6 +469,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 507E056B1CE9C67500E023D3 /* float_to_s16_neon.S in Sources */, 50D00E8E19D117C400EBA71E /* cc_resampler_neon.S in Sources */, 50521A441AA23BF500185CC9 /* griffin_objc.m in Sources */, 501232CE192E5FE30063A359 /* audio_utils_neon.S in Sources */, diff --git a/pkg/apple/float_to_s16_neon.S b/pkg/apple/float_to_s16_neon.S new file mode 100644 index 0000000000..3c6e2a75ac --- /dev/null +++ b/pkg/apple/float_to_s16_neon.S @@ -0,0 +1,56 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ +#if defined(__ARM_NEON__) + +#ifndef __MACH__ +.arm +#endif + +.align 4 +.globl audio_convert_float_s16_asm +.globl _audio_convert_float_s16_asm +# audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples) +audio_convert_float_s16_asm: +_audio_convert_float_s16_asm: + # Hacky way to get a constant of 2^15. + # ((2^4)^2)^2 * 0.5 = 2^15 + vmov.f32 q8, #16.0 + vmov.f32 q9, #0.5 + vmul.f32 q8, q8, q8 + vmul.f32 q8, q8, q8 + vmul.f32 q8, q8, q9 + +1: + # Preload here? + vld1.f32 {q0-q1}, [r1]! + + vmul.f32 q0, q0, q8 + vmul.f32 q1, q1, q8 + + vcvt.s32.f32 q0, q0 + vcvt.s32.f32 q1, q1 + + vqmovn.s32 d4, q0 + vqmovn.s32 d5, q1 + + vst1.f32 {d4-d5}, [r0]! + + # Guaranteed to get samples in multiples of 8. + subs r2, r2, #8 + bne 1b + + bx lr + +#endif