From patchwork Fri Nov 20 16:35:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 9760 Received: (qmail 47187 invoked by alias); 20 Nov 2015 16:35:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 46038 invoked by uid 89); 20 Nov 2015 16:35:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 20 Nov 2015 16:35:29 +0000 Received: by pacej9 with SMTP id ej9so120939987pac.2 for ; Fri, 20 Nov 2015 08:35:28 -0800 (PST) X-Received: by 10.68.125.197 with SMTP id ms5mr20710158pbb.161.1448037327944; Fri, 20 Nov 2015 08:35:27 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id oi3sm306725pbb.53.2015.11.20.08.35.24 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 20 Nov 2015 08:35:27 -0800 (PST) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] [AArch64] Support gnu vector in inferior call References: <1448035917-3049-1-git-send-email-yao.qi@linaro.org> <1448035917-3049-2-git-send-email-yao.qi@linaro.org> <564F48C5.5090801@redhat.com> Date: Fri, 20 Nov 2015 16:35:20 +0000 In-Reply-To: <564F48C5.5090801@redhat.com> (Pedro Alves's message of "Fri, 20 Nov 2015 16:22:29 +0000") Message-ID: <86h9kgzl13.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Pedro Alves writes: >> + else if (TYPE_CODE (arg_type) == TYPE_CODE_ARRAY >> + && TYPE_VECTOR (arg_type) && (len == 16 || len == 8)) >> + { >> + /* Short vector types are passed in V registers. */ >> + pass_in_v_or_stack (gdbarch, regcache, &info, arg_type, arg); > > Indentation looks odd here. Ur, sorry. Patch is updated. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index de85cb0..8ce0eaa 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -894,6 +894,17 @@ aarch64_type_align (struct type *t) return TYPE_LENGTH (t); case TYPE_CODE_ARRAY: + if (TYPE_VECTOR (t)) + { + /* Use the natural alignment for vector types (the same for + scalar type), but the maximum alignment is 128-bit. */ + if (TYPE_LENGTH (t) > 16) + return 16; + else + return TYPE_LENGTH (t); + } + else + return aarch64_type_align (TYPE_TARGET_TYPE (t)); case TYPE_CODE_COMPLEX: return aarch64_type_align (TYPE_TARGET_TYPE (t)); @@ -921,6 +932,10 @@ is_hfa (struct type *ty) case TYPE_CODE_ARRAY: { struct type *target_ty = TYPE_TARGET_TYPE (ty); + + if (TYPE_VECTOR (ty)) + return 0; + if (TYPE_CODE (target_ty) == TYPE_CODE_FLT && TYPE_LENGTH (ty) <= 4) return 1; break; @@ -1318,6 +1333,12 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, pass_on_stack (&info, arg_type, arg); } } + else if (TYPE_CODE (arg_type) == TYPE_CODE_ARRAY + && TYPE_VECTOR (arg_type) && (len == 16 || len == 8)) + { + /* Short vector types are passed in V registers. */ + pass_in_v_or_stack (gdbarch, regcache, &info, arg_type, arg); + } else if (len > 16) { /* PCS B.7 Aggregates larger than 16 bytes are passed by @@ -1643,6 +1664,15 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs, valbuf += len; } } + else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + && (TYPE_LENGTH (type) == 16 || TYPE_LENGTH (type) == 8)) + { + /* Short vector is returned in V register. */ + gdb_byte buf[V_REGISTER_SIZE]; + + regcache_cooked_read (regs, AARCH64_V0_REGNUM, buf); + memcpy (valbuf, buf, TYPE_LENGTH (type)); + } else { /* For a structure or union the behaviour is as if the value had @@ -1772,6 +1802,15 @@ aarch64_store_return_value (struct type *type, struct regcache *regs, valbuf += len; } } + else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + && (TYPE_LENGTH (type) == 8 || TYPE_LENGTH (type) == 16)) + { + /* Short vector. */ + gdb_byte buf[V_REGISTER_SIZE]; + + memcpy (buf, valbuf, TYPE_LENGTH (type)); + regcache_cooked_write (regs, AARCH64_V0_REGNUM, buf); + } else { /* For a structure or union the behaviour is as if the value had