kromanova updated this revision to Diff 45458.
kromanova added a comment.

Craig, thank you for the review. Here are the changes that you requested.
Katya.


Repository:
  rL LLVM

http://reviews.llvm.org/D16177

Files:
  lib/Headers/f16cintrin.h
  test/CodeGen/f16c-builtins.c

Index: test/CodeGen/f16c-builtins.c
===================================================================
--- test/CodeGen/f16c-builtins.c
+++ test/CodeGen/f16c-builtins.c
@@ -5,6 +5,18 @@
 
 #include <x86intrin.h>
 
+float test_cvtsh_ss(unsigned short a) {
+  // CHECK-LABEL: test_cvtsh_ss
+  // CHECK: @llvm.x86.vcvtph2ps.128
+  return _cvtsh_ss(a);
+}
+
+unsigned short test_cvtss_sh(float a) {
+  // CHECK-LABEL: test_cvtss_sh
+  // CHECK: @llvm.x86.vcvtps2ph.128
+  return _cvtss_sh(a, 0);
+}
+
 __m128 test_mm_cvtph_ps(__m128i a) {
   // CHECK-LABEL: test_mm_cvtph_ps
   // CHECK: @llvm.x86.vcvtph2ps.128
Index: lib/Headers/f16cintrin.h
===================================================================
--- lib/Headers/f16cintrin.h
+++ lib/Headers/f16cintrin.h
@@ -31,6 +31,20 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("f16c")))
 
+static __inline float __DEFAULT_FN_ATTRS
+_cvtsh_ss(unsigned short a)
+{
+  __v8hi v = {(short)a, 0, 0, 0, 0, 0, 0, 0};
+  __v4sf r = __builtin_ia32_vcvtph2ps(v);
+  return r[0];
+}
+
+#define _cvtss_sh(a, imm) __extension__ ({ \
+  __v8hi r = __builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, (imm)); \
+  (unsigned short)r[0]; \
+})
+
+
 #define _mm_cvtps_ph(a, imm) __extension__ ({ \
  (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm)); })
 


Index: test/CodeGen/f16c-builtins.c
===================================================================
--- test/CodeGen/f16c-builtins.c
+++ test/CodeGen/f16c-builtins.c
@@ -5,6 +5,18 @@
 
 #include <x86intrin.h>
 
+float test_cvtsh_ss(unsigned short a) {
+  // CHECK-LABEL: test_cvtsh_ss
+  // CHECK: @llvm.x86.vcvtph2ps.128
+  return _cvtsh_ss(a);
+}
+
+unsigned short test_cvtss_sh(float a) {
+  // CHECK-LABEL: test_cvtss_sh
+  // CHECK: @llvm.x86.vcvtps2ph.128
+  return _cvtss_sh(a, 0);
+}
+
 __m128 test_mm_cvtph_ps(__m128i a) {
   // CHECK-LABEL: test_mm_cvtph_ps
   // CHECK: @llvm.x86.vcvtph2ps.128
Index: lib/Headers/f16cintrin.h
===================================================================
--- lib/Headers/f16cintrin.h
+++ lib/Headers/f16cintrin.h
@@ -31,6 +31,20 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("f16c")))
 
+static __inline float __DEFAULT_FN_ATTRS
+_cvtsh_ss(unsigned short a)
+{
+  __v8hi v = {(short)a, 0, 0, 0, 0, 0, 0, 0};
+  __v4sf r = __builtin_ia32_vcvtph2ps(v);
+  return r[0];
+}
+
+#define _cvtss_sh(a, imm) __extension__ ({ \
+  __v8hi r = __builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, (imm)); \
+  (unsigned short)r[0]; \
+})
+
+
 #define _mm_cvtps_ph(a, imm) __extension__ ({ \
  (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm)); })
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to