--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f (void * in, void *out)
+{
+ vint32mf2_t v = __riscv_vle32_v_i32mf2 (in, 4);
+ vbool64_t mask = __riscv_vlm_v_b64 (in + 1, 4);
+ vint32mf2_t v2 = __riscv_vle32_v_i32mf2 (in+444, 4);
+ vbool64_t mask2 = __riscv_vmseq_vv_i32mf2_b64_m(mask,v,v2,4);
+ mask2 = __riscv_vmslt_vv_i32mf2_b64_mu(mask2,mask2,v2,v,4);
+ __riscv_vsm_v_b64 (out, mask2, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmseq_vv_i32m1_b32_m (m3, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmslt_vv_i32m1_b32_m (m3, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmseq_vv_i32m1_b32_mu (m3, m3, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmslt_vv_i32m1_b32_mu (m3, m3, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmseq_vv_i32m1_b32_mu (mask, m3, v, v, 4);
+ m4 = __riscv_vmseq_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmslt_vv_i32m1_b32_mu (mask, m3, v, v, 4);
+ m4 = __riscv_vmslt_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmv} 2 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = __riscv_vlm_v_b32 (in, 4);
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vv_i32m1_b32 (v, v2, 4);
+ vbool32_t m4 = __riscv_vmseq_vv_i32m1_b32_mu (m3, mask, v, v, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = __riscv_vlm_v_b32 (in, 4);
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vv_i32m1_b32 (v, v2, 4);
+ vbool32_t m4 = __riscv_vmslt_vv_i32m1_b32_mu (m3, mask, v, v, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmv} 2 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmseq_vv_i32m1_b32_m (m3, v2, v2, 4);
+ m4 = __riscv_vmseq_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vv_i32m1_b32 (v, v, 4);
+ vbool32_t m4 = __riscv_vmslt_vv_i32m1_b32_m (m3, v2, v2, 4);
+ m4 = __riscv_vmslt_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f (void * in, void *out, int32_t x)
+{
+ vint32mf2_t v = __riscv_vle32_v_i32mf2 (in, 4);
+ vbool64_t mask = __riscv_vlm_v_b64 (in + 1, 4);
+ vint32mf2_t v2 = __riscv_vle32_v_i32mf2 (in+444, 4);
+ vbool64_t mask2 = __riscv_vmseq_vx_i32mf2_b64_m(mask,v,x,4);
+ mask2 = __riscv_vmslt_vx_i32mf2_b64_mu(mask2,mask2,v2,x,4);
+ __riscv_vsm_v_b64 (out, mask2, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_m (m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_m (m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (m3, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (m3, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (mask, m3, v, x, 4);
+ m4 = __riscv_vmseq_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (mask, m3, v, x, 4);
+ m4 = __riscv_vmslt_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmv} 2 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = __riscv_vlm_v_b32 (in, 4);
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v2, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (m3, mask, v, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = __riscv_vlm_v_b32 (in, 4);
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v2, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (m3, mask, v, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmv} 2 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_m (m3, v2, x, 4);
+ m4 = __riscv_vmseq_vx_i32m1_b32_m (m4, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_m (m3, v2, x, 4);
+ m4 = __riscv_vmslt_vx_i32m1_b32_m (m4, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (m3, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (mask, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_m (m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, -16, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (m3, m3, v2, -16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16
+** vmseq\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*-16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, -16, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (mask, m3, v2, -16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, -16, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_m (m3, v2, -16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, 15, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (m3, m3, v2, 15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15
+** vmseq\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*15,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, 15, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (mask, m3, v2, 15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, 15, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_m (m3, v2, 15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (m3, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_mu (mask, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmseq_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmseq_vx_i32m1_b32_m (m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (m3, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (mask, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_m (m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, -15, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (m3, m3, v2, -15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmslt\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*-15,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, -15, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (mask, m3, v2, -15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, -15, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_m (m3, v2, -15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (m3, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmslt\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (mask, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_m (m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (m3, m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_mu (mask, m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmslt_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmslt_vx_i32m1_b32_m (m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, -16, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, -16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 15, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f4:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f4 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f5:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f5 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f6:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, -15, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, -15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 17, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 17, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f4:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f4 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f5:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f5 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f6:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*-16,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, -16, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, -16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15
+** vmseq\.vi\tv[0-9]+,\s*v[0-9]+,\s*15,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 15, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmseq\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 0xAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 0xAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, -15, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, -15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmslt\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 17, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 17, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 0xAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 0xAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmseq\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmseq\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmseq_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmseq_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmseq\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmslt_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmslt_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f (void * in, void *out, int32_t x)
+{
+ vint32mf2_t v = __riscv_vle32_v_i32mf2 (in, 4);
+ vbool64_t mask = __riscv_vlm_v_b64 (in + 1, 4);
+ vint32mf2_t v2 = __riscv_vle32_v_i32mf2 (in+444, 4);
+ vbool64_t mask2 = __riscv_vmsge_vx_i32mf2_b64_m(mask,v,x,4);
+ mask2 = __riscv_vmsge_vx_i32mf2_b64_mu(mask2,mask2,v2,x,4);
+ __riscv_vsm_v_b64 (out, mask2, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+\s+} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t} 1 } } */
+/* { dg-final { scan-assembler-times {vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmandn\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+\s+} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t} 1 } } */
+/* { dg-final { scan-assembler-times {vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmnot\.mm\s+v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+\s+} 2 } } */
+/* { dg-final { scan-assembler-times {vmandn\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmnot\.mm\s+v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v, x, 4);
+ m4 = __riscv_vmsge_vv_i32m1_b32_m (m4, v2, v2, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+\s+} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t} 1 } } */
+/* { dg-final { scan-assembler-times {vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmnot\.mm\s+v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmv} 1 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = __riscv_vlm_v_b32 (in, 4);
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v2, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, mask, v, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+\s+} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t} 1 } } */
+/* { dg-final { scan-assembler-times {vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmnot\.mm\s+v[0-9]+,\s*v[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmv} 1 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3" } */
+#include "riscv_vector.h"
+
+void f1 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ //asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, x, 4);
+ m4 = __riscv_vmsge_vx_i32m1_b32_m (m4, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+\s+} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vx\s+v[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t} 2 } } */
+/* { dg-final { scan-assembler-times {vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vmnot\.mm\s+v[0-9]+,\s*v[0-9]+} 1 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmandn\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, x, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, x, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, -15, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, -15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmsge\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*-15,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, -15, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v2, -15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, -15, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, -15, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmandn\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, -15, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, -15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 17, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 17, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f4:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f4 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f5:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f5 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f6:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** vsm\.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],mu
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[1-9][0-9]?,\s*v[0-9]+,\s*16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** vsetvli\t[a-x0-9]+,zero,e8,mf4,ta,ma
+** vlm.v\tv[0-9]+,0\([a-x0-9]+\)
+** vsetivli\tzero,4,e32,m1,t[au],m[au]
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\)
+** vle32\.v\tv[0-9]+,0\([a-x0-9]+\),v0.t
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,\s*v0.t
+** vsm.v\tv[0-9]+,0\([a-x0-9]+\)
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 16, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, 16, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f1:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmandn\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f1 (void * in, void * in2, void *out, int32_t x)
+{
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1 (in2, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (m3, m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[1-9][0-9]?,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_mu (mask, m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,\s*v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int32_t x)
+{
+ vbool32_t mask = *(vbool32_t*)in;
+ asm volatile ("":::"memory");
+ vint32m1_t v = __riscv_vle32_v_i32m1 (in, 4);
+ vint32m1_t v2 = __riscv_vle32_v_i32m1_m (mask, in, 4);
+ vbool32_t m3 = __riscv_vmsge_vx_i32m1_b32 (v, 17, 4);
+ vbool32_t m4 = __riscv_vmsge_vx_i32m1_b32_m (m3, v2, 17, 4);
+ __riscv_vsm_v_b32 (out, m4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, -15, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, -15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 17, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 17, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f4:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f4 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f5:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f5 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f6:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+#include "riscv_vector.h"
+
+/*
+** f0:
+** ...
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*-15,v0.t
+** ...
+** ret
+*/
+void f0 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, -15, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, -15, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f1:
+** ...
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16
+** vmsge\.vi\tv[0-9]+,\s*v[0-9]+,\s*16,v0.t
+** ...
+** ret
+*/
+void f1 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 16, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 16, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f2:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f2 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 17, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 17, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/*
+** f3:
+** ...
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+
+** vmnot\.mm\s+v[0-9]+,\s*v[0-9]+
+** vmslt\.vx\tv[0-9]+,\s*v[0-9]+,\s*[a-x0-9]+,v0.t
+** vmxor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+
+** ...
+** ret
+*/
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
+
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f3 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, 0xAAAAAAAAAAAAAAAA, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, 0xAAAAAAAAAAAAAAAA, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f6 (void * in, void *out, int64_t x, int n)
+{
+ vint64m1_t v = __riscv_vle64_v_i64m1 (in + 1, 4);
+ vint64m1_t v2 = __riscv_vle64_v_i64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsge_vx_i64m1_b64 (v2, x, 4);
+ vbool64_t v4 = __riscv_vmsge_vx_i64m1_b64_m (v3, v2, x, 4);
+ __riscv_vsm_v_b64 (out + 2, v4, 4);
+}
+
+/* { dg-final { scan-assembler-times {vlse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\),\s*zero} 1 } } */
+/* { dg-final { scan-assembler-times {vmslt\.vv\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-not {vmv} } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f (void * in, void *out, int64_t x, int n)
+{
+ vuint64m1_t v = __riscv_vle64_v_u64m1 (in + 1, 4);
+ vuint64m1_t v2 = __riscv_vle64_v_u64m1_tu (v, in + 2, 4);
+ vbool64_t v3 = __riscv_vmsgeu_vx_u64m1_b64 (v2, 0, 4);
+ __riscv_vsm_v_b64 (out + 2, v3, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmset\.m\s+v[0-9]+} 1 } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3" } */
+#include "riscv_vector.h"
+
+void f (void * in, void *out, int64_t x, int n)
+{
+ vuint64m1_t v = __riscv_vle64_v_u64m1 (in + 1, 4);
+ vuint64m1_t v2 = __riscv_vle64_v_u64m1_tu (v, in + 2, 4);
+ vbool64_t mask = __riscv_vlm_v_b64 (in,8);
+ vbool64_t mask2 = __riscv_vlm_v_b64 (in + 100,8);
+ vbool64_t v3 = __riscv_vmsgeu_vx_u64m1_b64_mu (mask,mask2,v2, 0, 4);
+ __riscv_vsm_v_b64 (out + 2, v3, 4);
+}
+
+/* { dg-final { scan-assembler-times {vmor\.mm\s+v[0-9]+,\s*v[0-9]+,\s*v[0-9]+} 1 } } */