Index: testsuite/gcc.dg/tm/memset.c
===================================================================
--- testsuite/gcc.dg/tm/memset.c	(revision 0)
+++ testsuite/gcc.dg/tm/memset.c	(revision 0)
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+extern void *memset (void *, int, __SIZE_TYPE__);
+
+char array[4] = "aaaa";
+
+__attribute__((transaction_safe))  
+void *my_memset()  
+{  
+  return memset(array,'b',4);
+}  
+
+   
+int main()  
+{  
+
+	__transaction [[atomic]] {  
+		my_memset();  
+	}  
+	return 0;  
+}
+
+/* { dg-final { scan-assembler "_ITM_memsetW" } } */
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c	(revision 169292)
+++ tree-ssa-alias.c	(working copy)
@@ -1057,6 +1057,7 @@ ref_maybe_used_by_call_p_1 (gimple call,
 	case BUILT_IN_MALLOC:
 	case BUILT_IN_CALLOC:
 	case BUILT_IN_MEMSET:
+        case BUILT_IN_TM_MEMSET:
 	case BUILT_IN_FREXP:
 	case BUILT_IN_FREXPF:
 	case BUILT_IN_FREXPL:
@@ -1234,6 +1235,7 @@ call_may_clobber_ref_p_1 (gimple call, a
 	case BUILT_IN_STRCAT:
 	case BUILT_IN_STRNCAT:
 	case BUILT_IN_MEMSET:
+        case BUILT_IN_TM_MEMSET:
         CASE_BUILT_IN_TM_STORE (1):
         CASE_BUILT_IN_TM_STORE (2):
         CASE_BUILT_IN_TM_STORE (4):
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 169442)
+++ trans-mem.c	(working copy)
@@ -485,6 +485,8 @@ find_tm_replacement_function (tree fndec
 	return built_in_decls[BUILT_IN_TM_MEMCPY];
       case BUILT_IN_MEMMOVE:
 	return built_in_decls[BUILT_IN_TM_MEMMOVE];
+      case BUILT_IN_MEMSET:
+	return built_in_decls[BUILT_IN_TM_MEMSET];
       default:
 	return NULL;
       }
Index: calls.c
===================================================================
--- calls.c	(revision 169292)
+++ calls.c	(working copy)
@@ -480,6 +480,7 @@ special_function_p (const_tree fndecl, i
 	case BUILT_IN_TM_GETTMCLONE_IRR:
 	case BUILT_IN_TM_MEMCPY:
 	case BUILT_IN_TM_MEMMOVE:
+        case BUILT_IN_TM_MEMSET:
 	CASE_BUILT_IN_TM_STORE (1):
 	CASE_BUILT_IN_TM_STORE (2):
 	CASE_BUILT_IN_TM_STORE (4):
Index: gtm-builtins.def
===================================================================
--- gtm-builtins.def	(revision 169292)
+++ gtm-builtins.def	(working copy)
@@ -14,6 +14,8 @@ DEF_TM_BUILTIN (BUILT_IN_TM_MEMCPY, "_IT
 		BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_TM_TMPURE_NOTHROW_LIST)
 DEF_TM_BUILTIN (BUILT_IN_TM_MEMMOVE, "_ITM_memmoveRtWt",
 		BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_TM_TMPURE_NOTHROW_LIST)
+DEF_TM_BUILTIN (BUILT_IN_TM_MEMSET, "_ITM_memsetW",
+	       	BT_FN_PTR_PTR_INT_SIZE, ATTR_TM_TMPURE_NOTHROW_LIST)
 
 DEF_TM_BUILTIN (BUILT_IN_TM_GETTMCLONE_IRR, "_ITM_getTMCloneOrIrrevocable",
 		BT_FN_PTR_PTR, ATTR_TM_CONST_NOTHROW_LIST)
Index: tree-ssa-structalias.c
===================================================================
--- tree-ssa-structalias.c	(revision 169292)
+++ tree-ssa-structalias.c	(working copy)
@@ -3720,6 +3720,7 @@ find_func_aliases (gimple t)
 	      return;
 	    }
 	  case BUILT_IN_MEMSET:
+	  case BUILT_IN_TM_MEMSET:
 	    {
 	      tree res = gimple_call_lhs (t);
 	      tree dest = gimple_call_arg (t, 0);
