Index: lib/Headers/Intrin.h
===================================================================
--- lib/Headers/Intrin.h
+++ lib/Headers/Intrin.h
@@ -46,12 +46,6 @@
 extern "C" {
 #endif
 
-#if defined(__MMX__)
-/* And the random ones that aren't in those files. */
-__m64 _m_from_float(float);
-float _m_to_float(__m64);
-#endif
-
 /* Other assorted instruction intrinsics. */
 void __addfsbyte(unsigned long, unsigned char);
 void __addfsdword(unsigned long, unsigned long);
Index: lib/Headers/mm3dnow.h
===================================================================
--- lib/Headers/mm3dnow.h
+++ lib/Headers/mm3dnow.h
@@ -37,6 +37,20 @@
   __builtin_ia32_femms();
 }
 
+static __inline__ float __DEFAULT_FN_ATTRS
+_m_to_float(__m64 __m) {
+  union { int __i; float __f; } __t;
+  __t.__i = __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
+  return __t.__f;
+}
+
+static __inline__ __m64 __DEFAULT_FN_ATTRS
+_m_from_float(float __f) {
+  union { int __i; float __f; } __t;
+  __t.__f = __f;
+  return (__m64)__builtin_ia32_vec_init_v2si(__t.__i, 0);
+}
+
 static __inline__ __m64 __DEFAULT_FN_ATTRS
 _m_pavgusb(__m64 __m1, __m64 __m2) {
   return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);
Index: test/CodeGen/3dnow-builtins.c
===================================================================
--- test/CodeGen/3dnow-builtins.c
+++ test/CodeGen/3dnow-builtins.c
@@ -5,6 +5,18 @@
 
 #include <x86intrin.h>
 
+__m64 test_m_from_float(float f) {
+  // CHECK-LABEL: define i64 @test_m_from_float
+  // CHECK: insertelement <2 x i32> 
+  return _m_from_float(f);
+}
+
+float test_m_to_float(__m64 m) {
+  // CHECK-LABEL: define float @test_m_to_float
+  // CHECK: extractelement <2 x i32>
+  return _m_to_float(m);
+}
+
 __m64 test_m_pavgusb(__m64 m1, __m64 m2) {
   // CHECK-LABEL: define i64 @test_m_pavgusb
   // CHECK: @llvm.x86.3dnow.pavgusb