[cfe-commits] [PATCH] [llvm+clang] memset for non-8-bit bytes

Patrik Hägglund H patrik.h.hagglund at ericsson.com
Thu Oct 18 06:11:43 PDT 2012

We have a back-end with 16-bit bytes, and have changed the memset
intrinsics to be able to work on arbitrary word sizes, just as memcpy.

This patch updates the type of the second parameter of memset in
Intrinsics.td, from llvm_i8_ty, to llvm_anyint_ty:

 def int_memset  : Intrinsic<[],
-                            [llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty,
+                            [llvm_anyptr_ty, llvm_anyint_ty, llvm_anyint_ty,
                              llvm_i32_ty, llvm_i1_ty],

IRBuilder.cpp and LangRef.html is updated accordingly.

To use the intrinsic, the declaration,

  declare void @llvm.memset.p0i8.i32(i8* <dest>, i8 <val>,
                                     i32 <len>, i32 <align>, i1 <isvolatile>)

now becomes

  declare void @llvm.memset.p0i8.i8.i32(i8* <dest>, i8 <val>,
                                        i32 <len>, i32 <align>, i1 <isvolatile>)

The bulk of this patch consists of such changes (mainly in tests).

Some tests in clang has to be updated, as shown by the second patch file.

/Patrik Hägglund  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-clang-Change-memset-in-Intrinsics.td-to-take-anyint.patch
Type: application/octet-stream
Size: 12799 bytes
Desc: 0002-clang-Change-memset-in-Intrinsics.td-to-take-anyint.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121018/5e11c4c0/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-llvm-Change-memset-in-Intrinsics.td-to-take-anyint.patch
Type: application/octet-stream
Size: 90870 bytes
Desc: 0001-llvm-Change-memset-in-Intrinsics.td-to-take-anyint.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121018/5e11c4c0/attachment-0001.obj>

More information about the cfe-commits mailing list