[PATCH] [clang][Headers] _mm_stream_load_si128 should accept const arguments.

Michael Spencer bigcheesegs at gmail.com
Fri Jan 30 08:12:48 PST 2015


Hi craig.topper,

Patch originally by Wolfgang Pieb.

http://reviews.llvm.org/D7297

Files:
  lib/Headers/smmintrin.h
  test/CodeGen/builtins-x86-sse42.c

Index: lib/Headers/smmintrin.h
===================================================================
--- lib/Headers/smmintrin.h
+++ lib/Headers/smmintrin.h
@@ -152,7 +152,7 @@
 
 /* SSE4 Streaming Load Hint Instruction.  */
 static __inline__  __m128i __attribute__((__always_inline__, __nodebug__))
-_mm_stream_load_si128 (__m128i *__V)
+_mm_stream_load_si128 (const __m128i *__V)
 {
   return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __V);
 }
Index: test/CodeGen/builtins-x86-sse42.c
===================================================================
--- /dev/null
+++ test/CodeGen/builtins-x86-sse42.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Werror -target-feature +sse4.2 %s -S -o - | FileCheck %s
+
+#define __MM_MALLOC_H
+
+#include <x86intrin.h>
+
+__m128i stream_load(__m128i *p)
+{
+  // CHECK-LABEL: stream_load
+  // CHECK: movntdqa
+  return _mm_stream_load_si128(p);
+}
+
+__m128i stream_load_c(const __m128i *p)
+{
+  // CHECK-LABEL: stream_load_c
+  // CHECK: movntdqa
+  return _mm_stream_load_si128(p);
+}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7297.19038.patch
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150130/bf820634/attachment.bin>


More information about the cfe-commits mailing list