diff mbox

[i-g-t] tests: Fix compilation when some gcc configurations

Message ID 1468580862-2309-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien July 15, 2016, 11:07 a.m. UTC
Depending how the gcc was compiled it may be necessary to enable SSE4
instructions explicitly. Otherwise:

  CC       gem_gtt_speed.o
In file included from gem_gtt_speed.c:54:0:
/usr/lib/gcc/x86_64-linux-gnu/4.8/include/smmintrin.h:31:3: error: #error "SSE4.1 instruction set not enabled"
 # error "SSE4.1 instruction set not enabled"
   ^

v2: Use a pragma directive (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tests/gem_exec_flush.c | 1 +
 tests/gem_gtt_speed.c  | 1 +
 2 files changed, 2 insertions(+)

Comments

Chris Wilson July 15, 2016, 11:35 a.m. UTC | #1
On Fri, Jul 15, 2016 at 12:07:42PM +0100, Damien Lespiau wrote:
> Depending how the gcc was compiled it may be necessary to enable SSE4
> instructions explicitly. Otherwise:
> 
>   CC       gem_gtt_speed.o
> In file included from gem_gtt_speed.c:54:0:
> /usr/lib/gcc/x86_64-linux-gnu/4.8/include/smmintrin.h:31:3: error: #error "SSE4.1 instruction set not enabled"
>  # error "SSE4.1 instruction set not enabled"
>    ^
> 
> v2: Use a pragma directive (Chris)
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  tests/gem_exec_flush.c | 1 +
>  tests/gem_gtt_speed.c  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/tests/gem_exec_flush.c b/tests/gem_exec_flush.c
> index c81a977..b43d511 100644
> --- a/tests/gem_exec_flush.c
> +++ b/tests/gem_exec_flush.c
> @@ -41,6 +41,7 @@ IGT_TEST_DESCRIPTION("Basic check of flushing after batches");
>  #define MOVNT 512
>  
>  #if defined(__x86_64__)
> +#pragma GCC target ("sse4.1")

I jumped ahead and did
#pragma GCC push_options
#pragma GCC target ("sse4.1")
..
#pragma GCC pop_options

Compiling with gcc 4.2 or even older will be fixed whenever...
-Chris
diff mbox

Patch

diff --git a/tests/gem_exec_flush.c b/tests/gem_exec_flush.c
index c81a977..b43d511 100644
--- a/tests/gem_exec_flush.c
+++ b/tests/gem_exec_flush.c
@@ -41,6 +41,7 @@  IGT_TEST_DESCRIPTION("Basic check of flushing after batches");
 #define MOVNT 512
 
 #if defined(__x86_64__)
+#pragma GCC target ("sse4.1")
 #include <smmintrin.h>
 __attribute__((noinline))
 __attribute__((target("sse4.1")))
diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c
index 94b3de3..ed8cfda 100644
--- a/tests/gem_gtt_speed.c
+++ b/tests/gem_gtt_speed.c
@@ -51,6 +51,7 @@  static double elapsed(const struct timeval *start,
 }
 
 #if defined(__x86_64__)
+#pragma GCC target ("sse4.1")
 #include <smmintrin.h>
 __attribute__((noinline))
 __attribute__((target("sse4.1")))