Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-21 Thread lvqcl
Erik de Castro Lopo wrote:

 Hmm, compiling just one or two flags with these flags is somewhat difficult.

Currently my intrinsic code is split into 5 files:

lpc_intrin_sse.c
lpc_intrin_sse2.c
lpc_intrin_sse41.c
stream_encoder_intrin_sse2.c
stream_encoder_intrin_ssse3.c


 I'll see if I can think of some way around this.

That would be great.
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-17 Thread lvqcl
Erik de Castro Lopo mle...@mega-nerd.com wrote:

 -msse for SSE code, -msse2 for SSE2 code, -msse4.1 for SSE4.1 code

 Yes, that was it. Brain fart. These flags were not needed on x86_64.

 Erik

But now all C code is compiled with -msse2 and it won't work on older CPUs.
Isn't it better to compile only necessary files with this flag?
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-17 Thread Erik de Castro Lopo
lvqcl wrote:

 Erik de Castro Lopo mle...@mega-nerd.com wrote:
 
  -msse for SSE code, -msse2 for SSE2 code, -msse4.1 for SSE4.1 code
 
  Yes, that was it. Brain fart. These flags were not needed on x86_64.
 
  Erik
 
 But now all C code is compiled with -msse2 and it won't work on older CPUs.
 Isn't it better to compile only necessary files with this flag?

Hmm, compiling just one or two flags with these flags is somewhat difficult.

I'll see if I can think of some way around this.

Cheers,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-15 Thread Erik de Castro Lopo
lvqcl wrote:

 It's not possible to use ia32/*.nasm code in 64-bit compiles.
 There's still no 64-bit asm code in FLAC. I'm not familiar with asm too,
 so I wrote SSE-accelerated code using intrinsics.

Thanks for your work on this.

I've applied these patches, updated the configure script to detect
the required features and then tweaked things slightly.

The biggest of these tweaks weas to disable the intrinsics version
fero FLAC__CPU_IA32 because I couldn't get this to compile on 
i386-linux (and we have the nasm versions). Still open to re-enabling
this if someone can get it to work.

Cheers,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-15 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

 lvqcl wrote:
 
  It's not possible to use ia32/*.nasm code in 64-bit compiles.
  There's still no 64-bit asm code in FLAC. I'm not familiar with asm too,
  so I wrote SSE-accelerated code using intrinsics.
 
 Thanks for your work on this.
 
 I've applied these patches, updated the configure script to detect
 the required features and then tweaked things slightly.
 
 The biggest of these tweaks weas to disable the intrinsics version
 fero FLAC__CPU_IA32 because I couldn't get this to compile on 
 i386-linux (and we have the nasm versions). Still open to re-enabling
 this if someone can get it to work.

BTW, tested this on:

x86-linux
x86-64-linux
x86-mingw  (cross-compiled from linux)
x86_64-mingw   (cross-compiled from linux)

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-15 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

 There is a segfault happening in the new code when compiling with
 -DDEBUG. Trying to track it down.

This turned out somewhat nasty.

The segfault was only happening in the libFLAC++ code and only when
compiled with -DDEBUG. Debugging with GDB and Valgrind only managed
to track the problem down to code where constructors or destructors
would be.

I then added -Weffc++ to CXXFLAGS and found a number of classes which
contained pointer data members but which had no copy constructors or
assignment operator methods. The other problem we related in missing
data member initializers.

Fixing all these issues made the segfault disappear.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-15 Thread lvqcl
Erik de Castro Lopo wrote:
  When should FLAC__HAS_X86INTRIN be defined? What header file should I be
  checking for?

 Ah, should be checking for x86intrin.h.

I simply don't know. In MSVS there's no x86intrin.h, but it has intrin.h.


 There is a segfault happening in the new code when compiling with
 -DDEBUG. Trying to track it down.

I suspect that it's inline asm code for cpuid. It will be replaced with 
__get_cpuid().
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-14 Thread Erik de Castro Lopo
lvqcl wrote:

 It's not possible to use ia32/*.nasm code in 64-bit compiles.
 There's still no 64-bit asm code in FLAC. I'm not familiar with asm too,
 so I wrote SSE-accelerated code using intrinsics.
 
 This code uses two new preprocessor macros:
 FLAC__CPU_X86_64 (analogous to FLAC__CPU_IA32)

Ok, I have defined FLAC__CPU_X86_64 in configure.ac.

 and FLAC__HAS_X86INTRIN (analogous to FLAC__HAS_NASM)

When should FLAC__HAS_X86INTRIN be defined? What header file should I be
checking for?

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-14 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

 When should FLAC__HAS_X86INTRIN be defined? What header file should I be
 checking for?

Ah, should be checking for x86intrin.h.

The rest seems to be coming together. Testing this now.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-14 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

 Erik de Castro Lopo wrote:
 
  When should FLAC__HAS_X86INTRIN be defined? What header file should I be
  checking for?
 
 Ah, should be checking for x86intrin.h.
 
 The rest seems to be coming together. Testing this now.

There is a segfault happening in the new code when compiling with
-DDEBUG. Trying to track it down.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[flac-dev] PATCH: x86-64 support and SSE intrinscis code

2013-09-08 Thread lvqcl

It's not possible to use ia32/*.nasm code in 64-bit compiles.
There's still no 64-bit asm code in FLAC. I'm not familiar with asm too,
so I wrote SSE-accelerated code using intrinsics.

This code uses two new preprocessor macros:
FLAC__CPU_X86_64 (analogous to FLAC__CPU_IA32)
and FLAC__HAS_X86INTRIN (analogous to FLAC__HAS_NASM)


Patch for cpu.c/cpu.h adds CPU features (sse3, ssse3) detection code
for x86-64 architecture.

Another patch adds SSE-accelerated functions:
FLAC__lpc_compute_autocorrelation_intrin_sse_lag_4()
FLAC__lpc_compute_autocorrelation_intrin_sse_lag_8()
FLAC__lpc_compute_autocorrelation_intrin_sse_lag_12()
FLAC__lpc_compute_autocorrelation_intrin_sse_lag_16()
FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2()

Note that the new code works only if both FLAC__CPU_X86_64 and 
FLAC__HAS_X86INTRIN
macros are defined somewhere in config files. Appropriate changes in *.vcproj,
makefiles, configure.ac files are necessary. Unfortunately MSVS 2005 Express 
Edition
doesn't support creation of 64-bit programs.

cpu.patch
Description: Binary data


intrin.patch
Description: Binary data
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev