qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 14/44] target/loongarch: Implement vmax/vmin


From: Richard Henderson
Subject: Re: [RFC PATCH v2 14/44] target/loongarch: Implement vmax/vmin
Date: Tue, 28 Mar 2023 13:39:19 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 3/27/23 20:06, Song Gao wrote:
+static void do_vminmax(unsigned vece, TCGv_vec t, TCGv_vec a, int64_t imm,
+                       void(*gen_vminmax_vec)(unsigned,
+                                              TCGv_vec, TCGv_vec, TCGv_vec))
+{
+    TCGv_vec t1;
+
+    t1 = tcg_temp_new_vec_matching(t);
+    tcg_gen_dupi_vec(vece, t1, imm);

t1 = tcg_constant_vec_matching(t, vece, imm);

+static void gen_vmini_s(unsigned vece, TCGv_vec t, TCGv_vec a, int64_t imm)
+{
+    do_vminmax(vece, t, a, imm, tcg_gen_smin_vec);
+}
+
+static void gen_vmini_u(unsigned vece, TCGv_vec t, TCGv_vec a, int64_t imm)
+{
+    do_vminmax(vece, t, a, imm, tcg_gen_umin_vec);
+}
+
+static void gen_vmaxi_s(unsigned vece, TCGv_vec t, TCGv_vec a, int64_t imm)
+{
+    do_vminmax(vece, t, a, imm, tcg_gen_smax_vec);
+}
+
+static void gen_vmaxi_u(unsigned vece, TCGv_vec t, TCGv_vec a, int64_t imm)
+{
+    do_vminmax(vece, t, a, imm, tcg_gen_umax_vec);
+}

Perhaps easier to expand

    tcg_gen_umax_vec(vece, t, a, tcg_constant_vec_matching(t, vece, imm));

in each instance?


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]