Closed Bug 786995 Opened 11 years ago Closed 11 years ago

configure should check for SSSE3 support in the whole toolchain


(Firefox Build System :: General, defect)

Not set


(Not tracked)



(Reporter: gaston, Assigned: gaston)




(1 file)

Followup to bug 759683, i've tried building m-c on OpenBSD with gcc 4.6 and it bails out when building the skia SSSE3 file with :

{standard input}: Assembler messages:
{standard input}:283: Error: no such instruction: `pmaddubsw %xmm2,%xmm3'
{standard input}:400: Error: no such instruction: `pmaddubsw %xmm0,%xmm1'
{standard input}:544: Error: no such instruction: `pmaddubsw %xmm0,%xmm1'
{standard input}:806: Error: no such instruction: `pmaddubsw %xmm1,%xmm4'
{standard input}:880: Error: no such instruction: `pmaddubsw %xmm1,%xmm4'
{standard input}:982: Error: no such instruction: `pmaddubsw %xmm0,%xmm1'
{standard input}:1058: Error: no such instruction: `pmaddubsw %xmm0,%xmm1'
{standard input}:1212: Error: no such instruction: `pmaddubsw %xmm0,%xmm1'

Of course our as from binutils 2.15 doesnt support pmaddubsw. sigh.

The configure test setting HAVE_COMPILER_FLAG_MSSSE3 only checks if the compiler itself supports -mssse3, but not the whole toolchain. SIGH.

Doing a configure test as :

# include <tmmintrin.h>
int main(){

__m128i a0, a1;
_mm_maddubs_epi16(a0, a1);

succeeds with eg++ -mssse3 so i don't know how to actually test for the support of pmaddubsw in as..
Blocks: 759683
As what was done in bug 778414 to test for @unwind sections, maybe a configure test doing :

echo '.text\npmaddubsw %xmm2,%xmm3' > foo.s && gcc -mssse3 foo.s 

in addition to check that the compiler itself support -mssse3 might do the trick. Here with my as 2.15 it bails out nicely with 

foo.s: Assembler messages:
foo.s:2: Error: no such instruction: `pmaddubsw %xmm2,%xmm3'

Can someone check what it does on a more decent/recent binutils/as ?
Works for me (after tweaking the commandline slightly) with:
gcc-4.6.real (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
GNU ld (GNU Binutils for Ubuntu) 2.22
SkBitmapProcState_opts_SSSE3.cpp builds fine with clang 3.1 too, as does the foo.s test.

So would that be okay to change the define HAVE_COMPILER_FLAG_MSSSE3 to HAVE_TOOLCHAIN_SUPPORT_MSSSE3 (if needed) and use that snippet as a test for proper ssse3 support ?
This seems to do the trick here, i'm getting 'no' for gcc 4.6/as 2.15 and 'yes' for clang 3.1 and its builtin as. The key change is 

+    AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])

Builds whole m-c fine with clang, currently building with gcc 4.6.
Assignee: nobody → landry
Attachment #656836 - Flags: review?(ted.mielczarek)
Attachment #656836 - Flags: review?(ted.mielczarek) → review+
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.