Correct sse flags for compiling against embree with gcc
Alec Jacobson
May 14, 2013
I had trouble compiling against the embree raytracing library. I first tried compiling a small test problem with gcc (g++-mp-4.7) and immediately got errors:
error: '_mm_abs_epi32' was not declared in this scope
error: '_mm_shuffle_epi8' was not declared in this scope
error: '_mm_abs_epi32' was not declared in this scope
I tried adding the gcc flag -msse
to no avail. I tried -mavx
I got tons of errors like:
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:20:no such instruction: `vxorps %xmm0, %xmm0,%xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:21:no such instruction: `vmovaps %xmm0, __ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:22:no such instruction: `vmovss LC0(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:23:no such instruction: `vmovaps %xmm0, 16+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:24:no such instruction: `vmovaps LC1(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:25:no such instruction: `vmovaps %xmm0, 32+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:26:no such instruction: `vmovaps LC2(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:27:no such instruction: `vmovaps %xmm0, 48+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:28:no such instruction: `vmovaps LC3(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:29:no such instruction: `vmovaps %xmm0, 64+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:30:no such instruction: `vmovaps LC4(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:31:no such instruction: `vmovaps %xmm0, 80+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:32:no such instruction: `vmovaps LC5(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:33:no such instruction: `vmovaps %xmm0, 96+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:34:no such instruction: `vmovaps LC6(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:35:no such instruction: `vmovaps %xmm0, 112+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:36:no such instruction: `vmovaps LC7(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:37:no such instruction: `vmovaps %xmm0, 128+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:38:no such instruction: `vmovaps LC8(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:39:no such instruction: `vmovaps %xmm0, 144+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:40:no such instruction: `vmovaps LC9(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:41:no such instruction: `vmovaps %xmm0, 160+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:42:no such instruction: `vmovaps LC10(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:43:no such instruction: `vmovaps %xmm0, 176+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:44:no such instruction: `vmovaps LC11(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:45:no such instruction: `vmovaps %xmm0, 192+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:46:no such instruction: `vmovaps LC12(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:47:no such instruction: `vmovaps %xmm0, 208+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:48:no such instruction: `vmovaps LC13(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:49:no such instruction: `vmovaps %xmm0, 224+__ZL17_mm_lookupmask_ps(%rip)'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:50:no such instruction: `vmovaps LC14(%rip), %xmm0'
/var/folders/6g/l7c387896dz565996h9tz6d40000gn/T//ccZ5EWof.s:51:no such instruction: `vmovaps %xmm0, 240+__ZL17_mm_lookupmask_ps(%rip)'
Finally I looked into the commands embree's makefile was issuing to compile it in the first place and found the correct flag: -msse4.2
.