diff mbox series

[38/62] AVX512FP16: Add testcase for vcvtsh2sd/vcvtsh2ss/vcvtsd2sh/vcvtss2sh.

Message ID 20210701061648.9447-39-hongtao.liu@intel.com
State New
Headers show
Series Support all AVX512FP16 intrinsics. | expand

Commit Message

liuhongt July 1, 2021, 6:16 a.m. UTC
gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-vcvtsd2sh-1a.c: New test.
	* gcc.target/i386/avx512fp16-vcvtsd2sh-1b.c: Ditto.
	* gcc.target/i386/avx512fp16-vcvtsh2sd-1a.c: Ditto.
	* gcc.target/i386/avx512fp16-vcvtsh2sd-1b.c: Ditto.
	* gcc.target/i386/avx512fp16-vcvtsh2ss-1a.c: Ditto.
	* gcc.target/i386/avx512fp16-vcvtsh2ss-1b.c: Ditto.
	* gcc.target/i386/avx512fp16-vcvtss2sh-1a.c: Ditto.
	* gcc.target/i386/avx512fp16-vcvtss2sh-1b.c: Ditto.
---
 .../gcc.target/i386/avx512fp16-vcvtsd2sh-1a.c | 25 ++++++++
 .../gcc.target/i386/avx512fp16-vcvtsd2sh-1b.c | 60 +++++++++++++++++++
 .../gcc.target/i386/avx512fp16-vcvtsh2sd-1a.c | 25 ++++++++
 .../gcc.target/i386/avx512fp16-vcvtsh2sd-1b.c | 57 ++++++++++++++++++
 .../gcc.target/i386/avx512fp16-vcvtsh2ss-1a.c | 25 ++++++++
 .../gcc.target/i386/avx512fp16-vcvtsh2ss-1b.c | 59 ++++++++++++++++++
 .../gcc.target/i386/avx512fp16-vcvtss2sh-1a.c | 25 ++++++++
 .../gcc.target/i386/avx512fp16-vcvtss2sh-1b.c | 60 +++++++++++++++++++
 8 files changed, 336 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1a.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1b.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1a.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1b.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1a.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1b.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1a.c
 create mode 100644 gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1b.c
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1a.c
new file mode 100644
index 00000000000..b663ca507fe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1a.c
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcvtsd2sh\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2sh\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2sh\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2sh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2sh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2sh\[ \\t\]+\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res, x1;
+volatile __m128d x2;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+  res = _mm_cvtsd_sh (x1, x2);
+  res = _mm_mask_cvtsd_sh (res, m8, x1, x2);
+  res = _mm_maskz_cvtsd_sh (m8, x1, x2);
+  res = _mm_cvt_roundsd_sh (x1, x2, 8);
+  res = _mm_mask_cvt_roundsd_sh (res, m8, x1, x2, 8);
+  res = _mm_maskz_cvt_roundsd_sh (m8, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1b.c
new file mode 100644
index 00000000000..552362058c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsd2sh-1b.c
@@ -0,0 +1,60 @@ 
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_vcvtsd2sh(V512 * dest, V512 op1, V512 op2,
+                __mmask8 k, int zero_mask)
+{
+    V512 v1, v2, v5, v6, v7, v8;
+    int i;
+    
+    unpack_ph_2twops(op1, &v1, &v2);
+    unpack_ph_2twops(*dest, &v7, &v8);
+
+    if ((k&1) || !k)
+      v5.f32[0] = (float)op2.f64[0];
+    else if (zero_mask)
+      v5.f32[0] = 0;
+    else
+      v5.f32[0] = v7.f32[0];
+
+    for (i = 1; i < 8; i++)
+      v5.f32[i] = v1.f32[i];
+
+    *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+  V512 res;
+  V512 exp;
+
+  init_src();
+  emulate_vcvtsd2sh(&exp, src1, src2, 0x1, 0);
+  res.xmmh[0] = _mm_cvt_roundsd_sh(src1.xmmh[0], src2.xmmd[0],
+                                 _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "_mm_cvt_roundsd_sh");
+
+  init_dest(&res, &exp);
+  emulate_vcvtsd2sh(&exp, src1, src2, 0x1, 0);
+  res.xmmh[0] = _mm_mask_cvt_roundsd_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+                                      src2.xmmd[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_mask_cvt_roundsd_sh");
+
+  emulate_vcvtsd2sh(&exp, src1, src2, 0x2, 1);
+  res.xmmh[0] = _mm_maskz_cvt_roundsd_sh(0x2, src1.xmmh[0],
+                                       src2.xmmd[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_maskz_cvt_roundsd_sh");
+
+  if (n_errs != 0) {
+      abort ();
+  }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1a.c
new file mode 100644
index 00000000000..59719ed18e6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1a.c
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcvtsh2sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2sd\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2sd\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+volatile __m128d res;
+volatile __m128d x1;
+volatile __m128h x2;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+  res = _mm_cvtsh_sd (x1, x2);
+  res = _mm_mask_cvtsh_sd (res, m8, x1, x2);
+  res = _mm_maskz_cvtsh_sd (m8, x1, x2);
+  res = _mm_cvt_roundsh_sd (x1, x2, 8);
+  res = _mm_mask_cvt_roundsh_sd (res, m8, x1, x2, 8);
+  res = _mm_maskz_cvt_roundsh_sd (m8, x1, x2, 4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1b.c
new file mode 100644
index 00000000000..e6bdc9580bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2sd-1b.c
@@ -0,0 +1,57 @@ 
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_vcvtsh2sd(V512 * dest, V512 op1, V512 op2,
+                __mmask8 k, int zero_mask)
+{
+    V512 v1, v2, v3, v4, v5, v6, v7, v8;
+
+    unpack_ph_2twops(op2, &v3, &v4);
+
+    if ((k&1) || !k)
+      v5.f64[0] = v3.f32[0];
+    else if (zero_mask)
+      v5.f64[0] = 0;
+    else
+      v5.f64[0] = dest->f64[0];
+
+    v5.f64[1] = op1.f64[1];
+
+    *dest = v5;
+}
+
+void
+test_512 (void)
+{
+  V512 res;
+  V512 exp;
+
+  init_src();
+  emulate_vcvtsh2sd(&exp, src1, src2, 0x1, 0);
+  res.xmmd[0] = _mm_cvt_roundsh_sd(src1.xmmd[0], src2.xmmh[0],
+                                 _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "_mm_cvt_roundsh_sd");
+
+  init_dest(&res, &exp);
+  emulate_vcvtsh2sd(&exp, src1, src2, 0x1, 0);
+  res.xmmd[0] = _mm_mask_cvt_roundsh_sd(res.xmmd[0], 0x1, src1.xmmd[0],
+                                      src2.xmmh[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_mask_cvt_roundsh_sd");
+
+  emulate_vcvtsh2sd(&exp, src1, src2, 0x2, 1);
+  res.xmmd[0] = _mm_maskz_cvt_roundsh_sd(0x2, src1.xmmd[0],
+                                       src2.xmmh[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_maskz_cvt_roundsh_sd");
+
+  if (n_errs != 0) {
+      abort ();
+  }
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1a.c
new file mode 100644
index 00000000000..e6c369c067f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1a.c
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcvtsh2ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2ss\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2ss\[ \\t\]+\{sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsh2ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+volatile __m128 res;
+volatile __m128 x1;
+volatile __m128h x2;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+  res = _mm_cvtsh_ss (x1, x2);
+  res = _mm_mask_cvtsh_ss (res, m8, x1, x2);
+  res = _mm_maskz_cvtsh_ss (m8, x1, x2);
+  res = _mm_cvt_roundsh_ss (x1, x2, 8);
+  res = _mm_mask_cvt_roundsh_ss (res, m8, x1, x2, 8);
+  res = _mm_maskz_cvt_roundsh_ss (m8, x1, x2, 4);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1b.c
new file mode 100644
index 00000000000..319598341cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtsh2ss-1b.c
@@ -0,0 +1,59 @@ 
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+ void NOINLINE
+emulate_vcvtsh2ss(V512 * dest, V512 op1, V512 op2,
+                __mmask8 k, int zero_mask)
+{
+    V512 v1, v2, v3, v4, v5, v6, v7, v8;
+    int i;
+
+    unpack_ph_2twops(op2, &v3, &v4);
+    if ((k&1) || !k)
+      v5.f32[0] = v3.f32[0];
+    else if (zero_mask)
+      v5.f32[0] = 0;
+    else
+      v5.f32[0] = dest->f32[0];
+
+    for (i = 1; i < 4; i++)
+      v5.f32[i] = op1.f32[i];
+
+    *dest = v5;
+}
+
+void
+test_512 (void)
+{
+  V512 res;
+  V512 exp;
+
+  init_src();
+  emulate_vcvtsh2ss(&exp, src1, src2, 0x1, 0);
+  res.xmm[0] = _mm_cvt_roundsh_ss(src1.xmm[0], src2.xmmh[0],
+                                 _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "_mm_cvt_roundsh_ss");
+
+  init_dest(&res, &exp);
+  emulate_vcvtsh2ss(&exp, src1, src2, 0x1, 0);
+  res.xmm[0] = _mm_mask_cvt_roundsh_ss(res.xmm[0], 0x1, src1.xmm[0],
+                                      src2.xmmh[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_mask_cvt_roundsh_ss");
+
+  emulate_vcvtsh2ss(&exp, src1, src2, 0x2, 1);
+  res.xmm[0] = _mm_maskz_cvt_roundsh_ss(0x2, src1.xmm[0],
+                                       src2.xmmh[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_maskz_cvt_roundsh_ss");
+
+  if (n_errs != 0) {
+      abort ();
+  }
+}
+
+
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1a.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1a.c
new file mode 100644
index 00000000000..63ad0906555
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1a.c
@@ -0,0 +1,25 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavx512fp16 -O2" } */
+/* { dg-final { scan-assembler-times "vcvtss2sh\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sh\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sh\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sh\[ \\t\]+\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sh\[ \\t\]+\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\[^\n\r]*%xmm\[0-9\]+\{%k\[0-9\]\}\{z\}\[^\n\r]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128h res, x1;
+volatile __m128 x2;
+volatile __mmask8 m8;
+
+void extern
+avx512f_test (void)
+{
+  res = _mm_cvtss_sh (x1, x2);
+  res = _mm_mask_cvtss_sh (res, m8, x1, x2);
+  res = _mm_maskz_cvtss_sh (m8, x1, x2);
+  res = _mm_cvt_roundss_sh (x1, x2, 8);
+  res = _mm_mask_cvt_roundss_sh (res, m8, x1, x2, 8);
+  res = _mm_maskz_cvt_roundss_sh (m8, x1, x2, 11);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1b.c b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1b.c
new file mode 100644
index 00000000000..94981bbb79f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512fp16-vcvtss2sh-1b.c
@@ -0,0 +1,60 @@ 
+/* { dg-do run { target avx512fp16 } } */
+/* { dg-options "-O2 -mavx512fp16 -mavx512dq" } */
+
+
+#define AVX512FP16
+#include "avx512fp16-helper.h"
+
+#define N_ELEMS 8
+
+void NOINLINE
+emulate_vcvtss2sh(V512 * dest, V512 op1, V512 op2,
+                __mmask8 k, int zero_mask)
+{
+    V512 v1, v2, v5, v6, v7, v8;
+    int i;
+    
+    unpack_ph_2twops(op1, &v1, &v2);
+    unpack_ph_2twops(*dest, &v7, &v8);
+
+    if ((k&1) || !k)
+      v5.f32[0] = op2.f32[0];
+    else if (zero_mask)
+      v5.f32[0] = 0;
+    else
+      v5.f32[0] = v7.f32[0];
+
+    for (i = 1; i < 8; i++)
+      v5.f32[i] = v1.f32[i];
+
+    *dest = pack_twops_2ph(v5, v6);
+}
+
+void
+test_512 (void)
+{
+  V512 res;
+  V512 exp;
+
+  init_src();
+  emulate_vcvtss2sh(&exp, src1, src2, 0x1, 0);
+  res.xmmh[0] = _mm_cvt_roundss_sh(src1.xmmh[0], src2.xmm[0],
+                                 _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "_mm_cvt_roundss_sh");
+
+  init_dest(&res, &exp);
+  emulate_vcvtss2sh(&exp, src1, src2, 0x1, 0);
+  res.xmmh[0] = _mm_mask_cvt_roundss_sh(res.xmmh[0], 0x1, src1.xmmh[0],
+                                      src2.xmm[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_mask_cvt_roundss_sh");
+
+  emulate_vcvtss2sh(&exp, src1, src2, 0x2, 1);
+  res.xmmh[0] = _mm_maskz_cvt_roundss_sh(0x2, src1.xmmh[0],
+                                       src2.xmm[0], _ROUND_NINT);
+  check_results(&res, &exp, N_ELEMS, "mm_maskz_cvt_roundss_sh");
+
+  if (n_errs != 0) {
+      abort ();
+  }
+}
+