You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.3KB

  1. diff --git a/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c b/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c
  2. index 4eac42e95..74d120e7d 100644
  3. --- a/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c
  4. +++ b/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c
  5. @@ -240,42 +240,7 @@ void FLAC__cpu_info(FLAC__CPUInfo *info)
  6. disable_sse(info);
  7. # endif
  8. #elif defined(__linux__)
  9. - int sse = 0;
  10. - struct sigaction sigill_save;
  11. - struct sigaction sigill_sse;
  12. - sigill_sse.sa_sigaction = sigill_handler_sse_os;
  13. - #ifdef __ANDROID__
  14. - sigemptyset (&sigill_sse.sa_mask);
  15. - #else
  16. - __sigemptyset(&sigill_sse.sa_mask);
  17. - #endif
  18. - sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */
  19. - if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save))
  20. - {
  21. - /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */
  22. - /* see sigill_handler_sse_os() for an explanation of the following: */
  23. - asm volatile (
  24. - "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */
  25. - "incl %0\n\t" /* SIGILL handler will jump over this */
  26. - /* landing zone */
  27. - "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */
  28. - "nop\n\t"
  29. - "nop\n\t"
  30. - "nop\n\t"
  31. - "nop\n\t"
  32. - "nop\n\t"
  33. - "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */
  34. - "nop\n\t"
  35. - "nop" /* SIGILL jump lands here if "inc" is 1 byte */
  36. - : "=r"(sse)
  37. - : "0"(sse)
  38. - );
  39. -
  40. - sigaction(SIGILL, &sigill_save, NULL);
  41. - }
  42. -
  43. - if(!sse)
  44. - disable_sse(info);
  45. + int sse = 1;
  46. #elif defined(_MSC_VER)
  47. __try {
  48. __asm {
  49. @@ -287,30 +252,7 @@ void FLAC__cpu_info(FLAC__CPUInfo *info)
  50. disable_sse(info);
  51. }
  52. #elif defined(__GNUC__) /* MinGW goes here */
  53. - int sse = 0;
  54. - /* Based on the idea described in Agner Fog's manual "Optimizing subroutines in assembly language" */
  55. - /* In theory, not guaranteed to detect lack of OS SSE support on some future Intel CPUs, but in practice works (see the aforementioned manual) */
  56. - if (ia32_fxsr) {
  57. - struct {
  58. - FLAC__uint32 buff[128];
  59. - } __attribute__((aligned(16))) fxsr;
  60. - FLAC__uint32 old_val, new_val;
  61. -
  62. - asm volatile ("fxsave %0" : "=m" (fxsr) : "m" (fxsr));
  63. - old_val = fxsr.buff[50];
  64. - fxsr.buff[50] ^= 0x0013c0de; /* change value in the buffer */
  65. - asm volatile ("fxrstor %0" : "=m" (fxsr) : "m" (fxsr)); /* try to change SSE register */
  66. - fxsr.buff[50] = old_val; /* restore old value in the buffer */
  67. - asm volatile ("fxsave %0 " : "=m" (fxsr) : "m" (fxsr)); /* old value will be overwritten if SSE register was changed */
  68. - new_val = fxsr.buff[50]; /* == old_val if FXRSTOR didn't change SSE register and (old_val ^ 0x0013c0de) otherwise */
  69. - fxsr.buff[50] = old_val; /* again restore old value in the buffer */
  70. - asm volatile ("fxrstor %0" : "=m" (fxsr) : "m" (fxsr)); /* restore old values of registers */
  71. -
  72. - if ((old_val^new_val) == 0x0013c0de)
  73. - sse = 1;
  74. - }
  75. - if(!sse)
  76. - disable_sse(info);
  77. + int sse = 1;
  78. #else
  79. /* no way to test, disable to be safe */
  80. disable_sse(info);