support arm32: 'qsort.c' of 'scf/examples' test ok
authoryu.dongliang <18588496441@163.com>
Mon, 15 May 2023 09:51:21 +0000 (17:51 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 15 May 2023 09:51:21 +0000 (17:51 +0800)
native/risc/scf_risc_reg.c

index dda0bcac56785dbbf3db4c6f6e065336487da3d4..47f1ca9aca5e9fd2358c649f4a4f96669d9f6cb9 100644 (file)
@@ -429,8 +429,11 @@ int risc_array_index_reg(scf_sib_t* sib, scf_dag_node_t* base, scf_dag_node_t* i
        int32_t s = scale->var->data.i;
        assert(s > 0);
 
+       if (scale->var->size > f->rops->MAX_BYTES)
+               scale->var->size = f->rops->MAX_BYTES;
+
        if (vb->nb_pointers + vb->nb_dimentions > 1 || vb->type >= SCF_STRUCT)
-               sib->size = 8;
+               sib->size = f->rops->MAX_BYTES;
        else {
                sib->size = vb->data_size;
                assert(8 >= vb->data_size);
@@ -452,7 +455,7 @@ int risc_array_index_reg(scf_sib_t* sib, scf_dag_node_t* base, scf_dag_node_t* i
                return ret;
        }
 
-       scf_register_t* ri2 = f->rops->find_register_color_bytes(ri->color, 8);
+       scf_register_t* ri2 = f->rops->find_register_color_bytes(ri->color, f->rops->MAX_BYTES);
 
        if (ri->bytes < ri2->bytes) {
 
@@ -470,8 +473,6 @@ int risc_array_index_reg(scf_sib_t* sib, scf_dag_node_t* base, scf_dag_node_t* i
                        && 4 != s
                        && 8 != s) {
 
-               assert(8 == scale->var->size);
-
                ret = risc_select_reg(&rs, scale, c, f, 0);
                if (ret < 0) {
                        scf_loge("\n");