target-xtensa: implement RT0 group
authorMax Filippov <jcmvbkbc@gmail.com>
Mon, 5 Sep 2011 23:55:29 +0000 (03:55 +0400)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 10 Sep 2011 16:57:36 +0000 (16:57 +0000)
NEG and ABS are the only members of RT0 group.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-xtensa/translate.c

index 4dfca2bcf8b9d1b9727230eb591ff0a8e57e7c94..92547d21f7b78015abe94f0f9590bf7b5f26d291 100644 (file)
@@ -255,6 +255,25 @@ static void disas_xtensa_insn(DisasContext *dc)
                 break;
 
             case 6: /*RT0*/
+                switch (RRR_S) {
+                case 0: /*NEG*/
+                    tcg_gen_neg_i32(cpu_R[RRR_R], cpu_R[RRR_T]);
+                    break;
+
+                case 1: /*ABS*/
+                    {
+                        int label = gen_new_label();
+                        tcg_gen_mov_i32(cpu_R[RRR_R], cpu_R[RRR_T]);
+                        tcg_gen_brcondi_i32(
+                                TCG_COND_GE, cpu_R[RRR_R], 0, label);
+                        tcg_gen_neg_i32(cpu_R[RRR_R], cpu_R[RRR_T]);
+                        gen_set_label(label);
+                    }
+                    break;
+
+                default: /*reserved*/
+                    break;
+                }
                 break;
 
             case 7: /*reserved*/